-
Notifications
You must be signed in to change notification settings - Fork 627
circuit-0.5.2 #1705
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
circuit-0.5.2 #1705
Conversation
WalkthroughThe change updates the logic in Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant RpcClient
participant BlockHeader
participant ParentBlock
Caller->>RpcClient: build_witness(current_block, prev_witness)
alt prev_witness exists
RpcClient->>RpcClient: Use prev_witness.state_root
else prev_witness is None
RpcClient->>BlockHeader: Get parent_hash from current_block.header
RpcClient->>ParentBlock: Fetch parent block by parent_hash
RpcClient->>RpcClient: Use parent_block.state_root
end
RpcClient->>Caller: Return witness with previous state root
Estimated code review effort1 (~5 minutes) Possibly related PRs
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/l2geth/src/rpc_client.rs (1)
124-143
: Improve error handling for parent block fetch.The fallback logic is sound and correctly implements fetching the parent block's state root when no previous witness is provided. However, consider improving error handling instead of using
expect
.- None => { - let parent_block = provider - .get_block_by_hash(parent_hash) - .await? - .expect("parent block should exist"); - - parent_block.header.state_root - } + None => { + let parent_block = provider + .get_block_by_hash(parent_hash) + .await? + .ok_or_else(|| eyre::eyre!("Parent block {parent_hash} not found"))?; + + parent_block.header.state_root + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/l2geth/src/rpc_client.rs
(2 hunks)
🔇 Additional comments (2)
crates/l2geth/src/rpc_client.rs (2)
114-114
: LGTM! Parent hash extraction is correct.The extraction of
parent_hash
from the block header is necessary for the new fallback logic and follows standard blockchain patterns.
144-144
: LGTM! Witness builder configuration is correct.Setting the
prev_state_root
on the witness builder ensures it always has a valid previous state root, either from the provided witness or the parent block.
Purpose or design rationale of this PR
Describe your change. Make sure to answer these three questions: What does this PR do? Why does it do it? How does it do it?
PR title
Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:
Deployment tag versioning
Has
tag
incommon/version.go
been updated or have you addedbump-version
label to this PR?Breaking change label
Does this PR have the
breaking-change
label?Summary by CodeRabbit