Skip to content

Commit f1fc731

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 bc818f2 commit f1fc731

14 files changed

Lines changed: 14 additions & 87 deletions

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({
@@ -297,12 +296,11 @@ describe('CheckpointProposalJob', () => {
297296
validatorClient = mock<ValidatorClient>();
298297
validatorClient.collectAttestations.mockImplementation(() => Promise.resolve([]));
299298
validatorClient.createBlockProposal.mockImplementation(
300-
async (blockHeader, _checkpointNumber, indexWithinCheckpoint, inHash, archiveRoot, txs) => {
299+
async (blockHeader, _checkpointNumber, indexWithinCheckpoint, archiveRoot, txs) => {
301300
const txHashes = await Promise.all((txs ?? []).map((tx: Tx) => tx.getTxHash()));
302301
return new BlockProposal(
303302
blockHeader,
304303
IndexWithinCheckpoint(indexWithinCheckpoint),
305-
inHash,
306304
archiveRoot,
307305
txHashes,
308306
mockedSig,
@@ -1445,8 +1443,7 @@ describe('CheckpointProposalJob', () => {
14451443

14461444
expect(checkpoint).toBeDefined();
14471445

1448-
// Streaming skips the bulk per-checkpoint fetch; every message reaches the builder through a block.
1449-
expect(l1ToL2MessageSource.getL1ToL2Messages).not.toHaveBeenCalled();
1446+
// Streaming has no bulk per-checkpoint list; every message reaches the builder through a block.
14501447
expect(checkpointsBuilder.startCheckpointCalls).toHaveLength(1);
14511448

14521449
// The first block consumes the selected bundle; the second consumes nothing.
@@ -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: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,6 @@ export class CheckpointProposalJob implements Traceable {
648648
this.checkpointSimulationOverridesPlan,
649649
);
650650

651-
// Under the streaming Inbox (AZIP-22 Fast Inbox) messages are selected per block, so the legacy inHash is fed
652-
// zero; the running values are computed block by block.
653-
const inHash = Fr.ZERO;
654-
655651
// Collect the out hashes of all the checkpoints before this one in the same epoch.
656652
// Under pipelining the parent checkpoint may not be on L1 yet at build time, so the helper
657653
// splices in the parent's checkpointOutHash from the locally-known proposed checkpoint so
@@ -723,7 +719,6 @@ export class CheckpointProposalJob implements Traceable {
723719
const result = await this.buildBlocksForCheckpoint(
724720
checkpointBuilder,
725721
checkpointGlobalVariables.timestamp,
726-
inHash,
727722
blockProposalOptions,
728723
streamingState,
729724
);
@@ -922,7 +917,6 @@ export class CheckpointProposalJob implements Traceable {
922917
private async buildBlocksForCheckpoint(
923918
checkpointBuilder: CheckpointBuilder,
924919
timestamp: bigint,
925-
inHash: Fr,
926920
blockProposalOptions: BlockProposalOptions,
927921
streamingState?: StreamingCheckpointState,
928922
): Promise<{
@@ -1020,9 +1014,8 @@ export class CheckpointProposalJob implements Traceable {
10201014
usedTxs.forEach(tx => txHashesAlreadyIncluded.add(tx.txHash.toString()));
10211015

10221016
// Streaming Inbox: the block built successfully, so advance the consumption cursor and carry this block's
1023-
// rolling-hash bucket reference. A block that consumed nothing reuses the parent bucket reference. The legacy
1024-
// inHash is dead post-flip; block proposals carry zero (AZIP-22 Fast Inbox).
1025-
const blockInHash = inHash;
1017+
// rolling-hash bucket reference. A block that consumed nothing reuses the parent bucket reference (AZIP-22
1018+
// Fast Inbox).
10261019
let blockBucketRef: InboxBucketRef | undefined = undefined;
10271020
if (streamingState && selection) {
10281021
if (selection.consume) {
@@ -1035,7 +1028,6 @@ export class CheckpointProposalJob implements Traceable {
10351028
// Sign the block proposal. This will throw if HA signing fails.
10361029
const proposal = await this.createBlockProposal(
10371030
block,
1038-
blockInHash,
10391031
usedTxs,
10401032
{
10411033
...blockProposalOptions,
@@ -1084,7 +1076,6 @@ export class CheckpointProposalJob implements Traceable {
10841076
/** Creates a block proposal for a given block via the validator client (unless in fisherman mode) */
10851077
private createBlockProposal(
10861078
block: L2Block,
1087-
inHash: Fr,
10881079
usedTxs: Tx[],
10891080
blockProposalOptions: BlockProposalOptions,
10901081
bucketRef?: InboxBucketRef,
@@ -1097,7 +1088,6 @@ export class CheckpointProposalJob implements Traceable {
10971088
block.header,
10981089
this.checkpointNumber,
10991090
block.indexWithinCheckpoint,
1100-
inHash,
11011091
block.archive.root,
11021092
usedTxs,
11031093
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 { NoCommitteeError, 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
@@ -66,7 +66,6 @@ describe('ProposalHandler checkpoint validation', () => {
6666
blockSource.syncImmediate.mockResolvedValue(undefined);
6767

6868
l1ToL2MessageSource = mock<L1ToL2MessageSource>();
69-
l1ToL2MessageSource.getL1ToL2Messages.mockResolvedValue([]);
7069

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

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export type BlockProposalValidationFailureReason =
7272
| 'invalid_proposal'
7373
| 'parent_block_not_found'
7474
| 'parent_block_wrong_slot'
75-
| 'in_hash_mismatch'
7675
// Streaming Inbox per-block acceptance failures.
7776
| StreamingBlockCheckReason
7877
| 'global_variables_mismatch'
@@ -191,7 +190,6 @@ export const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT: BlockProposalValidation
191190
'global_variables_mismatch',
192191
'invalid_proposal',
193192
'parent_block_wrong_slot',
194-
'in_hash_mismatch',
195193
];
196194

197195
/** Checkpoint-proposal validation failures that constitute a slashable invalid-checkpoint offense. */

0 commit comments

Comments
 (0)