Skip to content

Commit 5659159

Browse files
committed
chore(fast-inbox): drop legacy inHash threading from sequencer and validator (A-1388)
Removes the dead inHash=Fr.ZERO plumbing through the checkpoint proposal job and the validator/validation-service createBlockProposal path, and deletes the dead in_hash_mismatch validation-failure reason from proposal_handler, validator, and metrics. Updates the sequencer/validator test mocks and callers for the dropped inHash argument and the removed getL1ToL2Messages message source member.
1 parent 4251f2a commit 5659159

15 files changed

Lines changed: 19 additions & 95 deletions

yarn-project/sequencer-client/src/publisher/l1_publisher.integration.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@ describe('L1Publisher integration', () => {
503503
new GasFees(0, await rollup.getManaMinFeeAt(timestamp, true)),
504504
);
505505
const checkpoint = await buildCheckpoint(globalVariables, txs, l1ToL2Messages);
506-
blockSource.getL1ToL2Messages.mockResolvedValueOnce(l1ToL2Messages);
507506
return { checkpoint, l1ToL2Messages };
508507
};
509508

@@ -535,10 +534,10 @@ describe('L1Publisher integration', () => {
535534
'0x1647b194c649f5dd01d7c832f89b0f496043c9150797923ea89e93d5ac619a93',
536535
);
537536

538-
// The deployed rollup consumes L1->L2 messages with a lag of `inboxLag` checkpoints: a message
539-
// inserted while building checkpoint N is only consumable at checkpoint N + inboxLag. Model that
540-
// with a shift register so a real message is genuinely consumed and validated on L1.
541-
const inboxLag = getL1ContractsConfigEnvVars().inboxLag;
537+
// Legacy per-checkpoint lag model: a message inserted while building checkpoint N was only consumable at
538+
// checkpoint N + inboxLag. Modeled with a shift register so a real message is genuinely consumed and validated
539+
// on L1. Retained here for the integration flow; the streaming Inbox (AZIP-22) consumes per block instead.
540+
const inboxLag = 2;
542541
const messagesInFlight: Fr[][] = Array.from({ length: inboxLag }, () => []);
543542
const blobFieldsPerCheckpoint: Fr[][] = [];
544543
// The below batched blob is used for testing different epochs with 1..numberOfConsecutiveBlocks blocks on L1.
@@ -587,7 +586,6 @@ describe('L1Publisher integration', () => {
587586
expect(totalManaUsed.toBigInt()).toEqual(block.header.totalManaUsed.toBigInt());
588587

589588
prevHeader = block.header;
590-
blockSource.getL1ToL2Messages.mockResolvedValueOnce(currentL1ToL2Messages);
591589

592590
const checkpointBlobFields = checkpoint.toBlobFields();
593591
const blockBlobs = await getBlobsPerL1Block(checkpointBlobFields);

yarn-project/sequencer-client/src/sequencer/checkpoint_proposal_job.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ describe('CheckpointProposalJob', () => {
245245
checkpointBuilder = checkpointsBuilder.createCheckpointBuilder(checkpointConstants, checkpointNumber);
246246

247247
l1ToL2MessageSource = mock<L1ToL2MessageSource>();
248-
l1ToL2MessageSource.getL1ToL2Messages.mockResolvedValue(Array(4).fill(Fr.ZERO));
249248

250249
l2BlockSource = mock<L2BlockSource>();
251250
l2BlockSource.getCheckpointsData.mockResolvedValue([]);
@@ -278,12 +277,11 @@ describe('CheckpointProposalJob', () => {
278277
validatorClient = mock<ValidatorClient>();
279278
validatorClient.collectAttestations.mockImplementation(() => Promise.resolve([]));
280279
validatorClient.createBlockProposal.mockImplementation(
281-
async (blockHeader, _checkpointNumber, indexWithinCheckpoint, inHash, archiveRoot, txs) => {
280+
async (blockHeader, _checkpointNumber, indexWithinCheckpoint, archiveRoot, txs) => {
282281
const txHashes = await Promise.all((txs ?? []).map((tx: Tx) => tx.getTxHash()));
283282
return new BlockProposal(
284283
blockHeader,
285284
IndexWithinCheckpoint(indexWithinCheckpoint),
286-
inHash,
287285
archiveRoot,
288286
txHashes,
289287
mockedSig,
@@ -1423,8 +1421,7 @@ describe('CheckpointProposalJob', () => {
14231421

14241422
expect(checkpoint).toBeDefined();
14251423

1426-
// Streaming skips the bulk per-checkpoint fetch and tells the builder to insert messages per block.
1427-
expect(l1ToL2MessageSource.getL1ToL2Messages).not.toHaveBeenCalled();
1424+
// Streaming tells the builder to insert messages per block instead of a bulk per-checkpoint list.
14281425
expect(checkpointsBuilder.startCheckpointCalls).toHaveLength(1);
14291426
expect(checkpointsBuilder.startCheckpointCalls[0].l1ToL2Messages).toEqual([]);
14301427
expect(checkpointsBuilder.startCheckpointCalls[0].insertMessagesPerBlock).toBe(true);
@@ -1435,7 +1432,7 @@ describe('CheckpointProposalJob', () => {
14351432
expect(checkpointBuilder.buildBlockCalls[1].opts.l1ToL2Messages).toEqual([]);
14361433

14371434
// Both block proposals carry the selected bucket reference (the second reuses the first's).
1438-
const bucketRefArgs = validatorClient.createBlockProposal.mock.calls.map(call => call[8]);
1435+
const bucketRefArgs = validatorClient.createBlockProposal.mock.calls.map(call => call[7]);
14391436
expect(bucketRefArgs).toHaveLength(2);
14401437
expect(bucketRefArgs[0]?.bucketSeq).toBe(2n);
14411438
expect(bucketRefArgs[1]?.bucketSeq).toBe(2n);

yarn-project/sequencer-client/src/sequencer/checkpoint_proposal_job.timing.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ describe('CheckpointProposalJob Timing Tests', () => {
451451
worldState.fork.mockResolvedValue(mockFork);
452452

453453
l1ToL2MessageSource = mock<L1ToL2MessageSource>();
454-
l1ToL2MessageSource.getL1ToL2Messages.mockResolvedValue(Array(4).fill(Fr.ZERO));
455454

456455
l2BlockSource = mock<L2BlockSource>();
457456
l2BlockSource.getCheckpointsData.mockResolvedValue([]);

yarn-project/sequencer-client/src/sequencer/checkpoint_proposal_job.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,8 @@ export class CheckpointProposalJob implements Traceable {
639639
);
640640

641641
// Under the streaming Inbox (AZIP-22 Fast Inbox) messages are selected per block, so the checkpoint-level bulk
642-
// list stays empty and the legacy inHash is fed zero; the running values are computed block by block.
642+
// list stays empty; the running values are computed block by block.
643643
const l1ToL2Messages: Fr[] = [];
644-
const inHash = Fr.ZERO;
645644

646645
// Collect the out hashes of all the checkpoints before this one in the same epoch.
647646
// Under pipelining the parent checkpoint may not be on L1 yet at build time, so the helper
@@ -716,7 +715,6 @@ export class CheckpointProposalJob implements Traceable {
716715
const result = await this.buildBlocksForCheckpoint(
717716
checkpointBuilder,
718717
checkpointGlobalVariables.timestamp,
719-
inHash,
720718
blockProposalOptions,
721719
streamingState,
722720
);
@@ -908,7 +906,6 @@ export class CheckpointProposalJob implements Traceable {
908906
private async buildBlocksForCheckpoint(
909907
checkpointBuilder: CheckpointBuilder,
910908
timestamp: bigint,
911-
inHash: Fr,
912909
blockProposalOptions: BlockProposalOptions,
913910
streamingState?: StreamingCheckpointState,
914911
): Promise<{
@@ -1006,9 +1003,8 @@ export class CheckpointProposalJob implements Traceable {
10061003
usedTxs.forEach(tx => txHashesAlreadyIncluded.add(tx.txHash.toString()));
10071004

10081005
// Streaming Inbox: the block built successfully, so advance the consumption cursor and carry this block's
1009-
// rolling-hash bucket reference. A block that consumed nothing reuses the parent bucket reference. The legacy
1010-
// inHash is dead post-flip; block proposals carry zero (AZIP-22 Fast Inbox).
1011-
const blockInHash = inHash;
1006+
// rolling-hash bucket reference. A block that consumed nothing reuses the parent bucket reference (AZIP-22
1007+
// Fast Inbox).
10121008
let blockBucketRef: InboxBucketRef | undefined = undefined;
10131009
if (streamingState && selection) {
10141010
if (selection.consume) {
@@ -1021,7 +1017,6 @@ export class CheckpointProposalJob implements Traceable {
10211017
// Sign the block proposal. This will throw if HA signing fails.
10221018
const proposal = await this.createBlockProposal(
10231019
block,
1024-
blockInHash,
10251020
usedTxs,
10261021
{
10271022
...blockProposalOptions,
@@ -1070,7 +1065,6 @@ export class CheckpointProposalJob implements Traceable {
10701065
/** Creates a block proposal for a given block via the validator client (unless in fisherman mode) */
10711066
private createBlockProposal(
10721067
block: L2Block,
1073-
inHash: Fr,
10741068
usedTxs: Tx[],
10751069
blockProposalOptions: BlockProposalOptions,
10761070
bucketRef?: InboxBucketRef,
@@ -1083,7 +1077,6 @@ export class CheckpointProposalJob implements Traceable {
10831077
block.header,
10841078
this.checkpointNumber,
10851079
block.indexWithinCheckpoint,
1086-
inHash,
10871080
block.archive.root,
10881081
usedTxs,
10891082
this.proposer,

yarn-project/sequencer-client/src/sequencer/sequencer.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { MAX_L1_TO_L2_MSGS_PER_CHECKPOINT } from '@aztec/constants';
21
import { type EpochCache, type EpochCommitteeInfo, PROPOSER_PIPELINING_SLOT_OFFSET } from '@aztec/epoch-cache';
32
import type { RollupContract } from '@aztec/ethereum/contracts';
43
import {
@@ -338,7 +337,6 @@ describe('sequencer', () => {
338337
});
339338

340339
l1ToL2MessageSource = mock<L1ToL2MessageSource>({
341-
getL1ToL2Messages: () => Promise.resolve(Array(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT).fill(Fr.ZERO)),
342340
getL2Tips: mockFn().mockResolvedValue({
343341
proposed: { number: lastBlockNumber, hash },
344342
checkpointed: {

yarn-project/sequencer-client/src/test/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export function createBlockProposal(block: L2Block, signature: Signature): Block
142142
return new BlockProposal(
143143
block.header,
144144
block.indexWithinCheckpoint,
145-
Fr.ZERO, // inHash - using zero for testing
146145
block.archive.root,
147146
txHashes,
148147
signature,

yarn-project/validator-client/src/duties/validation_service.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ describe('ValidationService', () => {
3434
const txs = await Promise.all([Tx.random(), Tx.random()]);
3535
const blockHeader = makeBlockHeader(1);
3636
const indexWithinCheckpoint = IndexWithinCheckpoint(0);
37-
const inHash = Fr.random();
3837
const archive = Fr.random();
3938

4039
const proposal = await service.createBlockProposal(
4140
blockHeader,
4241
CheckpointNumber(1),
4342
indexWithinCheckpoint,
44-
inHash,
4543
archive,
4644
txs,
4745
addresses[0],
@@ -56,14 +54,12 @@ describe('ValidationService', () => {
5654
const txs = await Promise.all([Tx.random(), Tx.random()]);
5755
const blockHeader = makeBlockHeader(1);
5856
const indexWithinCheckpoint = IndexWithinCheckpoint(0);
59-
const inHash = Fr.random();
6057
const archive = Fr.random();
6158

6259
const proposal = await service.createBlockProposal(
6360
blockHeader,
6461
CheckpointNumber(1),
6562
indexWithinCheckpoint,
66-
inHash,
6763
archive,
6864
txs,
6965
addresses[0],
@@ -90,12 +86,11 @@ describe('ValidationService', () => {
9086
const checkpointHeader = makeCheckpointHeader(1);
9187

9288
// Create the block proposal first (as the sequencer would) so that getSender() can verify the block proposal
93-
// sender matches. The block-level inHash is dead post-flip (AZIP-22 Fast Inbox), so it carries zero.
89+
// sender matches.
9490
const blockProposal = await service.createBlockProposal(
9591
blockHeader,
9692
CheckpointNumber(1),
9793
indexWithinCheckpoint,
98-
Fr.ZERO,
9994
archive,
10095
txs,
10196
addresses[0],

yarn-project/validator-client/src/duties/validation_service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export class ValidationService {
3535
*
3636
* @param blockHeader - The block header
3737
* @param blockIndexWithinCheckpoint - The block index within checkpoint for HA signing context
38-
* @param inHash - Hash of L1 to L2 messages for this checkpoint
3938
* @param archive - The archive of the current block
4039
* @param txs - Ordered list of transactions (Tx[])
4140
* @param proposerAttesterAddress - The address of the proposer/attester, or undefined
@@ -49,7 +48,6 @@ export class ValidationService {
4948
blockHeader: BlockHeader,
5049
checkpointNumber: CheckpointNumber,
5150
blockIndexWithinCheckpoint: IndexWithinCheckpoint,
52-
inHash: Fr,
5351
archive: Fr,
5452
txs: Tx[],
5553
proposerAttesterAddress: EthAddress | undefined,
@@ -77,7 +75,6 @@ export class ValidationService {
7775
blockHeader,
7876
checkpointNumber,
7977
blockIndexWithinCheckpoint,
80-
inHash,
8178
archive,
8279
txs.map(tx => tx.getTxHash()),
8380
options.publishFullTxs ? txs : undefined,

yarn-project/validator-client/src/metrics.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ export class ValidatorMetrics {
4343
meter,
4444
Metrics.VALIDATOR_ATTESTATION_FAILED_BAD_PROPOSAL_COUNT,
4545
{
46-
[Attributes.ERROR_TYPE]: [
47-
'invalid_proposal',
48-
'state_mismatch',
49-
'failed_txs',
50-
'in_hash_mismatch',
51-
'parent_block_wrong_slot',
52-
],
46+
[Attributes.ERROR_TYPE]: ['invalid_proposal', 'state_mismatch', 'failed_txs', 'parent_block_wrong_slot'],
5347
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
5448
},
5549
);

yarn-project/validator-client/src/proposal_handler.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ describe('ProposalHandler checkpoint validation', () => {
6565
blockSource.syncImmediate.mockResolvedValue(undefined);
6666

6767
l1ToL2MessageSource = mock<L1ToL2MessageSource>();
68-
l1ToL2MessageSource.getL1ToL2Messages.mockResolvedValue([]);
6968

7069
checkpointsBuilder = mock<FullNodeCheckpointsBuilder>();
7170
checkpointsBuilder.getConfig.mockReturnValue({

0 commit comments

Comments
 (0)