warp icon indicating copy to clipboard operation
warp copied to clipboard

docs: internal writes documentation

Open ppedziwiatr opened this issue 2 years ago • 0 comments

Contract C_TX_2 makes an internal write on contract C_TX_1 at interaction I(n).

  1. Evaluator loads the state of the C_TX_1 up to internal write interaction I(n)
  2. I(n) is an internal write interaction. Thanks to tag data saved in the interaction, the evaluator knows that C_TX_2 is making write on C_TX_1. Evaluator saves the C_TX_1 state at I(n-1) interaction in cache.
  3. Evaluator loads the C_TX_2 contract and evaluates its state up to I(n) interaction.
  4. I(n) interaction for C_TX_2 is making a SmartWeave.contracts.write call on C_TX_1 with certain Input.
  5. In order to perform the write, evaluator loads the C_TX_1 contract state at I(n-1) transaction from cache
  6. Evaluator applies the input from the SmartWeave.contracts.write on the C_TX_1 as a 'dry-run' call
  7. Evaluator stores the result of the 'dry-run' in cache.
  8. Evaluator returns with the evaluation to the C_TX_1 contract. If first loads the state stored in point 7. and then continues to evaluate next interactions.

IMG_20220809_134959

ppedziwiatr avatar Aug 09 '22 11:08 ppedziwiatr