Skip to content

Commit 5627161

Browse files
authored
fix(e2e): resolve flaky checkpoint TypeError in multi_validator_node test (#24543)
## Flake `multi-node/block-production/multi_validator_node.parallel.test.ts`, case "should build blocks & attest with multiple validator keys", failed on [#24537](#24537) (unrelated PR) with: ``` TypeError: Cannot read properties of undefined (reading 'checkpoint') at checkpoint (multi-node/block-production/multi_validator_node.parallel.test.ts:92:73) ``` CI log: http://ci.aztec-labs.com/0f321ffb9fa923af ## Root cause `deployContractAndGetAttestedCheckpoint` reads the published checkpoint from the archiver immediately after the deploy tx receipt turns mined: ```ts const [publishedCheckpoint] = await dataStore.getCheckpoints({ from: blockData!.checkpointNumber, limit: 1 }); const payload = ConsensusPayload.fromCheckpoint(publishedCheckpoint.checkpoint, ...); // undefined here ``` The receipt turns mined as soon as the block is built locally, but the archiver only stores the *published* checkpoint (with its attestations, which come from the L1 `propose` calldata) once its L1 sync downloads that tx. In the window between the two, `getCheckpoints` returns `[]` and `publishedCheckpoint` is `undefined`. The CI log shows the race directly: the test node published checkpoint 1 to L1 at `15:17:57.694` (`sequencer:publisher ... Published checkpoint 1 at slot 14`), and its archiver logged `Downloaded checkpoint 1` at `15:17:57.795` — by which point the test had already failed and teardown was running. This is a test-side race, not a production bug: the archiver API is behaving as documented for a not-yet-synced checkpoint. ## Fix Poll for the checkpoint with `retryUntil` instead of reading it once, mirroring the existing pattern in `single-node/cross-chain/cross_chain_messaging_test.ts` (`advanceToEpochProven`), which wraps the same lookup in `retryUntil(..., 'archiver indexes checkpoint N', 120, 0.5)`. Note: the `next`-line variant of this test (`e2e_multi_validator/e2e_multi_validator_node.test.ts`) has the same unguarded lookup in two places and could flake the same way; that file is on a different base branch, so it is not touched here. Based on `merge-train/spartan-v5` because the flaking file only exists on the v5 line (it was consolidated into `multi-node/` there), and the failing run was on a PR targeting that branch. --- *Created by [claudebox](https://claudebox.work/v2/sessions/0959caa9f03f59fa) · group: `slackbot`*
1 parent 20a97b6 commit 5627161

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

yarn-project/end-to-end/src/multi-node/block-production/multi_validator_node.parallel.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Fr } from '@aztec/aztec.js/fields';
66
import { createExtendedL1Client } from '@aztec/ethereum/client';
77
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
88
import { Signature } from '@aztec/foundation/eth-signature';
9+
import { retryUntil } from '@aztec/foundation/retry';
910
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
1011
import { StatefulTestContractArtifact } from '@aztec/noir-test-contracts.js/StatefulTest';
1112
import { CheckpointAttestation, ConsensusPayload } from '@aztec/stdlib/p2p';
@@ -84,7 +85,14 @@ describe('multi-node/block-production/multi_validator_node', () => {
8485

8586
const dataStore = validatorNode.getBlockSource() as Archiver;
8687
const blockData = await dataStore.getBlockData({ number: BlockNumber(tx.blockNumber!) });
87-
const [publishedCheckpoint] = await dataStore.getCheckpoints({ from: blockData!.checkpointNumber, limit: 1 });
88+
// The receipt turns mined as soon as the block is built locally, but the archiver only stores the
89+
// published checkpoint (with its attestations) once it syncs the L1 propose tx, so poll for it.
90+
const publishedCheckpoint = await retryUntil(
91+
async () => (await dataStore.getCheckpoints({ from: blockData!.checkpointNumber, limit: 1 }))[0],
92+
`archiver indexes checkpoint ${blockData!.checkpointNumber}`,
93+
120,
94+
0.5,
95+
);
8896
const signatureContext = {
8997
chainId: config.l1ChainId,
9098
rollupAddress: deployL1ContractsValues.l1ContractAddresses.rollupAddress,

0 commit comments

Comments
 (0)