Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aggregator stress test #1679

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/aggregator-stress-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ pub async fn bootstrap_aggregator(
)
.await?;

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,
Expand All @@ -66,21 +76,17 @@ 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",
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");
let errors = fake_signer::register_signers_to_aggregator(
&aggregator,
Expand Down Expand Up @@ -115,3 +121,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(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ where
}
_ => request_first_list_item_with_expected_size::<I>(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"))),
}
}

Expand Down
Loading