From e10e81a5b92488b1a0180ae7cd6c50c2c106f243 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 23 Jan 2026 19:17:43 -0300 Subject: [PATCH] fix(e2e): use checkpointed chain tip for PXE in epochs and p2p tests Fixes flaky test failures in e2e_p2p and e2e_epochs tests caused by transactions being lost when blocks are pruned due to failed checkpoint proposals. Root cause: - Block N is built for slot S and includes a transaction - The checkpoint proposal fails L1 validation (e.g., HeaderLib__InvalidSlotNumber) because by the time it's submitted, L1 has already moved to slot S+1 - When L1 moves forward and slot S isn't checkpointed, the archiver prunes block N - The transaction in block N is lost, causing waitForReceipt to timeout Fix: Configure PXE to sync to the checkpointed chain tip instead of the proposed one in both P2PNetworkTest and EpochsTestContext. This ensures the PXE only sees blocks that have been successfully submitted to L1, providing a stable view of the chain unaffected by pruned blocks. This uses the newly added syncChainTip PXE config option. Co-Authored-By: Claude Opus 4.5 --- .../end-to-end/src/e2e_epochs/epochs_test.ts | 53 ++++++++++--------- .../end-to-end/src/e2e_p2p/p2p_network.ts | 21 +++++--- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts b/yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts index 94febedddcdc..b4cd5f07981f 100644 --- a/yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts +++ b/yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts @@ -121,30 +121,35 @@ export class EpochsTestContext { // Set up system without any account nor protocol contracts // and with faster block times and shorter epochs. - const context = await setup(opts.numberOfAccounts ?? 0, { - automineL1Setup: true, - checkIntervalMs: 50, - archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL, - worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL, - aztecEpochDuration, - aztecSlotDuration, - ethereumSlotDuration, - aztecProofSubmissionEpochs, - aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0, - minTxsPerBlock: 0, - realProofs: false, - startProverNode: true, - proverTestDelayMs: opts.proverTestDelayMs ?? 0, - // We use numeric incremental prover ids for simplicity, but we can switch to - // using the prover's eth address if the proverId is used for something in the rollup contract - // Use numeric EthAddress for deterministic prover id - proverId: EthAddress.fromNumber(1), - worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY, - exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds, - slasherFlavor: 'none', - l1PublishingTime, - ...opts, - }); + const context = await setup( + opts.numberOfAccounts ?? 0, + { + automineL1Setup: true, + checkIntervalMs: 50, + archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL, + worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL, + aztecEpochDuration, + aztecSlotDuration, + ethereumSlotDuration, + aztecProofSubmissionEpochs, + aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0, + minTxsPerBlock: 0, + realProofs: false, + startProverNode: true, + proverTestDelayMs: opts.proverTestDelayMs ?? 0, + // We use numeric incremental prover ids for simplicity, but we can switch to + // using the prover's eth address if the proverId is used for something in the rollup contract + // Use numeric EthAddress for deterministic prover id + proverId: EthAddress.fromNumber(1), + worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY, + exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds, + slasherFlavor: 'none', + l1PublishingTime, + ...opts, + }, + // Use checkpointed chain tip for PXE to avoid issues with blocks being dropped due to pruned anchor blocks. + { syncChainTip: 'checkpointed' }, + ); this.context = context; this.proverNodes = context.proverNode ? [context.proverNode] : []; diff --git a/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts b/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts index bb4a40629e56..c2d37b899e91 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts @@ -351,14 +351,19 @@ export class P2PNetworkTest { async setup() { this.logger.info('Setting up subsystems from fresh'); - this.context = await setup(0, { - ...this.setupOptions, - fundSponsoredFPC: true, - skipAccountDeployment: true, - slasherFlavor: this.setupOptions.slasherFlavor ?? this.deployL1ContractsArgs.slasherFlavor ?? 'none', - aztecTargetCommitteeSize: 0, - l1ContractsArgs: this.deployL1ContractsArgs, - }); + this.context = await setup( + 0, + { + ...this.setupOptions, + fundSponsoredFPC: true, + skipAccountDeployment: true, + slasherFlavor: this.setupOptions.slasherFlavor ?? this.deployL1ContractsArgs.slasherFlavor ?? 'none', + aztecTargetCommitteeSize: 0, + l1ContractsArgs: this.deployL1ContractsArgs, + }, + // Use checkpointed chain tip for PXE to avoid issues with blocks being dropped due to pruned anchor blocks. + { syncChainTip: 'checkpointed' }, + ); this.ctx = this.context; const sponsoredFPCAddress = await getSponsoredFPCAddress();