Conversation
📝 WalkthroughWalkthroughThe changes refactor the batch commit process to gather the submitter bitmap externally in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
contracts/contracts/l1/rollup/Rollup.sol (1)
247-249: Avoid overloadingsignedSequencersBitmapwith a sentinel0.
commitBatchWithProof()now stores0inbatchDataStore[_batchIndex].signedSequencersBitmap, while_challengerWin()still treats that field as the slash target. That makes this path depend on proof-backed batches never flowing through any punishment logic later. Splitting submitter accountability from signer/slash metadata would make this invariant explicit and much safer to maintain.Also applies to: 323-330, 351-372
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contracts/contracts/l1/rollup/Rollup.sol` around lines 247 - 249, The code currently overloads batchDataStore[_batchIndex].signedSequencersBitmap by storing sentinel 0 in commitBatchWithProof while _challengerWin() and punishment logic treat signedSequencersBitmap as the slash target; separate the concepts by adding a new explicit storage field (e.g., submitterBitmap or submitterAccountabilityBitmap) to the Batch struct and use that for submitter identity in commitBatchWithProof (leaving signedSequencersBitmap strictly for signer/slash metadata), then update all callers and checks in _challengerWin(), any punishment logic, and related helpers that reference signedSequencersBitmap (also adjust handling in functions around lines noted: the other commit/validation paths) to reference the new field so no sentinel 0 value is overloaded. Ensure BatchSignatureInput/commitBatchWithProof write the new submitter field and _challengerWin()/slash logic reads signedSequencersBitmap only for signer info.contracts/contracts/test/Rollup.t.sol (1)
542-577: Assert thebobprecondition explicitly.This test assumes
bobis not an active staker, but it never proves that. A precondition assertion will keep the test from silently becoming another “staker can call” case if the shared fixture changes.Proposed test hardening
bytes memory batchHeader1 = _createMatchingBatchHeader(1, 0, prevStateRoot, postStateRoot, withdrawalRoot); // Caller is bob: not a staker, not owner. Anyone can submit when delay is met. + assertFalse(l1Staking.isActiveStaker(bob)); hevm.prank(bob); rollup.commitBatchWithProof( batchDataInput, batchSignatureInput, batchHeader1,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contracts/contracts/test/Rollup.t.sol` around lines 542 - 577, Add an explicit precondition that bob is not an active staker before hevm.prank(bob) to prevent the test from passing accidentally if fixtures change: insert an assertion using the rollup contract and the test's bob variable (for example assertFalse(rollup.isStaker(bob)) or assertEq(rollup.stakers(bob), 0) depending on the rollup interface) immediately before the prank call so the test guarantees “bob is not a staker” when calling rollup.commitBatchWithProof.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@contracts/contracts/l1/rollup/Rollup.sol`:
- Around line 247-249: The code currently overloads
batchDataStore[_batchIndex].signedSequencersBitmap by storing sentinel 0 in
commitBatchWithProof while _challengerWin() and punishment logic treat
signedSequencersBitmap as the slash target; separate the concepts by adding a
new explicit storage field (e.g., submitterBitmap or
submitterAccountabilityBitmap) to the Batch struct and use that for submitter
identity in commitBatchWithProof (leaving signedSequencersBitmap strictly for
signer/slash metadata), then update all callers and checks in _challengerWin(),
any punishment logic, and related helpers that reference signedSequencersBitmap
(also adjust handling in functions around lines noted: the other
commit/validation paths) to reference the new field so no sentinel 0 value is
overloaded. Ensure BatchSignatureInput/commitBatchWithProof write the new
submitter field and _challengerWin()/slash logic reads signedSequencersBitmap
only for signer info.
In `@contracts/contracts/test/Rollup.t.sol`:
- Around line 542-577: Add an explicit precondition that bob is not an active
staker before hevm.prank(bob) to prevent the test from passing accidentally if
fixtures change: insert an assertion using the rollup contract and the test's
bob variable (for example assertFalse(rollup.isStaker(bob)) or
assertEq(rollup.stakers(bob), 0) depending on the rollup interface) immediately
before the prank call so the test guarantees “bob is not a staker” when calling
rollup.commitBatchWithProof.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2776f114-13ba-4786-900d-f57f09f67bb0
📒 Files selected for processing (2)
contracts/contracts/l1/rollup/Rollup.solcontracts/contracts/test/Rollup.t.sol
Summary by CodeRabbit