Skip to content

Conversation

@emhane
Copy link
Member

@emhane emhane commented Jan 6, 2026

Ref #520

Simplifies generics in various places by instead of using fully qualified syntax to access associated type, using adapters

  • PrimitivesTy to access associated type NodeTypes::Primitives
  • TxTy to access NodePrimitives::SignedTx
  • ReceiptTy to access NodePrimitives::Receipt
  • BlockTy to access NodePrimitives::Block
  • HeaderTy to access NodePrimitives::Header

@emhane emhane requested a review from dhyaniarun1993 as a code owner January 6, 2026 08:42
@emhane emhane added the K-debt Kind: debt label Jan 6, 2026
@emhane emhane added the A-sdk Area: node builder SDK label Jan 6, 2026
Copy link

Copilot AI left a 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 PrimitivesTy type adapter for cleaner access to NodeTypes::Primitives
  • Updates type bounds and associated types across node components, RPC handlers, and engine services
  • Replaces verbose <Node::Types as NodeTypes>::Primitives syntax with concise PrimitivesTy<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.

@emhane emhane requested a review from BioMark3r as a code owner January 6, 2026 08:57
@emhane emhane changed the title chore(sdk): Simplify syntax by using PrimitivesTy adapter chore(sdk): Simplify generics syntax by using adapters Jan 6, 2026
@emhane emhane marked this pull request as draft January 6, 2026 09:03
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 10.71429% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.40%. Comparing base (8fbd3be) to head (d4f27f5).
⚠️ Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
.../prune/prune/src/segments/user/receipts_by_logs.rs 0.00% 11 Missing ⚠️
crates/prune/prune/src/segments/receipts.rs 0.00% 7 Missing ⚠️
crates/rpc/rpc/src/validation.rs 0.00% 4 Missing ⚠️
crates/stages/stages/src/stages/headers.rs 0.00% 2 Missing ⚠️
...s/static-file/static-file/src/segments/receipts.rs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
crates/exex/exex/src/backfill/job.rs 0.00% <ø> (ø)
crates/payload/primitives/src/lib.rs 58.04% <ø> (ø)
crates/payload/primitives/src/traits.rs 43.18% <ø> (ø)
crates/stages/stages/src/stages/execution.rs 9.77% <ø> (ø)
crates/storage/db-common/src/init.rs 57.01% <100.00%> (ø)
...s/static-file/static-file/src/segments/receipts.rs 0.00% <0.00%> (ø)
crates/stages/stages/src/stages/headers.rs 9.40% <0.00%> (ø)
crates/rpc/rpc/src/validation.rs 0.00% <0.00%> (ø)
crates/prune/prune/src/segments/receipts.rs 0.00% <0.00%> (ø)
.../prune/prune/src/segments/user/receipts_by_logs.rs 0.00% <0.00%> (ø)

... and 39 files with indirect coverage changes

Flag Coverage Δ
e2e 35.72% <7.14%> (+0.13%) ⬆️
unit 23.83% <100.00%> (-2.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 53.58% <ø> (ø)
op historical proof 91.87% <ø> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wiz-b4c72f16a4
Copy link

wiz-b4c72f16a4 bot commented Jan 8, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 2 Low
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 2 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@emhane emhane marked this pull request as ready for review January 8, 2026 14:16
@emhane emhane requested a review from op-will as a code owner January 13, 2026 11:29
@emhane emhane force-pushed the emhane/use-primitive-types-adapters branch from c30e6f7 to a105bfe Compare January 13, 2026 13:43
emhane and others added 8 commits January 20, 2026 11:36
…163)

@dhyaniarun1993 @itschaindev @sadiq1971 @meyer9 think these are the only
crates we will need to touch. can update as we go. ideally the new logic
will only live inside of _crates/optimism_, but we may need to
generalise some components in the other crates I listed and make them
customisable up at SDK (node builder _crates/node_) level to achieve
this.
Closes #179

---------

Co-authored-by: Julian Meyer <[email protected]>
Fixes #177 

I added a few methods that should allow atomically pruning and reorging
blocks. Each function should represent a single transaction. We can
store trie nodes, reorg, prune in a single transaction now. I kept the
bulk insert methods available for storing the current state.

---------

Co-authored-by: Arun Dhyani <[email protected]>
Ref #176 

This PR adds an in-memory storage backend and tests that work with any
storage backend. We can easily add more test cases to the file to test
against a future SQLite backend.

---------

Co-authored-by: Arun Dhyani <[email protected]>
Co-authored-by: Emilia Hane <[email protected]>
Based on #183

This PR adds a backfill job that accepts a DB transaction and copies the
current state to the database. The transaction ensures we see a
consistent view of the database at the current block, even if the node
is syncing. This requires `--db.read-transaction-timeout 0`.

This currently doesn't handle interrupting the job because the state may
update while syncing and may read a different version of the database
upon restart.

---------

Co-authored-by: Arun Dhyani <[email protected]>
Co-authored-by: Emilia Hane <[email protected]>
No token, so this check always fails annoyingly. Disabling the upload
step if missing token.
emhane and others added 12 commits January 20, 2026 17:49
Ref #611

Reverts redundant import statement diff with stable to prepare for
release
Closes #567 

This PR improves the performance of the historical state pruning logic.
By refining how state updates are handled and written during pruning, we
observe a significant reduction in write latency.

Performance Benchmarks:
Comparison run using
[load_test](https://github.com/op-rs/op-reth/blob/541e889e886f3ffbee275a15f25f738b2242266a/crates/optimism/trie/src/db/store.rs#L3462)

Metric | Current (Baseline) | Optimised (This PR) | Improvement
-- | -- | -- | --
Write Time | ~107ms | ~50ms | ~2.1x Faster
Total Duration | ~129ms | ~81ms | ~1.6x Faster
…in v1.10.1 (#617)

Ref #611

Uses `reth-trie-common` dep explicitly in `reth-optimism-trie` to make
sure `serde-bincode-compat` can be enabled while using reth release
v1.10.1
Ref #611

Checks out deny.toml from stable branch
@emhane emhane force-pushed the emhane/use-primitive-types-adapters branch from 58d4418 to 7c5ff98 Compare January 22, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-sdk Area: node builder SDK K-debt Kind: debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.