ethereumjs-monorepo icon indicating copy to clipboard operation
ethereumjs-monorepo copied to clipboard

EVM: Refactor accessWitness from StateManager into EVM

Open gabrocheleau opened this issue 1 year ago • 1 comments

We have recently discussed the possibility of migrating the accessWitness from the StateManager to the EVM. It makes conceptual sense for the EVM to be in charge of this low-level tracking rather than the StateManager.

The accessWitness file itself is fairly minimal, only importing from the common and util packages, so the migration of the file itself is straightforward.

However there are some additional considerations:

  • accessWitness is deeply tied to verkle logic, notably for pricing execution witnesses (ref: https://eips.ethereum.org/EIPS/eip-4762), and we should only enable when verkle (EIP-6800) is also enabled. I think we want this to be hardfork/EIP-inferred rather than manually specified so that we are able to dynamically transition in the context of the merkle->verkle transition.
  • verkle state managers (both stateless and stateful) will have to be adjusted so that they obtain the acccess witness from the EVM somehow for things like postStateVerify. This shouldn't be too tricky, as I think postStateVerify is called by the VM, which could also pass in the accessWitness as an arg.
  • We'll need to create an AccessWitness interface or type for use for e.g. in the StateManager (we wouldn't want to add an EVM dependency just for importing the AccessWitness types, enums, etc)

gabrocheleau avatar Oct 17 '24 13:10 gabrocheleau

The accessWitness interface already exists in common so point 3 can be considered done already.

acolytec3 avatar Oct 17 '24 13:10 acolytec3