Skip to content

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

Merged
emhane merged 100 commits intomatt/scaffold-ethapifrom
emhane/optimism-api
Jun 13, 2024
Merged

chore(rpc): impl EthApiServer helper traits on type like EthApi#8799
emhane merged 100 commits intomatt/scaffold-ethapifrom
emhane/optimism-api

Conversation

@emhane
Copy link
Collaborator

@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.

jsvisa and others added 14 commits June 13, 2024 16:17
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Co-authored-by: Oliver <onbjerg@users.noreply.github.com>
@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
Collaborator 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
Collaborator 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
@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 A clean up/refactor of existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments