-
Notifications
You must be signed in to change notification settings - Fork 5
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
Split transition information from BatchInfo
to BatchTransition
#637
Conversation
08a8a65
to
0c2e551
Compare
Commit: 0960f83 SP1 Performance Test Results
|
BatchInfo
to BatchTransition
BatchInfo
to BatchTransition
BatchInfo
to BatchTransition
f24b345
to
a853e43
Compare
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.
Consider using the L1BlockCommitment
/L2BlockCommitment
types that are in the new chainstate manager PR.
Yes, makes sense. Will continue on this then once that is merged. |
@prajwolrg That PR got merged btw. |
c82518a
to
8060379
Compare
0068f21
to
b40b8cf
Compare
Right now How do you suggest I proceed here? Do I include HeaderVerificationState commitment to L1BlockCommitment? Or leave it out as it is? |
For |
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.
Okay so I was somewhat confused by the type/field names being vague here. The documentation should have clarified it but the names themselves led me in the wrong direction initially.
crates/state/src/batch.rs
Outdated
pub struct BatchTransition { | ||
/// The inclusive hash range of `HeaderVerificationState` for L1 blocks. | ||
/// This represents the transition of L1 state from the starting state to the | ||
/// ending state. The hash is computed via | ||
/// [`super::l1::HeaderVerificationState::compute_hash`]. | ||
/// | ||
/// Represents a transition from the starting L1 state to the ending L1 state. | ||
/// The hash is computed via [`super::l1::HeaderVerificationState::compute_hash`]. | ||
pub l1_transition: (Buf32, Buf32), | ||
|
||
/// The inclusive hash range of `Chainstate` for L2 blocks. | ||
/// This represents the transition of L2 state from the starting state to the | ||
/// ending state. The state root is computed via | ||
/// [`super::chain_state::Chainstate::compute_state_root`]. | ||
/// | ||
/// Represents a transition from the starting L2 state to the ending L2 state. | ||
/// The state root is computed via [`super::chain_state::Chainstate::compute_state_root`]. | ||
pub l2_transition: (Buf32, Buf32), |
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.
Oh I was misunderstanding this the whole time.
For now I don't think we need to explicitly state these L2 state roots here since they're transitively committed to by the blkids in the block commitments in the other struct. Or do these represent something else.
In the future we might commit to the "outer post-state" here (right now that is what's put in the epoch terminal block), but we can revisit that later.
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.
Right now there's a slight inconsistency between how states are recorded in BatchInfo
versus BatchTransition
. For example, in BatchInfo
, if you have an l1_range of (1, 5), the next range will be (6, 10). In this context, the block IDs (and the corresponding state root it commits) are recorded after the block is applied. However, in BatchTransition
, the state roots are captured before the block is applied, leading to a slight mismatch.
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.
Then would it make sense to change the framing to be based on "prev checkpoint tip" and "new checkpoint tip". And make it half open in the reverse direction?
However, in BatchTransition, the state roots are captured before the block is applied, leading to a slight mismatch.
This seems like a weird special case. What is the reason for this?
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.
For L2 it could have been based entirely on L2BlockId
since it already commits the state_root
. But since L1BlockId
doesn't commit to the L1State, it's done this way for the consistency between L1 and L2.
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.
I would go for some concise name for CheckpointBaseStateCommitment
, something like BaseStateCommitment
which should be clear enough given that the struct has docstring. But the rest is good.
84dfcc8
to
5ba172c
Compare
28f63bc
to
ce222f8
Compare
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.
I think this can be merged right?
Merging to unblock stuff. |
Description
Currently, the entire BatchInfo (including block heights and L1/L2 states) is proven, even though the block heights are already committed in the state. This leads to redundant data and unnatural edge cases—such as inclusive block ranges requiring small hacks to handle transitions.
This PR addresses those issues by splitting the structure into:
BatchTransition – contains only the essential proof data.
BatchInfo – handles auxiliary bookkeeping.
This separation removes duplication and simplifies handling of batch transitions.
Type of Change
Notes to Reviewers
Checklist
Related Issues