Skip to content

Commit a87c067

Browse files
committed
chore(fast-inbox): follow the checkpoint header inHash removal through stdlib and node (A-1387)
Mirror the consensus-format change in the stdlib CheckpointHeader (struct, serialization, viem, hash fixtures) and the circuit-ABI stdlib types (ParityPublicInputs, InboxParityPrivateInputs) and their noir conversion mappings. Sweep the header-inHash populate/read sites: the lightweight checkpoint builder, the checkpoint-proving orchestrator, the sequencer fixture writer, and the checkpoint proposal (its block-level inHash now sources zero rather than the removed header field). Regenerate the checkpoint p2p wire fixture for the shorter header. Replace NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP with MAX_L1_TO_L2_MSGS_PER_CHECKPOINT across the TS consumers. The block-level inHash struct fields (BlockProposal, L2Block) and stdlib/src/messaging/in_hash.ts remain for the node cleanup issue.
1 parent 6594e08 commit a87c067

34 files changed

Lines changed: 81 additions & 168 deletions

yarn-project/archiver/src/l1/calldata_retriever.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ describe('CalldataRetriever', () => {
12481248
expect(result.blockHash).toBe(tx.blockHash);
12491249

12501250
// Verify all components are properly decoded
1251-
expect(result.header.inHash).toBeInstanceOf(Fr);
1251+
expect(result.header.inboxRollingHash).toBeInstanceOf(Fr);
12521252
expect(result.header.gasFees).toBeInstanceOf(GasFees);
12531253

12541254
// Verify instrumentation was called
@@ -1322,7 +1322,7 @@ describe('CalldataRetriever', () => {
13221322
expect(result.blockHash).toBe(blockHash);
13231323

13241324
// Verify all components are properly decoded
1325-
expect(result.header.inHash).toBeInstanceOf(Fr);
1325+
expect(result.header.inboxRollingHash).toBeInstanceOf(Fr);
13261326
expect(result.header.gasFees).toBeInstanceOf(GasFees);
13271327

13281328
// Verify proxy implementation was checked

yarn-project/archiver/src/store/message_store.test.ts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
1+
import { MAX_L1_TO_L2_MSGS_PER_CHECKPOINT } from '@aztec/constants';
22
import { CheckpointNumber } from '@aztec/foundation/branded-types';
33
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
44
import { Fr } from '@aztec/foundation/curves/bn254';
@@ -165,9 +165,9 @@ describe('MessageStore', () => {
165165

166166
await checkMessages(msgs);
167167
const blockMessages = await messageStore.getL1ToL2Messages(CheckpointNumber(initialCheckpointNumber + 1));
168-
expect(blockMessages).toHaveLength(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
168+
expect(blockMessages).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
169169
expect(blockMessages).toEqual(
170-
msgs.slice(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP * 2).map(m => m.leaf),
170+
msgs.slice(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT, MAX_L1_TO_L2_MSGS_PER_CHECKPOINT * 2).map(m => m.leaf),
171171
);
172172
});
173173

@@ -244,7 +244,7 @@ describe('MessageStore', () => {
244244
overrideFn: (msg, i) => ({
245245
...msg,
246246
checkpointNumber: CheckpointNumber(2),
247-
index: BigInt(i + NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP * 2),
247+
index: BigInt(i + MAX_L1_TO_L2_MSGS_PER_CHECKPOINT * 2),
248248
}),
249249
});
250250
msgs[1].index++;
@@ -257,31 +257,19 @@ describe('MessageStore', () => {
257257
await messageStore.addL1ToL2Messages(msgs);
258258
await checkMessages(msgs);
259259

260-
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(1))).toHaveLength(
261-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
262-
);
263-
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(2))).toHaveLength(
264-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
265-
);
266-
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(3))).toHaveLength(
267-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
268-
);
269-
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(4))).toHaveLength(
270-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
271-
);
260+
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(1))).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
261+
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(2))).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
262+
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(3))).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
263+
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(4))).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
272264

273265
await messageStore.rollbackL1ToL2MessagesToCheckpoint(CheckpointNumber(2));
274266

275-
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(1))).toHaveLength(
276-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
277-
);
278-
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(2))).toHaveLength(
279-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
280-
);
267+
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(1))).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
268+
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(2))).toHaveLength(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
281269
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(3))).toHaveLength(0);
282270
expect(await messageStore.getL1ToL2Messages(CheckpointNumber(4))).toHaveLength(0);
283271

284-
await checkMessages(msgs.slice(0, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP * 2));
272+
await checkMessages(msgs.slice(0, MAX_L1_TO_L2_MSGS_PER_CHECKPOINT * 2));
285273
});
286274

287275
it('removes messages starting with the given index', async () => {

yarn-project/archiver/src/test/mock_structs.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
MAX_NOTE_HASHES_PER_TX,
3-
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
4-
PRIVATE_LOG_SIZE_IN_FIELDS,
5-
} from '@aztec/constants';
1+
import { MAX_L1_TO_L2_MSGS_PER_CHECKPOINT, MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
62
import { makeTuple } from '@aztec/foundation/array';
73
import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
84
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
@@ -101,13 +97,13 @@ export function makeInboxMessagesWithFullBlocks(
10197
opts: { initialCheckpointNumber?: CheckpointNumber } = {},
10298
): InboxMessage[] {
10399
const { initialCheckpointNumber = CheckpointNumber(13) } = opts;
104-
return makeInboxMessages(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP * blockCount, {
100+
return makeInboxMessages(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT * blockCount, {
105101
overrideFn: (msg, i) => {
106102
const checkpointNumber = CheckpointNumber(
107-
initialCheckpointNumber + Math.floor(i / NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
103+
initialCheckpointNumber + Math.floor(i / MAX_L1_TO_L2_MSGS_PER_CHECKPOINT),
108104
);
109105
const index =
110-
InboxLeaf.smallestIndexForCheckpoint(checkpointNumber) + BigInt(i % NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
106+
InboxLeaf.smallestIndexForCheckpoint(checkpointNumber) + BigInt(i % MAX_L1_TO_L2_MSGS_PER_CHECKPOINT);
111107
return { ...msg, checkpointNumber, index };
112108
},
113109
});

yarn-project/ethereum/src/contracts/rollup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export type ViemHeader = {
7979
lastArchiveRoot: `0x${string}`;
8080
blockHeadersHash: `0x${string}`;
8181
blobsHash: `0x${string}`;
82-
inHash: `0x${string}`;
8382
inboxRollingHash: `0x${string}`;
8483
outHash: `0x${string}`;
8584
slotNumber: bigint;

yarn-project/ivc-integration/src/base_parity_inputs.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { createLogger } from '@aztec/foundation/log';
1515
import { Noir } from '@aztec/noir-noir_js';
1616
import { ServerCircuitArtifacts } from '@aztec/noir-protocol-circuits-types/server';
1717
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
18-
import { L1ToL2MessageSponge, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
18+
import { L1ToL2MessageSponge } from '@aztec/stdlib/messaging';
1919
import { InboxParityPrivateInputs } from '@aztec/stdlib/parity';
2020

2121
import { jest } from '@jest/globals';
@@ -47,7 +47,6 @@ describe('Inbox Parity Benchmark Inputs', () => {
4747
l1ToL2Messages,
4848
Fr.ZERO,
4949
L1ToL2MessageSponge.empty(),
50-
computeInHashFromL1ToL2Messages(l1ToL2Messages),
5150
vkTreeRoot,
5251
Fr.random(),
5352
);
@@ -75,8 +74,6 @@ describe('Inbox Parity Benchmark Inputs', () => {
7574
num_absorbed: startSponge.numAbsorbed,
7675
},
7776
// eslint-disable-next-line camelcase
78-
in_hash: inputs.inHash.toString(),
79-
// eslint-disable-next-line camelcase
8077
vk_tree_root: inputs.vkTreeRoot.toString(),
8178
// eslint-disable-next-line camelcase
8279
prover_id: inputs.proverId.toString(),

yarn-project/ivc-integration/src/bb_js_debug.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { createLogger } from '@aztec/foundation/log';
1212
import { Noir } from '@aztec/noir-noir_js';
1313
import { ServerCircuitArtifacts } from '@aztec/noir-protocol-circuits-types/server';
1414
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
15-
import { L1ToL2MessageSponge, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
15+
import { L1ToL2MessageSponge } from '@aztec/stdlib/messaging';
1616
import { InboxParityPrivateInputs } from '@aztec/stdlib/parity';
1717

1818
import { jest } from '@jest/globals';
@@ -62,7 +62,6 @@ describe('BB.js Debug Wrapper', () => {
6262
l1ToL2Messages,
6363
Fr.ZERO,
6464
L1ToL2MessageSponge.empty(),
65-
computeInHashFromL1ToL2Messages(l1ToL2Messages),
6665
vkTreeRoot,
6766
Fr.random(),
6867
);
@@ -88,8 +87,6 @@ describe('BB.js Debug Wrapper', () => {
8887
num_absorbed: startSponge.numAbsorbed,
8988
},
9089
// eslint-disable-next-line camelcase
91-
in_hash: inboxParityInputs.inHash.toString(),
92-
// eslint-disable-next-line camelcase
9390
vk_tree_root: inboxParityInputs.vkTreeRoot.toString(),
9491
// eslint-disable-next-line camelcase
9592
prover_id: inboxParityInputs.proverId.toString(),

yarn-project/noir-protocol-circuits-types/src/conversion/server.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ export function mapAvmProofDataToNoir(
481481

482482
function mapParityPublicInputsToNoir(parityPublicInputs: ParityPublicInputs): ParityPublicInputsNoir {
483483
return {
484-
in_hash: mapFieldToNoir(parityPublicInputs.inHash),
485484
start_rolling_hash: mapFieldToNoir(parityPublicInputs.startRollingHash),
486485
end_rolling_hash: mapFieldToNoir(parityPublicInputs.endRollingHash),
487486
start_sponge: mapL1ToL2MessageSpongeToNoir(parityPublicInputs.startSponge),
@@ -520,7 +519,6 @@ export function mapRootRollupPublicInputsFromNoir(
520519
*/
521520
export function mapParityPublicInputsFromNoir(parityPublicInputs: ParityPublicInputsNoir): ParityPublicInputs {
522521
return new ParityPublicInputs(
523-
mapFieldFromNoir(parityPublicInputs.in_hash),
524522
mapFieldFromNoir(parityPublicInputs.start_rolling_hash),
525523
mapFieldFromNoir(parityPublicInputs.end_rolling_hash),
526524
mapL1ToL2MessageSpongeFromNoir(parityPublicInputs.start_sponge),
@@ -739,7 +737,6 @@ export function mapInboxParityPrivateInputsToNoir(inputs: InboxParityPrivateInpu
739737
num_msgs: mapNumberToNoir(inputs.numMessages),
740738
start_rolling_hash: mapFieldToNoir(inputs.startRollingHash),
741739
start_sponge: mapL1ToL2MessageSpongeToNoir(inputs.startSponge),
742-
in_hash: mapFieldToNoir(inputs.inHash),
743740
vk_tree_root: mapFieldToNoir(inputs.vkTreeRoot),
744741
prover_id: mapFieldToNoir(inputs.proverId),
745742
};

yarn-project/prover-client/src/light/lightweight_checkpoint_builder.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ export class LightweightCheckpointBuilder {
209209

210210
// Streaming Inbox (AZIP-22 Fast Inbox): insert this block's L1-to-L2 message bundle before reading the end state,
211211
// so the block header's L1-to-L2 tree snapshot reflects it. First-in-checkpoint bundles are padded to
212-
// NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP (matching the legacy per-checkpoint insertion and the world-state
212+
// MAX_L1_TO_L2_MSGS_PER_CHECKPOINT (matching the legacy per-checkpoint insertion and the world-state
213213
// synchronizer); non-first bundles are appended compactly. The logical (unpadded) messages are accumulated only
214-
// once the block is fully built (below), so a mid-build failure does not pollute the checkpoint's inHash/rolling
215-
// hash; the rolling hash and inHash are recomputed over them at checkpoint completion.
214+
// once the block is fully built (below), so a mid-build failure does not pollute the checkpoint's rolling hash;
215+
// the rolling hash is recomputed over them at checkpoint completion.
216216
if (opts.l1ToL2Messages !== undefined) {
217217
if (isFirstBlock) {
218218
await appendL1ToL2MessagesToTree(this.db, opts.l1ToL2Messages);
@@ -257,7 +257,7 @@ export class LightweightCheckpointBuilder {
257257
this.blocks.push(block);
258258

259259
// Accumulate the streaming bundle now that the block is fully built, so a mid-build throw above leaves the
260-
// checkpoint's message list (and thus its inHash/rolling hash) consistent with the blocks actually built.
260+
// checkpoint's message list (and thus its rolling hash) consistent with the blocks actually built.
261261
if (opts.l1ToL2Messages !== undefined) {
262262
this.l1ToL2Messages.push(...opts.l1ToL2Messages);
263263
}
@@ -294,9 +294,6 @@ export class LightweightCheckpointBuilder {
294294
const blobs = await getBlobsPerL1Block(this.blobFields);
295295
const blobsHash = computeBlobsHashFromBlobs(blobs);
296296

297-
// Legacy inHash is dead post-flip; the checkpoint header carries zero (AZIP-22 Fast Inbox). The consensus
298-
// rolling hash over the consumed messages is the authoritative Inbox commitment.
299-
const inHash = Fr.ZERO;
300297
const inboxRollingHash = accumulateInboxRollingHash(this.previousInboxRollingHash, this.l1ToL2Messages);
301298

302299
const { slotNumber, coinbase, feeRecipient, gasFees } = this.constants;
@@ -314,7 +311,6 @@ export class LightweightCheckpointBuilder {
314311
const header = CheckpointHeader.from({
315312
lastArchiveRoot: this.lastArchives[0].root,
316313
blobsHash,
317-
inHash,
318314
inboxRollingHash,
319315
epochOutHash,
320316
blockHeadersHash,

yarn-project/prover-client/src/orchestrator/checkpoint-proving-state.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,13 @@ export class CheckpointProvingState {
151151
/**
152152
* Builds the checkpoint's single InboxParity input. The circuit is sized to the smallest ladder rung that fits the
153153
* message count; the rolling hash starts from the previous checkpoint's end and the message sponge starts empty (it
154-
* resets per checkpoint). `in_hash` (the L1 frontier root) is supplied as an unconstrained pass-through hint.
154+
* resets per checkpoint).
155155
*/
156156
public getInboxParityInputs(): InboxParityPrivateInputs {
157157
return InboxParityPrivateInputs.fromMessages(
158158
this.l1ToL2Messages,
159159
this.startInboxRollingHash,
160160
L1ToL2MessageSponge.empty(),
161-
// Legacy in_hash is dead post-flip; the InboxParity pass-through hint carries zero (AZIP-22 Fast Inbox).
162-
Fr.ZERO,
163161
this.constants.vkTreeRoot,
164162
this.constants.proverId,
165163
);

yarn-project/prover-client/src/test/bb_prover_full_rollup.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BBNativeRollupProver, type BBProverConfig } from '@aztec/bb-prover';
2-
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, PAIRING_POINTS_SIZE } from '@aztec/constants';
2+
import { MAX_L1_TO_L2_MSGS_PER_CHECKPOINT, PAIRING_POINTS_SIZE } from '@aztec/constants';
33
import { EpochNumber } from '@aztec/foundation/branded-types';
44
import { timesAsync } from '@aztec/foundation/collection';
55
import { parseBooleanEnv } from '@aztec/foundation/config';
@@ -52,7 +52,7 @@ describe('prover/bb_prover/full-rollup', () => {
5252
const checkpoints = await timesAsync(numCheckpoints, () =>
5353
context.makeCheckpoint(numBlockPerCheckpoint, {
5454
numTxsPerBlock,
55-
numL1ToL2Messages: NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
55+
numL1ToL2Messages: MAX_L1_TO_L2_MSGS_PER_CHECKPOINT,
5656
makeProcessedTxOpts: (_, txIndex) => ({ privateOnly: txIndex % 2 === 0 }),
5757
}),
5858
);

0 commit comments

Comments
 (0)