Skip to content

Commit 41e0f8e

Browse files
committed
chore(fast-inbox): follow the L1 inbox cleanup through the TS clients (A-1386)
Track the regenerated Inbox ABI after the legacy L1 path was removed (AZIP-22 Fast Inbox): - ethereum InboxContract: drop getLag() (the LAG getter is gone) and the MessageSent checkpointNumber decode; getState() no longer reads inProgress and InboxContractState.treeInProgress becomes optional (no longer tracked on-chain). - Stop threading inboxLag through queries/getL1ContractsConfig and the L1 deploy env; the broader AZTEC_INBOX_LAG config removal is deferred to the node cleanup. - archiver decode: derive the message's checkpoint number from the compact index (the event no longer carries it), keeping the legacy per-checkpoint store shape. - Remove the obsolete advanceInboxInProgress cheat code and its inbox-drift tests; drop the orphaned archiver inHash-mismatch sync test (the cross-check was removed at the flip). Add the flip-stranded bucketHint to the propose-call test fixtures.
1 parent 9bc53b1 commit 41e0f8e

10 files changed

Lines changed: 20 additions & 235 deletions

File tree

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

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
2323
import { GENESIS_BLOCK_HEADER_HASH, L2BlockSourceEvents, type L2BlockSourceUpdatedEvent } from '@aztec/stdlib/block';
2424
import type { ProposedCheckpointInput } from '@aztec/stdlib/checkpoint';
2525
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
26-
import { computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
2726
import { CheckpointHeader } from '@aztec/stdlib/rollup';
2827
import { mockCheckpointAndMessages } from '@aztec/stdlib/testing';
2928
import { ConsensusTimetable } from '@aztec/stdlib/timetable';
@@ -338,53 +337,6 @@ describe('Archiver Sync', () => {
338337
);
339338
});
340339

341-
it('stop processing if one of the checkpoints has a mismatch inHash', async () => {
342-
expect(await archiver.getCheckpointNumber()).toEqual(CheckpointNumber(0));
343-
344-
// Add checkpoint 1 and 2 with all messages visible
345-
await fake.addCheckpoint(CheckpointNumber(1), {
346-
l1BlockNumber: 70n,
347-
messagesL1BlockNumber: 50n,
348-
numL1ToL2Messages: 3,
349-
});
350-
351-
await fake.addCheckpoint(CheckpointNumber(2), {
352-
l1BlockNumber: 80n,
353-
messagesL1BlockNumber: 60n,
354-
numL1ToL2Messages: 3,
355-
});
356-
357-
// Add checkpoint 3 with 3 messages at L1 block 100n
358-
const { checkpoint: cp3, messages: msgs3 } = await fake.addCheckpoint(CheckpointNumber(3), {
359-
l1BlockNumber: 90n,
360-
messagesL1BlockNumber: 100n,
361-
numL1ToL2Messages: 3,
362-
});
363-
364-
// Move last 2 messages of checkpoint 3 to L1 block 103n (beyond current L1 block)
365-
// This simulates partial message visibility
366-
const totalMessages = 3 + 3 + 3; // 9 messages total
367-
fake.moveMessageAtIndexToL1Block(totalMessages - 1, 103n); // Move last message
368-
fake.moveMessageAtIndexToL1Block(totalMessages - 2, 103n); // Move second to last
369-
370-
// Set current L1 block to 102n - only 1 message from checkpoint 3 will be visible
371-
fake.setL1BlockNumber(102n);
372-
373-
// The archiver will compute inHash from only the first message,
374-
// which won't match the checkpoint's inHash (computed from all 3 messages)
375-
const visibleMessages = msgs3.slice(0, 1);
376-
const computedInHash = computeInHashFromL1ToL2Messages(visibleMessages);
377-
378-
// Run archiver (expect failure)
379-
await expect(() => archiver.syncImmediate()).rejects.toThrow(
380-
new RegExp(`mismatch inHash for checkpoint 3.*${computedInHash}.*${cp3.header.inHash}`, 'i'),
381-
);
382-
383-
// Should still be at checkpoint 0 since the error prevents checkpoint processing
384-
// (checkpoints 1 and 2 also fail because they're in the same batch)
385-
expect(await archiver.getCheckpointNumber()).toEqual(CheckpointNumber(0));
386-
}, 10_000);
387-
388340
it('skip event search if no changes found', async () => {
389341
const loggerSpy = jest.spyOn(syncLogger, 'debug');
390342

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('CalldataRetriever', () => {
140140
archive,
141141
oracleInput: { feeAssetPriceModifier: BigInt(0) },
142142
header: viemHeader,
143-
bucketHint: 0n,
143+
bucketHint: BigInt(0),
144144
},
145145
attestations,
146146
signers,
@@ -369,7 +369,11 @@ describe('CalldataRetriever', () => {
369369
archive,
370370
oracleInput: { feeAssetPriceModifier },
371371
header,
372+
<<<<<<< HEAD
372373
bucketHint: 0n,
374+
=======
375+
bucketHint: BigInt(0),
376+
>>>>>>> e74ca75577 (chore(fast-inbox): follow the L1 inbox cleanup through the TS clients (A-1386))
373377
},
374378
attestations,
375379
[], // signers

yarn-project/archiver/src/l1/data_retrieval.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { type Logger, createLogger } from '@aztec/foundation/log';
2424
import { RollupAbi } from '@aztec/l1-artifacts';
2525
import { Body, CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
2626
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
27+
import { InboxLeaf } from '@aztec/stdlib/messaging';
2728
import { Proof } from '@aztec/stdlib/proofs';
2829
import { CheckpointHeader } from '@aztec/stdlib/rollup';
2930
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
@@ -385,7 +386,9 @@ function mapLogInboxMessage(log: MessageSentLog): InboxMessage {
385386
leaf: log.args.leaf,
386387
l1BlockNumber: log.l1BlockNumber,
387388
l1BlockHash: log.l1BlockHash,
388-
checkpointNumber: log.args.checkpointNumber,
389+
// The Inbox no longer emits a checkpoint number (AZIP-22 Fast Inbox). Derive it from the compact index for the
390+
// legacy per-checkpoint message store, which the node still keeps until it drops the per-checkpoint flow.
391+
checkpointNumber: InboxLeaf.checkpointNumberFromIndex(log.args.index),
389392
rollingHash: log.args.rollingHash,
390393
inboxRollingHash: log.args.inboxRollingHash,
391394
bucketSeq: log.args.bucketSeq,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ export class FakeL1State {
699699
l1TransactionHash: `0x${msg.l1BlockNumber.toString(16)}` as `0x${string}`,
700700
l1BlockTimestamp: this.getTimestampAtL1Block(msg.l1BlockNumber),
701701
args: {
702-
checkpointNumber: msg.checkpointNumber,
703702
index: msg.index,
704703
leaf: msg.leaf,
705704
rollingHash: msg.rollingHash,

yarn-project/end-to-end/src/single-node/bot/bot.test.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ import { NO_REORG_SUBMISSION_EPOCHS } from '../setup.js';
2828
// Tests the transaction bot implementations (transfer bot, AMM bot, cross-chain bot).
2929
// Uses setup(0, PIPELINING_SETUP_OPTS + aztecProofSubmissionEpochs:NO_REORG_SUBMISSION_EPOCHS) with one node, production
3030
// sequencer (ethereumSlotDuration=4s, aztecSlotDuration=12s, proofSubEpochs=NO_REORG_SUBMISSION_EPOCHS, minTxsPerBlock=0;
31-
// aztecEpochDuration is the setup() default). The bridge-resume, setup-via-bridging, and
32-
// cross-chain-bot subsuites actively drive L1 cross-chain bridging: fee-juice portal deposits,
33-
// advanceInboxInProgress, and L2→L1 messages via CrossChainBot.
31+
// aztecEpochDuration is the setup() default). The bridge-resume and cross-chain-bot subsuites actively
32+
// drive L1 cross-chain bridging: fee-juice portal deposits and L2→L1 messages via CrossChainBot.
3433
describe('single-node/bot/bot', () => {
3534
let wallet: EmbeddedWallet;
3635
let aztecNode: AztecNode;
@@ -263,30 +262,6 @@ describe('single-node/bot/bot', () => {
263262
});
264263
});
265264

266-
// Tests that Bot.create succeeds after the inbox drifts away from the rollup contract.
267-
// Actively drives L1 via advanceInboxInProgress.
268-
describe('setup via bridging funds cross-chain', () => {
269-
beforeAll(() => {
270-
config = {
271-
...getBotDefaultConfig(),
272-
followChain: 'PROPOSED',
273-
botMode: 'transfer',
274-
senderPrivateKey: new SecretValue(Fr.random()),
275-
l1PrivateKey: getPrivateKey(),
276-
l1RpcUrls,
277-
flushSetupTransactions: true,
278-
};
279-
});
280-
281-
// See 'can consume L1 to L2 message in %s after inbox drifts away from the rollup'
282-
// in end-to-end/src/e2e_cross_chain_messaging/l1_to_l2.test.ts for context on this test.
283-
// Advances inbox 4 slots then creates Bot; verifies it completes setup without error.
284-
it('creates bot after inbox drift', async () => {
285-
await cheatCodes.rollup.advanceInboxInProgress(4);
286-
await Bot.create(config, wallet, aztecNode, aztecNodeAdmin, new BotStore(await openTmpStore('bot')));
287-
}, 300_000);
288-
});
289-
290265
// Tests the CrossChainBot: seeds L1→L2 messages and on each tick consumes one while seeding
291266
// a replacement. Actively drives L1 portal contracts.
292267
describe('cross-chain-bot', () => {

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { asyncPool } from '@aztec/foundation/async-pool';
22
import { maxBigint } from '@aztec/foundation/bigint';
3-
import { CheckpointNumber } from '@aztec/foundation/branded-types';
43
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
54
import { Fr } from '@aztec/foundation/curves/bn254';
65
import { EthAddress } from '@aztec/foundation/eth-address';
@@ -19,11 +18,11 @@ import { checkBlockTag } from './utils.js';
1918
export type MessageSentArgs = {
2019
index: bigint;
2120
leaf: Fr;
22-
checkpointNumber: CheckpointNumber;
21+
/** Legacy 128-bit keccak rolling hash of all messages inserted up to and including this one. */
2322
rollingHash: Buffer16;
24-
/** Consensus rolling hash (truncated sha256 chain) after this message (AZIP-22 Fast Inbox). Not yet consumed by the node. */
23+
/** Consensus rolling hash (truncated sha256 chain) after this message (AZIP-22 Fast Inbox). */
2524
inboxRollingHash: Fr;
26-
/** Sequence number of the Inbox bucket this message was absorbed into (AZIP-22 Fast Inbox). Not yet consumed by the node. */
25+
/** Sequence number of the Inbox bucket this message was absorbed into (AZIP-22 Fast Inbox). */
2726
bucketSeq: bigint;
2827
};
2928

@@ -68,18 +67,12 @@ export class InboxContract {
6867
return this.inbox;
6968
}
7069

71-
public async getLag(opts: { blockTag?: BlockTag; blockNumber?: bigint } = {}): Promise<bigint> {
72-
await checkBlockTag(opts.blockNumber, this.client);
73-
return await this.inbox.read.LAG(opts);
74-
}
75-
7670
public async getState(opts: { blockTag?: BlockTag; blockNumber?: bigint } = {}): Promise<InboxContractState> {
7771
await checkBlockTag(opts.blockNumber, this.client);
7872
const state = await this.inbox.read.getState(opts);
7973
return {
8074
totalMessagesInserted: state.totalMessagesInserted,
8175
messagesRollingHash: Buffer16.fromString(state.rollingHash),
82-
treeInProgress: state.inProgress,
8376
};
8477
}
8578

@@ -133,7 +126,6 @@ export class InboxContract {
133126
args: {
134127
index?: bigint;
135128
hash?: `0x${string}`;
136-
checkpointNumber?: bigint;
137129
rollingHash?: `0x${string}`;
138130
inboxRollingHash?: `0x${string}`;
139131
bucketSeq?: bigint;
@@ -149,7 +141,6 @@ export class InboxContract {
149141
args: {
150142
index: log.args.index!,
151143
leaf: Fr.fromString(log.args.hash!),
152-
checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber!),
153144
rollingHash: Buffer16.fromString(log.args.rollingHash!),
154145
inboxRollingHash: Fr.fromString(log.args.inboxRollingHash!),
155146
bucketSeq: log.args.bucketSeq!,
@@ -161,5 +152,9 @@ export class InboxContract {
161152
export type InboxContractState = {
162153
totalMessagesInserted: bigint;
163154
messagesRollingHash: Buffer16;
164-
treeInProgress: bigint;
155+
/**
156+
* Checkpoint currently accumulating messages, when known. No longer tracked on-chain post-flip (AZIP-22 Fast
157+
* Inbox); used only by the legacy per-checkpoint message-readiness gate.
158+
*/
159+
treeInProgress?: bigint;
165160
};

yarn-project/ethereum/src/deploy_aztec_l1_contracts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ export function getDeployRollupForUpgradeEnvVars(
572572
AZTEC_TARGET_COMMITTEE_SIZE: args.aztecTargetCommitteeSize.toString(),
573573
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: args.lagInEpochsForValidatorSet.toString(),
574574
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: args.lagInEpochsForRandao.toString(),
575-
AZTEC_INBOX_LAG: args.inboxLag?.toString(),
576575
AZTEC_PROOF_SUBMISSION_EPOCHS: args.aztecProofSubmissionEpochs.toString(),
577576
AZTEC_LOCAL_EJECTION_THRESHOLD: args.localEjectionThreshold.toString(),
578577
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: args.slashingLifetimeInRounds.toString(),

yarn-project/ethereum/src/queries.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { BaseError, type Block } from 'viem';
55
import { DefaultL1ContractsConfig, type L1ContractsConfig } from './config.js';
66
import { ReadOnlyGovernanceContract } from './contracts/governance.js';
77
import { GovernanceProposerContract } from './contracts/governance_proposer.js';
8-
import { InboxContract } from './contracts/inbox.js';
98
import { RollupContract } from './contracts/rollup.js';
109
import type { ViemClient, ViemPublicClient } from './types.js';
1110

@@ -78,7 +77,7 @@ export async function getL1ContractsConfig(
7877
publicClient: ViemPublicClient,
7978
addresses: { governanceAddress: EthAddress; rollupAddress?: EthAddress },
8079
): Promise<
81-
Omit<L1ContractsConfig, 'ethereumSlotDuration'> & {
80+
Omit<L1ContractsConfig, 'ethereumSlotDuration' | 'inboxLag'> & {
8281
l1StartBlock: bigint;
8382
l1GenesisTime: bigint;
8483
rollupVersion: number;
@@ -92,8 +91,6 @@ export async function getL1ContractsConfig(
9291
const rollup = new RollupContract(publicClient, rollupAddress.toString());
9392
const slasherProposer = await rollup.getSlashingProposer();
9493
const slasher = await rollup.getSlasherContract();
95-
const rollupAddresses = await rollup.getRollupAddresses();
96-
const inboxContract = new InboxContract(publicClient, rollupAddresses.inboxAddress.toString());
9794

9895
const [
9996
l1StartBlock,
@@ -104,7 +101,6 @@ export async function getL1ContractsConfig(
104101
aztecTargetCommitteeSize,
105102
lagInEpochsForValidatorSet,
106103
lagInEpochsForRandao,
107-
inboxLag,
108104
activationThreshold,
109105
ejectionThreshold,
110106
localEjectionThreshold,
@@ -132,7 +128,6 @@ export async function getL1ContractsConfig(
132128
rollup.getTargetCommitteeSize(),
133129
rollup.getLagInEpochsForValidatorSet(),
134130
rollup.getLagInEpochsForRandao(),
135-
inboxContract.getLag(),
136131
rollup.getActivationThreshold(),
137132
rollup.getEjectionThreshold(),
138133
rollup.getLocalEjectionThreshold(),
@@ -162,7 +157,6 @@ export async function getL1ContractsConfig(
162157
aztecTargetCommitteeSize: Number(aztecTargetCommitteeSize),
163158
lagInEpochsForValidatorSet: Number(lagInEpochsForValidatorSet),
164159
lagInEpochsForRandao: Number(lagInEpochsForRandao),
165-
inboxLag: Number(inboxLag),
166160
governanceProposerQuorum: Number(governanceProposerQuorum),
167161
governanceProposerRoundSize: Number(governanceProposerRoundSize),
168162
governanceVotingDuration: DefaultL1ContractsConfig.governanceVotingDuration,

yarn-project/ethereum/src/test/rollup_cheat_codes.test.ts

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)