Skip to content

Comments

Block and Chain drivers#29

Merged
prestwich merged 6 commits intomainfrom
prestwich/block-driver
Aug 1, 2024
Merged

Block and Chain drivers#29
prestwich merged 6 commits intomainfrom
prestwich/block-driver

Conversation

@prestwich
Copy link
Member

@prestwich prestwich commented Jul 30, 2024

Working on higher-level traits to drive trevm instances through many txns in a single function call

  • Add BlockDriver and ChainDriver traits
  • Add a partial impl of BlockDriver for alloy rpc block type

Some significant refactoring to achieve this:

  • BlockContext generics have been moved to the functions involved
  • BlockContext error is now generic over Db
  • EvmNeedsFirstBlock and EvmNeedsNextBlock have been collapsed to EvmNeedsBlock to simplify context handling. Separating them was a holdover from earlier designs where trevm would accumulate context info
  • added several convenience functions for trevm error handling
    -Trevm::errored()
    -EvmErrored::err_into
    -EvmErrored::map_err
  • states with contexts now expose take_context

@prestwich prestwich marked this pull request as ready for review August 1, 2024 15:24
@prestwich prestwich changed the title [WIP] Block and Chain drivers Block and Chain drivers Aug 1, 2024
@prestwich prestwich force-pushed the prestwich/block-driver branch from 9da5cef to 25ed451 Compare August 1, 2024 16:10

let trevm = trevm.close_block().map_err(EvmErrored::err_into)?;

match driver.post_block_checks(&trevm) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should mark this as a TODO too indicating it's a noop atm.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#30

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I like how each trait now handles an specific part of the system, and pushing generics to the functions instead of the traits.

@prestwich prestwich merged commit 2840b30 into main Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants