Skip to content

Commit a73f17f

Browse files
committed
Address remarks
1 parent e28dd6f commit a73f17f

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

cardano-api/src/Cardano/Api/Genesis/Internal.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ conwayGenesisDefaults =
271271

272272
costModelParamsForTesting :: HasCallStack => [(V3.ParamName, Int64)]
273273
costModelParamsForTesting =
274-
-- all geneses should contain only the number of cost model params equal to the initial number
274+
-- all geneses should have exactly the number of cost model params equal to the initial number
275+
-- initial number - a number of parameters for the language, when the plutus language was introduced
275276
take (L.costModelInitParamCount PlutusV3)
276277
. Map.toList
277278
. fromJust

cardano-api/test/cardano-api-test/Test/Cardano/Api/CBOR.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ prop_text_envelope_roundtrip_txbody_CBOR = H.property $ do
9191
deserialiseFromTextEnvelope
9292
)
9393

94-
_prop_text_envelope_roundtrip_tx_CBOR :: Property
95-
_prop_text_envelope_roundtrip_tx_CBOR = H.property $ do
94+
prop_text_envelope_roundtrip_tx_CBOR :: Property
95+
prop_text_envelope_roundtrip_tx_CBOR = H.property $ do
9696
AnyShelleyBasedEra era <- H.noteShowM . H.forAll $ Gen.element [minBound .. maxBound]
9797
x <- H.forAll $ genTx era
9898
shelleyBasedEraConstraints
@@ -427,8 +427,8 @@ tests =
427427
[ testProperty "test canonicalisation of CBOR" prop_canonicalise_cbor
428428
, testProperty "rountrip txbody text envelope" prop_text_envelope_roundtrip_txbody_CBOR
429429
, testProperty "txbody backwards compatibility" prop_txbody_backwards_compatibility
430-
, -- , testProperty "rountrip tx text envelope" prop_text_envelope_roundtrip_tx_CBOR
431-
testProperty "roundtrip witness CBOR" prop_roundtrip_witness_CBOR
430+
, testProperty "rountrip tx text envelope" prop_text_envelope_roundtrip_tx_CBOR
431+
, testProperty "roundtrip witness CBOR" prop_roundtrip_witness_CBOR
432432
, testProperty "roundtrip legacy key witness CBOR" prop_roundtrip_legacy_key_witness_CBOR
433433
, testProperty
434434
"roundtrip operational certificate CBOR"

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ prop_make_transaction_body_autobalance_return_correct_fee_for_multi_asset = H.pr
334334
feeWithTxoutAsset === fee
335335

336336
prop_make_transaction_body_autobalance_when_deregistering_certs :: Property
337-
prop_make_transaction_body_autobalance_when_deregistering_certs = H.propertyOnce $ do
337+
prop_make_transaction_body_autobalance_when_deregistering_certs = H.property $ do
338338
let ceo = ConwayEraOnwardsConway
339339
beo = convert ceo
340340
sbe = convert beo
@@ -354,15 +354,22 @@ prop_make_transaction_body_autobalance_when_deregistering_certs = H.propertyOnce
354354
address = mkAddress sbe scriptHash
355355
deregDeposit = L.Coin 20_000_000
356356
txOutCoin = L.Coin 20_800_000
357-
358-
-- that's the same stake credential as in UTXO
359-
lStakeCred@(L.KeyHashObj kh) <-
360-
pure $ mkCredential "keyHash-ebe9de78a37f84cc819c0669791aa0474d4f0a764e54b9f90cfe2137"
361-
let stakeCred = StakeCredentialByKey $ StakeKeyHash kh
357+
mkStakeKeyFromHash hashStr = do
358+
(L.KeyHashObj kh) <-
359+
pure $ mkCredential hashStr
360+
pure . StakeCredentialByKey $ StakeKeyHash kh
361+
362+
(expectedFee, stakeCred) <-
363+
forAll $
364+
Gen.choice
365+
-- expected fee is larger, when the certificate credential does not match the credential required when witnessing UTXO
366+
[ (180_901,) <$> genStakeCredential
367+
, (176_457,) <$> mkStakeKeyFromHash "keyHash-ebe9de78a37f84cc819c0669791aa0474d4f0a764e54b9f90cfe2137"
368+
]
362369
let certs =
363370
[
364371
( ConwayCertificate ceo $
365-
L.ConwayTxCertDeleg (L.ConwayUnRegCert lStakeCred (L.SJust deregDeposit))
372+
L.ConwayTxCertDeleg (L.ConwayUnRegCert (toShelleyStakeCredential stakeCred) (L.SJust deregDeposit))
366373
, Nothing
367374
)
368375
]
@@ -395,7 +402,7 @@ prop_make_transaction_body_autobalance_when_deregistering_certs = H.propertyOnce
395402
H.note_ "Sanity check: inputs == outputs"
396403
mconcat [deregDeposit, txInputsTotalCoin] === mconcat [txOutCoin, fee, changeCoin]
397404

398-
176_457 === fee
405+
expectedFee === fee
399406

400407
prop_make_transaction_body_autobalance_multi_asset_collateral :: Property
401408
prop_make_transaction_body_autobalance_multi_asset_collateral = H.propertyOnce $ do

0 commit comments

Comments
 (0)