Skip to content

Conversation

@dlachaume
Copy link
Collaborator

@dlachaume dlachaume commented Jul 4, 2025

Content

This PR includes changes to the mithril-client library and CLI to ease and reduce friction during Mithril era transitions.

mithril-client library updates:

  • Add MithrilEraClient struct: client wrapper around an EraFetcher to improve extensibility.
  • Add EraFetcher trait: defines an interface to retrieve the current Mithril era, returning a FetchedEra.
  • Introduce FetchedEra struct: wraps a raw era string and provides conversion to a SupportedEra.
  • Implement AggregatorHttpEraFetcher: EraFetcher implementation that retrieves the era from the aggregator’s /status endpoint.
  • Update Client API: allows setting a custom MithrilEraClient and exposes the conversion to SupportedEra.

mithril-client CLI updates:

  • Add --era global CLI argument: allows users to override the era manually.
  • Implement ForcedEraFetcher: a static EraFetcher that always returns the CLI-provided era.

mithril-client WASM updates:

  • Add fetch_current_mithril_era function

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
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)
    • Add ADR blog post or Dev ADR entry (if relevant)
    • No new TODOs introduced

Issue(s)

Closes #2619

@dlachaume dlachaume self-assigned this Jul 4, 2025
@github-actions
Copy link

github-actions bot commented Jul 4, 2025

Test Results

    4 files  ± 0    154 suites  ±0   22m 20s ⏱️ +25s
2 079 tests + 7  2 079 ✅ + 7  0 💤 ±0  0 ❌ ±0 
6 386 runs  +26  6 386 ✅ +26  0 💤 ±0  0 ❌ ±0 

Results for commit 1ffc3da. ± Comparison against base commit b6fb6c2.

♻️ This comment has been updated with latest results.

@dlachaume dlachaume temporarily deployed to testing-preview July 4, 2025 15:12 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2619/client-era-support branch from e1781c8 to 1d1a974 Compare July 4, 2025 15:17
@dlachaume dlachaume requested a review from Copilot July 4, 2025 15:21
Copy link

Copilot AI left a comment

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 adds era-awareness to the Mithril client library and CLI by introducing a common trait for fetching the current Mithril era and allowing it to be overridden via a CLI flag.

  • Added an EraFetcher trait, a FetchedEra wrapper, and an HTTP-based implementation in the library
  • Updated ClientBuilder and Client to use a pluggable EraFetcher
  • Extended the CLI with a global --era flag and a ForcedEraFetcher implementation
  • Documentation and website manual updated to reflect the new flag and behavior

Reviewed Changes

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

Show a summary per file
File Description
src/type_alias.rs Exposed SupportedEra in the public type aliases
src/lib.rs Registered the new era_fetcher module and re-exported types
src/era_fetcher.rs Defined EraFetcher, FetchedEra, AggregatorHttpEraFetcher
src/client.rs Stored and exposed a pluggable EraFetcher in Client and builder
src/aggregator_client.rs Added Status request route and a unit test for it
mithril-client-cli/src/utils/ Introduced ForcedEraFetcher and wired it into the utils module
mithril-client-cli/src/main.rs Added --era global argument and registered it in config
mithril-client-cli/src/commands/mod.rs Factored builder config to conditionally inject ForcedEraFetcher
docs/website/root/manual/develop/nodes/mithril-client.md Updated CLI manual to list --era for every command
docs/website/adr/004-mithril-network-update-strategy.md Documented client-side era awareness
Comments suppressed due to low confidence (1)

mithril-client-cli/src/utils/forced_era_fetcher.rs:1

  • Add unit tests for ForcedEraFetcher to verify that fetch_current_era returns the provided era string correctly.
use async_trait::async_trait;

@dlachaume dlachaume temporarily deployed to testing-preview July 4, 2025 15:30 — with GitHub Actions Inactive
@dlachaume dlachaume marked this pull request as ready for review July 4, 2025 15:31
Copy link
Collaborator

@turmelclem turmelclem left a comment

Choose a reason for hiding this comment

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

LGTM ✨

Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Collaborator

@Alenar Alenar left a comment

Choose a reason for hiding this comment

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

LGTM, but I've a concern on how era features will evolve in the client, see the comment below.

@dlachaume dlachaume temporarily deployed to testing-preview July 7, 2025 10:33 — with GitHub Actions Inactive
@dlachaume dlachaume temporarily deployed to testing-preview July 7, 2025 13:10 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2619/client-era-support branch 4 times, most recently from 8f0eae3 to 6b8f006 Compare July 7, 2025 13:43
@dlachaume dlachaume temporarily deployed to testing-preview July 7, 2025 13:55 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2619/client-era-support branch from 6b8f006 to 72ab260 Compare July 7, 2025 14:37
@dlachaume dlachaume temporarily deployed to testing-preview July 7, 2025 14:46 — with GitHub Actions Inactive
dlachaume added 4 commits July 7, 2025 17:55
…implementation and `FetchedEra` conversion to `SupportedEra`
- Add global `--era` CLI argument to manually override the era used by the client
- Implement `ForcedEraFetcher` to bypass the era retrieved from the aggregator's `/status` endpoint
- Inject `ForcedEraFetcher` into the `ClientBuilder` when the `era` argument is provided
- Refactor shared client builder configuration into `finalize_builder_config` to reduce duplication
@dlachaume dlachaume force-pushed the dlachaume/2619/client-era-support branch from 72ab260 to 0688700 Compare July 7, 2025 15:56
dlachaume added 5 commits July 7, 2025 17:57
Update documentation to reflect new aggregator stores directory with leader/follower feature
* mithril-build-script from `0.2.24` to `0.2.25`
* mithril-client-cli from `0.12.20` to `0.12.21`
* mithril-client-wasm from `0.9.3` to `0.9.4`
* mithril-client from `0.12.20` to `0.12.21`
* mithril-aggregator-fake from `0.4.10` to `0.4.11`
* [js] mithril-client-wasm from `0.9.3` to `0.9.4`
@dlachaume dlachaume force-pushed the dlachaume/2619/client-era-support branch from 0688700 to 1ffc3da Compare July 7, 2025 15:59
@dlachaume dlachaume temporarily deployed to testing-preview July 7, 2025 16:10 — with GitHub Actions Inactive
@dlachaume dlachaume merged commit 46802f0 into main Jul 8, 2025
41 checks passed
@dlachaume dlachaume deleted the dlachaume/2619/client-era-support branch July 8, 2025 07:44
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.

Clients support Mithril era transition

5 participants