Repository navigation
Add transaction sub-transaction commands (Dijkstra) - #1453
Merged
Merged
Conversation
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
from
September 29, 2026 13:35
1a5e13d to
2f85784
Compare
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
5 times, most recently
from
September 29, 2026 19:08
c76aa6b to
573c791
Compare
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
from
September 29, 2026 19:09
573c791 to
03011f3
Compare
Jimbo4350
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Sep 29, 2026
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. It does not
assert the era after the hard fork on purpose, so that on a consensus that
never leaves Conway the failure shows up at submission ("The node is
running in the Conway era, but the transaction is for the Dijkstra era").
Supporting changes:
* `Testnet.Components.Query.stopEpochStateView` stops the client-side
ledger fold behind an EpochStateView. cardano-api 11.7's ledger event
conversion has no Dijkstra case and dies on the first Dijkstra block,
so both Dijkstra tests stop the view before PV12 can be enacted, keep
the epoch state logger off, and observe the node through the CLI.
* `hardForkToDijkstra` waits for PV12 via `query protocol-parameters`
and the era assertion now explains that a Conway answer means the
pinned consensus ignores the Dijkstra trigger.
Jimbo4350
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Oct 5, 2026
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.
Jimbo4350
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Oct 5, 2026
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.
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
from
October 6, 2026 18:49
03011f3 to
c506264
Compare
Jimbo4350
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Oct 6, 2026
…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.
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
from
October 8, 2026 12:35
c506264 to
9215632
Compare
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
2 times, most recently
from
October 8, 2026 14:17
7ec3f6a to
ecc5d0f
Compare
Jimbo4350
marked this pull request as ready for review
October 8, 2026 17:05
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
from
October 8, 2026 17:05
ecc5d0f to
8140104
Compare
Jimbo4350
requested review from
carbolymer,
disassembler,
kevinhammond and
palas
as code owners
October 8, 2026 17:05
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Script guards cannot currently be witnessed, and the signing command advertises an unusable Byron-address option.
2 open findings
What changed in this PR
Adds Dijkstra-only sub-transaction construction, signing, identification, and embedding support.
Changes:
- Adds
sub-transaction build-raw,sign, andtxid. - Embeds repeatable signed sub-transactions in top-level transactions.
- Adds CLI, golden, help, envelope, and changelog coverage.
| File | Description |
|---|---|
.changes/20260929_114047_cardano-cli_jordan.millar_sub_transaction_commands.yml |
Adds the feature changelog. |
cardano-cli/cardano-cli.cabal |
Registers new modules and tests. |
cardano-cli/src/Cardano/CLI/Compatible/Transaction/Run.hs |
Uses the relocated witness helper. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/Command.hs |
Adds sub-transaction commands and build arguments. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/Internal/Common.hs |
Extracts shared transaction-building helpers. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/Option.hs |
Integrates Dijkstra-only parsers. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs |
Embeds signed sub-transactions. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/SubTransaction/Command.hs |
Defines command argument types. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/SubTransaction/Option.hs |
Defines command and guard parsers. |
cardano-cli/src/Cardano/CLI/EraBased/Transaction/SubTransaction/Run.hs |
Builds, signs, identifies, and reads sub-transactions. |
cardano-cli/src/Cardano/CLI/Read.hs |
Reads signed and unsigned envelopes. |
cardano-cli/src/Cardano/CLI/Type/Common.hs |
Adds sub-transaction file types. |
cardano-cli/src/Cardano/CLI/Type/Error/TxCmdError.hs |
Adds duplicate and Byron-witness errors. |
cardano-cli/test/cardano-cli-test/Test/Cli/Transaction/SubTransaction.hs |
Tests rejection and era-gating behavior. |
cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/Transaction/SubTransaction.hs |
Tests the end-to-end pipeline. |
cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/transaction/sub-transaction/signed_out |
Pins the signed envelope. |
cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/transaction/sub-transaction/tx_body_with_sub_tx_out |
Pins the embedded transaction body. |
cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/transaction/sub-transaction/txid_out |
Pins the sub-transaction ID. |
cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/transaction/sub-transaction/unsigned_out |
Pins the unsigned envelope. |
cardano-cli/test/cardano-cli-golden/files/golden/help.cli |
Updates aggregate help. |
cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_transaction.cli |
Lists the new command group. |
cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_transaction_build-raw.cli |
Documents embedding options. |
cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_transaction_sub-transaction.cli |
Documents the subgroup. |
cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_transaction_sub-transaction_build-raw.cli |
Documents sub-transaction construction. |
cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_transaction_sub-transaction_sign.cli |
Documents signing. |
cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_transaction_sub-transaction_txid.cli |
Documents ID output. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| fmap SubTransactionSignCmd $ | ||
| SubTransactionSignCmdArgs | ||
| <$> pUnsignedSubTxFileIn | ||
| <*> many pWitnessSigningData |
palas
reviewed
Oct 8, 2026
palas
left a comment
Contributor
There was a problem hiding this comment.
I like the design, it is very simple. I include a couple of issues I saw. I probably should look more in depth at the code later. But it looks good in general
…ation Add era-aware and explicit-language parsers for all six script purposes, removing obsolete wrappers and version helpers. Top-level builders select languages using their actual era; Dijkstra sub-transactions use V4-only parsers directly. Reject pre-V4 executed sub-transaction witnesses. Cover V4 reference scripts, older top-level languages, native and stored scripts, and era restrictions.
Refresh the top-level transaction help goldens and changelog to reflect the era-aware parser changes.
…ards Add required top-level guards to sub-transaction build-raw
Jimbo4350
force-pushed
the
jordan/basic-sub-tx-integration
branch
from
October 14, 2026 15:27
55cff1e to
7467cef
Compare
Jimbo4350
enabled auto-merge
October 14, 2026 15:39
Jimbo4350
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Oct 14, 2026
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.
This was referenced Oct 15, 2026
21 of 28 tasks
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.

Changelog
Context
First cut of nested (sub-)transaction support in
cardano-cli. Dijkstra lets a top-level transaction embed sub-transactions that other parties build and sign on their own.sub-transaction build-rawtakes the Conway-era options a sub-transaction body shares with a top-level one, plus guards (--guard-key-hash,--guard-verification-key,--guard-verification-key-file,--guard-script-hash), which replace required signers in Dijkstra. No fee, collateral, required signers or script validity.Unwitnessed SubTx DijkstraEra/Witnessed SubTx DijkstraEra. Sub-transactions are fixed to Dijkstra on the API side, so there is no era index. Only signed sub-transactions can be embedded, and duplicates are rejected, since the ledger keys sub-transactions by id.--signed-sub-tx-fileare gated on the era GADT and do not exist underconway.lateststill maps to Conway.Builds against the released
cardano-api11.9.0.0 from CHaP, which carries the merged sub-transaction support (IntersectMBO/cardano-api#1361). Nosource-repository-packagestanzas.Deferred to follow-ups:
sub-transaction witness/assemble,--required-top-level-guard*,--direct-deposit,--account-balance-interval,--signed-sub-tx-fileon the balancedbuild(fee estimation does not account for sub-transactions yet), and showing sub-transactions indebug transaction view.How to trust this PR
Test.Golden.Dijkstra.Transaction.SubTransactionpins every file in the pipeline: unsigned and signed sub-transaction envelopes, the sub-transaction id (equal before and after signing), and a top-level body embedding the sub-transaction, which then signs and identifies as usual.Test.Cli.Transaction.SubTransactionchecks that the group and--signed-sub-tx-filedo not parse underconway, that duplicate and unsigned sub-transactions are rejected, and that Byron keys are refused for sub-transaction signing.dijkstra;conway_*andlatest_*are byte-identical.Checklist
.changes/