Skip to content

Commit a739518

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 72a5eaf commit a739518

31 files changed

Lines changed: 88 additions & 221 deletions

File tree

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/test/mock_structs.ts

Lines changed: 3 additions & 7 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';
@@ -104,12 +100,12 @@ export function makeInboxMessagesWithFullBlocks(
104100
opts: { initialCheckpointNumber?: CheckpointNumber } = {},
105101
): InboxMessage[] {
106102
const { initialCheckpointNumber = CheckpointNumber(13) } = opts;
107-
return makeInboxMessages(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP * blockCount, {
103+
return makeInboxMessages(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT * blockCount, {
108104
// Keep the compact global index from makeInboxMessages; only spread the (now-vestigial) checkpoint assignment
109105
// across blocks so multi-block coverage still exercises differing checkpoint numbers.
110106
overrideFn: (msg, i) => {
111107
const checkpointNumber = CheckpointNumber(
112-
initialCheckpointNumber + Math.floor(i / NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
108+
initialCheckpointNumber + Math.floor(i / MAX_L1_TO_L2_MSGS_PER_CHECKPOINT),
113109
);
114110
return { ...msg, checkpointNumber };
115111
},

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: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export class LightweightCheckpointBuilder {
248248
this.blocks.push(block);
249249

250250
// Accumulate the streaming bundle now that the block is fully built, so a mid-build throw above leaves the
251-
// checkpoint's message list (and thus its inHash/rolling hash) consistent with the blocks actually built.
251+
// checkpoint's message list (and thus its rolling hash) consistent with the blocks actually built.
252252
this.l1ToL2Messages.push(...l1ToL2Messages);
253253

254254
const [msSpongeAbsorb] = await elapsed(() => this.spongeBlob.absorb(blockBlobFields));
@@ -283,9 +283,6 @@ export class LightweightCheckpointBuilder {
283283
const blobs = await getBlobsPerL1Block(this.blobFields);
284284
const blobsHash = computeBlobsHashFromBlobs(blobs);
285285

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

291288
const { slotNumber, coinbase, feeRecipient, gasFees } = this.constants;
@@ -303,7 +300,6 @@ export class LightweightCheckpointBuilder {
303300
const header = CheckpointHeader.from({
304301
lastArchiveRoot: this.lastArchives[0].root,
305302
blobsHash,
306-
inHash,
307303
inboxRollingHash,
308304
epochOutHash,
309305
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
@@ -161,15 +161,13 @@ export class CheckpointProvingState {
161161
/**
162162
* Builds the checkpoint's single InboxParity input. The circuit is sized to the smallest ladder rung that fits the
163163
* message count; the rolling hash starts from the previous checkpoint's end and the message sponge starts empty (it
164-
* resets per checkpoint). `in_hash` (the L1 frontier root) is supplied as an unconstrained pass-through hint.
164+
* resets per checkpoint).
165165
*/
166166
public getInboxParityInputs(): InboxParityPrivateInputs {
167167
return InboxParityPrivateInputs.fromMessages(
168168
this.l1ToL2Messages,
169169
this.startInboxRollingHash,
170170
L1ToL2MessageSponge.empty(),
171-
// Legacy in_hash is dead post-flip; the InboxParity pass-through hint carries zero (AZIP-22 Fast Inbox).
172-
Fr.ZERO,
173171
this.constants.vkTreeRoot,
174172
this.constants.proverId,
175173
);

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createLogger } from '@aztec/foundation/log';
55
import type { ServerProtocolArtifact } from '@aztec/noir-protocol-circuits-types/server';
66
import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
77
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
8-
import { L1ToL2MessageSponge, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
8+
import { L1ToL2MessageSponge } from '@aztec/stdlib/messaging';
99
import { INBOX_PARITY_SIZES, InboxParityPrivateInputs, type InboxParitySize } from '@aztec/stdlib/parity';
1010

1111
import { TestContext } from '../mocks/test_context.js';
@@ -48,15 +48,11 @@ describe('prover/bb_prover/parity', () => {
4848
// Fill the rung with real messages so `numMessages === size` (the largest circuit for that rung).
4949
const messages = Array.from({ length: size }, () => Fr.random());
5050
const proverId = Fr.random();
51-
// The in_hash is a sha256 frontier root (top byte zeroed to fit the field), which `ParityPublicInputs` enforces;
52-
// compute it from the messages rather than using a raw random field.
53-
const inHash = computeInHashFromL1ToL2Messages(messages);
5451

5552
const inputs = InboxParityPrivateInputs.fromMessages(
5653
messages,
5754
Fr.ZERO,
5855
L1ToL2MessageSponge.empty(),
59-
inHash,
6056
getVKTreeRoot(),
6157
proverId,
6258
);

yarn-project/pxe/src/storage/backwards_compatibility_tests/schema_tests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ export const SCHEMA_TESTS: readonly SchemaTest[] = [
275275
new Fr(5n),
276276
new Fr(7n),
277277
new Fr(11n),
278-
new Fr(13n),
279278
new Fr(15n),
280279
new Fr(17n),
281280
SlotNumber(19),

0 commit comments

Comments
 (0)