Skip to content

Commit 567526e

Browse files
committed
feat: introduce inboxRollingHash end to end, dual with inHash (A-1373)
Adds the Fast Inbox (AZIP-22) rolling-hash commitment as a dual of the legacy inHash, flowing through parity circuits, block/checkpoint rollup public inputs, the checkpoint header, L1, and the node/prover. Circuits (noir): - Parity base absorbs only real leaves into a truncated-to-field sha256 chain (accumulate_inbox_rolling_hash, guarded by num_msgs + assert_trailing_zeros); merkle roots keep absorbing padding. Parity public inputs gain start_rolling_hash / end_rolling_hash / num_msgs; parity root threads the four base segments sequentially and sums counts. - BlockRollupPublicInputs and CheckpointRollupPublicInputs carry a {start,end} pair propagated exactly like in_hash (first block root sets it, merges take left's, validate asserts right's is zero). Checkpoint merge asserts right.start == left.end (decision 11). CheckpointHeader gains inbox_rolling_hash (the end value) immediately after in_hash. - Root rollup public inputs are unchanged: exposing the epoch pair is inseparable from the L1 epoch-proof anchoring that is out of scope here (FI-08/FI-14), so it is deferred with the rest of L1 anchoring. TS: stdlib inbox_rolling_hash mirror (unit-tested against the FI-02 vectors), CheckpointHeader / parity / block / checkpoint PI classes, noir-protocol-circuits-types conversions, orchestrator threading of per-base start hashes + counts, and node header population at the sequencer / prover / validator sites (sourced from the previous checkpoint header via getPreviousCheckpointInboxRollingHash). L1: ProposedHeader + ProposedHeaderLib.hash pack inboxRollingHash after inHash (no new propose checks); test fixtures + headerHash regenerated.
1 parent cc40d0b commit 567526e

78 files changed

Lines changed: 753 additions & 56 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

l1-contracts/src/core/libraries/rollup/ProposedHeaderLib.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct ProposedHeader {
2222
bytes32 blockHeadersHash;
2323
bytes32 blobsHash;
2424
bytes32 inHash;
25+
bytes32 inboxRollingHash;
2526
bytes32 outHash;
2627
Slot slotNumber;
2728
Timestamp timestamp;
@@ -56,6 +57,7 @@ library ProposedHeaderLib {
5657
_header.blockHeadersHash,
5758
_header.blobsHash,
5859
_header.inHash,
60+
_header.inboxRollingHash,
5961
_header.outHash,
6062
_header.slotNumber,
6163
Timestamp.unwrap(_header.timestamp).toUint64(),

l1-contracts/test/base/DecoderBase.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ contract DecoderBase is TestBase {
4747
bytes32 feeRecipient;
4848
GasFees gasFees;
4949
bytes32 inHash;
50+
bytes32 inboxRollingHash;
5051
bytes32 lastArchiveRoot;
5152
bytes32 outHash;
5253
uint256 slotNumber;
@@ -104,6 +105,7 @@ contract DecoderBase is TestBase {
104105
blockHeadersHash: full.checkpoint.header.blockHeadersHash,
105106
blobsHash: full.checkpoint.header.blobsHash,
106107
inHash: full.checkpoint.header.inHash,
108+
inboxRollingHash: full.checkpoint.header.inboxRollingHash,
107109
outHash: full.checkpoint.header.outHash,
108110
slotNumber: Slot.wrap(full.checkpoint.header.slotNumber),
109111
timestamp: Timestamp.wrap(full.checkpoint.header.timestamp),

l1-contracts/test/escape-hatch/integration/EscapeHatchIntegrationBase.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ abstract contract EscapeHatchIntegrationBase is ValidatorSelectionTestBase {
142142
blockHeadersHash: full.checkpoint.header.blockHeadersHash,
143143
blobsHash: full.checkpoint.header.blobsHash,
144144
inHash: full.checkpoint.header.inHash,
145+
inboxRollingHash: full.checkpoint.header.inboxRollingHash,
145146
outHash: full.checkpoint.header.outHash,
146147
slotNumber: slotNumber,
147148
timestamp: rollup.getTimestampForSlot(slotNumber),

l1-contracts/test/fixtures/empty_checkpoint_1.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"blockHeadersHash": "0x2e3e0911389bc48fa8126a93273d016cc7dc08019f8ffc5f1f5ae7d90745eaa2",
3636
"blobsHash": "0x00e5b752fe6bc2154155ff3a979c4c5fa91d3ac0d716169ac521e1560fd83b2b",
3737
"inHash": "0x00de7b349d2306334734e4f58b1302a6ed5a6c796a706f6597a5641b6d468223",
38+
"inboxRollingHash": "0x00cad6497cf81748167158f149ba70c31f34c68b0ae1b156117de63e073d14b5",
3839
"outHash": "0x00c95e0ceb41951039e1592745ec2faea9866f6eaf01bf189a4463b4143af093",
3940
"slotNumber": 99,
4041
"timestamp": 1776857814,
@@ -47,7 +48,7 @@
4748
"totalManaUsed": 0,
4849
"accumulatedFees": 0
4950
},
50-
"headerHash": "0x0069eb49ccf7b0dd2902a19712dd167fd3b5d890df7f0711fdcfe4d2987838ad",
51+
"headerHash": "0x0002fc455005d993521be4e6f8ed92d1e0b50e58b21445881c87d02ed51a1e4c",
5152
"numTxs": 0
5253
}
53-
}
54+
}

l1-contracts/test/fixtures/empty_checkpoint_2.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"blockHeadersHash": "0x0b3bda1754ca30707b8c0bbe72760c68e574cf23309e7e4fd7cabea36b4078da",
3636
"blobsHash": "0x000e9acabf609c9c113078ecb383ba6310573ce246958b605452132617d2c960",
3737
"inHash": "0x006504de282a40084bb8098456a915c645d53482d351db52fa9433b6cd638763",
38+
"inboxRollingHash": "0x0080dbf2bd9576e81fd99fc0f9d35bfd7fc15a6221d0b6e1e92a1884f14d0c84",
3839
"outHash": "0x00c95e0ceb41951039e1592745ec2faea9866f6eaf01bf189a4463b4143af093",
3940
"slotNumber": 102,
4041
"timestamp": 1776858030,
@@ -47,7 +48,7 @@
4748
"totalManaUsed": 0,
4849
"accumulatedFees": 0
4950
},
50-
"headerHash": "0x0004d4907090fd10f0c7fa759b7ce89c3b7055385423b585c5f7e959c17290ef",
51+
"headerHash": "0x00120ecaf7a72f61adf3c8ee180acd930401221668a4792a8f91584755840d16",
5152
"numTxs": 0
5253
}
53-
}
54+
}

l1-contracts/test/fixtures/mixed_checkpoint_1.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"blockHeadersHash": "0x087b6f59388fa4207876ee1b50521ff838d6eed422d0ad07ff996393f32a77e6",
6969
"blobsHash": "0x001bef3ff3f657c565ff86d5072186f7f2bfddb8a31ca0714562c164fe954d84",
7070
"inHash": "0x00de7b349d2306334734e4f58b1302a6ed5a6c796a706f6597a5641b6d468223",
71+
"inboxRollingHash": "0x00cad6497cf81748167158f149ba70c31f34c68b0ae1b156117de63e073d14b5",
7172
"outHash": "0x00cffdbb0e7f5e164d314d781d38ae31230910a3bae4c34e7df6222df71b1539",
7273
"slotNumber": 99,
7374
"timestamp": 1776857848,
@@ -80,7 +81,7 @@
8081
"totalManaUsed": 0,
8182
"accumulatedFees": 0
8283
},
83-
"headerHash": "0x003ce6d2bb91ea8852841510f5485595dfbddbaa0420e083caf37f182be2140a",
84+
"headerHash": "0x00c1431d117825d25f8169e35eb70ed4b16c0fc4b3cac85506852c240d03740e",
8485
"numTxs": 4
8586
}
86-
}
87+
}

l1-contracts/test/fixtures/mixed_checkpoint_2.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"blockHeadersHash": "0x144dbe32a03df9ccc672207c93cd22099eb91e44a71e1676148cd3c6c6c98b9e",
6969
"blobsHash": "0x008bd0b669b942b57ccf85d3401214db65cde3608afa0b2ae0e57f35ec60d72e",
7070
"inHash": "0x006504de282a40084bb8098456a915c645d53482d351db52fa9433b6cd638763",
71+
"inboxRollingHash": "0x0080dbf2bd9576e81fd99fc0f9d35bfd7fc15a6221d0b6e1e92a1884f14d0c84",
7172
"outHash": "0x008a85da85a596471f2e5fe402fde332723da8d24b6e7affd60d16c7cb7e9020",
7273
"slotNumber": 102,
7374
"timestamp": 1776858064,
@@ -80,7 +81,7 @@
8081
"totalManaUsed": 0,
8182
"accumulatedFees": 0
8283
},
83-
"headerHash": "0x00eb0f37a51d2df835ea48d6cdde28398df86078d8507d467f34434dac062456",
84+
"headerHash": "0x00ab5faa05cb38faa2cd1fc62c40007f64594c9fdc3bb8b7b478a351a7c7dc5a",
8485
"numTxs": 4
8586
}
86-
}
87+
}

l1-contracts/test/fixtures/single_tx_checkpoint_1.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"blockHeadersHash": "0x07db5c24565ad9a2c9d39ef7d9a4446e9742d6090567ff28aef9a45f4738a5cb",
4545
"blobsHash": "0x00ec2400a7cfc9d975cb0802980d49387588738160a0cf0301f07e1abad6456c",
4646
"inHash": "0x00de7b349d2306334734e4f58b1302a6ed5a6c796a706f6597a5641b6d468223",
47+
"inboxRollingHash": "0x00cad6497cf81748167158f149ba70c31f34c68b0ae1b156117de63e073d14b5",
4748
"outHash": "0x007c92c6cf05665e1c02a305370a4d38bcb8b555261c6b39c862f8c067d6bcb7",
4849
"slotNumber": 99,
4950
"timestamp": 1776857833,
@@ -56,7 +57,7 @@
5657
"totalManaUsed": 0,
5758
"accumulatedFees": 0
5859
},
59-
"headerHash": "0x00628120df9716928e25a69ca7b1ac2497f22fdaab439f64315ad4daf7bc5191",
60+
"headerHash": "0x0072a35395a79027db315321cbdaba5bc0b070979c3395b7369ec902ca48d9b2",
6061
"numTxs": 1
6162
}
62-
}
63+
}

l1-contracts/test/fixtures/single_tx_checkpoint_2.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"blockHeadersHash": "0x12813725f2d16ce92088d2401ffa4a53ce6061bf75b77320ca7b8ef6c5145adf",
4545
"blobsHash": "0x002b8ae4c9f405529e2b689b829852ad52f77acdac57d1dbac3dabea1760affc",
4646
"inHash": "0x006504de282a40084bb8098456a915c645d53482d351db52fa9433b6cd638763",
47+
"inboxRollingHash": "0x0080dbf2bd9576e81fd99fc0f9d35bfd7fc15a6221d0b6e1e92a1884f14d0c84",
4748
"outHash": "0x0007eac1d76cddf92b28b8f11cd292f199f35dfc588376092986575cef487f59",
4849
"slotNumber": 102,
4950
"timestamp": 1776858049,
@@ -56,7 +57,7 @@
5657
"totalManaUsed": 0,
5758
"accumulatedFees": 0
5859
},
59-
"headerHash": "0x00f2d5075ed8fdbb50bc0171790cb495308b229325c0aa3e1c3fadd5772d11f4",
60+
"headerHash": "0x000b3c0bf27d3123a81b66570e4b63734cb06bbfd260a70fabbbfd41dec13255",
6061
"numTxs": 1
6162
}
62-
}
63+
}

noir-projects/noir-protocol-circuits/crates/rollup-lib/src/abis/block_rollup_public_inputs.nr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ pub struct BlockRollupPublicInputs {
4343
// Block root rollups that are not the first in a checkpoint will have an `in_hash` value of 0.
4444
pub in_hash: Field,
4545

46+
// Inbox rolling-hash chain segment consumed by this block range, set in the first block root from the parity root
47+
// and propagated to the checkpoint root exactly like `in_hash`: the first block root carries the checkpoint's
48+
// `(start, end)`, non-first block roots carry `(0, 0)`, merges take the left rollup's pair, and
49+
// `validate_consecutive_block_rollups` asserts the right rollup's pair is zero. Unlike `in_hash`, the value may
50+
// legitimately be zero (genesis / empty checkpoint), so it is not asserted nonzero at the checkpoint root.
51+
pub start_inbox_rolling_hash: Field,
52+
pub end_inbox_rolling_hash: Field,
53+
4654
// Root of the *wonky* tree composed of all tx out hashes in this block. It will be combined with the `out_hash`
4755
// values from other blocks within the same checkpoint to form a *wonky* tree.
4856
// The tx and block out hashes form a wonky tree and not an unbalanced tree because zero values are skipped.

0 commit comments

Comments
 (0)