Skip to content

Conversation

@jpraynaud
Copy link
Member

@jpraynaud jpraynaud commented Dec 5, 2025

Content

This PR includes support or aggregator capabilities in the aggregator discovery process.

The capabilities of the discovered aggregators are now available in the CLI output. This command:

./mithril-client --unstable tools discover-aggregator pre-release-preview

Will output:

Mithril Client CLI version: 0.12.38
+-----------------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------------------------------------------------+
| Aggregator Endpoint                                                   | Aggregate Signature Type | Signed Entity Types                                                                                             |
+-----------------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------------------------------------------------+
| https://aggregator.pre-release-preview.api.mithril.network/aggregator | Concatenation            | MithrilStakeDistribution,CardanoStakeDistribution,CardanoImmutableFilesFull,CardanoDatabase,CardanoTransactions |
+-----------------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------------------------------------------------+

Pre-submit checklist

  • Branch
    • 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

Issue(s)

Relates to #2726

@jpraynaud jpraynaud self-assigned this Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Test Results

    5 files  ±0    172 suites  ±0   33m 4s ⏱️ +13s
2 452 tests ±0  2 452 ✅ ±0  0 💤 ±0  0 ❌ ±0 
7 654 runs  ±0  7 654 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 4661764. ± Comparison against base commit 2f5a13f.

♻️ This comment has been updated with latest results.

@jpraynaud jpraynaud force-pushed the jpraynaud/2726-simple-aggregator-discovery-endpoint branch from f5c7cb6 to 2aede73 Compare January 15, 2026 17:46
@jpraynaud jpraynaud changed the title feat: return aggregator capabilities in aggregator discovery feat: support aggregator capabilities in aggregator discovery Jan 15, 2026
@jpraynaud jpraynaud force-pushed the jpraynaud/2726-simple-aggregator-discovery-endpoint branch from 2aede73 to 01d53af Compare January 15, 2026 17:50
@jpraynaud jpraynaud force-pushed the jpraynaud/2726-simple-aggregator-discovery-endpoint branch from 01d53af to b2dbab8 Compare January 30, 2026 07:14
@jpraynaud jpraynaud requested a review from Copilot January 30, 2026 07:14
@jpraynaud jpraynaud marked this pull request as ready for review January 30, 2026 07:14
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 support for displaying aggregator capabilities in the aggregator discovery process. The AggregatorDiscoverer trait has been made generic to support returning either basic endpoints or endpoints with capabilities, and the CLI now displays capability information (aggregate signature type and signed entity types) when discovering aggregators.

Changes:

  • Made AggregatorDiscoverer trait generic over return type to support both AggregatorEndpoint and AggregatorEndpointWithCapabilities
  • Added AggregatorEndpointWithCapabilities model with capability information and conversion implementations
  • Updated CLI aggregator discovery command to display capabilities in a table format

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/mithril-aggregator-discovery/src/interface.rs Made AggregatorDiscoverer trait generic with type parameter T
internal/mithril-aggregator-discovery/src/model.rs Added AggregatorEndpointWithCapabilities struct and conversion implementations
internal/mithril-aggregator-discovery/src/capabilities_discoverer.rs Updated to return AggregatorEndpointWithCapabilities and modified iterator logic
internal/mithril-aggregator-discovery/src/http_config_discoverer.rs Updated trait implementation to specify AggregatorEndpoint type parameter
internal/mithril-aggregator-discovery/src/rand_discoverer.rs Updated trait implementation to specify AggregatorEndpoint type parameter
internal/mithril-aggregator-discovery/src/test/double/discoverer.rs Updated test double to specify AggregatorEndpoint type parameter
internal/mithril-aggregator-discovery/src/lib.rs Exported AggregatorEndpointWithCapabilities
mithril-client/src/client.rs Updated type annotations and made discover_aggregator return endpoints with capabilities
mithril-client-cli/src/commands/tools/aggregator_discovery.rs Enhanced output table to display aggregate signature type and signed entity types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jpraynaud jpraynaud requested a review from Copilot January 30, 2026 09:45
@jpraynaud jpraynaud force-pushed the jpraynaud/2726-simple-aggregator-discovery-endpoint branch from b2dbab8 to 7534d16 Compare January 30, 2026 09:49
@jpraynaud jpraynaud force-pushed the jpraynaud/2726-simple-aggregator-discovery-endpoint branch from 7534d16 to 4661764 Compare January 30, 2026 09:49
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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 with one caution (see first comment).

Overall I feel that this api is fragile, when reading this PR I see two main problems:

  1. usage of async code inside sync code because it returns an Iterator (the main problem)
  2. the addition of a generic to the AggregatorDiscoverer trait, making the api less easy to use
  1. may be addressed by using futures::stream::TryStream, but there may be some hiccup when using it downstream as this means not using the standard iterator api anymore.
  2. is more difficult to solve and would probably mean an extensive refactoring of the crate (maybe with returning concrete type instead of returning traits).

None of this is need immediate action, this code is okay as is.

}
}

impl TryFrom<AggregatorEndpoint> for AggregatorEndpointWithCapabilities {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is dangerous, like Copilot said if called outside of tokio this will panic, instead of implementing TryFrom I think it would be better to instead add a retrieve_capabilities_blocking to AggregatorEndpoint which would be specify to not call it outside of a tokio runtime to avoid panic.

This would still be brittle as this don't change the fact that the capabilities discoverer have to run async code in a non-async method, but would be a avoid a second level of abstraction which hide this fact.

Also it could be interesting to explore using Handle::try_current() to avoid the panic if run outside of a tokio runtime but instead raising an error.

.unwrap();

let next_aggregator = aggregators.next();
let next_aggregator = aggregators.next().map(|endpoint| endpoint.into());
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Nitpick] you should be able to also write this conversion like this:

Suggested change
let next_aggregator = aggregators.next().map(|endpoint| endpoint.into());
let next_aggregator = aggregators.next().map(Into::into);

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