Skip to content

feat: accelerate aggregator startup by one epoch in e2e tests - #3436

Merged
jpraynaud merged 6 commits into
mainfrom
jpraynaud/handle-aggregator-epoch-zero
Jul 27, 2026
Merged

feat: accelerate aggregator startup by one epoch in e2e tests#3436
jpraynaud merged 6 commits into
mainfrom
jpraynaud/handle-aggregator-epoch-zero

Conversation

@jpraynaud

@jpraynaud jpraynaud commented Jul 27, 2026

Copy link
Copy Markdown
Member

Content

This PR includes an acceleration of the end to end tests by one epoch, by allowing the aggregator to start as soon as the devnet is at epoch zero instead of waiting for the next epoch.

  • Make the end to end infrastructure wait for epoch 1 before the leader aggregator serves, so the startup epoch is deterministic across runs
  • Add Epoch::offset_to_signer_retrieval_epoch_saturating in mithril-common, which clamps to epoch zero instead of returning an error when the signer retrieval offset would yield a negative epoch
  • Use the saturating variant when computing the network configuration in the aggregator EpochService, in the local and HTTP MithrilNetworkConfigurationProvider implementations, and in the EpochSettingsStorer startup discrepancy handling

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

Clamp the signer retrieval epoch to epoch zero when computing the network
configuration, so the aggregator can start as soon as the devnet is at epoch zero.
@jpraynaud jpraynaud self-assigned this Jul 27, 2026
Copilot AI review requested due to automatic review settings July 27, 2026 10:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces end-to-end test startup time and flakiness around epoch transitions by allowing the aggregator to compute “signer retrieval” epochs safely at epoch 0 (clamping instead of erroring), and by making the leader aggregator startup epoch deterministic in the e2e harness.

Changes:

  • Add Epoch::offset_to_signer_retrieval_epoch_saturating() in mithril-common and unit-test its clamping behavior.
  • Switch aggregator/network-configuration code paths to use the saturating offset when deriving “aggregation / signer retrieval” epochs.
  • Update e2e infrastructure to wait for epoch 1 before serving the leader aggregator for deterministic startup behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mithril-test-lab/mithril-end-to-end/src/mithril/infrastructure.rs Waits for epoch 1 before serving the leader aggregator to stabilize startup timing across runs.
mithril-common/src/entities/epoch.rs Introduces a saturating epoch offset helper and tests for epoch-0 clamping.
mithril-aggregator/src/store/epoch_settings_storer.rs Uses the saturating epoch offset when handling epoch-settings startup discrepancies.
mithril-aggregator/src/services/network_configuration_provider.rs Uses the saturating offset when computing aggregation-related epochs (local provider).
mithril-aggregator/src/services/epoch_service.rs Uses the saturating offset when computing signer retrieval epoch in the epoch service.
internal/mithril-protocol-config/src/http.rs Uses the saturating offset when computing aggregation-related epochs (HTTP provider).

Comment thread mithril-common/src/entities/epoch.rs
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Test Results

     5 files  ± 0     209 suites  ±0   1h 0m 3s ⏱️ - 55m 23s
 3 325 tests  - 48   3 325 ✅  - 48  0 💤 ±0  0 ❌ ±0 
11 070 runs   - 38  11 070 ✅  - 38  0 💤 ±0  0 ❌ ±0 

Results for commit d86100f. ± Comparison against base commit 8bbdf2d.

♻️ This comment has been updated with latest results.

@jpraynaud
jpraynaud temporarily deployed to testing-preview July 27, 2026 11:13 — with GitHub Actions Inactive
@jpraynaud
jpraynaud temporarily deployed to testing-2-preview July 27, 2026 11:13 — with GitHub Actions Inactive
Compute the clamped epoch on the underlying integer instead of discarding the
error, so unrelated offset failures are no longer reported as epoch zero.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread mithril-common/src/entities/epoch.rs Outdated
@jpraynaud
jpraynaud temporarily deployed to testing-2-preview July 27, 2026 13:26 — with GitHub Actions Inactive
@jpraynaud
jpraynaud temporarily deployed to testing-preview July 27, 2026 13:26 — with GitHub Actions Inactive
Replace the i64 cast in 'offset_by' with checked signed arithmetic, which no
longer truncates above i64::MAX nor wraps above u64::MAX.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread mithril-aggregator/src/store/epoch_settings_storer.rs
Comment thread mithril-aggregator/src/services/network_configuration_provider.rs
Comment thread mithril-aggregator/src/services/epoch_service.rs
Comment thread internal/mithril-protocol-config/src/http.rs

@Alenar Alenar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but this raise business questions, but since it will in fact only occurs on dev networks this should be fine.

Comment thread mithril-common/src/entities/epoch.rs Outdated
Check that `inform_epoch` and the epoch settings discrepancy handling
succeed at epoch zero with a clamped signer retrieval epoch.
* mithril-protocol-config from `0.1.11` to `0.1.12`
* mithril-aggregator from `0.9.17` to `0.9.18`
* mithril-common from `0.7.13` to `0.7.14`
* mithril-end-to-end from `0.5.6` to `0.5.7`
@jpraynaud
jpraynaud temporarily deployed to testing-preview July 27, 2026 15:33 — with GitHub Actions Inactive
@jpraynaud
jpraynaud temporarily deployed to testing-2-preview July 27, 2026 15:33 — with GitHub Actions Inactive

@turmelclem turmelclem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jpraynaud
jpraynaud merged commit bc9d8c1 into main Jul 27, 2026
91 of 92 checks passed
@jpraynaud
jpraynaud deleted the jpraynaud/handle-aggregator-epoch-zero branch July 27, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants