Skip to content

Introduce a block execution abstraction #79

@ferranbt

Description

@ferranbt

Right now the way we include transactions in the block is pretty verbose and hard to extend if we assume we are going into a direction in which we want to have more flexibility around block building (apply batches of transactions, revert back to a given state, etc...). Introduce a BlockExecutor utility that abstracts away all that boilerplate.

Initially, the API can be just a wrapper around the current Reth BlockState like:

let state = State::new();
let executor = BlockState::new();
let result = executor.apply(tx);
state.commit(state);

but the medium term goal is to add something more optimised for our block building use case like:

let state = State::new();
let executor = BlockState::new()
let snap = state.snapshot();
let result = executor.apply(snap, tx);

In this case, the interface handles execution reverts of the state, something that it is less likely to be optimised in Reth.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions