Skip to content

Commit dbc9255

Browse files
committed
Added reference test for compatible conway transaction singed-transaction
1 parent 7965ce2 commit dbc9255

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
@@ -360,6 +360,7 @@ test-suite cardano-cli-test
360360
Test.Cli.Shelley.Run.Hash
361361
Test.Cli.Shelley.Run.Query
362362
Test.Cli.Shelley.Transaction.Build
363+
Test.Cli.Shelley.Transaction.Compatible.Build
363364
Test.Cli.VerificationKey
364365

365366
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
@@ -10787,6 +10787,25 @@ Usage: cardano-cli compatible shelley transaction signed-transaction
1078710787
| --testnet-magic NATURAL
1078810788
]
1078910789
--fee LOVELACE
10790+
[
10791+
--certificate-file FILEPATH
10792+
[ --certificate-script-file FILEPATH
10793+
[
10794+
( --certificate-redeemer-cbor-file CBOR_FILE
10795+
| --certificate-redeemer-file JSON_FILE
10796+
| --certificate-redeemer-value JSON_VALUE
10797+
)
10798+
--certificate-execution-units (INT, INT)]
10799+
| --certificate-tx-in-reference TX-IN
10800+
( --certificate-plutus-script-v2
10801+
| --certificate-plutus-script-v3
10802+
)
10803+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
10804+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
10805+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
10806+
)
10807+
--certificate-reference-tx-in-execution-units (INT, INT)
10808+
]]
1079010809
--out-file FILEPATH
1079110810

1079210811
Create a simple signed transaction.
@@ -10901,6 +10920,25 @@ Usage: cardano-cli compatible allegra transaction signed-transaction
1090110920
| --testnet-magic NATURAL
1090210921
]
1090310922
--fee LOVELACE
10923+
[
10924+
--certificate-file FILEPATH
10925+
[ --certificate-script-file FILEPATH
10926+
[
10927+
( --certificate-redeemer-cbor-file CBOR_FILE
10928+
| --certificate-redeemer-file JSON_FILE
10929+
| --certificate-redeemer-value JSON_VALUE
10930+
)
10931+
--certificate-execution-units (INT, INT)]
10932+
| --certificate-tx-in-reference TX-IN
10933+
( --certificate-plutus-script-v2
10934+
| --certificate-plutus-script-v3
10935+
)
10936+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
10937+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
10938+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
10939+
)
10940+
--certificate-reference-tx-in-execution-units (INT, INT)
10941+
]]
1090410942
--out-file FILEPATH
1090510943

1090610944
Create a simple signed transaction.
@@ -11015,6 +11053,25 @@ Usage: cardano-cli compatible mary transaction signed-transaction
1101511053
| --testnet-magic NATURAL
1101611054
]
1101711055
--fee LOVELACE
11056+
[
11057+
--certificate-file FILEPATH
11058+
[ --certificate-script-file FILEPATH
11059+
[
11060+
( --certificate-redeemer-cbor-file CBOR_FILE
11061+
| --certificate-redeemer-file JSON_FILE
11062+
| --certificate-redeemer-value JSON_VALUE
11063+
)
11064+
--certificate-execution-units (INT, INT)]
11065+
| --certificate-tx-in-reference TX-IN
11066+
( --certificate-plutus-script-v2
11067+
| --certificate-plutus-script-v3
11068+
)
11069+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11070+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11071+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11072+
)
11073+
--certificate-reference-tx-in-execution-units (INT, INT)
11074+
]]
1101811075
--out-file FILEPATH
1101911076

1102011077
Create a simple signed transaction.
@@ -11137,6 +11194,25 @@ Usage: cardano-cli compatible alonzo transaction signed-transaction
1113711194
| --testnet-magic NATURAL
1113811195
]
1113911196
--fee LOVELACE
11197+
[
11198+
--certificate-file FILEPATH
11199+
[ --certificate-script-file FILEPATH
11200+
[
11201+
( --certificate-redeemer-cbor-file CBOR_FILE
11202+
| --certificate-redeemer-file JSON_FILE
11203+
| --certificate-redeemer-value JSON_VALUE
11204+
)
11205+
--certificate-execution-units (INT, INT)]
11206+
| --certificate-tx-in-reference TX-IN
11207+
( --certificate-plutus-script-v2
11208+
| --certificate-plutus-script-v3
11209+
)
11210+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11211+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11212+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11213+
)
11214+
--certificate-reference-tx-in-execution-units (INT, INT)
11215+
]]
1114011216
--out-file FILEPATH
1114111217

1114211218
Create a simple signed transaction.
@@ -11269,6 +11345,25 @@ Usage: cardano-cli compatible babbage transaction signed-transaction
1126911345
| --testnet-magic NATURAL
1127011346
]
1127111347
--fee LOVELACE
11348+
[
11349+
--certificate-file FILEPATH
11350+
[ --certificate-script-file FILEPATH
11351+
[
11352+
( --certificate-redeemer-cbor-file CBOR_FILE
11353+
| --certificate-redeemer-file JSON_FILE
11354+
| --certificate-redeemer-value JSON_VALUE
11355+
)
11356+
--certificate-execution-units (INT, INT)]
11357+
| --certificate-tx-in-reference TX-IN
11358+
( --certificate-plutus-script-v2
11359+
| --certificate-plutus-script-v3
11360+
)
11361+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11362+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11363+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11364+
)
11365+
--certificate-reference-tx-in-execution-units (INT, INT)
11366+
]]
1127211367
--out-file FILEPATH
1127311368

1127411369
Create a simple signed transaction.
@@ -11452,6 +11547,25 @@ Usage: cardano-cli compatible conway transaction signed-transaction
1145211547
| --testnet-magic NATURAL
1145311548
]
1145411549
--fee LOVELACE
11550+
[
11551+
--certificate-file FILEPATH
11552+
[ --certificate-script-file FILEPATH
11553+
[
11554+
( --certificate-redeemer-cbor-file CBOR_FILE
11555+
| --certificate-redeemer-file JSON_FILE
11556+
| --certificate-redeemer-value JSON_VALUE
11557+
)
11558+
--certificate-execution-units (INT, INT)]
11559+
| --certificate-tx-in-reference TX-IN
11560+
( --certificate-plutus-script-v2
11561+
| --certificate-plutus-script-v3
11562+
)
11563+
( --certificate-reference-tx-in-redeemer-cbor-file CBOR_FILE
11564+
| --certificate-reference-tx-in-redeemer-file JSON_FILE
11565+
| --certificate-reference-tx-in-redeemer-value JSON_VALUE
11566+
)
11567+
--certificate-reference-tx-in-execution-units (INT, INT)
11568+
]]
1145511569
--out-file FILEPATH
1145611570

1145711571
Create a simple signed transaction.

0 commit comments

Comments
 (0)