Skip to content

Commit 7658eb5

Browse files
committed
repro
1 parent 9386533 commit 7658eb5

File tree

1 file changed

+17
-20
lines changed
  • cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction

1 file changed

+17
-20
lines changed

cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Autobalance.hs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ prop_make_transaction_body_autobalance_multi_asset_collateral = H.propertyOnce $
142142
let ceo = ConwayEraOnwardsConway
143143
beo = convert ceo
144144
sbe = convert beo
145-
meo = convert beo
146-
era = toCardanoEra sbe
147-
aeo <- H.nothingFail $ forEraMaybeEon @AlonzoEraOnwards era
145+
-- meo = convert beo
148146

149147
systemStart <-
150148
fmap SystemStart . H.evalIO $
@@ -156,28 +154,26 @@ prop_make_transaction_body_autobalance_multi_asset_collateral = H.propertyOnce $
156154
LedgerProtocolParameters
157155
<$> H.readJsonFileOk "test/cardano-api-test/files/input/protocol-parameters/conway.json"
158156

159-
(sh@(ScriptHash scriptHash), plutusWitness) <- loadPlutusWitness ceo
160-
let policyId' = PolicyId sh
161-
-- one UTXO with an asset - the same we're minting in the transaction
157+
(_sh@(ScriptHash scriptHash), plutusWitness) <- loadPlutusWitness ceo
158+
159+
PlutusScriptWitness slang psv psori NoScriptDatumForMint rdmr exunits <- pure plutusWitness
160+
-- plutus minting script rewritten for spending
161+
let pw2 = PlutusScriptWitness slang psv psori (ScriptDatumForTxIn Nothing) rdmr exunits
162+
162163
let utxos = mkUtxos beo scriptHash
163-
txInputs = map (,BuildTxWith (KeyWitness KeyWitnessForSpending)) . toList . M.keys . unUTxO $ utxos
164-
txInputsCollateral = TxInsCollateral aeo $ toList . M.keys . unUTxO $ utxos
164+
txInputs =
165+
map (,BuildTxWith (ScriptWitness ScriptWitnessForSpending pw2)) . toList . M.keys . unUTxO $ utxos
165166
let address = mkAddress sbe scriptHash
166-
let txMint =
167-
TxMintValue
168-
meo
169-
[(policyId', [("eeee", 1, BuildTxWith plutusWitness)])]
170167

171168
let content =
172169
defaultTxBodyContent sbe
173170
& setTxIns txInputs
174-
& setTxInsCollateral txInputsCollateral
171+
& setTxInsReference (TxInsReference beo (map fst txInputs))
175172
& setTxOuts (mkTxOutput beo address Nothing)
176-
& setTxMintValue txMint
177173
& setTxProtocolParams (pure $ pure pparams)
178174

179175
-- autobalanced body has assets and ADA in the change txout
180-
(BalancedTxBody balancedContent _ _ fee) <-
176+
(BalancedTxBody _balancedContent _ _ _fee) <-
181177
H.leftFail $
182178
makeTransactionBodyAutoBalance
183179
sbe
@@ -192,11 +188,12 @@ prop_make_transaction_body_autobalance_multi_asset_collateral = H.propertyOnce $
192188
address
193189
Nothing
194190

195-
335_475 === fee
196-
TxReturnCollateral _ (TxOut _ txOutValue _ _) <- H.noteShow $ txReturnCollateral balancedContent
197-
let assets = [a | a@(AssetId _ _, _) <- toList $ txOutValueToValue txOutValue]
198-
H.note_ "Check that all assets from UTXO, from the collateral txin, are in the return collateral."
199-
[(AssetId policyId' "eeee", 1)] === assets
191+
-- 335_475 === fee
192+
-- TxReturnCollateral _ (TxOut _ txOutValue _ _) <- H.noteShow $ txReturnCollateral balancedContent
193+
-- let assets = [a | a@(AssetId _ _, _) <- toList $ txOutValueToValue txOutValue]
194+
-- H.note_ "Check that all assets from UTXO, from the collateral txin, are in the return collateral."
195+
-- [(AssetId policyId' "eeee", 1)] === assets
196+
H.failure
200197

201198
-- | Implements collateral validation from Babbage spec, from
202199
-- https://github.com/IntersectMBO/cardano-ledger/releases, babbage-ledger.pdf, Figure 2.

0 commit comments

Comments
 (0)