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

chore(rpc): impl EthApiServer helper traits on type like EthApi #8799

Merged
merged 100 commits into from
Jun 13, 2024

Conversation

emhane
Copy link
Member

@emhane emhane commented Jun 13, 2024

  • Moves block building into default impl of LoadPendingBlock, so it can be reused for any network stack.
  • Extracts methods for assembling receipt and calculating receipts root from block building, so can be overridden for Optimism.
  • Introduces macro rules for implementing EthApiServer on types with same data layout as EthApi. This makes it quick to implement custom EthApiServer behaviour for other networks, that are identical in data layout to EthApi, like OptimismApi.

@emhane emhane force-pushed the emhane/optimism-api branch from 3c064fb to f7b076d Compare June 13, 2024 14:18
@emhane emhane changed the title chore(rpc): macro rules for impl of EthApi helper traits on type like EthApi chore(rpc): impl EthApiServer helper traits on type like EthApi Jun 13, 2024
@emhane emhane marked this pull request as ready for review June 13, 2024 14:53
@emhane emhane force-pushed the emhane/optimism-api branch from 93c1d96 to 31960d3 Compare June 13, 2024 16:10
@emhane emhane changed the base branch from matt/scaffold-ethapi to main June 13, 2024 16:13
@emhane emhane changed the base branch from main to matt/scaffold-ethapi June 13, 2024 16:13
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

the helper macros make sense, to quickly implement the sub trait

Comment on lines +182 to +185
#[cfg(feature = "optimism")]
deposit_nonce: None,
#[cfg(feature = "optimism")]
deposit_receipt_version: None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to find a way to get rid of these features

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah...I know...

Copy link
Member Author

Choose a reason for hiding this comment

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

they should be able to remove when optimism feature is entirely removed from the crate, as long as we have some dep for which we pull in optimism feature, likelihood that that crate pulls in reth-primitives with optimism feature, is very high - and we're screwed

@emhane emhane merged commit 9c579e1 into matt/scaffold-ethapi Jun 13, 2024
18 of 25 checks passed
@emhane emhane deleted the emhane/optimism-api branch June 13, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.