Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
263d2b2
feat(contracts): keep per-batch Rollup data in a reusable storage ring
SegueII Dec 1, 2026
2a892d6
feat(contracts): add upgradeRollupBatchRing task
SegueII Dec 1, 2026
dd85787
chore(bindings): regenerate Rollup bindings for the batch ring
SegueII Dec 1, 2026
f428038
docs(node,challenger): describe Rollup batch data without the finaliz…
SegueII Dec 1, 2026
84ec3a4
fix(contracts): verify the batch ring start from the upgrade event
SegueII Dec 1, 2026
973b5ca
test(contracts): cover the batch ring cutover during a challenge
SegueII Dec 1, 2026
c126540
test(contracts): cover the batch ring cutover with a pending revert r…
SegueII Dec 1, 2026
32391a9
test(contracts): run the Rollup suites on legacy batch storage and co…
SegueII Dec 3, 2026
5eda453
fix(contracts): run every upgradeRollupBatchRing preflight check befo…
SegueII Dec 3, 2026
c0ed7ba
docs(contracts): describe what the batch views report for legacy batches
SegueII Dec 3, 2026
b2718f5
fix(contracts): read the upgradeRollupBatchRing preflight state at on…
SegueII Dec 3, 2026
f2586e0
fix(contracts): make the upgradeRollupBatchRing preflight ask the Sub…
SegueII Dec 3, 2026
86e18f4
test(contracts,tx-submitter): cover a full batch ring on the paths th…
SegueII Dec 3, 2026
62c3501
fix(contracts): refuse to start the batch ring while the backlog woul…
SegueII Dec 3, 2026
6187e79
chore(bindings): regenerate Rollup bindings for the initialize5 backl…
SegueII Dec 3, 2026
8ea9cca
docs(contracts): name the upgradeRollupBatchRing check that initializ…
SegueII Dec 3, 2026
70d3c14
Merge branch 'main' into feat/rollup-batch-storage-reuse
SegueII Dec 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/bin/rollup_deployed.hex

Large diffs are not rendered by default.

29 changes: 25 additions & 4 deletions bindings/bindings/centralization_cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ func TestCurrentRollupBindingShape(t *testing.T) {
"commitState": {selector: "67caa37a", inputs: 1},
"commitBatchWithProof": {selector: "1544ba3a", inputs: 3},
"initialize4": {selector: "843bc9a1", inputs: 2},
"initialize5": {selector: "7ae64261", inputs: 0},
// The per-batch getters keep the selectors of the public mappings they replaced.
"batchDataStore": {selector: "5ef7a94a", inputs: 1},
"committedStateRoots": {selector: "68589dfa", inputs: 1},
"batchBlobVersionedHashes": {selector: "2a213ba1", inputs: 1},
}
for name, want := range expected {
method, ok := current.Methods[name]
Expand Down Expand Up @@ -51,6 +56,17 @@ func TestCurrentRollupBindingShape(t *testing.T) {
len(method.Outputs) != 1 || method.Outputs[0].Type.String() != "uint256" {
t.Fatalf("generated Rollup binding has invalid legacyCutoverBatchIndex getter: %v", method)
}
for _, name := range []string{"batchRingStartIndex", "highestRevertedBatchIndex"} {
if method, ok := current.Methods[name]; !ok ||
len(method.Outputs) != 1 || method.Outputs[0].Type.String() != "uint64" {
t.Fatalf("generated Rollup binding has invalid %s getter: %v", name, method)
}
}
ringEvent, ok := current.Events["BatchRingStarted"]
if !ok || len(ringEvent.Inputs) != 1 ||
!ringEvent.Inputs[0].Indexed || ringEvent.Inputs[0].Type.String() != "uint256" {
t.Fatalf("BatchRingStarted must index the start batch: %v", ringEvent)
}
cutoverEvent, ok := current.Events["SubmitterContractUpdated"]
if !ok || len(cutoverEvent.Inputs) != 3 ||
!cutoverEvent.Inputs[2].Indexed || cutoverEvent.Inputs[2].Type.String() != "uint256" {
Expand Down Expand Up @@ -102,11 +118,16 @@ func TestCurrentSubmitterBindingShape(t *testing.T) {
}

func TestCurrentStorageLayoutsAreGenerated(t *testing.T) {
// The per-batch mappings keep their slots under their legacy names. The batch ring is appended.
wantRollupSlots := map[string]uint{
"submitterContract": 151,
"batchDataStore": 162,
"batchBlobVersionedHashes": 173,
"legacyCutoverBatchIndex": 174,
"submitterContract": 151,
"_legacyBatchDataStore": 162,
"_legacyCommittedStateRoots": 171,
"_legacyBatchBlobVersionedHashes": 173,
"legacyCutoverBatchIndex": 174,
"batchRingStartIndex": 175,
"highestRevertedBatchIndex": 175,
"_batchRing": 176,
}
for _, entry := range RollupStorageLayout.Storage {
if entry.Label == "pendingBatchCount" {
Expand Down
262 changes: 260 additions & 2 deletions bindings/bindings/rollup.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bindings/bindings/rollup_more.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions challenger/service/calldata.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

// commitInput is the batch data carried by the commit transaction.
// The contract deletes committedStateRoots and batchDataStore when the next batch
// finalizes, so this is the record that remains for an older batch.
// The contract stops reporting committedStateRoots and batchDataStore of a batch
// once the next batch finalizes, so this is the record that remains for an older batch.
type commitInput struct {
BlockNumber uint64
StateRoot common.Hash
Expand Down
5 changes: 3 additions & 2 deletions challenger/service/roots.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ func newRootSource(rollup *bindings.Rollup, l1, l2 *ethclient.Client) (*rootSour
// the latest commit wrote batchDataStore in the same transaction, so its
// originTimestamp is the timestamp of the block holding that transaction.
//
// Finalized batches are refused: finalizeBatch deletes the previous batch's
// batchDataStore, and a finalized batch cannot be challenged anyway.
// Finalized batches are refused: the contract stops reporting a batch's
// batchDataStore once the next batch finalizes, and a finalized batch cannot be
// challenged anyway.
func (s *rootSource) Compare(ctx context.Context, batchIndex uint64) (Comparison, error) {
index := new(big.Int).SetUint64(batchIndex)
head, err := s.l1.HeaderByNumber(ctx, nil)
Expand Down
4 changes: 4 additions & 0 deletions contracts/contracts/l1/rollup/IRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ interface IRollup {
address indexed oldAddr, address indexed newAddr, uint256 indexed legacyCutoverBatchIndex
);

/// @notice Emitted when the per-batch data of new batches starts being kept in the storage ring.
/// @param startBatchIndex The first batch index whose per-batch data is kept in the ring.
event BatchRingStarted(uint256 indexed startBatchIndex);

/// @notice Emitted when the state of Challenge is updated.
/// @param batchIndex The index of the batch.
/// @param challenger The address of challenger.
Expand Down
299 changes: 264 additions & 35 deletions contracts/contracts/l1/rollup/Rollup.sol

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions contracts/contracts/mock/MockLegacyL1Staking.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: MIT

pragma solidity =0.8.24;

/// @dev Stands for the legacy L1Staking contract in upgrade tests. Like L1Staking it reports the
/// Rollup it belongs to, and it has none of the functions of the Submitter.
contract MockLegacyL1Staking {
address public rollupContract;

constructor(address _rollupContract) {
rollupContract = _rollupContract;
}
}
2 changes: 2 additions & 0 deletions contracts/contracts/test/Rollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,8 @@ contract RollupSubmitterUpgradeTest is L1MessageBaseTest {
function test_initialize4IsAtomicThroughProxyAdminAndRunsOnce() public {
uint256 expectedCutoverBatchIndex = 7;
Rollup nextImplementation = new Rollup(layer2ChainID);
// A deployment that has not gone through the Submitter cutover predates the batch ring too.
hevm.store(address(rollup), bytes32(BATCH_RING_STATE_SLOT), bytes32(0));
bytes32 batchDataBase = keccak256(abi.encode(uint256(0), BATCH_DATA_STORE_SLOT));
bytes32 legacyOwnerSlot = bytes32(uint256(batchDataBase) + 3);
bytes32 legacyValue = bytes32(uint256(0xAABBCC));
Expand Down
Loading
Loading