Skip to content

cardano-testnet: strengthen RPC ReadGenesis test coverage - #6657

Open
carbolymer wants to merge 1 commit into
masterfrom
mgalazyn/test/rpc-readgenesis-initialfunds
Open

cardano-testnet: strengthen RPC ReadGenesis test coverage#6657
carbolymer wants to merge 1 commit into
masterfrom
mgalazyn/test/rpc-readgenesis-initialfunds

Conversation

@carbolymer

@carbolymer carbolymer commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

Strengthens the UTxO RPC ReadGenesis integration test in cardano-testnet.

  • Re-enables the initialFunds assertion (temporarily relaxed in 764a27f) and upgrades it to an exact comparison: the RPC response must match the funds embedded in the genesis file.
    The expectation prefers extraConfig.initialFunds.data, where cardano-cli create-testnet-data embeds the funds, and falls back to the legacy top-level initialFunds, so the test keeps working when a future cardano-cli moves the funds back to the top level.
  • Checks the returned genesis hash against the Blake2b-256 hash of the raw Shelley genesis file bytes, replacing the previous length-only check.
  • Adds an error-path check: ReadGenesis fails with FAILED_PRECONDITION when the genesis file changed since the node started.
    This check runs before the first successful call, because the server caches the parsed genesis only on success.

The cardano-rpc fix this test depends on (IntersectMBO/cardano-api#1305, resolving initial funds from sgExtraConfig) is already consumed from CHaP since the cardano-rpc 11.2 bump, so this PR is no longer stacked on anything and needs no source-repository-package stanza.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Running tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
    • cardano-node-chairman, cardano-submit-api and cardano-testnet instead need a
      changelog fragment in <package>/.changes/, because their CHANGELOG.md is generated
      from fragments at release time. Copy _TEMPLATE.yml from that directory, or run
      nix run github:input-output-hk/cardano-dev#herald -- new
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-9.6 and ghc-9.12
  • Self-reviewed the diff

Note on CI

If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.

@carbolymer
carbolymer requested a review from a team as a code owner August 20, 2026 14:21
@carbolymer
carbolymer changed the base branch from master to mgalazyn/test/rpc-readgenesis-followtip-fetchblock August 20, 2026 14:21
@carbolymer carbolymer self-assigned this Aug 20, 2026
@carbolymer
carbolymer marked this pull request as draft August 20, 2026 14:22
@carbolymer carbolymer changed the title Mgalazyn/test/rpc readgenesis initialfunds cardano-testnet: re-enable RPC ReadGenesis initialFunds assertion Aug 20, 2026
@carbolymer
carbolymer force-pushed the mgalazyn/test/rpc-readgenesis-initialfunds branch from 9343bd0 to 521778a Compare August 20, 2026 14:25
Base automatically changed from mgalazyn/test/rpc-readgenesis-followtip-fetchblock to master August 20, 2026 15:11
@carbolymer
carbolymer force-pushed the mgalazyn/test/rpc-readgenesis-initialfunds branch from 521778a to 63d0675 Compare August 26, 2026 14:54
@carbolymer
carbolymer marked this pull request as ready for review August 26, 2026 14:58
@carbolymer carbolymer changed the title cardano-testnet: re-enable RPC ReadGenesis initialFunds assertion cardano-testnet: strengthen RPC ReadGenesis test coverage Aug 26, 2026
@carbolymer
carbolymer force-pushed the mgalazyn/test/rpc-readgenesis-initialfunds branch from 63d0675 to 28a2d4d Compare August 26, 2026 15:04
This reverts the temporary relaxation from 764a27f and extends the test.
cardano-rpc now resolves initial funds from the genesis sgExtraConfig, so the ReadGenesis response carries the wallets that create-testnet-data provisions.
The test now asserts the exact initialFunds map from the genesis file (extraConfig.initialFunds.data preferred, legacy top-level initialFunds as fallback), verifies the returned genesis hash equals the Blake2b-256 hash of the raw Shelley genesis file bytes, and covers the FAILED_PRECONDITION error for a genesis file that changed since the node started.
@carbolymer
carbolymer force-pushed the mgalazyn/test/rpc-readgenesis-initialfunds branch from 28a2d4d to a6566a7 Compare August 27, 2026 14:16
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.

1 participant