Skip to content

Commit 47c3db2

Browse files
committed
chore: deflake e2e_reqresp tests
The issue was racing on network readiness/state sync and occasionally sending to the wrong proposer (attester ordering mismatch). Fixes: - Wait for full P2P mesh connectivity instead of a fixed sleep. - Wait for all validator nodes to catch up to the block where the funded account was deployed before preparing/sending txs. - Align proposer selection to the validator order used to create nodes. - Await sendTx and fail fast on errors to avoid silent drops NOTE: The plan is to delete the `no_handhsake` version, but in the meantime, there is significant code duplication between the 2 (they are essentially identical), and any change to one test would have to be copied over to the other. I've decided to clean up this a bit to make our life easier.
1 parent 9e1d53c commit 47c3db2

File tree

6 files changed

+282
-377
lines changed

6 files changed

+282
-377
lines changed

yarn-project/end-to-end/bootstrap.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function test_cmds {
4545
local tests=(
4646
# List all standalone and nested tests, except for the ones listed above.
4747
src/e2e_!(prover)/*.test.ts
48+
src/e2e_p2p/reqresp/*.test.ts
4849
src/e2e_!(block_building).test.ts
4950
)
5051
for test in "${tests[@]}"; do

yarn-project/end-to-end/src/e2e_p2p/reqresp.test.ts

Lines changed: 0 additions & 186 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { AztecNodeService } from '@aztec/aztec-node';
2+
3+
import type { P2PNetworkTest } from '../p2p_network.js';
4+
import { cleanupReqrespTest, createReqrespDataDir, createReqrespTest, runReqrespTxTest } from './utils.js';
5+
6+
const DATA_DIR = createReqrespDataDir();
7+
8+
describe('e2e_p2p_reqresp_tx', () => {
9+
let t: P2PNetworkTest;
10+
let nodes: AztecNodeService[];
11+
12+
beforeEach(async () => {
13+
t = await createReqrespTest();
14+
});
15+
16+
afterEach(async () => {
17+
await cleanupReqrespTest({ t, nodes, dataDir: DATA_DIR });
18+
});
19+
20+
it('should produce an attestation by requesting tx data over the p2p network', async () => {
21+
/**
22+
* Birds eye overview of the test
23+
* 1. We spin up x nodes
24+
* 2. We turn off receiving a tx via gossip from two of the nodes
25+
* 3. We send a transactions and gossip it to other nodes
26+
* 4. The disabled nodes will receive an attestation that it does not have the data for
27+
* 5. They will request this data over the p2p layer
28+
* 6. We receive all of the attestations that we need and we produce the block
29+
*
30+
* Note: we do not attempt to let this node produce a block, as it will not have received any transactions
31+
* from the other pxes.
32+
*/
33+
nodes = await runReqrespTxTest({ t, dataDir: DATA_DIR });
34+
});
35+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { AztecNodeService } from '@aztec/aztec-node';
2+
3+
import type { P2PNetworkTest } from '../p2p_network.js';
4+
import { cleanupReqrespTest, createReqrespDataDir, createReqrespTest, runReqrespTxTest } from './utils.js';
5+
6+
// TODO: DELETE THIS FILE
7+
// This is a temporary copy of reqresp.test.ts with status handshake disabled
8+
// Delete this file once we have settled on the cause of the reqresp flakes.
9+
10+
const DATA_DIR = createReqrespDataDir();
11+
12+
describe('e2e_p2p_reqresp_tx_no_handshake', () => {
13+
let t: P2PNetworkTest;
14+
let nodes: AztecNodeService[];
15+
16+
beforeEach(async () => {
17+
t = await createReqrespTest({ disableStatusHandshake: true });
18+
});
19+
20+
afterEach(async () => {
21+
await cleanupReqrespTest({ t, nodes, dataDir: DATA_DIR });
22+
});
23+
24+
it('should produce an attestation by requesting tx data over the p2p network', async () => {
25+
/**
26+
* Birds eye overview of the test
27+
* 1. We spin up x nodes
28+
* 2. We turn off receiving a tx via gossip from two of the nodes
29+
* 3. We send a transactions and gossip it to other nodes
30+
* 4. The disabled nodes will receive an attestation that it does not have the data for
31+
* 5. They will request this data over the p2p layer
32+
* 6. We receive all of the attestations that we need and we produce the block
33+
*
34+
* Note: we do not attempt to let this node produce a block, as it will not have received any transactions
35+
* from the other pxes.
36+
*/
37+
nodes = await runReqrespTxTest({ t, dataDir: DATA_DIR, disableStatusHandshake: true });
38+
});
39+
});

0 commit comments

Comments
 (0)