Skip to content

[#688] Allow passing sender and source to run_code and fix morley reference tests

Description

Problem: Tezos RPC allows us to set the result of SENDER and SOURCE commands when running code via the run_code endpoint, however morley-client doesn't support that.

Solution: Add a data structure RunContractParameters that lets us set all the usual runCode paramters, plus Sender and Source. Implement runContract' in terms of this data structure. Re-implement runContract in terms of runContract' (for convenience and to avoid unnecessary breakage)

Problem: Reference implementation (i.e. tezos run script) uses the contract address as SENDER and SOURCE by default. On the other hand, our tests against reference use one of the genesis addresses for that on the Morley interpreter. This leads to inconsistencies and occasional test breakage.

Solution: Set SENDER and SOURCE when running on the reference implementation appropriately.

Related issue(s)

Resolves #688 (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 Nikolay Yakimov

Merge request reports