Skip to content

[#788] Support a mix of RPC and non-RPC representations in `runCode`

Diogo Castro requested to merge diogo/#788-mixed-rpc into master

Description

Problem: In #737 (closed), we added support for the /run_code RPC endpoint. Our API lets users specify a contract's parameter and storage in either its RPC representation (with only big_map IDs and no big_map values) or its normal representation (only big_map values and no big_map IDs).

However, the endpoint actually allows using a mix of both in the same value. If a contract's parameter expects a list of big_maps, you can send in a list where the first element is a big_map value and the second is a big_map ID.

Solution: Cleveland users have to be able to express heterogeneous lists (e.g. lists with both nats representing big_map IDs and big_map values), so we can't use Typed.Value t for this. We have to use Untyped.Value in Cleveland's API instead.

In the emulator's implementation, when we typecheck an untyped value, if we find an integer where a big_map is expected, we check if a big_map with that ID exists and replace the ID with the actual big_map value.

Related issue(s)

Resolves #788 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Diogo Castro

Merge request reports