Skip to content

Conversation

@Alenar
Copy link
Collaborator

@Alenar Alenar commented Dec 4, 2025

Content

This PR add to the mithril-aggregator-client crate all the query needed by the mithril-client library. Allowing its upcoming usage and ensuring that everything is ready before a publication to crates.io.

Details

mithril-aggregator-client

New GET queries:

  • GetAggregatorStatusQuery: call /status
  • GetCardanoDatabaseQuery: call /artifact/cardano-database/{hash}
  • GetCardanoDatabaseListQuery: call /artifact/cardano-database or artifact/cardano-database/epoch/{specifier}
  • GetCardanoStakeDistributionQuery: call /artifact/cardano-stake-distribution/{hash} or artifact/cardano-stake-distribution/epoch/{specifier}
  • GetCardanoStakeDistributionsListQuery: call /artifact/cardano-stake-distributions
  • GetCardanoTransactionQuery: call /artifact/cardano-transaction/{hash}
  • GetCardanoTransactionProofQuery: call /proof/cardano-transaction?transaction_hashes={hashes} with hashes being a comma separated list
  • GetCardanoTransactionsListQuery: call /artifact/cardano-transactions
  • GetMithrilStakeDistributionQuery: call /artifact/mithril-stake-distribution/{hash}
  • GetMithrilStakeDistributionsListQuery: call /artifact/mithril-stake-distributions
  • GetSnapshotQuery: call /artifact/snapshot/{hash}
  • GetSnapshotsListQuery: call /artifact/snapshots

New POST queries:

  • PostIncrementCardanoDatabaseAncillaryRestoredStatisticQuery: call /statistics/cardano-database/ancillary-files-restored without a body
  • PostIncrementCardanoDatabaseImmutablesRestoredStatisticQuery: call /statistics/cardano-database/immutable-files-restored with a CardanoDatabaseImmutableFilesRestoredMessage body containing the number of restored files
  • PostIncrementCardanoDatabaseRestorationStatisticQuery: call either /statistics/cardano-database/complete-restoration or statistics/cardano-database/partial-restoration depending of the constructor called (no body supplied)
  • PostIncrementSnapshotDownloadStatisticQuery: call /statistics/snapshot with a SnapshotDownloadMessage body

Client enhancements:

  • properly handle api version fetching error: if one is raised a log is print and the query is run without sending the mithril-api-version header and without checking api version returned by the aggregator.
  • centralized debug message emission before sending a query:
    • no longer done by the queries, the client now write them. Queries can override the entry_log_additional_fields method if they need to add context (such as some information extracted from the query body).
    • standardize format ({HTTP_VERB} {query_route}; aggregator={endpoint}, [optional additional key values from query])

Misc:

  • Removed / from GetAggregatorFeaturesQuery route, as this resulted in a // in the reworked entry debug log

mithril-common

  • Make MemoryDrainForTest also send messages to stdout for easier debugging in failing tests when asserting specific logs are emitted. Note: this allow removal of print of the full log in assertion messages since they are now always logged.
  • Add Dummy impl for some types used in aggregator client tests

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
    • No new TODOs introduced

Issue(s)

Relates to #2827

Alenar added 13 commits December 4, 2025 11:00
This allow to see logs in failing tests without having to explicitly
show the logs content in the assertion error message.
…hing failure

Before the client would crash if the api version could not be computed,
now it will only log an error.
by using `when.any_request()` on the mock server, since the pathing is
tested by the happy path tests (such as the `ok_200` tests).
… v2 snapshots

List can be done using an `EpochSpecifier` in oder to scope it to an
epoch, the latest epoch (with or without and offest)
…stribution

Getting one item can be done using an `EpochSpecifier` in oder to scope
it to an epoch, the latest epoch (with or without and offest)
@Alenar Alenar requested a review from jpraynaud December 4, 2025 10:58
@Alenar Alenar self-assigned this Dec 4, 2025
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Test Results

    4 files  ±  0    168 suites  ±0   23m 28s ⏱️ +29s
2 276 tests + 53  2 276 ✅ + 53  0 💤 ±0  0 ❌ ±0 
7 145 runs  +212  7 145 ✅ +212  0 💤 ±0  0 ❌ ±0 

Results for commit d376da3. ± Comparison against base commit f8f0268.

♻️ This comment has been updated with latest results.

@Alenar Alenar temporarily deployed to testing-preview December 4, 2025 11:09 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2827/prepare_aggregator_client_usage_in_mithril-client branch from 8900a40 to da3599b Compare December 4, 2025 11:45
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 👍

By sending them in the client directly instead of in the queries.

Queries can add context throught additional key/value pair by
overloading the `entry_log_additional_fields` method.
* mithril-aggregator-client from `0.1.3` to `0.1.4`
* mithril-client from `0.12.35` to `0.12.36`
* mithril-common from `0.6.31` to `0.6.32`
@Alenar Alenar force-pushed the djo/2827/prepare_aggregator_client_usage_in_mithril-client branch from da3599b to d376da3 Compare December 4, 2025 15:35
@Alenar Alenar temporarily deployed to testing-preview December 4, 2025 15:59 — with GitHub Actions Inactive
@Alenar Alenar merged commit 8cd976a into main Dec 4, 2025
91 of 93 checks passed
@Alenar Alenar deleted the djo/2827/prepare_aggregator_client_usage_in_mithril-client branch December 4, 2025 16:00
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.

3 participants