Skip to content

feat(setup): guess mithril signer and dmq params for mithril setup command - #3738

Merged
turmelclem merged 12 commits into
mainfrom
ctl/3678-Guess-Mithril-signer-and-DMQ-params-for-mithril-setup-command
Dec 3, 2026
Merged

turmelclem merged 12 commits into
mainfrom
ctl/3678-Guess-Mithril-signer-and-DMQ-params-for-mithril-setup-command

Conversation

@turmelclem

@turmelclem turmelclem commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Content

This PR adds a guessing module to mithril-setup. It provides the data needed to guess the Mithril signer and DMQ node parameters from the facts found by the Cardano discovery (#3677).

The Mithril networks come from networks.json and the reader files of mithril-infra/configuration/, which are embedded at build time, so nothing is downloaded.

This PR covers the building blocks only. The SignerGuesser and DmqGuesser, the new fields of the signer schema, and the wiring into SignerEffectHandler::guess() come in a follow-up PR. Until then, the setup does not change its behavior.

Mithril signer

Field Provenance
NETWORK Shelley genesis (discovery) and enum association to guess NETWORK from NETWORK_MAGIC (in both sides)
NETWORK_MAGIC Shelley genesis (discovery) and enum association to guess NETWORK from NETWORK_MAGIC (in both sides)
MITHRIL_NETWORK networks.json
AGGREGATOR_ENDPOINT networks.json
ERA_READER_ADAPTER_TYPE networks.json
ERA_READER_ADAPTER_PARAMS mithril-infra/configuration/<mithril-network>/era.addr and era.vkey, embedded at build time
PROTOCOL_CONFIGURATION_READER_ADAPTER_CONFIG Adapter type from networks.json; protocol-config.addr and protocol-config.vkey embedded at build time
RUN_INTERVAL Constants associated to each Cardano Network
STORE_RETENTION_LIMIT Constants associated to each Cardano Network
DATA_STORES_DIRECTORY Constants associated to each Cardano Network
NetworkMagic Cardano network, then its paired DMQ network (constants)

This PR includes...

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

Relates to #3678

@turmelclem turmelclem self-assigned this Dec 1, 2026
@jpraynaud jpraynaud added the feature 🚀 New implemented feature label Dec 1, 2026
@jpraynaud
jpraynaud requested a lite review from Copilot December 1, 2026 10:53

Copilot AI 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.

🟡 Changes recommended

Approval is blocked by an unresolved critical public API break, along with a moderate malformed-input handling flaw and a guideline violation.

3 open issues
What changed in this PR

This PR introduces the pure guessing foundations for mithril-setup, adding Cardano, DMQ, Mithril network, reader configuration, and signer runtime-default mappings while embedding required repository configuration at build time without changing setup behavior.

Changes:

  • Added network models, environment classification, Mithril metadata parsing, and signer runtime defaults.
  • Moved CardanoNetwork into the guessing module and updated Cardano discovery to use it.
  • Added build-time embedding and Nix source-filter support for network and reader configuration files.
File Description
mithril-setup/​src/​lib.rs Exposes the new guessing module.
mithril-setup/​src/​guessing/​signer_runtime_defaults.rs Defines signer runtime defaults for each Cardano network.
mithril-setup/​src/​guessing/​mod.rs Declares and re-exports the guessing components.
mithril-setup/​src/​guessing/​mithril_networks.rs Parses embedded Mithril network metadata and reader configuration.
mithril-setup/​src/​guessing/​mithril_environment.rs Classifies Mithril networks by environment.
mithril-setup/​src/​guessing/​dmq_network.rs Maps Cardano networks to their DMQ networks and magic values.
mithril-setup/​src/​guessing/​cardano_network.rs Defines Cardano network identification and network magic mappings.
mithril-setup/​src/​discovery/​cardano/​node_files/​shelley_genesis.rs Uses the shared guessing Cardano network type when parsing Shelley genesis data.
mithril-setup/​src/​discovery/​cardano/​node_files/​mod.rs Adjusts node-file module visibility after moving the Cardano network type.
mithril-setup/​src/​discovery/​cardano/​discovery.rs Updates discovered Cardano facts to use the shared guessing network type.
mithril-setup/​src/​discovery/​cardano/​discoverer/​node_files_facts.rs Updates discovery logic and tests for the relocated Cardano network type.
mithril-setup/​src/​discovery/​cardano/​discoverer/​mod.rs Updates discovery tests to import the shared Cardano network type.
mithril-setup/​Cargo.toml Adds build dependencies and disables publication for the repository-dependent crate.
mithril-setup/​build.rs Embeds Mithril network metadata and reader configuration files during compilation.
flake.nix Includes the network and reader configuration files required by the setup build in filtered Nix sources.

Review effort: Lite

Comment thread mithril-setup/build.rs Resolved
Comment thread mithril-setup/build.rs Resolved
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Test Results

     5 files  ± 0     211 suites  ±0   56m 17s ⏱️ - 58m 3s
 4 775 tests  - 31   4 775 ✅  - 31  0 💤 ±0  0 ❌ ±0 
15 725 runs  +59  15 725 ✅ +59  0 💤 ±0  0 ❌ ±0 

Results for commit 26fa4e1. ± Comparison against base commit 742984e.

This pull request removes 65 and adds 34 tests. Note that renamed tests count towards both.
mithril-setup ‑ discovery::cardano::node_files::shelley_genesis::tests::cardano_network::gives_back_the_magic_of_the_network
mithril-setup ‑ discovery::cardano::node_files::shelley_genesis::tests::cardano_network::identifies_any_other_magic_as_a_private_network
mithril-setup ‑ discovery::cardano::node_files::shelley_genesis::tests::cardano_network::identifies_the_known_networks_by_their_magic
mithril-setup ‑ discovery::cardano::node_files::shelley_genesis::tests::cardano_network::names_the_networks_like_the_mithril_signer_expects
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::index_out_of_bounds
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::index_too_large_for_circuit_range
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::indices_not_increasing
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_merkle_path_mismatch
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_swap_keep_merkle_path
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_wrong_verification_key
…
mithril-setup ‑ guessing::cardano_network::tests::does_not_identify_a_private_network_by_its_name_since_its_magic_is_unknown
mithril-setup ‑ guessing::cardano_network::tests::does_not_identify_an_unknown_name
mithril-setup ‑ guessing::cardano_network::tests::gives_back_the_magic_of_the_network
mithril-setup ‑ guessing::cardano_network::tests::gives_back_the_network_from_its_name
mithril-setup ‑ guessing::cardano_network::tests::identifies_a_network_by_its_name_ignoring_case
mithril-setup ‑ guessing::cardano_network::tests::identifies_any_other_magic_as_a_private_network
mithril-setup ‑ guessing::cardano_network::tests::identifies_the_known_networks_by_their_magic
mithril-setup ‑ guessing::cardano_network::tests::identifies_the_known_networks_by_their_name
mithril-setup ‑ guessing::cardano_network::tests::names_the_networks_like_the_mithril_signer_expects
mithril-setup ‑ guessing::dmq_network::tests::does_not_pair_a_private_cardano_network_since_its_dmq_magic_is_unknown
…

♻️ This comment has been updated with latest results.

Introduce the  module that will hold the pure guessing of the
Mithril signer and DMQ node parameters. The Shelley genesis parser keeps
reading the network magic, and now asks the guessing module for the
network it identifies.
Add  to read, from the content of , the
Mithril networks running on each Cardano network: their first aggregator
endpoint, era reader and protocol configuration reader. The readers
configuration (address and verification key) is given apart, keyed by
the Mithril network name, so that the parsing does no I/O and reads no
URL.
@turmelclem
turmelclem force-pushed the ctl/3678-Guess-Mithril-signer-and-DMQ-params-for-mithril-setup-command branch from 0da5312 to b0cdc1a Compare December 1, 2026 16:20
@turmelclem
turmelclem temporarily deployed to testing-2-preview December 1, 2026 16:35 — with GitHub Actions Inactive

@jpraynaud jpraynaud left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍

@damrobi damrobi 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 👍

Comment thread mithril-setup/build.rs Resolved
@turmelclem
turmelclem force-pushed the ctl/3678-Guess-Mithril-signer-and-DMQ-params-for-mithril-setup-command branch from e3b791c to 340edf8 Compare December 2, 2026 15:33
@turmelclem
turmelclem deployed to testing-2-preview December 2, 2026 15:47 — with GitHub Actions Active
@turmelclem
turmelclem deployed to testing-preview December 2, 2026 15:47 — with GitHub Actions Active

@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

@turmelclem
turmelclem force-pushed the ctl/3678-Guess-Mithril-signer-and-DMQ-params-for-mithril-setup-command branch from 79dfc12 to dad53a9 Compare December 3, 2026 09:42
@turmelclem
turmelclem deployed to testing-2-preview December 3, 2026 09:56 — with GitHub Actions Active
@turmelclem
turmelclem deployed to testing-preview December 3, 2026 09:56 — with GitHub Actions Active
* mithril-setup from `0.1.3` to `0.1.4`
@turmelclem
turmelclem deployed to testing-preview December 3, 2026 10:22 — with GitHub Actions Active
@turmelclem
turmelclem deployed to testing-2-preview December 3, 2026 10:22 — with GitHub Actions Active
@turmelclem
turmelclem merged commit e0537cb into main Dec 3, 2026
53 checks passed
@turmelclem
turmelclem deleted the ctl/3678-Guess-Mithril-signer-and-DMQ-params-for-mithril-setup-command branch December 3, 2026 10:23

This branch was successfully deployed

2 active deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 New implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants