Skip to content

Commit 70213e7

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 ed302f1 commit 70213e7

15 files changed

Lines changed: 20 additions & 93 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
@@ -249,7 +249,6 @@ describe('CheckpointProposalJob', () => {
249249
checkpointBuilder = checkpointsBuilder.createCheckpointBuilder(checkpointConstants, checkpointNumber);
250250

251251
l1ToL2MessageSource = mock<L1ToL2MessageSource>();
252-
l1ToL2MessageSource.getL1ToL2Messages.mockResolvedValue(Array(4).fill(Fr.ZERO));
253252
// Genesis bucket for the empty-tree cursor above; with no newer synced buckets mocked, block bundle
254253
// selection consumes nothing by default.
255254
l1ToL2MessageSource.getInboxBucketByTotalMsgCount.mockResolvedValue({
@@ -298,12 +297,11 @@ describe('CheckpointProposalJob', () => {
298297
validatorClient = mock<ValidatorClient>();
299298
validatorClient.collectAttestations.mockImplementation(() => Promise.resolve([]));
300299
validatorClient.createBlockProposal.mockImplementation(
301-
async (blockHeader, _checkpointNumber, indexWithinCheckpoint, inHash, archiveRoot, txs) => {
300+
async (blockHeader, _checkpointNumber, indexWithinCheckpoint, archiveRoot, txs) => {
302301
const txHashes = await Promise.all((txs ?? []).map((tx: Tx) => tx.getTxHash()));
303302
return new BlockProposal(
304303
blockHeader,
305304
IndexWithinCheckpoint(indexWithinCheckpoint),
306-
inHash,
307305
archiveRoot,
308306
txHashes,
309307
mockedSig,
@@ -1443,8 +1441,7 @@ describe('CheckpointProposalJob', () => {
14431441

14441442
expect(checkpoint).toBeDefined();
14451443

1446-
// Streaming skips the bulk per-checkpoint fetch and tells the builder to insert messages per block.
1447-
expect(l1ToL2MessageSource.getL1ToL2Messages).not.toHaveBeenCalled();
1444+
// Streaming tells the builder to insert messages per block instead of a bulk per-checkpoint list.
14481445
expect(checkpointsBuilder.startCheckpointCalls).toHaveLength(1);
14491446
expect(checkpointsBuilder.startCheckpointCalls[0].l1ToL2Messages).toEqual([]);
14501447
expect(checkpointsBuilder.startCheckpointCalls[0].insertMessagesPerBlock).toBe(true);
@@ -1455,7 +1452,7 @@ describe('CheckpointProposalJob', () => {
14551452
expect(checkpointBuilder.buildBlockCalls[1].opts.l1ToL2Messages).toEqual([]);
14561453

14571454
// Both block proposals carry the selected bucket reference (the second reuses the first's).
1458-
const bucketRefArgs = validatorClient.createBlockProposal.mock.calls.map(call => call[8]);
1455+
const bucketRefArgs = validatorClient.createBlockProposal.mock.calls.map(call => call[7]);
14591456
expect(bucketRefArgs).toHaveLength(2);
14601457
expect(bucketRefArgs[0]?.bucketSeq).toBe(2n);
14611458
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
@@ -455,7 +455,6 @@ describe('CheckpointProposalJob Timing Tests', () => {
455455
worldState.fork.mockResolvedValue(mockFork);
456456

457457
l1ToL2MessageSource = mock<L1ToL2MessageSource>();
458-
l1ToL2MessageSource.getL1ToL2Messages.mockResolvedValue(Array(4).fill(Fr.ZERO));
459458
l1ToL2MessageSource.getInboxBucketByTotalMsgCount.mockResolvedValue({
460459
seq: 0n,
461460
inboxRollingHash: Fr.ZERO,

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

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

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

656655
// Collect the out hashes of all the checkpoints before this one in the same epoch.
657656
// Under pipelining the parent checkpoint may not be on L1 yet at build time, so the helper
@@ -726,7 +725,6 @@ export class CheckpointProposalJob implements Traceable {
726725
const result = await this.buildBlocksForCheckpoint(
727726
checkpointBuilder,
728727
checkpointGlobalVariables.timestamp,
729-
inHash,
730728
blockProposalOptions,
731729
streamingState,
732730
);
@@ -925,7 +923,6 @@ export class CheckpointProposalJob implements Traceable {
925923
private async buildBlocksForCheckpoint(
926924
checkpointBuilder: CheckpointBuilder,
927925
timestamp: bigint,
928-
inHash: Fr,
929926
blockProposalOptions: BlockProposalOptions,
930927
streamingState?: StreamingCheckpointState,
931928
): Promise<{
@@ -1023,9 +1020,8 @@ export class CheckpointProposalJob implements Traceable {
10231020
usedTxs.forEach(tx => txHashesAlreadyIncluded.add(tx.txHash.toString()));
10241021

10251022
// Streaming Inbox: the block built successfully, so advance the consumption cursor and carry this block's
1026-
// rolling-hash bucket reference. A block that consumed nothing reuses the parent bucket reference. The legacy
1027-
// inHash is dead post-flip; block proposals carry zero (AZIP-22 Fast Inbox).
1028-
const blockInHash = inHash;
1023+
// rolling-hash bucket reference. A block that consumed nothing reuses the parent bucket reference (AZIP-22
1024+
// Fast Inbox).
10291025
let blockBucketRef: InboxBucketRef | undefined = undefined;
10301026
if (streamingState && selection) {
10311027
if (selection.consume) {
@@ -1038,7 +1034,6 @@ export class CheckpointProposalJob implements Traceable {
10381034
// Sign the block proposal. This will throw if HA signing fails.
10391035
const proposal = await this.createBlockProposal(
10401036
block,
1041-
blockInHash,
10421037
usedTxs,
10431038
{
10441039
...blockProposalOptions,
@@ -1087,7 +1082,6 @@ export class CheckpointProposalJob implements Traceable {
10871082
/** Creates a block proposal for a given block via the validator client (unless in fisherman mode) */
10881083
private createBlockProposal(
10891084
block: L2Block,
1090-
inHash: Fr,
10911085
usedTxs: Tx[],
10921086
blockProposalOptions: BlockProposalOptions,
10931087
bucketRef?: InboxBucketRef,
@@ -1100,7 +1094,6 @@ export class CheckpointProposalJob implements Traceable {
11001094
block.header,
11011095
this.checkpointNumber,
11021096
block.indexWithinCheckpoint,
1103-
inHash,
11041097
block.archive.root,
11051098
usedTxs,
11061099
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 {
@@ -349,7 +348,6 @@ describe('sequencer', () => {
349348
});
350349

351350
l1ToL2MessageSource = mock<L1ToL2MessageSource>({
352-
getL1ToL2Messages: () => Promise.resolve(Array(MAX_L1_TO_L2_MSGS_PER_CHECKPOINT).fill(Fr.ZERO)),
353351
getL2Tips: mockFn().mockResolvedValue({
354352
proposed: { number: lastBlockNumber, hash },
355353
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)