From 6ed38df2ae10c0a7f08974b207f5c92535eaead8 Mon Sep 17 00:00:00 2001 From: Damien Lachaume <135982616+dlachaume@users.noreply.github.com> Date: Tue, 14 May 2024 16:12:00 +0200 Subject: [PATCH 1/4] fix: signer registration in aggregator stress test --- .../src/stress_test/aggregator_helpers.rs | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs b/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs index dd462be0f24..ce032b377a3 100644 --- a/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs +++ b/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs @@ -58,6 +58,8 @@ pub async fn bootstrap_aggregator( ) .await?; + restart_aggregator_and_move_one_epoch_forward(&mut aggregator, current_epoch, args).await?; + info!(">> Send the Signer Key Registrations payloads for the genesis signers"); let errors = fake_signer::register_signers_to_aggregator( &aggregator, @@ -66,20 +68,8 @@ pub async fn bootstrap_aggregator( ) .await?; assert_eq!(0, errors); - aggregator.stop().await.unwrap(); - info!(">> Move one epoch forward in order to issue the genesis certificate"); - *current_epoch += 1; - fake_chain::set_epoch(&args.mock_epoch_file_path(), *current_epoch); - - info!(">> Restarting the aggregator still with a large run interval"); - aggregator.serve().unwrap(); - wait::for_http_response( - &format!("{}/epoch-settings", aggregator.endpoint()), - Duration::from_secs(10), - "Waiting for the aggregator to start", - ) - .await?; + restart_aggregator_and_move_one_epoch_forward(&mut aggregator, current_epoch, args).await?; info!(">> Send the Signer Key Registrations payloads for next genesis signers"); let errors = fake_signer::register_signers_to_aggregator( @@ -115,3 +105,26 @@ pub async fn bootstrap_aggregator( Ok(aggregator) } + +async fn restart_aggregator_and_move_one_epoch_forward( + aggregator: &mut Aggregator, + current_epoch: &mut Epoch, + args: &AggregatorParameters, +) -> StdResult<()> { + info!(">> Stop the aggregator to move one epoch forward"); + aggregator.stop().await.unwrap(); + + *current_epoch += 1; + fake_chain::set_epoch(&args.mock_epoch_file_path(), *current_epoch); + + info!(">> Restarting the aggregator with a large run interval"); + aggregator.serve().unwrap(); + wait::for_http_response( + &format!("{}/epoch-settings", aggregator.endpoint()), + Duration::from_secs(10), + "Waiting for the aggregator to start", + ) + .await?; + + Ok(()) +} From 29fbe30fa1c87ef8631d3cb7a4db9865fc6f726a Mon Sep 17 00:00:00 2001 From: Damien Lachaume <135982616+dlachaume@users.noreply.github.com> Date: Tue, 14 May 2024 16:34:16 +0200 Subject: [PATCH 2/4] fix: missing 'format' in error context msg --- mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs b/mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs index 5fb9f00d3cf..b387efc8d6a 100644 --- a/mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs +++ b/mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs @@ -48,7 +48,7 @@ where } _ => request_first_list_item_with_expected_size::(url, expected_size).await, }, - Err(err) => Err(anyhow!(err).context("Request to `{url}` failed")), + Err(err) => Err(anyhow!(err).context(format!("Request to `{url}` failed"))), } } From dd886adea4af7f0152b695c51be14bf8e94074fa Mon Sep 17 00:00:00 2001 From: Damien Lachaume <135982616+dlachaume@users.noreply.github.com> Date: Wed, 15 May 2024 16:46:39 +0200 Subject: [PATCH 3/4] chore: publish and use artifact for `load-aggregator` in CI --- .github/workflows/aggregator-stress-test.yml | 24 ++++++++++++-------- .github/workflows/ci.yml | 10 ++++---- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/aggregator-stress-test.yml b/.github/workflows/aggregator-stress-test.yml index 710e8fd0f1a..0ca28dea3c1 100644 --- a/.github/workflows/aggregator-stress-test.yml +++ b/.github/workflows/aggregator-stress-test.yml @@ -52,20 +52,26 @@ jobs: workflow: ci.yml workflow_conclusion: success + - name: Download test runners + uses: dawidd6/action-download-artifact@v3 + with: + name: mithril-tooling-Linux-X64 + path: ./bin + commit: ${{ inputs.commit_sha }} + workflow: ci.yml + workflow_conclusion: success + - name: Set permissions shell: bash working-directory: ./bin - run: chmod +x ./mithril-aggregator - - - name: Build the aggregator stress test - working-directory: mithril-test-lab/mithril-end-to-end - run: make build + run: | + chmod +x ./mithril-aggregator + chmod +x ./load-aggregator - name: Run the aggregator stress test - working-directory: mithril-test-lab/mithril-end-to-end run: | - ./load-aggregator ${{ steps.prepare.outputs.debug_level }} \ - --cardano-cli-path script/mock-cardano-cli \ - --aggregator-dir ../../bin \ + ./bin/load-aggregator ${{ steps.prepare.outputs.debug_level }} \ + --cardano-cli-path ./mithril-test-lab/mithril-end-to-end/script/mock-cardano-cli \ + --aggregator-dir ./bin \ --num-signers=${{ inputs.num_signers }} \ --num-clients=${{ inputs.num_clients }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cfa51ff7f7..07430887269 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: # We separate the build in 2 steps as we want to avoid side effects with Rust feature unification. - name: Cargo build - Tooling shell: bash - run: cargo build --release -p mithril-end-to-end + run: cargo build --release --bin mithril-end-to-end --bin load-aggregator - name: Build Mithril workspace & publish artifacts uses: ./.github/workflows/actions/build-upload-mithril-artifact @@ -58,8 +58,10 @@ jobs: - name: Publish End-to-end runner (${{ runner.os }}-${{ runner.arch }}) uses: actions/upload-artifact@v4 with: - name: mithril-end-to-end-${{ runner.os }}-${{ runner.arch }} - path: target/release/mithril-end-to-end + name: mithril-tooling-${{ runner.os }}-${{ runner.arch }} + path: | + target/release/mithril-end-to-end + target/release/load-aggregator if-no-files-found: error - name: Prepare test lab eras @@ -302,7 +304,7 @@ jobs: - name: Download rust test runner uses: actions/download-artifact@v4 with: - name: mithril-end-to-end-${{ runner.os }}-${{ runner.arch }} + name: mithril-tooling-${{ runner.os }}-${{ runner.arch }} path: ./ - run: | From 4f3fc484a4e7830bef7675a9301ae687b494129d Mon Sep 17 00:00:00 2001 From: Damien Lachaume <135982616+dlachaume@users.noreply.github.com> Date: Wed, 15 May 2024 19:09:29 +0200 Subject: [PATCH 4/4] fix: prevent registering signers if registration round is closed --- .../src/stress_test/aggregator_helpers.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs b/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs index ce032b377a3..ecfac461ee3 100644 --- a/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs +++ b/mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs @@ -60,6 +60,14 @@ pub async fn bootstrap_aggregator( restart_aggregator_and_move_one_epoch_forward(&mut aggregator, current_epoch, args).await?; + fake_signer::try_register_signer_until_registration_round_is_open( + &aggregator, + &signers_fixture.signers()[0], + *current_epoch + 1, + Duration::from_secs(60), + ) + .await?; + info!(">> Send the Signer Key Registrations payloads for the genesis signers"); let errors = fake_signer::register_signers_to_aggregator( &aggregator, @@ -69,6 +77,14 @@ pub async fn bootstrap_aggregator( .await?; assert_eq!(0, errors); + fake_signer::try_register_signer_until_registration_round_is_open( + &aggregator, + &signers_fixture.signers()[0], + *current_epoch + 1, + Duration::from_secs(60), + ) + .await?; + restart_aggregator_and_move_one_epoch_forward(&mut aggregator, current_epoch, args).await?; info!(">> Send the Signer Key Registrations payloads for next genesis signers");