Fix fetching custom network file#587
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deploying blockfrost-platform with
|
| Latest commit: |
b82dbb0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://335711bb.blockfrost-platform.pages.dev |
| Branch Preview URL: | https://fix-custom-network.blockfrost-platform.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR fixes --custom-genesis-config so that a user-supplied genesis file is parsed during config construction, merged into a registry, and consistently used across the server, API handlers, and Hydra integration.
Changes:
- Load and merge custom genesis into
Configup front (and setNetwork::Customwhen provided), so the registry is authoritative everywhere. - Update network-magic/genesis consumers (server node pool, epochs parameters, Hydra) to use the merged registry rather than the built-in lookup.
- Add unit tests covering config loading (JSON/TOML), epoch-length resolution, and the ledger genesis endpoint for custom vs built-in networks.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/platform/src/server.rs | Use config.genesis for network magic and store merged registry in app state. |
| crates/platform/src/main.rs | Pass merged genesis into Hydra controller spawn. |
| crates/platform/src/hydra_client/mod.rs | Thread genesis through Hydra controller/state instead of using built-in genesis lookup. |
| crates/platform/src/genesis.rs | Refactor registry traits/impls to work over slices; add mutable registry trait. |
| crates/platform/src/epochs.rs | Make epoch parsing depend on the provided genesis registry; add tests for custom genesis. |
| crates/platform/src/config.rs | Parse custom genesis during config build, store merged registry, and add config-level tests. |
| crates/platform/src/api/ledger/genesis.rs | Add tests verifying the endpoint serves custom genesis when network is custom. |
| crates/platform/src/api/epochs/number/parameters.rs | Pass merged registry into EpochData::from_path. |
| crates/integration_tests/src/platform/mod.rs | Initialize Config with built-in genesis registry for integration test harness. |
| CHANGELOG.md | Document the fix for --custom-genesis-config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Something happened to the commit message of 9103223 😅:
|
48221e5 to
e5e2250
Compare
e5e2250 to
b82dbb0
Compare
michalrus
left a comment
There was a problem hiding this comment.
BTW, after this work, do you have any thoughts about sync progress:
blockfrost-platform/crates/node/src/sync_progress.rs
Lines 24 to 35 in b82dbb0
michalrus
left a comment
There was a problem hiding this comment.
I also found this – so according to us, no stake address is valid on any custom network:
blockfrost-platform/crates/platform/src/addresses.rs
Lines 74 to 87 in b82dbb0
wow very good catch! |
| } | ||
| } | ||
|
|
||
| Ok(()) |
There was a problem hiding this comment.
Maybe let's also check:
active_slots_coefficientis anf64between(0,1]max_lovelace_supplyis a positive integer
There was a problem hiding this comment.
Maybe we should also reject magic numbers that shadow existing and well-known networks? So that user's GenesisRegistryMut::add with a well-known number doesn't break searching networks by magic… OTOH, one run of blockfrost-platform is bound to a specific network, so maybe it doesn’t matter that much. Like when would it matter?
There was a problem hiding this comment.
Maybe let's also check:
OTOH… The user wouldn't be able to run a cardano-node otherwise 🤔 I don’t know, your call
| } | ||
|
|
||
| /// Insert or replace the `GenesisContent` for `network` at the front. | ||
| pub trait GenesisRegistryMut { |
There was a problem hiding this comment.
Now pub type GenesisExtension above appears unused:
| pub no_metrics: bool, | ||
| pub network: Network, | ||
| pub custom_genesis_config: Option<PathBuf>, | ||
| pub genesis: Vec<(Network, GenesisResponse)>, |
There was a problem hiding this comment.
Okay, so now this is redundant:
blockfrost-platform/crates/platform/src/server/state.rs
Lines 8 to 13 in b82dbb0
Maybe let's have all handlers reference a single source of truth: the new state.config.genesis (the line I'm commenting this on).
Removing that previous one will also surface places that are still using it (if any).

No description provided.