From 682539dffd373559ffadddcc5bce3431bcafc2c0 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:55:38 +0000 Subject: [PATCH 1/9] fix: reenable "flakey" p2p tests --- yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts | 5 ----- yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts | 3 +-- yarn-project/end-to-end/src/e2e_p2p/rediscovery.test.ts | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts b/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts index 7a6e90d62581..25fb02acf2f7 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts @@ -43,11 +43,6 @@ describe('e2e_p2p_gerousia', () => { } }); - /** - * There is some flaky behavior in here, likely similar to what is in the gossip test. - * For this reason we are not running it as part of the CI. - * TODO(https://github.com/AztecProtocol/aztec-packages/issues/9164): Currently flakey - */ it('Should cast votes to upgrade gerousia', async () => { // create the bootstrap node for the network if (!t.bootstrapNodeEnr) { diff --git a/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts index b59a5a7ed8b6..2520cd225b49 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts @@ -32,8 +32,7 @@ describe('e2e_p2p_network', () => { } }); - // TODO(https://github.com/AztecProtocol/aztec-packages/issues/9164): Currently flakey - it.skip('should rollup txs from all peers', async () => { + it('should rollup txs from all peers', async () => { // create the bootstrap node for the network if (!t.bootstrapNodeEnr) { throw new Error('Bootstrap node ENR is not available'); diff --git a/yarn-project/end-to-end/src/e2e_p2p/rediscovery.test.ts b/yarn-project/end-to-end/src/e2e_p2p/rediscovery.test.ts index c9d78f5d1cad..51c222e238ad 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/rediscovery.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/rediscovery.test.ts @@ -32,7 +32,7 @@ describe('e2e_p2p_rediscovery', () => { } }); - it.skip('should re-discover stored peers without bootstrap node', async () => { + it('should re-discover stored peers without bootstrap node', async () => { const contexts: NodeContext[] = []; nodes = await createNodes( t.ctx.aztecNodeConfig, From 8151e7bb2ae5e30c1b692a0d2b2d049500d3314e Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:22:12 +0000 Subject: [PATCH 2/9] fix: add e2e p2p to test config --- yarn-project/end-to-end/scripts/e2e_test_config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/yarn-project/end-to-end/scripts/e2e_test_config.yml b/yarn-project/end-to-end/scripts/e2e_test_config.yml index 4ed71e04d03e..14352f7009bd 100644 --- a/yarn-project/end-to-end/scripts/e2e_test_config.yml +++ b/yarn-project/end-to-end/scripts/e2e_test_config.yml @@ -82,6 +82,7 @@ tests: e2e_static_calls: {} e2e_synching: {} e2e_token_contract: {} + e2e_p2p: {} flakey_e2e_tests: test_path: './src/flakey' ignore_failures: true From 22eab85d2aa8078eee58e2be79675ab429ea927a Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:19:36 +0000 Subject: [PATCH 3/9] fix --- yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts | 6 ++++-- yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts | 6 +++++- yarn-project/p2p/src/bootstrap/bootstrap.ts | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts b/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts index 25fb02acf2f7..b4d0e91d1693 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/gerousia.test.ts @@ -17,7 +17,9 @@ import { P2PNetworkTest } from './p2p_network.js'; // Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds const NUM_NODES = 4; -const BOOT_NODE_UDP_PORT = 40600; +// Note: these ports must be distinct from the other e2e tests, else the tests will +// interfere with each other. +const BOOT_NODE_UDP_PORT = 45000; const DATA_DIR = './data/gossip'; @@ -36,8 +38,8 @@ describe('e2e_p2p_gerousia', () => { }); afterEach(async () => { - await t.stopNodes(nodes); await t.teardown(); + await t.stopNodes(nodes); for (let i = 0; i < NUM_NODES; i++) { fs.rmSync(`${DATA_DIR}-${i}`, { recursive: true, force: true }); } 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 84a2aa53b8f8..a105e4c90137 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 @@ -143,14 +143,18 @@ export class P2PNetworkTest { async stopNodes(nodes: AztecNodeService[]) { this.logger.info('Stopping nodes'); + + if (!nodes) return; + if (!nodes.length) return; + for (const node of nodes) { await node.stop(); } - await this.bootstrapNode.stop(); this.logger.info('Nodes stopped'); } async teardown() { + await this.bootstrapNode.stop(); await this.snapshotManager.teardown(); } } diff --git a/yarn-project/p2p/src/bootstrap/bootstrap.ts b/yarn-project/p2p/src/bootstrap/bootstrap.ts index b80ed067a4f3..d3840ba51299 100644 --- a/yarn-project/p2p/src/bootstrap/bootstrap.ts +++ b/yarn-project/p2p/src/bootstrap/bootstrap.ts @@ -77,7 +77,7 @@ export class BootstrapNode { public async stop() { // stop libp2p await this.node?.stop(); - this.logger.debug('libp2p has stopped'); + this.logger.debug('Discv5 has stopped'); } /** From d77b1f4f897955639c08bb7163d779c30dd13467 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:36:11 +0000 Subject: [PATCH 4/9] run seperately --- yarn-project/end-to-end/scripts/e2e_test_config.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yarn-project/end-to-end/scripts/e2e_test_config.yml b/yarn-project/end-to-end/scripts/e2e_test_config.yml index 14352f7009bd..b414088ba22b 100644 --- a/yarn-project/end-to-end/scripts/e2e_test_config.yml +++ b/yarn-project/end-to-end/scripts/e2e_test_config.yml @@ -82,7 +82,14 @@ tests: e2e_static_calls: {} e2e_synching: {} e2e_token_contract: {} - e2e_p2p: {} + e2e_p2p_gossip: + test_path: 'e2e_p2p/gossip_network.test.ts' + e2e_p2p_gerousia: + test_path: 'e2e_p2p/gerousia.test.ts' + e2e_p2p_rediscovery: + test_path: 'e2e_p2p/rediscovery.test.ts' + e2e_p2p_reqresp: + test_path: 'e2e_p2p/reqresp.test.ts' flakey_e2e_tests: test_path: './src/flakey' ignore_failures: true From 1748069725b39245ffc4f02d5473d29aa2760317 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:53:23 +0000 Subject: [PATCH 5/9] fix: extend allowlist to matching prefixes --- scripts/ci/get_e2e_jobs.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh index c7e9d26b55f2..45b14a93f4ca 100755 --- a/scripts/ci/get_e2e_jobs.sh +++ b/scripts/ci/get_e2e_jobs.sh @@ -47,21 +47,38 @@ allow_list=( "guides_writing_an_account_contract" ) -# Add labels from input to the allow_list +# Add labels from input to the allow_list, supports prefix matching +# E.g: +# e2e_p2p label will match e2e_p2p_gossip, e2e_p2p_rediscovery, e2e_p2p_reqresp etc. +# e2e_prover label will match e2e_prover_fake_proofs, e2e_prover_coordination etc. IFS=',' read -r -a input_labels <<<"$LABELS" -allow_list+=("${input_labels[@]}") +expanded_allow_list=() +for label in "${input_labels[@]}"; do + # For each input label, find all tests that start with this prefix + matching_tests=$(echo "$full_list" | tr ' ' '\n' | grep "^${label}" || true) + if [ ! -z "$matching_tests" ]; then + # Add all matching tests to the expanded allow list + while IFS= read -r test; do + expanded_allow_list+=("$test") + done <<< "$matching_tests" + else + # If no prefix match found, treat it as an exact match (original behavior) + expanded_allow_list+=("$label") + fi +done +allow_list+=("${expanded_allow_list[@]}") # Generate full list of targets, excluding specific entries, on one line test_list=$(echo "${full_list[@]}" | grep -v 'base' | grep -v 'bench' | grep -v "network" | grep -v 'devnet' | xargs echo) -# # If branch is master or allow_list contains 'e2e-all', return full list +# If branch is master or allow_list contains 'e2e-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e_all" ]]; then # print as JSON list echo "$test_list" | jq -Rc 'split(" ")' exit 0 fi -# # Filter the test_list to include only items in the allow_list +# Filter the test_list to include only items in the allow_list filtered_list=() for item in $test_list; do for allowed in "${allow_list[@]}"; do @@ -71,5 +88,5 @@ for item in $test_list; do done done -# # Print the filtered list in JSON format +# Print the filtered list in JSON format echo ${filtered_list[@]} | jq -Rc 'split(" ")' From dbe94324783635e3897058ba0d4e510efbe8a74d Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 07:00:45 +0000 Subject: [PATCH 6/9] fix: shorten reqresp test name --- .../src/e2e_p2p/{reqresp_tx.test.ts => reqresp.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename yarn-project/end-to-end/src/e2e_p2p/{reqresp_tx.test.ts => reqresp.test.ts} (100%) diff --git a/yarn-project/end-to-end/src/e2e_p2p/reqresp_tx.test.ts b/yarn-project/end-to-end/src/e2e_p2p/reqresp.test.ts similarity index 100% rename from yarn-project/end-to-end/src/e2e_p2p/reqresp_tx.test.ts rename to yarn-project/end-to-end/src/e2e_p2p/reqresp.test.ts From f3fd8187b7fc65b7377ea99441de997ae1af2a09 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 07:30:03 +0000 Subject: [PATCH 7/9] fix fmt --- yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 a105e4c90137..040c7f6cb150 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 @@ -144,8 +144,10 @@ export class P2PNetworkTest { async stopNodes(nodes: AztecNodeService[]) { this.logger.info('Stopping nodes'); - if (!nodes) return; - if (!nodes.length) return; + if (!nodes || !nodes.length) { + this.logger.info('No nodes to stop'); + return; + } for (const node of nodes) { await node.stop(); From 028c637953ad271873cb0fd2a3ad27d3f9a6c725 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 07:45:53 +0000 Subject: [PATCH 8/9] fix: simplify labels --- scripts/ci/get_e2e_jobs.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh index 45b14a93f4ca..f738ad0d0727 100755 --- a/scripts/ci/get_e2e_jobs.sh +++ b/scripts/ci/get_e2e_jobs.sh @@ -51,22 +51,24 @@ allow_list=( # E.g: # e2e_p2p label will match e2e_p2p_gossip, e2e_p2p_rediscovery, e2e_p2p_reqresp etc. # e2e_prover label will match e2e_prover_fake_proofs, e2e_prover_coordination etc. -IFS=',' read -r -a input_labels <<<"$LABELS" +IFS=',' read -r -a input_labels <<< "$LABELS" expanded_allow_list=() + for label in "${input_labels[@]}"; do # For each input label, find all tests that start with this prefix matching_tests=$(echo "$full_list" | tr ' ' '\n' | grep "^${label}" || true) - if [ ! -z "$matching_tests" ]; then - # Add all matching tests to the expanded allow list - while IFS= read -r test; do - expanded_allow_list+=("$test") - done <<< "$matching_tests" + + # If matching tests are found, add them to expanded_allow_list; otherwise, add the label itself + if [ -n "$matching_tests" ]; then + expanded_allow_list+=($matching_tests) else - # If no prefix match found, treat it as an exact match (original behavior) expanded_allow_list+=("$label") fi done -allow_list+=("${expanded_allow_list[@]}") + +# Add the input labels and expanded matches to allow_list +allow_list+=("${input_labels[@]}" "${expanded_allow_list[@]}") + # Generate full list of targets, excluding specific entries, on one line test_list=$(echo "${full_list[@]}" | grep -v 'base' | grep -v 'bench' | grep -v "network" | grep -v 'devnet' | xargs echo) From 0d9d68b71246f97040faa23dc0c12f95606a83a9 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:06:40 +0000 Subject: [PATCH 9/9] fix: update gerousia test name --- yarn-project/end-to-end/scripts/e2e_test_config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn-project/end-to-end/scripts/e2e_test_config.yml b/yarn-project/end-to-end/scripts/e2e_test_config.yml index b414088ba22b..869813c0f3dd 100644 --- a/yarn-project/end-to-end/scripts/e2e_test_config.yml +++ b/yarn-project/end-to-end/scripts/e2e_test_config.yml @@ -84,8 +84,8 @@ tests: e2e_token_contract: {} e2e_p2p_gossip: test_path: 'e2e_p2p/gossip_network.test.ts' - e2e_p2p_gerousia: - test_path: 'e2e_p2p/gerousia.test.ts' + e2e_p2p_upgrade_governance_proposer: + test_path: 'e2e_p2p/upgrade_governance_proposer.test.ts' e2e_p2p_rediscovery: test_path: 'e2e_p2p/rediscovery.test.ts' e2e_p2p_reqresp: