refactor(end-to-end): promote scenario to commands, switch epoch length based wait duration, rework and cleanup assertions - #3316
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Mithril end-to-end test runner to make scenarios explicit clap subcommands, to base polling/wait timings on the configured Cardano epoch duration, and to replace the previous flat assertions helpers with a structured toolkit that can carry shared context across checks/exec/waits.
Changes:
- Promote scenarios to clap subcommands (
full,run-only) and rework CLI argument grouping/flattening accordingly. - Replace hardcoded wait durations with epoch-derived delays via a shared
ScenarioToolkitContext/AttemptPolicy. - Rename/replace
assertionswith a structuredtoolkit(check/exec/wait), and update scenarios/infrastructure to use it.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| mithril-test-lab/mithril-end-to-end/src/toolkit/wait.rs | New wait helpers using epoch-derived delays and attempt!. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/mod.rs | Introduces ScenarioToolkit facade that groups check/exec/wait toolkits. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/exec.rs | New exec helpers (bootstrap genesis, protocol params update, era marker, etc.). |
| mithril-test-lab/mithril-end-to-end/src/toolkit/context.rs | Adds ScenarioToolkitContext + AttemptPolicy to compute epoch-based delays (with unit tests). |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/utils.rs | Shared HTTP/attempt helpers for “wait for latest artifact” + common assertions. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/toolkit.rs | New CheckToolkit grouping artifact verification routines and client checks. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/mod.rs | New module layout for toolkit checks. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/mithril_stake_distribution.rs | Toolkit-based checks for Mithril stake distribution artifact verification. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/certificate.rs | Toolkit-based checks for certificate creation with expected signer count. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/cardano_transactions.rs | Toolkit-based checks for Cardano transactions artifact verification. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/cardano_stake_distribution.rs | Toolkit-based checks for Cardano stake distribution artifact verification (epoch/hash downloads). |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/cardano_database.rs | Toolkit-based checks for Cardano DB snapshot + digests map + client verification. |
| mithril-test-lab/mithril-end-to-end/src/toolkit/check/cardano_blocks_transactions.rs | Toolkit-based checks for block/tx certification via client CLI (v2). |
| mithril-test-lab/mithril-end-to-end/src/scenario/run_only.rs | Converts “run-only” flow to RunOnlyScenario using ScenarioToolkit. |
| mithril-test-lab/mithril-end-to-end/src/scenario/mod.rs | Exposes scenario types (FullScenario, RunOnlyScenario). |
| mithril-test-lab/mithril-end-to-end/src/scenario/full.rs | Refactors former “Spec” flow into FullScenario and routes checks through toolkits. |
| mithril-test-lab/mithril-end-to-end/src/mithril/infrastructure.rs | Threads ScenarioToolkit into infrastructure for era-marker registration and removes old flags. |
| mithril-test-lab/mithril-end-to-end/src/main.rs | Major CLI refactor: scenario subcommands, flattened arg groups, and scenario dispatch logic. |
| mithril-test-lab/mithril-end-to-end/src/lib.rs | Exposes scenario and toolkit modules; removes old assertions exports. |
| mithril-test-lab/mithril-end-to-end/src/assertions/wait.rs | Removes old wait assertions (migrated into toolkit). |
| mithril-test-lab/mithril-end-to-end/src/assertions/mod.rs | Removes old assertions module entrypoint. |
| mithril-test-lab/mithril-end-to-end/src/assertions/exec.rs | Removes old exec assertions (migrated into toolkit). |
| mithril-test-lab/mithril-end-to-end/src/assertions/check.rs | Removes old check assertions (migrated into toolkit). |
| mithril-test-lab/mithril-end-to-end/Cargo.toml | Bumps crate version to 0.5.0. |
| mithril-test-lab/cardano-devnet/README.md | Updates documentation to use run-only subcommand instead of --run-only. |
| Cargo.lock | Updates lockfile for the mithril-end-to-end version bump. |
| .github/workflows/ci.yml | Updates CI E2E invocation to include the full scenario subcommand. |
| .github/workflows/backward-compatibility.yml | Updates backward-compat workflow E2E invocation to include the full scenario subcommand. |
Alenar
force-pushed
the
djo/3151/e2e-refactor-to-prepare-snark-scenario
branch
2 times, most recently
from
June 8, 2026 16:24
3201452 to
22cb8ae
Compare
* rename `Args` to `Cli` to avoid name colision with `clap::Args` * restructured args are flatten in to the main `Cli` struct, meaning that there's no changes to the cli interface
…e for clarity * introduced a new `scenario` module to group related logic * moved `Spec` to `FullScenario` and `RunOnly` to `RunOnlyScenario`
First step of the refactor which will move those functions into a type which will hold the test context.
…heckToolkit`, `ExecToolkit`, `WaitToolkit`) * Added `ScenarioToolkit` for centralized test context handling. * Implemented `ScenarioToolkitContext` and `AttemptPolicy` to control retry policies and delays.
* Moved toolkit functions into their dedicated struct. * Improved reusability and modularity by integrating context handling. * Temporary keep old methods, with an indirection, to keep compatibity and avoid a bigbang
…cat types + certificate Integrated new specialized toolkits (`CheckCardanoBlocksTransactionsToolkit`, `CheckCardanoDatabaseToolkit`, `CheckCardanoStakeDistributionToolkit`, `CheckCardanoTransactionsToolkit`, `CheckCertificateToolkit`, `CheckMithrilStakeDistributionToolkit`) to enhance modularity and reusability in end-to-end testing scenarios.
…toolkits * Add "all in one" `is_certified_and_verified` routines across toolkits that checks artificats productions, certificates signing, and client verification * Streamlined `client_*` verification methods into consistent naming (`verify_with_client`/`verify_transactions_with_client`/`verify_blocks_with_client`).
…ructure - Replaced standalone toolkit function calls with corresponding methods in `ScenarioToolkit`. - Updated `FullScenario` and `RunOnlyScenario` to use `ScenarioToolkit` for modular subcomponents. - Removed obsolete standalone toolkit methods.
Unified artifact-related methods across check toolkits by replacing repetitive methods with reusable `wait_for_artifact` and `check_artifact` utilities.
…t` across check toolkits
`is_creating_certificate_with_enough_signers` wait for any certificate, not for a certificate with a given minimum of signers.
…uration utilities - Remove `Default` trait implementations across various toolkits to force user to provide an epoch length - Refactored `ScenarioToolkitContext` to support Cardano epoch-based duration calculations with new helper methods and constructors.
…tilities - Updated all `attempt!` calls to use `ScenarioToolkitContext` delay helpers (`tenth_epoch_delay` and `half_epoch_delay`) for consistency and configurability.
- `Full` and `RunOnly` Scenarios are now subcommands - Default scenario to `full` - Moved `check_client_cli_snapshot_converter` to full subcommand as it's only relevant here - Moved `signed_entity_types` to both full and runonly subcommands (note: upcoming "minimal" scenario will only allow one signed entity type, this give the flexibility to parametrize that) - Simplified infrastructure and CLI parsing logic by removing redundant arguments. - Updated `README.md` and CI to reflect changes in Mithril execution commands.
… consistency Has those functions are in the `WaitContext` we do not need to repeat `wait_` in their names.
jpraynaud
approved these changes
Jun 9, 2026
Alenar
force-pushed
the
djo/3151/e2e-refactor-to-prepare-snark-scenario
branch
from
June 9, 2026 14:47
22cb8ae to
0e64a24
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Content
This PR includes three major changes to the end-to-end runners:
run-onlyinstead of--run-onlyand it have to be passed at the end of the commandcardano_slot_lengthandcardano_epoch_lengthargs)assertionsmodule, which contains shared, have been renamed totoolkitand overhauled from an list of static method into a tree of structures (split by subdomains) to allow them to hold a context.Additional details
About the command line arguments:
Argsstruct have been renamed toClito avoid a collision withclap::ArgsClivalues they have been split into multiple structures:NetworkTopologyArgs: number of aggregators, signers, do we use the mithril relay, the dmq, ...MithrilArgs: Mithril state machines run interval, the start era, ...CardanoDevnetArgs: Devnet scripts location, Cardano node version, slot/epoch lenght, ...Clistruct, meaning there's no functional change for them for usersAbout scenario:
scenariofolder moduleFullis usedFull:check_client_cli_snapshot_converterhas it was only used by that scenario,signed_entity_typeshas the upcomingminimalscenario won't allow for more than oneRunOnly:signed_entity_typessame cause as in theFullscenarioAbout the refactor of the assertion module into
toolkit:checkandwaitinto struct allowed named simplification (e.g. no need to repeat "check" in method names has you will use them through their structures:toolkit.check.certificate.is_creating_certificate_with_enough_signersinstead oftoolkit.check.certificate.check_is_creating_certificate_with_enough_signers)wait_for_latest_artifactutility method was added to remove duplication betweenwait_for_artifactmethods in each signed entity type dedicated check toolkitminimalscenario, check steps of each signed entities have been aggregated intois_certified_and_verifiedmethodscheck_artifactmethodscheck_artifactnaming is willingly broad to allow future addition of additional checksPre-submit checklist
Issue(s)
Relates to #3151