test(e2e): extract p2p gossip scenario skeleton and add category README#24500
Merged
Conversation
PhilWindle
approved these changes
Jul 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 8 of 9 of the e2e round-2 consolidation. Scope:
end-to-end/src/p2p/**only. Dedup + docs; no timing/config value changes.DATA_DIR centralization
DATA_DIR = fs.mkdtempSync(...)at module scope plus a per-nodefs.rmSynccleanup loop inafterEach. That boilerplate now lives onP2PNetworkTest:setup()creates one root temp dir (this.dataDir),dataDirFor(label)hands out a nested per-role path (multi-nodecreateNodesappends-<index>; single-node factories use it verbatim), andteardown()removes the whole tree in one recursive delete.reqresp/utils.ts); deleted the per-filefs/os/pathimports,mkdtempSync, and cleanup loops. This also fixes a small pre-existing leak: the oldmkdtempSyncroot dir was never removed (node data went into sibling-Ndirs), whereas nodes now live under the root that teardown deletes.Gossip scenario skeleton (
shared.ts)runGossipScenario(opts): Promise<AztecNodeService[]>— the shared bootstrap→createNodes→mesh→account→(submit)→verify flow. Varying parts are options/callbacks:numValidators,bootNodePort,txsPerNode(0 skips submission),submitSequentially,mesh(topic/peer-count overrides),checkpointSource('first-tx'|'first-published'),beforeCreateNodes,createExtraNodes,beforeSubmit,afterVerify. Returns the validator nodes for teardown tracking.verifyAttestationSigners(t, nodes, checkpoint)(recovers signers, asserts each ∈ validator set, returns signers),getPublishedCheckpointForTx(node, txHash),waitForFirstPublishedCheckpoint(t, nodes),waitForNodesToSync(t, nodes), andmaybeCheckQosAlerts(logger)(theCHECK_ALERTSGrafana block that was copy-pasted in 4 files).Merge:
gossip_network_no_cheat.test.ts→gossip_network.test.tsThe two files shared the skeleton but genuinely differ in network bootstrap (cheat MultiAdder registration vs. on-chain
addL1ValidatorCLI flow) and config, so they became twodescribes in one file, each with its ownbeforeEach— the mesh is not re-spun perit.describe('cheat-registered validators')— wasgossip_network.test.ts. Effective node config unchanged: 4 validators,startProverNode:false,SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES+aztecSlotDuration:24, aztecEpochDuration:4, blockDurationMs:10000, slashingRoundSizeInEpochs:2, slashingQuorum:5, listenAddress:127.0.0.1, inboxLag:2; plus a p2p-only prover node and a re-execution monitoring node; proven-block assertion preserved.describe('on-chain-registered validators (no cheats)')— wasgossip_network_no_cheat.test.ts. Effective node config unchanged: 4 validators,SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES+aztecSlotDuration:24, blockDurationMs:10000, minTxsPerBlock:0, listenAddress:127.0.0.1, inboxLag:2; full-mesh wait on the proposal/checkpoint topics; all on-chain registration assertions preserved.BOOT_NODE_UDP_PORTdefault stays 4500 (now shared with the cheat describe, which honored theBOOT_NODE_UDP_PORTenv override — the default is unchanged).Both describes run sequentially in one CI container reusing port 4500 (teardown fully frees ports before the next
beforeEach).fee_asset_price_oracle_gossip.test.tsKept as its own file, now on the shared skeleton with
txsPerNode: 0(it submits no txs — empty blocks carry the price) andcheckpointSource: 'first-published'. Effective node config unchanged: 4 validators,startProverNode:false,SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES+aztecSlotDuration:12, aztecEpochDuration:4, slashingRoundSizeInEpochs:2, slashingQuorum:5, listenAddress, inboxLag:2, plus a prover node (minTxsPerBlock:0). Both oracle-convergence rounds and final assertions preserved.Other files
preferred_gossip_network.test.tsadoptedverifyAttestationSigners+maybeCheckQosAlerts(its signer-check block was identical, keyed off thevalidatorsarray), plus the DATA_DIR change. Node config and theexpect(signers.length).toEqual(validators.length)assertion unchanged.late_prover_tx_collection.test.ts,rediscovery.test.ts,reqresp/reqresp.test.ts+reqresp/utils.ts: DATA_DIR change only; node config unchanged.p2p/README.md(the missing category README) matching themulti-node/single-nodestructure: what belongs here (real-libp2p subjects — discovery, req/resp, mesh, peer auth, transport), what does not (consensus/slashing/sentinel →multi-node), theP2PNetworkTestentrypoint, the shared skeleton/helpers, and the post-merge file inventory.Behavior notes
setupAccount()now runs before the first-checkpoint wait instead of after — both still precede tx submission, andsetupAccount()only registers the account in the PXE (no on-chain effect), so the "checkpoint published before submit" invariant is preserved; (2) the merged submit path useswaitForTxs(...)for both describes rather than the no-cheat file's per-txPromise.all(waitForTx)— same asserted property (all txs mined).Local runs (one file at a time; real-libp2p tests bind fixed ports)
All green:
CI selection is glob/regex-based (
src/p2p/**/*.test.ts,src/p2p/*.test.ts,.test_patterns.yml'ssrc/p2p/.*), so deleting the merged-away file needs no CI-config edits.