cardano-rpc: resolve genesis initial funds from sgExtraConfig - #1305
Open
carbolymer wants to merge 1 commit into
Open
cardano-rpc: resolve genesis initial funds from sgExtraConfig#1305carbolymer wants to merge 1 commit into
carbolymer wants to merge 1 commit into
Conversation
carbolymer
requested review from
CarlosLopezDeLara,
disassembler,
erikd and
palas
as code owners
August 20, 2026 13:42
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes cardano-rpc’s ReadGenesis behavior so initial_funds is correctly populated for networks produced by cardano-cli create-testnet-data, where funds are stored via sgExtraConfig.secInitialFunds rather than legacy sgInitialFunds. The change resolves initial funds during GenesisBundle construction using the ledger’s injection resolution APIs, and adjusts exported types accordingly.
Changes:
- Resolve Shelley genesis initial funds from
sgExtraConfig.secInitialFunds(includingEmbeddedInjectionandInjectionFromFilewith hash verification) when constructing theGenesisBundle. - Make
mkNodeKernelAccess/readGenesisBundlemonad-polymorphic with(MonadST m, MonadThrow m)and unify theProtocolInfoArgsmonad with the ambient monad. - Update
cardano-rpclibrary dependencies to includefs-apiandio-classes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cardano-rpc/src/Cardano/Rpc/Server/NodeKernelAccess.hs | Resolves Shelley initial funds via ledger injection resolution during genesis bundle construction; updates exported mkNodeKernelAccess signature accordingly. |
| cardano-rpc/cardano-rpc.cabal | Adds fs-api and io-classes to support SomeHasFS usage and MonadST/MonadThrow constraints. |
| .changes/20260820_cardano_rpc_genesis_initial_funds_extraconfig.yml | Adds a changelog fragment documenting the bugfix + breaking signature change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+133
to
+140
| initialFundsSource <- | ||
| L.resolveInjectionSource | ||
| "initialFunds" | ||
| (L.sgExtraConfig genesis) | ||
| L.secInitialFunds | ||
| (L.sgInitialFunds genesis) | ||
| resolvedInitialFunds <- | ||
| Exts.fromList <$> L.foldInjectionData hasFS initialFundsSource (flip (:)) [] |
| @@ -0,0 +1,10 @@ | |||
| project: cardano-rpc | |||
|
|
|||
| pr: 0 | |||
carbolymer
force-pushed
the
mgalazyn/fix/rpc-initial-funds-extraconfig
branch
from
August 20, 2026 13:57
444e652 to
518ecea
Compare
Draft
9 tasks
carbolymer
force-pushed
the
mgalazyn/fix/rpc-initial-funds-extraconfig
branch
from
August 20, 2026 14:27
8d2154b to
c0d48b9
Compare
carbolymer
force-pushed
the
mgalazyn/fix/rpc-initial-funds-extraconfig
branch
from
August 20, 2026 14:39
c0d48b9 to
39619bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The UTxO RPC
ReadGenesisresponse reported an emptyinitial_fundsmap for any network created withcardano-cli create-testnet-data.create-testnet-dataprovisions wallets by writing their funded addresses into the Shelley genesis'sgExtraConfig.secInitialFunds, leaving the legacysgInitialFundsfield empty, but cardano-rpc'sReadGenesishandler read onlysgInitialFunds.This fixes it by resolving initial funds at
GenesisBundleconstruction time using ledger's ownresolveInjectionSource/foldInjectionData, via theSomeHasFSthatProtocolInfoArgsCardanoalready carries but was previously discarded. BothEmbeddedInjectionandInjectionFromFileare handled, including hash verification for the latter.As a consequence,
mkNodeKernelAccessandreadGenesisBundleare now monad-polymorphic under(MonadST m, MonadThrow m)rather than pinned toIO, unifying theProtocolInfoArgsmonad with the ambient one. This strengthens the exported signature, hence the breaking changelog kind alongside bugfix.The bug was caught by the
ReadGenesisintegration test added in cardano-node PR #6655. A stacked cardano-node PR re-enabling theinitialFundsassertion against this branch will follow once it can be pushed.How to trust this PR
Consumed via a temporary
source-repository-packagestanza in cardano-node'scabal.projectpointing at this branch's head commit, the stacked PR mentioned above will demonstrate the fix against the real integration test.Checklist
ReadGenesisintegration test in the stacked cardano-node PR.changes/