Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add with_handler method to EvmBuilder #1124

Merged
merged 5 commits into from
Feb 24, 2024

Conversation

Rjected
Copy link
Collaborator

@Rjected Rjected commented Feb 23, 2024

Added a method to make it possible to add a specific handler, for example a handler other than optimism or mainnet, to the evm builder.

@Rjected Rjected force-pushed the dan/add-with-handler branch from eef91b4 to 98dbc7e Compare February 23, 2024 22:53
Comment on lines 206 to 208
/// // set up empty handler cfg
/// let handler = HandlerCfg::new(SpecId::LATEST);
/// let builder = builder.with_handler_cfg(handler);
Copy link
Member

Choose a reason for hiding this comment

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

Would remove this lines, they can be confusing

Suggested change
/// // set up empty handler cfg
/// let handler = HandlerCfg::new(SpecId::LATEST);
/// let builder = builder.with_handler_cfg(handler);

Copy link
Member

Choose a reason for hiding this comment

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

Second comment will address why you needed this previously: #1124 (comment)

/// // build the EVM
/// let evm = builder.build();
/// ```
pub fn with_handler(
Copy link
Member

Choose a reason for hiding this comment

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

This function is inside:
impl<'a, EXT, DB: Database> EvmBuilder<'a, HandlerStage, EXT, DB> {

But it should be in:
impl<'a, BuilderStage, EXT, DB: Database> EvmBuilder<'a, BuilderStage, EXT, DB> {

Reason for this is that with_handler can be called from both HandlerStage and SetGenericStage

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah I see, yeah it makes sense to call it from either handler or setgeneric stages

@rakita rakita merged commit 1411784 into bluealloy:main Feb 24, 2024
25 checks passed
@github-actions github-actions bot mentioned this pull request Feb 24, 2024
fubuloubu pushed a commit to ApeWorX/revm that referenced this pull request Apr 11, 2024
* feat: add with_handler method to EvmBuilder

* improve docs

* add imports to docs

* fix docs

* move with_handler to BuilderStage
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