[go: up one dir, main page]

Proto/Client Alpha: Add an option to set SELF_ADDRESS for run script command.

Context

When tezos-client run script command is executed, a fresh contract is being originated to execute the script for. This is problematic because the account is assigned a fresh (random) address. For contracts that depend on the address having some fixed value it makes it impossible to successfully replay historic transactions. To remedy this, the client now allows users to set some particular address for the script being run with the --self-address option. When that option is used, a fresh contract is NOT opriginated, so the address must refer to an account actually existing in the context.

NOTE because the contract is no longer originated, there's no way to assign a custom balance to it. To enable this the balnce is being made a step constant in !3871 (merged), which should be merged before this one.

Manually testing the MR

$ dune exec tezt/tests/main.exe -- --file run_script.ml

Also read the test to see how --self-address and --balance options work and how they influence the behaviour of the script.

Try replaying historic transaction on contracts using the SELF_ADDRESS instruction. The vesting contract is a good example. The replay-transaction script can be used to automatically fetch operation details from an indexer and feed them to the run script command. It already uses the --self-address option.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, the Development Version section of CHANGES.md for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Sventimir

Merge request reports

Loading