Skip to content

Commit bd35a36

Browse files
committed
Added reference test for compatible conway transaction singed-transaction
1 parent 31313dc commit bd35a36

File tree

10 files changed

+566
-8
lines changed

10 files changed

+566
-8
lines changed

cardano-cli/cardano-cli.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ test-suite cardano-cli-test
364364
Test.Cli.Shelley.Run.Hash
365365
Test.Cli.Shelley.Run.Query
366366
Test.Cli.Shelley.Transaction.Build
367+
Test.Cli.Shelley.Transaction.Compatible.Build
367368
Test.Cli.VerificationKey
368369

369370
ghc-options:

cardano-cli/src/Cardano/CLI/Compatible/Transaction.hs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ runCompatibleTransactionCmd
260260
]
261261
-- TODO is this missing something? see EraBased.Run.Transaction L907
262262
validatedRefInputs <- liftEither . first CompatibleTxCmdError $ validateTxInsReference refInputs
263+
let txCerts = convertCertificates certsAndMaybeScriptWits
263264

265+
-- this body is only for witnesses
264266
apiTxBody <-
265267
firstExceptT CompatibleTxBodyError $
266268
hoistEither $
@@ -269,36 +271,39 @@ runCompatibleTransactionCmd
269271
& setTxIns (map (,BuildTxWith (KeyWitness KeyWitnessForSpending)) ins)
270272
& setTxOuts allOuts
271273
& setTxFee (TxFeeExplicit sbe fee)
272-
& setTxCertificates (convertCertificates certsAndMaybeScriptWits)
274+
& setTxCertificates txCerts
273275
& setTxInsReference validatedRefInputs
274276

275277
let (sksByron, sksShelley) = partitionSomeWitnesses $ map categoriseSomeSigningWitness sks
276278

277279
byronWitnesses <-
278-
firstExceptT CompatibleBootstrapWitnessError $
279-
hoistEither (mkShelleyBootstrapWitnesses sbe mNetworkId apiTxBody sksByron)
280+
firstExceptT CompatibleBootstrapWitnessError . hoistEither $
281+
mkShelleyBootstrapWitnesses sbe mNetworkId apiTxBody sksByron
280282

281283
let newShelleyKeyWits = map (makeShelleyKeyWitness sbe apiTxBody) sksShelley
282284
allKeyWits = newShelleyKeyWits ++ byronWitnesses
283285

284286
(protocolUpdates, votes) <-
285287
caseShelleyToBabbageOrConwayEraOnwards
286288
( const $ do
287-
prop <- maybe (return $ NoPParamsUpdate sbe) readUpdateProposalFile mUpdateProposal
289+
prop <- maybe (pure $ NoPParamsUpdate sbe) readUpdateProposalFile mUpdateProposal
288290
return (prop, NoVotes)
289291
)
290292
( \w -> do
291-
prop <- maybe (return $ NoPParamsUpdate sbe) readProposalProcedureFile mProposalProcedure
292-
votesAndWits <- firstExceptT CompatibleVoteError $ newExceptT $ readVotingProceduresFiles w mVotes
293+
prop <- maybe (pure $ NoPParamsUpdate sbe) readProposalProcedureFile mProposalProcedure
294+
votesAndWits <-
295+
firstExceptT CompatibleVoteError . newExceptT $
296+
readVotingProceduresFiles w mVotes
293297
votingProcedures <-
294-
firstExceptT CompatibleVoteMergeError $ hoistEither $ mkTxVotingProcedures votesAndWits
298+
firstExceptT CompatibleVoteMergeError . hoistEither $
299+
mkTxVotingProcedures votesAndWits
295300
return (prop, VotingProcedures w votingProcedures)
296301
)
297302
sbe
298303

299304
signedTx <-
300305
firstExceptT CompatiblePParamsConversionError . hoistEither $
301-
createCompatibleSignedTx sbe ins allOuts allKeyWits fee protocolUpdates votes
306+
createCompatibleSignedTx sbe ins allOuts allKeyWits fee protocolUpdates votes txCerts
302307

303308
firstExceptT CompatibleFileError $
304309
newExceptT $

cardano-cli/test/cardano-cli-golden/files/golden/help.cli

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10723,6 +10723,25 @@ Usage: cardano-cli compatible shelley transaction signed-transaction
1072310723
| --testnet-magic NATURAL
1072410724
]
1072510725
--fee LOVELACE
10726+
[
10727+
--certificate-file FILEPATH
10728+
[ --certificate-script-file FILEPATH
10729+
[
10730+
( --certificate-redeemer-cbor-file CBOR_FILE
10731+
| --certificate-redeemer-file JSON_FILE
10732+
| --certificate-redeemer-value JSON_VALUE
10733+
)
10734+
--certificate-execution-units (INT, INT)]
10735+
| --certificate-tx-in-reference TX-IN
10736+
( --certificate-plutus-script-v2
10737+
| --certificate-plutus-script-v3
10738+
)
10739+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
10740+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
10741+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
10742+
)
10743+
--certificate-reference-tx-in-execution-units (INT, INT)
10744+
]]
1072610745
--out-file FILEPATH
1072710746

1072810747
Create a simple signed transaction.
@@ -10837,6 +10856,25 @@ Usage: cardano-cli compatible allegra transaction signed-transaction
1083710856
| --testnet-magic NATURAL
1083810857
]
1083910858
--fee LOVELACE
10859+
[
10860+
--certificate-file FILEPATH
10861+
[ --certificate-script-file FILEPATH
10862+
[
10863+
( --certificate-redeemer-cbor-file CBOR_FILE
10864+
| --certificate-redeemer-file JSON_FILE
10865+
| --certificate-redeemer-value JSON_VALUE
10866+
)
10867+
--certificate-execution-units (INT, INT)]
10868+
| --certificate-tx-in-reference TX-IN
10869+
( --certificate-plutus-script-v2
10870+
| --certificate-plutus-script-v3
10871+
)
10872+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
10873+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
10874+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
10875+
)
10876+
--certificate-reference-tx-in-execution-units (INT, INT)
10877+
]]
1084010878
--out-file FILEPATH
1084110879

1084210880
Create a simple signed transaction.
@@ -10951,6 +10989,25 @@ Usage: cardano-cli compatible mary transaction signed-transaction
1095110989
| --testnet-magic NATURAL
1095210990
]
1095310991
--fee LOVELACE
10992+
[
10993+
--certificate-file FILEPATH
10994+
[ --certificate-script-file FILEPATH
10995+
[
10996+
( --certificate-redeemer-cbor-file CBOR_FILE
10997+
| --certificate-redeemer-file JSON_FILE
10998+
| --certificate-redeemer-value JSON_VALUE
10999+
)
11000+
--certificate-execution-units (INT, INT)]
11001+
| --certificate-tx-in-reference TX-IN
11002+
( --certificate-plutus-script-v2
11003+
| --certificate-plutus-script-v3
11004+
)
11005+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11006+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11007+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11008+
)
11009+
--certificate-reference-tx-in-execution-units (INT, INT)
11010+
]]
1095411011
--out-file FILEPATH
1095511012

1095611013
Create a simple signed transaction.
@@ -11073,6 +11130,25 @@ Usage: cardano-cli compatible alonzo transaction signed-transaction
1107311130
| --testnet-magic NATURAL
1107411131
]
1107511132
--fee LOVELACE
11133+
[
11134+
--certificate-file FILEPATH
11135+
[ --certificate-script-file FILEPATH
11136+
[
11137+
( --certificate-redeemer-cbor-file CBOR_FILE
11138+
| --certificate-redeemer-file JSON_FILE
11139+
| --certificate-redeemer-value JSON_VALUE
11140+
)
11141+
--certificate-execution-units (INT, INT)]
11142+
| --certificate-tx-in-reference TX-IN
11143+
( --certificate-plutus-script-v2
11144+
| --certificate-plutus-script-v3
11145+
)
11146+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11147+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11148+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11149+
)
11150+
--certificate-reference-tx-in-execution-units (INT, INT)
11151+
]]
1107611152
--out-file FILEPATH
1107711153

1107811154
Create a simple signed transaction.
@@ -11205,6 +11281,25 @@ Usage: cardano-cli compatible babbage transaction signed-transaction
1120511281
| --testnet-magic NATURAL
1120611282
]
1120711283
--fee LOVELACE
11284+
[
11285+
--certificate-file FILEPATH
11286+
[ --certificate-script-file FILEPATH
11287+
[
11288+
( --certificate-redeemer-cbor-file CBOR_FILE
11289+
| --certificate-redeemer-file JSON_FILE
11290+
| --certificate-redeemer-value JSON_VALUE
11291+
)
11292+
--certificate-execution-units (INT, INT)]
11293+
| --certificate-tx-in-reference TX-IN
11294+
( --certificate-plutus-script-v2
11295+
| --certificate-plutus-script-v3
11296+
)
11297+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11298+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11299+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11300+
)
11301+
--certificate-reference-tx-in-execution-units (INT, INT)
11302+
]]
1120811303
--out-file FILEPATH
1120911304

1121011305
Create a simple signed transaction.
@@ -11388,6 +11483,25 @@ Usage: cardano-cli compatible conway transaction signed-transaction
1138811483
| --testnet-magic NATURAL
1138911484
]
1139011485
--fee LOVELACE
11486+
[
11487+
--certificate-file FILEPATH
11488+
[ --certificate-script-file FILEPATH
11489+
[
11490+
( --certificate-redeemer-cbor-file CBOR_FILE
11491+
| --certificate-redeemer-file JSON_FILE
11492+
| --certificate-redeemer-value JSON_VALUE
11493+
)
11494+
--certificate-execution-units (INT, INT)]
11495+
| --certificate-tx-in-reference TX-IN
11496+
( --certificate-plutus-script-v2
11497+
| --certificate-plutus-script-v3
11498+
)
11499+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11500+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11501+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11502+
)
11503+
--certificate-reference-tx-in-execution-units (INT, INT)
11504+
]]
1139111505
--out-file FILEPATH
1139211506

1139311507
Create a simple signed transaction.

0 commit comments

Comments
 (0)