Skip to content

cardano-testnet: Dijkstra hard fork and nested transaction swap tests - #6709

Draft
Jimbo4350 wants to merge 16 commits into
masterfrom
jordan/dijkstra-testnet-start-test
Draft

Jimbo4350 wants to merge 16 commits into
masterfrom
jordan/dijkstra-testnet-start-test

Conversation

@Jimbo4350

@Jimbo4350 Jimbo4350 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Two cardano-testnet integration tests for Dijkstra, plus the config change they need.

Hard fork to Dijkstra starts the default three-node cluster in Conway at protocol version 10 and hard forks it through governance, the way mainnet will: a HardForkInitiation action to PV 11.0 (voted for by the three default DReps and the default SPO, ratified, enacted), then a chained HardForkInitiation action to PV 12.0. It then asserts that the node reports the Dijkstra era over node-to-client, that the ledger state served by the node is a Dijkstra NewEpochState, and that the node keeps producing blocks.

Nested transaction swap additionally mints 100 TokenA to Alice in Conway and funds Bob, then, once in Dijkstra, settles a multi-asset swap with a Dijkstra nested transaction built with cardano-cli dijkstra transaction sub-transaction (IntersectMBO/cardano-cli#1453, via CARDANO_CLI): Alice's sub-transaction gives 100 TokenA for 53 ADA, Bob's gives 60 ADA for the 100 TokenA plus 7 ADA change, the batcher's top-level transaction embeds both and pays the fee. Each party signs only its own sub-transaction. Proof is read back from query utxo: Bob holds the tokens, Alice gained exactly 50 ADA, Bob lost exactly 50 ADA, the batcher paid the fee.

Testnet/Defaults.hs now sets ExperimentalHardForksEnabled: true for every era. Without it the node declares PV11 as its maximum and, once PV12 is enacted, rejects its own blocks with ObsoleteNode and the chain stalls. Golden config updated.

Status

Based on #6721 (js/koslambrou/prepare-11.2), which moves the node to ouroboros-consensus 5.0.0.0, cardano-ledger-core 1.22.0.0 and cardano-ledger-dijkstra 0.4.0.0 from CHaP. Those carry everything the tests need:

On top of #6721's cabal.project this PR repoints two SRPs:

Both tests pass locally on this base with no environment overrides (about 136s each). The "Check git dependencies" CI job fails while the cardano-cli pin points at a PR branch. Rebase onto master once #6721 lands.

Earlier revisions of this PR carried the same two SRPs as #6716 (consensus 4.2.1.0 + #2167, cardano-api 11.7.0.0 + #1362); with those the hard fork test passed and the swap was rejected with SubBadInputsUTxO.

Run with:

DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Hard fork to Dijkstra/"'
DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Nested transaction swap/"'

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated.
  • Any changes are noted in the CHANGELOG.md for affected package (changelog fragment in cardano-testnet/.changes/)
  • The version bounds in .cabal files are updated
  • CI passes.
  • Self-reviewed the diff

🤖 Generated with Claude Code

@Jimbo4350
Jimbo4350 force-pushed the jordan/dijkstra-testnet-start-test branch 2 times, most recently from ad0be01 to d5c25ac Compare September 29, 2026 18:28
@Jimbo4350 Jimbo4350 changed the title cardano-testnet: add test that starts a cluster in the Dijkstra era cardano-testnet: add test that hard forks a cluster into the Dijkstra era Sep 29, 2026
@Jimbo4350 Jimbo4350 changed the title cardano-testnet: add test that hard forks a cluster into the Dijkstra era cardano-testnet: Dijkstra hard fork and nested transaction swap tests Sep 29, 2026
@Jimbo4350
Jimbo4350 force-pushed the jordan/dijkstra-testnet-start-test branch 2 times, most recently from 93980ed to 64e1edb Compare October 5, 2026 20:55
@Jimbo4350
Jimbo4350 changed the base branch from master to js/koslambrou/prepare-11.2 October 5, 2026 20:56
@Jimbo4350
Jimbo4350 changed the base branch from js/koslambrou/prepare-11.2 to master October 6, 2026 19:16
koslambrou and others added 16 commits October 9, 2026 08:38
…for 11.2 release.

* Replace leiosKernelTracer/leiosPeerTracer (removed) with new Peras
  diffusion tracers: perasCertDiffusionInbound/Outbound,
  perasVoteDiffusionInbound/Outbound, perasCertInclusion,
  perasVoteForging — all stubbed with nullTracer for now
* Remove ObjectDiffusion inbound/outbound helpers from Consensus.hs
  (TraceObjectDiffusionInbound/Outbound no longer exported)
* ExtValidationError has two new constructors:
  ExtValidationErrorPerasEpochContextResolver and
  ExtValidationErrorPerasCertInBlock; add pattern matches and
  Show (PerasError blk) constraint to all affected LogFormatting
  instances (TraceEvent, TraceAddBlockEvent, TraceValidationEvent,
  TraceInitChainSelEvent, TraceForgeEvent, ExtValidationError)
* PerasVoteDB.TraceEvent now requires Show (PerasCert blk) instead of
  StandardHash blk for its LogFormatting instance
* Drop stale tracing namespace registrations for removed tracers in
  Consistency.hs and Documentation.hs
* Replace deprecated caseByronOrShelleyBasedEra with inEonForEra
  in tx-generator
* mkNodeKernelAccess gains a ShelleyGenesisFile In argument between the
  genesis hash and block type; extract it alongside the hash in Run.hs
* Update TraceRpc constructor names in Rpc.hs
* Fix incomplete pattern match in namespaceFor for TraceRpcSync:
  add TraceRpcFetchBlockNotFound and TraceRpcNodeKernelAccessUnavailable
* Rename StakeKeyAlreadyRegisteredDELEG to DelegAccountAlreadyRegistered
* Add allow-newer for plutus-scripts-bench plutus-* bounds
* Add PlutusV4 cost model values in emptyDijkstraGenesis (Dijkstra.hs)
There is a mismatch between 369 cost model params given by `testingCostModel
PlutusV4` and what the cardano-ledger expects in `costModelInitParamCount` (251).
… era

Add `hprop_hardfork_to_dijkstra` ("Hard fork to Dijkstra"), which starts
the default three-node cluster in Conway at protocol version 10 and hard
forks it through governance, the way mainnet will:

  1. a HardForkInitiation action to PV 11.0 (Conway intra-era hard fork),
     voted for by the three default DReps and the default SPO, ratified
     and enacted;
  2. a chained HardForkInitiation action to PV 12.0, voted, ratified and
     enacted.

It then asserts that `query tip` and the ledger state served over
node-to-client both report the Dijkstra era, and reuses the existing
block-production and clean-shutdown check.

Set `ExperimentalHardForksEnabled: true` in the generated node
configuration for every era. Without it the node declares PV11 as its
maximum protocol version, so once the ledger enacts PV12 it rejects its
own blocks with `ObsoleteNode` and the chain stalls. The golden default
node configuration is updated accordingly.

Needs ouroboros-consensus >= 5.0. With 4.2.1.0 the governance part
succeeds (PV 10 -> 11 -> 12 is enacted and the node keeps forging at
PV12) but the cluster stays in Conway: `protocolInfoCardano` builds the
Conway ledger config with `TriggerHardForkNotDuringThisExecution`, so
the Dijkstra trigger is ignored (IntersectMBO/ouroboros-consensus#2167).
Add `hprop_nested_transaction_swap` ("Nested transaction swap"). It mints
100 TokenA to Alice in Conway and funds Bob, hard forks the cluster into
Dijkstra through governance (shared with the "Hard fork to Dijkstra"
test), then settles a multi-asset swap with a nested transaction built
with `cardano-cli dijkstra transaction sub-transaction`:

  * Alice's sub-transaction spends her 100 TokenA and pays herself 53 ADA
    (50 ADA price + the 3 ADA that travelled with the tokens);
  * Bob's sub-transaction spends 60 ADA and pays himself the 100 TokenA
    plus 7 ADA change, i.e. exactly 50 ADA;
  * the batcher's top-level transaction embeds both signed
    sub-transactions and pays the fee.

Each sub-transaction is guarded by and signed with its owner's key only.
The proof is read back from `query utxo`: Bob holds the 100 TokenA, Alice
gained exactly 50 ADA, Bob lost exactly 50 ADA, the batcher paid the fee.

The test needs a cardano-cli with the sub-transaction commands
(IntersectMBO/cardano-cli#1453), pointed at via CARDANO_CLI, and
cardano-ledger-dijkstra >= 0.4: before IntersectMBO/cardano-ledger#6129,
UTxO-HD key fetching through `allInputsTxBodyF` did not load
sub-transaction inputs and the ledger rejected the nested transaction
with SubBadInputsUTxO.
…nsactions

Spending a key-locked input already requires the owner's witness on the
sub-transaction, so the --guard-key-hash options added nothing.
…ction commands

Point cardano-api (and cardano-rpc) at IntersectMBO/cardano-api@c9943eb3,
which is master after IntersectMBO/cardano-api#1328 (ouroboros-consensus
5.0, cardano-ledger-core 1.22) and IntersectMBO/cardano-api#1361 (the
Dijkstra sub-transaction API), replacing the input-output-hk fork pin.

Point cardano-cli at IntersectMBO/cardano-cli@c5062645, the head of
IntersectMBO/cardano-cli#1453 ("Add transaction sub-transaction commands
(Dijkstra)") on top of the 11.2 bounds update, so that the cardano-cli in
the build plan has the `dijkstra transaction sub-transaction` commands the
"Nested transaction swap" test needs. Previously the test could only run
with CARDANO_CLI pointing at a separate build of that PR, and a build
against the old ledger at that, since its `create-testnet-data` writes a
Dijkstra genesis without `minPoolMargin`.

With these pins both Dijkstra tests pass with no environment overrides.
The cardano-cli pin is temporary: replace it once #1453 is released.
… SRP

cardano-api 11.8.0.0 and cardano-rpc 11.5.0.0 are now on CHaP and contain
everything the cardano-api source-repository-package provided (cardano-api#1328
and #1361), so drop it and bump the CHaP index-state to 2026-10-07T23:57:11Z.

cardano-api 11.8 requires ouroboros-consensus 5.1, so bump that bound too.
Bump the cardano-cli SRP to the cleaned-up head of cardano-cli#1453, which is
rebased on the cardano-cli 11.3.0.0 release, and bump the local cardano-api,
cardano-rpc and cardano-cli bounds to match.
@Jimbo4350
Jimbo4350 force-pushed the jordan/dijkstra-testnet-start-test branch from 8f3dc1a to 1d3e280 Compare October 9, 2026 12:50

This branch has not been deployed

No deployments
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