[go: up one dir, main page]

EVM Node: Introduce a transaction layer for the `Evm_context` state

The main job of the Evm_context worker is to ensure the node’s view on its head remains consistent with its local store (consisting of an Irmin repository, and a SQLite database).

The worker keeps some data about the head in its state, in a type called session_state. Following a well-established but tricky pattern of the Octez codebase, this type contains mutable fields, which can be modified in-place without having to return the new state. Although it is handy to reduce the verbosity of the code and the type signature, the cost becomes clear when having to deal with cancelable functions. Every functions interacting with the on-disk store of the node is potentially cancelable or can fail, and we want to be resilient to that.

The previous approach was to delay any modification of the session_state type to after the SQLite requests and Irmin commits have succeeded. But recent refactorings have made it clear this naive approach is not sustainable. It is too easy to make a mistake.

As a consequence, we propose an alternative take, with the introduction of a Transaction inner-module allowing to modify the session in-place while still having the possibility to abort and retain the initial session values.

Manually testing the MR

CI should prevail.

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, CHANGES.rst at the root of the repository 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 Thomas Letan

Merge request reports

Loading