Summary
cardano-cli transaction witness writes a text envelope of type
TxWitness DijkstraEra, but cardano-cli transaction assemble (alias
sign-witness) only accepts TxWitness ShelleyEra through
TxWitness ConwayEra. The witness round-trip is broken inside a single binary
whenever the era is Dijkstra.
Steps to reproduce
Against a Dijkstra testnet (protocol version 12), with cardano-cli 11.1.0.0:
cardano-cli dijkstra transaction build-raw ... --out-file tx.body
cardano-cli dijkstra transaction witness --tx-body-file tx.body --signing-key-file payment.skey --out-file tx.witness
cardano-cli dijkstra transaction assemble --tx-body-file tx.body --witness-file tx.witness --out-file tx.signed
Actual
Error: Failed to decode the ledger's CDDL serialisation format. TextEnvelope type error: Expected one of: TxWitness ShelleyEra, TxWitness AllegraEra, TxWitness MaryEra, TxWitness AlonzoEra, TxWitness BabbageEra, TxWitness ConwayEra Actual: TxWitness DijkstraEra
CallStack (from HasCallStack):
fromExceptTCli, called at src/Cardano/CLI/EraBased/Transaction/Run.hs:119:41 in cardano-cli-11.1.0.0:Cardano.CLI.EraBased.Transaction.Run
runTransactionCmds, called at src/Cardano/CLI/EraBased/Run.hs:61:5 in cardano-cli-11.1.0.0:Cardano.CLI.EraBased.Run
runCmds, called at src/Cardano/CLI/EraBased/Run.hs:35:35 in cardano-cli-11.1.0.0:Cardano.CLI.EraBased.Run
runAnyEraCommand, called at src/Cardano/CLI/Run.hs:56:5 in cardano-cli-11.1.0.0:Cardano.CLI.Run
runClientCommand, called at app/cardano-cli.hs:58:14 in cardano-cli-11.1.0.0:Main
with tx.witness containing exactly what the previous command wrote:
{
"type": "TxWitness DijkstraEra",
"description": "Key Witness ShelleyEra",
"cborHex": "8258..."
}
Expected
transaction assemble accepts a witness produced by transaction witness of
the same binary and era.
Cause
readFileInAnyShelleyBasedEra in cardano-cli/src/Cardano/CLI/Read.hs:619-638
hardcodes the accepted eras, and the list was not extended for Dijkstra:
readFileInAnyShelleyBasedEra
:: ( HasTextEnvelope (thing ShelleyEra)
, HasTextEnvelope (thing AllegraEra)
, HasTextEnvelope (thing MaryEra)
, HasTextEnvelope (thing AlonzoEra)
, HasTextEnvelope (thing BabbageEra)
, HasTextEnvelope (thing ConwayEra)
)
=> (forall era. AsType era -> AsType (thing era))
-> FileOrPipe
-> IO (Either (FileError TextEnvelopeError) (InAnyShelleyBasedEra thing))
readFileInAnyShelleyBasedEra asThing =
readFileOrPipeTextEnvelopeAnyOf
[ FromSomeType (asThing AsShelleyEra) (InAnyShelleyBasedEra ShelleyBasedEraShelley)
, FromSomeType (asThing AsAllegraEra) (InAnyShelleyBasedEra ShelleyBasedEraAllegra)
, FromSomeType (asThing AsMaryEra) (InAnyShelleyBasedEra ShelleyBasedEraMary)
, FromSomeType (asThing AsAlonzoEra) (InAnyShelleyBasedEra ShelleyBasedEraAlonzo)
, FromSomeType (asThing AsBabbageEra) (InAnyShelleyBasedEra ShelleyBasedEraBabbage)
, FromSomeType (asThing AsConwayEra) (InAnyShelleyBasedEra ShelleyBasedEraConway)
]
That list is what the "Expected one of:" in the error is built from. The call
chain is short and has exactly one entry point:
readFileInAnyShelleyBasedEra (Read.hs:630)
-> readFileTxKeyWitness (Read.hs:339-344, its only caller)
-> runTransactionSignWitnessCmd (EraBased/Transaction/Run.hs:1752, its only caller)
= transaction assemble / transaction sign-witness (EraBased/Transaction/Option.hs:80,146)
so transaction assemble is the only affected command.
cardano-api is not at fault here. At the revision this was found with
(f5ee53d4c26bd0d36540a2a6d06899ff9376aa9b) it is Dijkstra-complete:
Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs:286 - maxBound = AnyShelleyBasedEra ShelleyBasedEraDijkstra
Cardano/Api/Serialise/TextEnvelope/Internal.hs:355,362,369,376 - all four * DijkstraEra envelope types are mapped
Cardano/Api/Tx/Internal/Sign.hs:295,847 - the writers emit Tx DijkstraEra and TxWitness DijkstraEra
That is also why the rest of the tx workflow is fine: readFileTx and
readFileTxBody go through fromSomeShelleyTx (Read.hs:328-331), which
derives its list from [minBound .. maxBound] and therefore picked Dijkstra up
automatically. Only the hand-written list did not.
Versions
- cardano-cli 11.1.0.0
- Reproduced with cardano-cli
de786557757db816af2dcf56b0a667cecfced011, the leios-prototype revision pinned by cardano-node cabal.project
- Present unchanged on cardano-cli master
174b30d14, so this is not specific to the leios branch
Summary
cardano-cli transaction witnesswrites a text envelope of typeTxWitness DijkstraEra, butcardano-cli transaction assemble(aliassign-witness) only acceptsTxWitness ShelleyErathroughTxWitness ConwayEra. The witness round-trip is broken inside a single binarywhenever the era is Dijkstra.
Steps to reproduce
Against a Dijkstra testnet (protocol version 12), with cardano-cli 11.1.0.0:
Actual
with
tx.witnesscontaining exactly what the previous command wrote:{ "type": "TxWitness DijkstraEra", "description": "Key Witness ShelleyEra", "cborHex": "8258..." }Expected
transaction assembleaccepts a witness produced bytransaction witnessofthe same binary and era.
Cause
readFileInAnyShelleyBasedEraincardano-cli/src/Cardano/CLI/Read.hs:619-638hardcodes the accepted eras, and the list was not extended for Dijkstra:
That list is what the "Expected one of:" in the error is built from. The call
chain is short and has exactly one entry point:
readFileInAnyShelleyBasedEra(Read.hs:630)->
readFileTxKeyWitness(Read.hs:339-344, its only caller)->
runTransactionSignWitnessCmd(EraBased/Transaction/Run.hs:1752, its only caller)=
transaction assemble/transaction sign-witness(EraBased/Transaction/Option.hs:80,146)so
transaction assembleis the only affected command.cardano-api is not at fault here. At the revision this was found with
(
f5ee53d4c26bd0d36540a2a6d06899ff9376aa9b) it is Dijkstra-complete:Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs:286-maxBound = AnyShelleyBasedEra ShelleyBasedEraDijkstraCardano/Api/Serialise/TextEnvelope/Internal.hs:355,362,369,376- all four* DijkstraEraenvelope types are mappedCardano/Api/Tx/Internal/Sign.hs:295,847- the writers emitTx DijkstraEraandTxWitness DijkstraEraThat is also why the rest of the tx workflow is fine:
readFileTxandreadFileTxBodygo throughfromSomeShelleyTx(Read.hs:328-331), whichderives its list from
[minBound .. maxBound]and therefore picked Dijkstra upautomatically. Only the hand-written list did not.
Versions
de786557757db816af2dcf56b0a667cecfced011, theleios-prototyperevision pinned by cardano-nodecabal.project174b30d14, so this is not specific to the leios branch