-
Notifications
You must be signed in to change notification settings - Fork 9
chore(sdk): Simplify generics syntax by using adapters #549
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
base: unstable
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR simplifies generic syntax throughout the codebase by introducing and using the PrimitivesTy<N> type adapter instead of the fully qualified syntax <N as NodeTypes>::Primitives. The change improves code readability by reducing boilerplate in type declarations.
Key changes:
- Introduces
PrimitivesTytype adapter for cleaner access toNodeTypes::Primitives - Updates type bounds and associated types across node components, RPC handlers, and engine services
- Replaces verbose
<Node::Types as NodeTypes>::Primitivessyntax with concisePrimitivesTy<Node::Types>
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/optimism/node/tests/it/builder.rs |
Updates test EVM configuration to use PrimitivesTy adapter |
crates/optimism/node/src/node.rs |
Updates EVM config and validator builder to use PrimitivesTy adapter |
crates/node/builder/src/rpc.rs |
Updates RPC handle types and engine validator traits to use PrimitivesTy adapter |
crates/node/builder/src/node.rs |
Adds import and updates NodeTypes implementation with PrimitivesTy adapter |
crates/node/builder/src/launch/invalid_block_hook.rs |
Updates invalid block hook extension trait to use PrimitivesTy adapter |
crates/node/builder/src/launch/common.rs |
Updates static file provider return type to use PrimitivesTy adapter |
crates/node/builder/src/components/mod.rs |
Updates component trait bounds to use PrimitivesTy adapter |
crates/node/api/src/node.rs |
Adds import and updates component traits and context to use PrimitivesTy adapter |
crates/engine/service/src/service.rs |
Updates engine service type aliases to use PrimitivesTy adapter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PrimitivesTy adapter
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
c30e6f7 to
a105bfe
Compare
…s/op-reth into emhane/use-primitive-types-adapters
Ref #520
Simplifies generics in various places by instead of using fully qualified syntax to access associated type, using adapters
PrimitivesTyto access associated typeNodeTypes::PrimitivesTxTyto accessNodePrimitives::SignedTxReceiptTyto accessNodePrimitives::ReceiptBlockTyto accessNodePrimitives::BlockHeaderTyto accessNodePrimitives::Header