Skip to content

Commit 22f37db

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 18eaddb commit 22f37db

9 files changed

Lines changed: 20 additions & 187 deletions

File tree

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
@@ -702,7 +702,6 @@ export class FakeL1State {
702702
l1TransactionHash: `0x${msg.l1BlockNumber.toString(16)}` as `0x${string}`,
703703
l1BlockTimestamp: this.getTimestampAtL1Block(msg.l1BlockNumber),
704704
args: {
705-
checkpointNumber: msg.checkpointNumber,
706705
index: msg.index,
707706
leaf: msg.leaf,
708707
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.

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -295,47 +295,6 @@ export class RollupCheatCodes {
295295
);
296296
}
297297

298-
/**
299-
* Overrides the inProgress field of the Inbox contract state
300-
* @param howMuch - How many checkpoints to move it forward
301-
*/
302-
public advanceInboxInProgress(howMuch: number | bigint): Promise<bigint> {
303-
return this.ethCheatCodes.execWithPausedAnvil(async () => {
304-
// Storage slot 2 contains the InboxState struct
305-
const inboxStateSlot = 2n;
306-
307-
// Get inbox and its current state values
308-
const inboxAddress = await this.rollup.read.getInbox();
309-
const currentStateValue = await this.ethCheatCodes.load(EthAddress.fromString(inboxAddress), inboxStateSlot);
310-
311-
// Extract current values from the packed storage slot
312-
// Storage layout: rollingHash (128 bits) | totalMessagesInserted (64 bits) | inProgress (64 bits)
313-
const currentRollingHash = currentStateValue & ((1n << 128n) - 1n);
314-
const currentTotalMessages = (currentStateValue >> 128n) & ((1n << 64n) - 1n);
315-
const currentInProgress = currentStateValue >> 192n;
316-
const newInProgress = currentInProgress + BigInt(howMuch);
317-
318-
// Pack new values: rollingHash (low 128 bits) | totalMessages (middle 64 bits) | inProgress (high 64 bits)
319-
const newValue = (BigInt(newInProgress) << 192n) | (currentTotalMessages << 128n) | currentRollingHash;
320-
321-
await this.ethCheatCodes.store(EthAddress.fromString(inboxAddress), inboxStateSlot, newValue, {
322-
silent: true,
323-
});
324-
325-
this.logger.warn(`Inbox inProgress advanced from ${currentInProgress} to ${newInProgress}`, {
326-
inbox: inboxAddress,
327-
oldValue: '0x' + currentStateValue.toString(16),
328-
newValue: '0x' + newValue.toString(16),
329-
rollingHash: currentRollingHash,
330-
totalMessages: currentTotalMessages,
331-
oldInProgress: currentInProgress,
332-
newInProgress,
333-
});
334-
335-
return newInProgress;
336-
});
337-
}
338-
339298
public insertOutbox(epoch: EpochNumber, numCheckpointsInEpoch: number, outHash: bigint) {
340299
return this.ethCheatCodes.execWithPausedAnvil(async () => {
341300
const outboxAddress = await this.rollup.read.getOutbox();

0 commit comments

Comments
 (0)