Skip to content

feat: implement proposal_id caching for L2 blocks#885

Merged
mikhailUshakoff merged 10 commits intomasterfrom
mu/proposal-id
Mar 4, 2026
Merged

feat: implement proposal_id caching for L2 blocks#885
mikhailUshakoff merged 10 commits intomasterfrom
mu/proposal-id

Conversation

@mikhailUshakoff
Copy link
Collaborator

No description provided.

Copy link
Contributor

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

Implements a cached mechanism for deriving the last safe L2 block height from L1 nextProposalId, and wires it through node verification/reanchor flows to reduce repeated RPC work.

Changes:

  • Introduce LastSafeL2BlockFinder with proposal_id→last_block_id caching and a binary-search fallback when direct lookup fails.
  • Update Node/Verifier call sites to use the finder instead of get_l2_height_from_l1.
  • Add L2 execution-layer helpers for fetching latest block/proposal_id and optimize proposal_id fetch to use headers.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
shasta/src/node/verifier.rs Uses LastSafeL2BlockFinder to compute inbox height during verification/reanchor decisions.
shasta/src/node/mod.rs Instantiates and passes LastSafeL2BlockFinder through node flows; removes l2_height_from_l1 module export.
shasta/src/node/last_safe_l2_block_finder/mod.rs New cached “last safe L2 block” resolver with fast-path lookup and slow-path search.
shasta/src/node/last_safe_l2_block_finder/binary_search_last_block.rs New binary-search utility + unit tests for proposal_id monotonic sequences.
shasta/src/l2/execution_layer.rs Adds get_latest_block_id_and_proposal_id; switches proposal_id fetch to use block headers.
Cargo.toml Workspace version bump to 1.33.11.
Cargo.lock Lockfile updates reflecting the version bump.
Comments suppressed due to low confidence (1)

shasta/src/node/verifier.rs:121

  • Error message grammar: "Verifier return an error" should be "Verifier returned an error" (or similar) to read correctly for operators reviewing ReanchorNeeded reasons.
                        Ok(VerificationResult::ReanchorNeeded(
                            taiko_inbox_height,
                            format!("Verifier return an error: {err}"),
                        ))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

shasta/src/node/verifier.rs:121

  • The error message has a grammatical issue: "Verifier return an error" should be "Verifier returned an error" (or similar) to read correctly in logs/UI.
                        let taiko_inbox_height = self.last_safe_l2_block_finder.get().await?;
                        Ok(VerificationResult::ReanchorNeeded(
                            taiko_inbox_height,
                            format!("Verifier return an error: {err}"),
                        ))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mikhailUshakoff mikhailUshakoff merged commit f2e9a80 into master Mar 4, 2026
8 checks passed
@mikhailUshakoff mikhailUshakoff deleted the mu/proposal-id branch March 4, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants