py-evm icon indicating copy to clipboard operation
py-evm copied to clipboard

Create State without ExecutionContext

Open carver opened this issue 6 years ago • 0 comments

Extract ExecutionContext out as something that's adjacent to State instead of embedded in it. When you want to execute, you run it through the VM which combines state with the execution context generated with the header in order to actually build a computation.

This makes State as easy to initialize as AccountDB was.

I'm thinking something like:

  • move BaseState.execution_context -> BaseVM.execution_context
  • move BaseState.get_computation -> BaseVM.get_computation (which builds with its local execution context)
  • rename ExecutionContext -> BlockContext
  • Computation learns about BlockContext, like it knows about TransactionContext
  • BaseState now only needs a db and state root to be generated

Note that there is some hacky code in eth.chains.base.Chain.from_genesis should be cleaned up when State is easier to initialize.

cc @lithp

Originally posted by @carver in https://github.com/ethereum/py-evm/pull/1755

carver avatar Apr 19 '19 00:04 carver