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(sdk): add helper trait to node API to simplify type definition #10616

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

emhane
Copy link
Member

@emhane emhane commented Aug 29, 2024

Ref #9555

Building unit tests for any type that inherits from FullNodeComponents is too costly. Replacing the trait bound N: FullNodeComponents with N: NodeCore in type definitions, enables testing without importing a massive framework of unused mock node components. This, without scarfing the aggregate generic N for a long list of generics and with it DevX.

  • Adds helper traits reth_node_api::NodeCore and reth_node_api::NodeTy, with blanket implementation for all types that impl reth_node_api::FullNodeComponents and reth_node_api::NodeTypes respectively.
  • Replaces reth_optimism_rpc::OpEthApi<N: FullNodeComponents> with OpEthApi<N: NodeCore>

@emhane emhane added C-debt Refactor of code section that is hard to understand or maintain A-op-reth Related to Optimism and op-reth A-sdk Related to reth's use as a library labels Aug 29, 2024
@emhane emhane requested review from klkvr and shekhirin August 29, 2024 17:34
@emhane emhane requested a review from gakonst as a code owner September 4, 2024 14:34
@github-actions github-actions bot added S-stale This issue/PR is stale and will close with no further activity and removed S-stale This issue/PR is stale and will close with no further activity labels Sep 26, 2024
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-sdk Related to reth's use as a library 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.

1 participant