reth icon indicating copy to clipboard operation
reth copied to clipboard

chore(sdk): add helper trait to node API to simplify type definition

Open emhane opened this issue 6 months ago • 0 comments

Ref https://github.com/paradigmxyz/reth/issues/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 avatar Aug 29 '24 17:08 emhane