Skip to content

Commit c05ef85

Browse files
committed
chore(fast-inbox): delete legacy node message paths (A-1388)
Node cleanup for the Fast Inbox (AZIP-22) project — removes the legacy L1-to-L2 message paths the flip (#24789) left dead. Sits on the Fast Inbox stack (#24784..#24792); base is `spl/a-1387-circuits-cleanup`. - **stdlib / p2p**: `computeInHashFromL1ToL2Messages` and the whole `in_hash.ts`; the `inHash` field on `BlockProposal` (constructor, signed payload, wire, and the `createBlockProposal` validator-interface argument); the `CheckpointProposal.getBlockProposal` `inHash` pass-through; the padded per-checkpoint `InboxLeaf` helpers (`smallestIndexForCheckpoint` / `indexRangeForCheckpoint` / `checkpointNumberFromIndex`); the legacy `getL1ToL2Messages(checkpointNumber)` member from the `L1ToL2MessageSource` and archiver RPC interfaces. - **archiver**: the legacy per-checkpoint `getL1ToL2Messages` flow, the padded per-checkpoint index invariants, the `inboxTreeInProgress` readiness gate + `L1ToL2MessagesNotReadyError`, and the 128-bit keccak rolling hash. `InboxMessage` now carries only the compact global index and the full-width consensus rolling hash (the vacuous derived `checkpointNumber` and the 128-bit `rollingHash` are gone). Reorg detection compares the local consensus rolling hash and total against the Inbox's current rolling-hash bucket (new `getBucket` / `getCurrentBucketSeq` / `getCurrentBucket` wrappers) instead of the 128-bit `getState`. - **sequencer / validator**: the dead `inHash = Fr.ZERO` threading through the checkpoint proposal job and the validator/validation-service create-proposal path, plus the dead `in_hash_mismatch` validation-failure reason. - **world-state**: the no-op first-in-checkpoint padding alias and the obsolete non-first-block-empty-bundle transitional test (the production assertion was already removed at the flip). - **node**: the public-calls simulator's dead next-checkpoint message fetch and its now-unused `l1ToL2MessageSource` dependency. - **config / env**: `AZTEC_INBOX_LAG` / `inboxLag` from ethereum config, foundation env vars, the network-consensus-config list, the l1-contracts + spartan network defaults, and the e2e option plumbing. - **docs**: `THREAT_MODEL.md` and the archiver README rewritten from the `inHash == inbox.consume(...)` model to the consensus rolling-hash / bucket model. - **Store version bump**: `ARCHIVER_DB_VERSION` 8 → 9 because `InboxMessage` serialization dropped `rollingHash` + `checkpointNumber` and the `inboxTreeInProgress` singleton is gone. No migration — nodes resync (fresh rollup instance per release line, same no-migration policy as the rest of the stack). - **p2p wire format**: dropping the (zeroed-since-flip) `inHash` shrinks the block-proposal bytes. Done as a plain removal at a release boundary (fresh networks), matching the A-1381 optional-tail precedent; the golden `wire_compat_fixtures.ts` buffers were regenerated. The checkpoint-proposal fixture is unaffected (it never carried `inHash`). - **L1 follow-through: done (leftover sweep, below).** The on-chain Inbox 128-bit `messagesRollingHash` accumulation, `InboxState.rollingHash`, and the `MessageSent.rollingHash` event arg are now removed in this PR — this is the earliest branch where it is safe, since the TS reads disappear here. `getState()` / `getTotalMessagesInserted()` are kept: `chain_monitor` and fast node sync still read the message count. Locally green (unit suites that run without `@aztec/bb-avm-sim`): archiver (561), stdlib p2p + interfaces (76), world-state synchronizer + native (74), validator-client unit (38), ethereum config (6). Suites that import `@aztec/bb-avm-sim` (p2p libp2p, sequencer-client, node simulator, validator integration) and full typecheck of the packages downstream of the pinned-VK blocker are CI-validated. No e2e / VK regen locally. Four commits were appended by the final review pass: - The env sweep removed `AZTEC_INBOX_LAG` from `scripts/network-defaults.json` while both L1 deploy-script test setUps still `readUint` the key, reverting before any test ran; the reads are gone. - The p2p attestation store version is bumped 2 -> 3: it persists proposal/attestation buffers whose formats changed in this stack (checkpoint header lost `inHash`; block-proposal wire dropped it), and stored checkpoint attestations decode without a tolerant fallback. - `l1_publisher.integration.test.ts` is reworked for streaming consumption: each checkpoint consumes every message sent while it was built, threading the previous checkpoint's rolling hash and reading the propose `bucketHint` from the Inbox's current bucket (the legacy inboxLag shift register is gone). - Remaining `inboxLag`/`inHash` references are swept from the spartan environment profiles, the governance-upgrade tutorial, the validator/sequencer READMEs, and stale e2e comments. This branch's rewrite of `l1_publisher.integration.test.ts` is superseded by the corrected streaming-selector version landed at A-1387 (#24792): the branch's own message-reconstruction rework commit is dropped and the file is byte-identical to A-1387's here (segment diff for this file is zero). The A-1384 world-state mock bucket registration coexists with this branch's legacy-message-path deletion (the buckets survive the cleanup). First real box verification of this suite at A-1388: l1_publisher 13/13; world-state integration 12/12 at top. - Removed the legacy 128-bit keccak inbox rolling hash from L1: `InboxState.rollingHash`, the `MessageSent` `bytes16 rollingHash` event arg, and its keccak accumulation in `Inbox.sol`, updating the four Solidity test suites that asserted it (`Inbox.t`, `InboxBuckets.t`, `TokenPortal.t`, `depositToAztecPublic.t`) and the three live docs-example inbox ABIs that embedded the old event shape. The node's message sync and L1-reorg detection already run entirely on the full-width consensus rolling hash from the buckets. - Deleted the dead `InboxLeaf` class from stdlib (this branch had already removed its per-checkpoint index helpers) and fixed a stale `InboxLeaf` mention in the archiver retrieval JSDoc. - Clarified the checkpoint-builder comments: the up-front whole-checkpoint message insertion (`insertMessagesPerBlock = false`) is only exercised by tests; production always streams messages per block. Replaces #24793.
1 parent ea94128 commit c05ef85

124 files changed

Lines changed: 549 additions & 916 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.

docs/docs-developers/docs/tutorials/testing_governance_rollup_upgrade.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export AZTEC_EPOCH_DURATION=16
8989
export AZTEC_TARGET_COMMITTEE_SIZE=48
9090
export AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET=2
9191
export AZTEC_LAG_IN_EPOCHS_FOR_RANDAO=2
92-
export AZTEC_INBOX_LAG=2
9392
export AZTEC_PROOF_SUBMISSION_EPOCHS=2
9493
export AZTEC_LOCAL_EJECTION_THRESHOLD=0
9594
export AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS=1

docs/docs-operate/operators/reference/node-api-reference.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,22 +635,24 @@ curl -X POST http://localhost:8080 \
635635
-d '{"jsonrpc":"2.0","method":"aztec_getL1ToL2MessageMembershipWitness","params":["latest","0x1234..."],"id":1}'
636636
```
637637

638-
### aztec_getL1ToL2MessageCheckpoint
638+
### aztec_getL1ToL2MessageIndex
639639

640-
Returns the L2 checkpoint number in which this L1 to L2 message becomes available, or undefined if not found.
640+
Returns the compact leaf index assigned to this L1 to L2 message as soon as the node has ingested it from L1,
641+
before any L2 block consumes it. Returns undefined if the node has not yet seen the message. The message becomes
642+
consumable once a block's L1-to-L2 message tree grows past this index.
641643

642644
**Parameters**:
643645

644646
1. `l1ToL2Message` - `Fr`
645647

646-
**Returns**: `number | undefined`
648+
**Returns**: `bigint | undefined`
647649

648650
**Example**:
649651

650652
```bash
651653
curl -X POST http://localhost:8080 \
652654
-H 'Content-Type: application/json' \
653-
-d '{"jsonrpc":"2.0","method":"aztec_getL1ToL2MessageCheckpoint","params":["0x1234..."],"id":1}'
655+
-d '{"jsonrpc":"2.0","method":"aztec_getL1ToL2MessageIndex","params":["0x1234..."],"id":1}'
654656
```
655657

656658
### aztec_getL2ToL1MembershipWitness

docs/examples/ts/aave_bridge/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ const INBOX_ABI = [
349349
inputs: [
350350
{ name: "index", type: "uint256", indexed: false },
351351
{ name: "hash", type: "bytes32", indexed: true },
352-
{ name: "rollingHash", type: "bytes16", indexed: false },
353352
{ name: "inboxRollingHash", type: "bytes32", indexed: false },
354353
{ name: "bucketSeq", type: "uint256", indexed: false },
355354
],

docs/examples/ts/example_swap/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ const INBOX_ABI = [
261261
inputs: [
262262
{ name: "index", type: "uint256", indexed: false },
263263
{ name: "hash", type: "bytes32", indexed: true },
264-
{ name: "rollingHash", type: "bytes16", indexed: false },
265264
{ name: "inboxRollingHash", type: "bytes32", indexed: false },
266265
{ name: "bucketSeq", type: "uint256", indexed: false },
267266
],

docs/examples/ts/token_bridge/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ const INBOX_ABI = [
167167
inputs: [
168168
{ name: "index", type: "uint256", indexed: false },
169169
{ name: "hash", type: "bytes32", indexed: true },
170-
{ name: "rollingHash", type: "bytes16", indexed: false },
171170
{ name: "inboxRollingHash", type: "bytes32", indexed: false },
172171
{ name: "bucketSeq", type: "uint256", indexed: false },
173172
],

docs/scripts/node_api_reference_generation/generate_node_api_reference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ const METHOD_GROUPS: { heading: string; namespace: string; methods: string[] }[]
559559
namespace: 'aztec',
560560
methods: [
561561
'getL1ToL2MessageMembershipWitness',
562-
'getL1ToL2MessageCheckpoint',
562+
'getL1ToL2MessageIndex',
563563
'getL2ToL1MembershipWitness',
564564
'getL2ToL1Messages',
565565
],

l1-contracts/scripts/network-defaults.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN": 48,
1515
"AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT": 2,
1616
"AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE": 48,
17-
"AZTEC_INBOX_LAG": 1,
1817
"AZTEC_PROOF_SUBMISSION_EPOCHS": 1,
1918
"AZTEC_MANA_TARGET": 100000000,
2019
"AZTEC_PROVING_COST_PER_MANA": 100,

l1-contracts/src/core/interfaces/IRollup.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct PublicInputArgs {
2727
bytes32 previousArchive;
2828
bytes32 endArchive;
2929
bytes32 outHash;
30-
// Inbox rolling-hash chain segment consumed across the proven epoch (AZIP-22 Fast Inbox). Both boundaries are
30+
// Inbox rolling-hash chain segment consumed across the proven epoch. Both boundaries are
3131
// anchored at proof submission against the rolling hashes recorded at propose for checkpoints start - 1 and end.
3232
bytes32 previousInboxRollingHash;
3333
bytes32 endInboxRollingHash;

l1-contracts/src/core/interfaces/messagebridge/IInbox.sol

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ uint256 constant MAX_MSGS_PER_BUCKET = 256;
1616
*/
1717
interface IInbox {
1818
struct InboxState {
19-
// Legacy 128-bit keccak rolling hash of all messages inserted into the inbox. Consumed only by the
20-
// node for message sync and L1-reorg detection.
21-
// TODO: remove once the node relies on the full-width consensus rolling hash tracked in the buckets
22-
// instead (AZIP-22 Fast Inbox).
23-
bytes16 rollingHash;
2419
// Cumulative number of messages inserted into the inbox. Useful for synching the node faster as it can
2520
// more easily figure out if it can just skip looking for events for a time period.
2621
uint64 totalMessagesInserted;
@@ -50,13 +45,10 @@ interface IInbox {
5045
* @notice Emitted when a message is sent
5146
* @param index - The compact cumulative index of the message in the Inbox insertion order
5247
* @param hash - The hash of the message
53-
* @param rollingHash - The legacy 128-bit rolling hash of all messages inserted into the inbox
5448
* @param inboxRollingHash - The consensus rolling hash (truncated sha256 chain) after this message
5549
* @param bucketSeq - The sequence number of the bucket this message was absorbed into
5650
*/
57-
event MessageSent(
58-
uint256 index, bytes32 indexed hash, bytes16 rollingHash, bytes32 inboxRollingHash, uint256 bucketSeq
59-
);
51+
event MessageSent(uint256 index, bytes32 indexed hash, bytes32 inboxRollingHash, uint256 bucketSeq);
6052

6153
// docs:start:send_l1_to_l2_message
6254
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@ library ProposeLib {
401401

402402
/**
403403
* @notice Validates a checkpoint's Inbox consumption against the streaming inbox buckets and returns how
404-
* far consumption has reached. Called from propose() as the enforced consumption path (AZIP-22 Fast
405-
* Inbox).
404+
* far consumption has reached. Called from propose() as the enforced consumption path.
406405
*
407406
* @dev Read-only; performs no Inbox write. Checks, in order:
408407
* 1. The checkpoint header's `inboxRollingHash` must equal the rolling hash snapshotted in the Inbox

0 commit comments

Comments
 (0)