[go: up one dir, main page]

Separate internal operations

The Apply module is responsible for applying a sequence of operations on the chain. These operations may come, for example, from a transaction initiated by a user, which might trigger a smart contract that will in turn result in more operations to execute, etc.

Some of these operations contain untyped script parts. For instance, a Transaction carries the yet untyped parameter to be fed to the destination contract.

  1. Now, when a transaction T1 is applied, the destination script is fetched and then executed with its parameter still untyped at the calling site.
  2. At some point during the execution, the parameter is parsed (i.e. typed), and the interpretation goes on in the typed world, eventually calling step if everything runs fine.
  3. During this interpretation, when a transfer instruction is met, its here typed parameter will be unparsed (i.e. made untyped) to be included in an internal transaction operation T2.
  4. T2 will also be executed after T1 finishes, through a recursive call and going back to step 1, where T2's parameter that was unparsed at step 3 when treating T1 will be parsed again at step 2 when treating T2.

The purpose of this issue is twofold:

  • avoid unparsing and reparsing script parts this way;
  • have a separation between the internal operations and the ones initiated by a user. Indeed, only transactions, originations, and delegations can be produced by the interpreter.

Merge requests breakdown

  • First part is !4613 (merged), with preparation work.
  • Second part is !4623 (merged), moving internal operations from Operation_repr to Script_typed_ir.
  • Third part is !4632 (merged), enriching internal transactions with a Michelson version of the parameter.
  • Fourth and last part is !4643 (merged), enriching internal originations with a Michelson version of the script.
  • (There is also !4291 (closed), a merge request from a previous attempt. It is to be closed but all threads need to be answered first.)

Bonus: get rid of temporary lazy storage. (See the dedicated issue #4059.)

Edited by Nicolas Ayache