diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 46e4c0264..dc623dd61 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -318,6 +318,8 @@ test-suite cardano-api-test cardano-ledger-api ^>=1.9, cardano-ledger-binary, cardano-ledger-core:{cardano-ledger-core, testlib} >=1.8, + cardano-ledger-mary, + cardano-ledger-shelley, cardano-protocol-tpraos, cardano-slotting, cborg, diff --git a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs index 025a2ab87..2f432702f 100644 --- a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs +++ b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs @@ -246,7 +246,7 @@ genPlutusScript _ = genScriptDataSchema :: Gen ScriptDataJsonSchema genScriptDataSchema = Gen.element [ScriptDataJsonNoSchema, ScriptDataJsonDetailedSchema] -genHashableScriptData :: Gen HashableScriptData +genHashableScriptData :: HasCallStack => Gen HashableScriptData genHashableScriptData = do sd <- genScriptData case deserialiseFromCBOR AsHashableScriptData $ serialiseToCBOR sd of diff --git a/cardano-api/internal/Cardano/Api/Experimental/Tx.hs b/cardano-api/internal/Cardano/Api/Experimental/Tx.hs index 6cecdffcd..76566c0df 100644 --- a/cardano-api/internal/Cardano/Api/Experimental/Tx.hs +++ b/cardano-api/internal/Cardano/Api/Experimental/Tx.hs @@ -39,8 +39,8 @@ import Cardano.Ledger.Hashes import qualified Cardano.Ledger.Keys as L import qualified Cardano.Ledger.SafeHash as L -import qualified Data.Map.Strict as Map import qualified Data.Set as Set +import GHC.Exts (IsList (..)) import Lens.Micro -- | A transaction that can contain everything @@ -115,7 +115,7 @@ makeUnsignedTx era bc = obtainCommonConstraints era $ do scriptWitnesses = L.mkBasicTxWits & L.scriptTxWitsL - .~ Map.fromList + .~ fromList [ (L.hashScript sw, sw) | sw <- scripts ] diff --git a/cardano-api/internal/Cardano/Api/Fees.hs b/cardano-api/internal/Cardano/Api/Fees.hs index 727bbf54a..2740f9f68 100644 --- a/cardano-api/internal/Cardano/Api/Fees.hs +++ b/cardano-api/internal/Cardano/Api/Fees.hs @@ -1062,6 +1062,12 @@ makeTransactionBodyAutoBalance -- 2. figure out the overall min fees -- 3. update tx with fees -- 4. balance the transaction and update tx change output + + let totalValueAtSpendableUTxO = fromLedgerValue sbe . calculateIncomingUTxOValue . Map.elems $ unUTxO utxo + change = + monoidForEraInEon (toCardanoEra sbe) $ \w -> + toLedgerValue w $ calculateChangeValue sbe totalValueAtSpendableUTxO txbodycontent + UnsignedTx unsignedTx0 <- first TxBodyError $ makeUnsignedTx @@ -1070,9 +1076,7 @@ makeTransactionBodyAutoBalance $ txbodycontent { txOuts = txOuts txbodycontent - ++ [TxOut changeaddr (lovelaceToTxOutValue sbe 0) TxOutDatumNone ReferenceScriptNone] - -- TODO: think about the size of the change output - -- 1,2,4 or 8 bytes? + <> [TxOut changeaddr (TxOutValueShelleyBased sbe change) TxOutDatumNone ReferenceScriptNone] } exUnitsMapWithLogs <- first TxBodyErrorValidityInterval @@ -1109,12 +1113,6 @@ makeTransactionBodyAutoBalance let maxLovelaceChange = L.Coin (2 ^ (64 :: Integer)) - 1 let maxLovelaceFee = L.Coin (2 ^ (32 :: Integer) - 1) - let totalValueAtSpendableUTxO = fromLedgerValue sbe $ calculateIncomingUTxOValue $ Map.elems $ unUTxO utxo - let change = - forShelleyBasedEraInEon - sbe - mempty - (\w -> toLedgerValue w $ calculateChangeValue sbe totalValueAtSpendableUTxO txbodycontent1) let changeWithMaxLovelace = change & A.adaAssetL sbe .~ maxLovelaceChange let changeTxOut = forShelleyBasedEraInEon @@ -1131,8 +1129,8 @@ makeTransactionBodyAutoBalance $ txbodycontent1 { txFee = TxFeeExplicit sbe maxLovelaceFee , txOuts = - TxOut changeaddr changeTxOut TxOutDatumNone ReferenceScriptNone - : txOuts txbodycontent + txOuts txbodycontent + <> [TxOut changeaddr changeTxOut TxOutDatumNone ReferenceScriptNone] , txReturnCollateral = dummyCollRet , txTotalCollateral = dummyTotColl } @@ -1278,7 +1276,7 @@ isNotAda AdaAssetId = False isNotAda _ = True onlyAda :: Value -> Bool -onlyAda = null . valueToList . filterValue isNotAda +onlyAda = null . toList . filterValue isNotAda calculateIncomingUTxOValue :: Monoid (Ledger.Value (ShelleyLedgerEra era)) diff --git a/cardano-api/internal/Cardano/Api/Tx/Body.hs b/cardano-api/internal/Cardano/Api/Tx/Body.hs index 6eec0fdd4..0e40356f0 100644 --- a/cardano-api/internal/Cardano/Api/Tx/Body.hs +++ b/cardano-api/internal/Cardano/Api/Tx/Body.hs @@ -288,6 +288,7 @@ import qualified Data.Text as Text import Data.Type.Equality (TestEquality (..), (:~:) (Refl)) import Data.Word (Word16, Word32, Word64) import GHC.Exts (IsList (..)) +import GHC.Stack import Lens.Micro hiding (ix) import Lens.Micro.Extras (view) import qualified Text.Parsec as Parsec @@ -709,7 +710,8 @@ toByronTxOut = \case toShelleyTxOut :: forall era ledgerera - . ShelleyLedgerEra era ~ ledgerera + . HasCallStack + => ShelleyLedgerEra era ~ ledgerera => ShelleyBasedEra era -> TxOut CtxUTxO era -> Ledger.TxOut ledgerera @@ -959,12 +961,12 @@ instance IsShelleyBasedEra era => FromJSON (TxOutValue era) where decodeAssetId (polid, Aeson.Object assetNameHm) = do let polId = fromString . Text.unpack $ Aeson.toText polid aNameQuantity <- decodeAssets assetNameHm - pure . valueFromList $ + pure . fromList $ map (first $ AssetId polId) aNameQuantity decodeAssetId ("lovelace", Aeson.Number sci) = case toBoundedInteger sci of Just (ll :: Word64) -> - pure $ valueFromList [(AdaAssetId, Quantity $ toInteger ll)] + pure $ fromList [(AdaAssetId, Quantity $ toInteger ll)] Nothing -> fail $ "Expected a Bounded number but got: " <> show sci decodeAssetId wrong = fail $ "Expected a policy id and a JSON object but got: " <> show wrong @@ -1829,7 +1831,7 @@ outputDoesNotExceedMax -> TxOut CtxTx era -> Either TxBodyError () outputDoesNotExceedMax era v txout = - case [q | (_, q) <- valueToList v, q > maxTxOut] of + case [q | (_, q) <- toList v, q > maxTxOut] of [] -> Right () q : _ -> Left (TxBodyOutputOverflow q (txOutInAnyEra era txout)) @@ -1840,7 +1842,7 @@ positiveOutput -> TxOut CtxTx era -> Either TxBodyError () positiveOutput era v txout = - case [q | (_, q) <- valueToList v, q < 0] of + case [q | (_, q) <- toList v, q < 0] of [] -> Right () q : _ -> Left (TxBodyOutputNegative q (txOutInAnyEra era txout)) @@ -3057,7 +3059,8 @@ makeShelleyTransactionBody -- embedded datums (taking only their hash). toShelleyTxOutAny :: forall ctx era ledgerera - . ShelleyLedgerEra era ~ ledgerera + . HasCallStack + => ShelleyLedgerEra era ~ ledgerera => ShelleyBasedEra era -> TxOut ctx era -> Ledger.TxOut ledgerera diff --git a/cardano-api/internal/Cardano/Api/Value.hs b/cardano-api/internal/Cardano/Api/Value.hs index 695cfe7ec..819e7eb33 100644 --- a/cardano-api/internal/Cardano/Api/Value.hs +++ b/cardano-api/internal/Cardano/Api/Value.hs @@ -189,7 +189,7 @@ newtype Value = Value (Map AssetId Quantity) instance Show Value where showsPrec d v = showParen (d > 10) $ - showString "valueFromList " . shows (valueToList v) + showString "valueFromList " . shows (toList v) instance Semigroup Value where Value a <> Value b = Value (mergeAssetMaps a b) @@ -197,6 +197,14 @@ instance Semigroup Value where instance Monoid Value where mempty = Value Map.empty +instance IsList Value where + type Item Value = (AssetId, Quantity) + fromList = + Value + . Map.filter (/= 0) + . Map.fromListWith (<>) + toList (Value m) = toList m + {-# NOINLINE mergeAssetMaps #-} -- as per advice in Data.Map.Merge docs mergeAssetMaps :: Map AssetId Quantity @@ -223,14 +231,13 @@ instance FromJSON Value where selectAsset :: Value -> (AssetId -> Quantity) selectAsset (Value m) a = Map.findWithDefault mempty a m +{-# DEPRECATED valueFromList "Use 'fromList' instead." #-} valueFromList :: [(AssetId, Quantity)] -> Value -valueFromList = - Value - . Map.filter (/= 0) - . Map.fromListWith (<>) +valueFromList = fromList +{-# DEPRECATED valueToList "Use 'toList' instead." #-} valueToList :: Value -> [(AssetId, Quantity)] -valueToList (Value m) = toList m +valueToList = toList -- | This lets you write @a - b@ as @a <> negateValue b@. negateValue :: Value -> Value diff --git a/cardano-api/internal/Cardano/Api/ValueParser.hs b/cardano-api/internal/Cardano/Api/ValueParser.hs index fe3163cd4..ada6c83bf 100644 --- a/cardano-api/internal/Cardano/Api/ValueParser.hs +++ b/cardano-api/internal/Cardano/Api/ValueParser.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE OverloadedLists #-} + module Cardano.Api.ValueParser ( parseValue , assetName @@ -34,9 +36,8 @@ evalValueExpr vExpr = case vExpr of ValueExprAdd x y -> evalValueExpr x <> evalValueExpr y ValueExprNegate x -> negateValue (evalValueExpr x) - ValueExprLovelace quant -> valueFromList [(AdaAssetId, quant)] - ValueExprMultiAsset polId aName quant -> - valueFromList [(AssetId polId aName, quant)] + ValueExprLovelace quant -> [(AdaAssetId, quant)] + ValueExprMultiAsset polId aName quant -> [(AssetId polId aName, quant)] ------------------------------------------------------------------------------ -- Expression parser diff --git a/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Value.hs b/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Value.hs index 3342921e1..9430e858a 100644 --- a/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Value.hs +++ b/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Value.hs @@ -11,6 +11,7 @@ import Data.Aeson (eitherDecode, encode) import Data.List (groupBy, sort) import qualified Data.Map.Strict as Map import qualified Data.Text as Text +import GHC.Exts (IsList (..)) import qualified Text.Parsec as Parsec (parse) import Test.Gen.Cardano.Api.Typed (genAssetName, genValueDefault, genValueNestedRep) @@ -47,7 +48,7 @@ hprop_goldenValue_1_lovelace :: Property hprop_goldenValue_1_lovelace = H.propertyOnce $ do valueList <- pure [(Api.AdaAssetId, 1)] - value <- pure $ Text.unpack $ Api.renderValuePretty $ Api.valueFromList valueList + value <- pure $ Text.unpack $ Api.renderValuePretty $ fromList valueList H.diffVsGoldenFile value "test/cardano-api-golden/files/golden/Cardano/Api/Value/value-ada-1.json" @@ -57,7 +58,7 @@ hprop_goldenValue1 = policyId <- pure $ Api.PolicyId "a0000000000000000000000000000000000000000000000000000000" assetName <- pure $ Api.AssetName "asset1" valueList <- pure [(Api.AssetId policyId assetName, 1)] - value <- pure $ Text.unpack $ Api.renderValuePretty $ Api.valueFromList valueList + value <- pure $ Text.unpack $ Api.renderValuePretty $ fromList valueList H.diffVsGoldenFile value diff --git a/cardano-api/test/cardano-api-golden/Test/Golden/ErrorsSpec.hs b/cardano-api/test/cardano-api-golden/Test/Golden/ErrorsSpec.hs index d0e24c40e..19cc09359 100644 --- a/cardano-api/test/cardano-api-golden/Test/Golden/ErrorsSpec.hs +++ b/cardano-api/test/cardano-api-golden/Test/Golden/ErrorsSpec.hs @@ -382,7 +382,7 @@ test_TxBodyErrorAutoBalance = , ("TxBodyErrorMinUTxONotMet", TxBodyErrorMinUTxONotMet txOutInAnyEra1 1) , ( "TxBodyErrorNonAdaAssetsUnbalanced" - , TxBodyErrorNonAdaAssetsUnbalanced (valueFromList [(AdaAssetId, Quantity 1)]) + , TxBodyErrorNonAdaAssetsUnbalanced (fromList [(AdaAssetId, Quantity 1)]) ) , ( "TxBodyErrorScriptWitnessIndexMissingFromExecUnitsMap" diff --git a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs index cead101db..320496519 100644 --- a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs +++ b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs @@ -1,7 +1,14 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE OverloadedLists #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} + +{- HLINT ignore "Use list comprehension" -} +{- HLINT ignore "Use camelCase" -} module Test.Cardano.Api.Typed.TxBody ( tests @@ -10,24 +17,34 @@ where import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Shelley (ReferenceScript (..), ShelleyLedgerEra, - refScriptToShelleyScript) +import Cardano.Api.Script +import Cardano.Api.Shelley (Address (..), LedgerProtocolParameters (..), ShelleyLedgerEra) + +import qualified Cardano.Ledger.Mary.Value as L +import qualified Cardano.Ledger.Shelley.Scripts as L +import qualified Cardano.Slotting.EpochInfo as CS +import qualified Cardano.Slotting.Slot as CS +import qualified Cardano.Slotting.Time as CS +import qualified Data.ByteString as B +import Data.Function +import qualified Data.Map.Strict as M import Data.Maybe (isJust) +import qualified Data.Time.Format as DT import Data.Type.Equality (TestEquality (testEquality)) -import GHC.Exts (IsList (..)) +import GHC.Exts (IsList (..), IsString (..)) +import GHC.Stack -import Test.Gen.Cardano.Api.Typed (genValidTxBody) +import Test.Gen.Cardano.Api.Typed import Test.Cardano.Api.Typed.Orphans () import Hedgehog (MonadTest, Property, (===)) import qualified Hedgehog as H +import qualified Hedgehog.Extras as H import Test.Tasty (TestTree, testGroup) import Test.Tasty.Hedgehog (testProperty) -{- HLINT ignore "Use camelCase" -} - -- | Check the txOuts in a TxBodyContent after a ledger roundtrip. prop_roundtrip_txbodycontent_txouts :: forall era. ShelleyBasedEra era -> Property prop_roundtrip_txbodycontent_txouts era = H.property $ do @@ -107,6 +124,174 @@ prop_roundtrip_txbodycontent_conway_fields = H.property $ do getProposalProcedures TxProposalProceduresNone = Nothing getProposalProcedures txpp@(TxProposalProcedures _ _) = Just . toList $ convProposalProcedures txpp +-- | Test that the fee is the same when spending minted asset manually or when autobalancing it +prop_make_transaction_body_autobalance_return_correct_fee_for_multi_asset :: Property +prop_make_transaction_body_autobalance_return_correct_fee_for_multi_asset = H.propertyOnce $ do + let sbe = ShelleyBasedEraConway + era = toCardanoEra sbe + aeo <- H.nothingFail $ forEraMaybeEon @AlonzoEraOnwards era + + systemStart <- + fmap SystemStart . H.evalIO $ + DT.parseTimeM True DT.defaultTimeLocale "%Y-%m-%dT%H:%M:%S%QZ" "2021-09-01T00:00:00Z" + + let epochInfo = LedgerEpochInfo $ CS.fixedEpochInfo (CS.EpochSize 100) (CS.mkSlotLength 1000) + + pparams <- + LedgerProtocolParameters @ConwayEra + <$> H.readJsonFileOk "test/cardano-api-test/files/input/protocol-parameters/conway.json" + + plutusWitness <- loadPlutusWitness + + let scriptHashStr = "e2b715a86bee4f14fef84081217f9e2646893a7d60a38af69e0aa572" + let policyId' = fromString scriptHashStr + let scriptHash = L.ScriptHash $ fromString scriptHashStr + -- one UTXO with an asset - the same we're minting in the transaction + let utxos = + UTxO + [ + ( TxIn + "01f4b788593d4f70de2a45c2e1e87088bfbdfa29577ae1b62aba60e095e3ab53" + (TxIx 0) + , TxOut + ( AddressInEra + (ShelleyAddressInEra ShelleyBasedEraConway) + ( ShelleyAddress + L.Testnet + ( L.KeyHashObj $ + L.KeyHash "ebe9de78a37f84cc819c0669791aa0474d4f0a764e54b9f90cfe2137" + ) + L.StakeRefNull + ) + ) + ( TxOutValueShelleyBased + ShelleyBasedEraConway + ( L.MaryValue + (L.Coin 4_000_000) + (L.MultiAsset [(L.PolicyID scriptHash, [(L.AssetName "eeee", 1)])]) + ) + ) + TxOutDatumNone + ReferenceScriptNone + ) + ] + + txInputs = map (,BuildTxWith (KeyWitness KeyWitnessForSpending)) . toList . M.keys . unUTxO $ utxos + txInputsCollateral = TxInsCollateral aeo $ toList . M.keys . unUTxO $ utxos + + let address = + AddressInEra + (ShelleyAddressInEra ShelleyBasedEraConway) + ( ShelleyAddress + L.Testnet + (L.ScriptHashObj scriptHash) + L.StakeRefNull + ) + let txOutputs doesIncludeAsset = + [ TxOut + address + ( TxOutValueShelleyBased + ShelleyBasedEraConway + ( L.MaryValue + (L.Coin 2_000_000) + ( L.MultiAsset $ + if doesIncludeAsset + then [(L.PolicyID scriptHash, [(L.AssetName "eeee", 2)])] + else [] + ) + ) + ) + TxOutDatumNone + ReferenceScriptNone + ] + + let txMint = + TxMintValue + MaryEraOnwardsConway + [(AssetId policyId' "eeee", 1)] + (BuildTxWith [(policyId', plutusWitness)]) + + -- tx body content without an asset in TxOut + let content = + defaultTxBodyContent sbe + & setTxIns txInputs + & setTxInsCollateral txInputsCollateral + & setTxOuts (txOutputs False) -- include minted asset in txout manually + & setTxMintValue txMint + & setTxProtocolParams (pure $ pure pparams) + + -- tx body content with manually added asset to TxOut + let contentWithTxoutAsset = content & setTxOuts (txOutputs True) + + -- change txout only with ADA + (BalancedTxBody balancedContentWithTxoutAsset _ _ feeWithTxoutAsset) <- + H.leftFail $ + makeTransactionBodyAutoBalance + sbe + systemStart + epochInfo + pparams + mempty + mempty + mempty + utxos + contentWithTxoutAsset + address + Nothing + -- the correct amount with manual balancing of assets + 335_729 === feeWithTxoutAsset + + -- autobalanced body has assets and ADA in the change txout + (BalancedTxBody balancedContent _ _ fee) <- + H.leftFail $ + makeTransactionBodyAutoBalance + sbe + systemStart + epochInfo + pparams + mempty + mempty + mempty + utxos + content + address + Nothing + + H.noteShow_ feeWithTxoutAsset + H.noteShow_ fee + H.note_ "There are differences between fees for two autobalanced TxBodyContents. Diff:" + H.diff balancedContentWithTxoutAsset (\_ _ -> feeWithTxoutAsset == fee) balancedContent + feeWithTxoutAsset === fee + where + loadPlutusWitness + :: HasCallStack + => MonadFail m + => MonadIO m + => MonadTest m + => m (ScriptWitness WitCtxMint ConwayEra) + loadPlutusWitness = do + envelope <- + H.leftFailM $ + fmap (deserialiseFromJSON AsTextEnvelope) . H.evalIO $ + B.readFile "test/cardano-api-test/files/input/plutus/v3.alwaysTrue.json" + ScriptInAnyLang (PlutusScriptLanguage PlutusScriptV3) (PlutusScript PlutusScriptV3 script) <- + H.leftFail $ deserialiseFromTextEnvelopeAnyOf textEnvTypes envelope + pure $ + PlutusScriptWitness + PlutusScriptV3InConway + PlutusScriptV3 + (PScript script) + NoScriptDatumForMint + (unsafeHashableScriptData (ScriptDataMap [])) + (ExecutionUnits 0 0) + + textEnvTypes :: [FromSomeType HasTextEnvelope ScriptInAnyLang] + textEnvTypes = + [ FromSomeType + (AsScript AsPlutusScriptV3) + (ScriptInAnyLang (PlutusScriptLanguage PlutusScriptV3)) + ] + tests :: TestTree tests = testGroup @@ -118,4 +303,7 @@ tests = , testProperty "roundtrip txbodycontent new conway fields" prop_roundtrip_txbodycontent_conway_fields + , testProperty + "makeTransactionBodyAutoBalance test correct fees when mutli-asset tx" + prop_make_transaction_body_autobalance_return_correct_fee_for_multi_asset ] diff --git a/cardano-api/test/cardano-api-test/files/input/plutus/v3.alwaysTrue.json b/cardano-api/test/cardano-api-test/files/input/plutus/v3.alwaysTrue.json new file mode 100644 index 000000000..03e9ec6ec --- /dev/null +++ b/cardano-api/test/cardano-api-test/files/input/plutus/v3.alwaysTrue.json @@ -0,0 +1,5 @@ +{ + "type": "PlutusScriptV3", + "description": "that's a simple script which always returs True - I'm not sure why it's that big though", + "cborHex": "590b2c590b29010100323232323232323232232498c8c8c954ccd5cd19b874800000844c8c8c8c8c8c8c8ca002646464aa666ae68cdc3a4000004226464646464646464646464646464646466666666666646664664664444444444444445001010807c03a01b00c805c02a013008803c01a00b004801c00a00230013574202860026ae8404cc0908c8c8c954ccd5cd19b87480000084600260406ae84006600a6ae84d5d1000844c0b52401035054310035573c0046aae74004dd5000998120009aba1011232323255333573466e1d20000021132328009919192a999ab9a3370e900000108c004c08cd5d0800ccc0848c8c8c954ccd5cd19b874800000846002604e6ae8400422aa666ae68cdc3a40040042265003375a6ae8400a6eb4d5d0800cdd69aba1357440023574400222606a9201035054310035573c0046aae74004dd50009aba135744002113031491035054310035573c0046aae74004dd51aba100398039aba10029919192a999ab9a3370e900000108c0004554ccd5cd19b87480080084600a6eb8d5d080084554ccd5cd19b8748010008460066ae840042260629201035054310035573c0046aae74004dd51aba10019980f3ae357426ae880046ae88004d5d1000889816249035054310035573c0046aae74004dd50009bad3574201e60026ae84038c004c005d69981100b1aba100c33301501975a6ae8402cc8c8c954ccd5cd19b874800000846002646464aa666ae68cdc3a4000004230013302b75a6ae8400660546ae84d5d1000844c0b5241035054310035573c0046aae74004dd51aba10019919192a999ab9a3370e900000108c004cc0add69aba100198151aba13574400211302d4901035054310035573c0046aae74004dd51aba13574400211302a4901035054310035573c0046aae74004dd51aba100a3302275c6ae84024ccc0548c8c8c954ccd5cd19b8748000008460066eb8d5d080084554ccd5cd19b874800800846012603c6ae8400422aa666ae68cdc3a400800423007301d357420021155333573466e1d2006002118009bad35742003301a357426ae8800422aa666ae68cdc3a40100042300b301c357420021155333573466e1d200a002118029bad357420033018357426ae880042260569201035054310035573c0046aae74004dd50008119aba1008330010233574200e6eb8d5d080319980a80c1980a81311919192a999ab9a3370e900000108c0084554ccd5cd19b87480080084600822aa666ae68cdc3a40080042300011302b491035054310035573c0046aae74004dd50009aba1005330220143574200860046ae8400cc008d5d09aba2003301475c602aeb4d5d10009aba2001357440026ae88004d5d10009aba2001357440026ae88004d5d10009aba2001357440026ae88004d5d10009aba20011130174901035054310035573c0046aae74004dd51aba10099aba10089919192a999ab9a3370e900000108c00cdd71aba100108aa999ab9a3370e900100108c024c028d5d0800ccc01c04cd5d09aba200108aa999ab9a3370e900200108c01cc024d5d080084554ccd5cd19b8748018008460026eb4d5d0800cc018d5d09aba200108aa999ab9a3370e900400108c02cc020d5d080084554ccd5cd19b87480280084600a6eb4d5d0800cc010d5d09aba200108980ba481035054310035573c0046aae74004dd51aba135744010232323255333573466e1d200000211328009bad35742005300a3574200332323255333573466e1d200000211328049980600d9aba10029aba1001998063ae357426ae880046ae880044554ccd5cd19b874800800846002660160346ae84006646464aa666ae68cdc3a400000423001375a6ae840066eb4d5d09aba200108980f2481035054310035573c0046aae74004dd51aba1357440021155333573466e1d200400211805999804806bad357420033300b75c6ae84d5d100084554ccd5cd19b87480180084600e660160346ae8400422aa666ae68cdc3a401000422646500d3300d01c357420073301800f3574200533300b00f75a6ae840072646464aa666ae68cdc3a400000423001375a6ae840066eb4d5d09aba20010898102481035054310035573c0046aae74004dd51aba13574400322330180020010d5d10009aba20011155333573466e1d200a002118029980580d1aba10019919192a999ab9a3370e900000108998073ae3574200222603c9201035054310035573c0046aae74004dd51aba1357440021155333573466e1d200c0021180108980da481035054310035573c0046aae74004dd51aba1357440023574400222602e9201035054310035573c0046aae74004dd50009119118011bab00130152233335573e0025000232801c004c018d55ce800cc014d55cf000a60086ae8800c6ae8400a0004646464aa666ae68cdc3a40000042300d3007357420033300575a6ae84d5d100084554ccd5cd19b874800800846026600e6ae840066600aeb4d5d09aba200108a992999ab9a3370e900200188c00cc020d5d08014c004d5d09aba200208aa999ab9a3370e90030018899402cc024d5d0801cc008d5d0800cdd69aba1357440023574400422aa666ae68cdc3a401000623009300835742005375a6ae84d5d100104554ccd5cd19b874802800c4602a60106ae8400822aa666ae68cdc3a401800623011300835742005375a6ae84d5d100104554ccd5cd19b874803800c4600a6eb8d5d08014dd71aba1357440041155333573466e1d2010003118039bae35742005375a6ae84d5d100104554ccd5cd19b874804800c4600260106ae8400a60106ae84d5d100104554ccd5cd19b874805000c4601e60106ae8400822602c9210350543100232323255333573466e1d2000002118009bae35742002115325333573466e1d20020031180298009aba100208aa999ab9a3370e900200188c00cdd71aba100298009aba13574400411301a49010350543100232323255333573466e1d20000021180098079aba100108aa999ab9a3370e900100108c0084554ccd5cd19b87480100084600822603a9201035054310035573c0046aae74004dd50009aab9e00235573a0026ea8004d55cf0011aab9d001375400244646464aa666ae68cdc3a4004004230021155333573466e1d20000021180098029aba100108980aa49035054310035573c0046aae74004dd500091919192a999ab9a3370e900000108c004c014d5d080084554ccd5cd19b874800800846006600a6ae8400422aa666ae68cdc3a400800423005375c6ae840042260269201035054310035573c0046aae74004dd500091919192a999ab9a3370e900000108c004dd71aba100108aa999ab9a3370e900100108c00cdd71aba1001089809249035054310035573c0046aae74004dd500091919192a999ab9a3370e900000108c004dd71aba10019bad357426ae880042260229201035054310035573c0046aae74004dd50009aba200111300c4901035054310035573c0046aae74004dd500098041112a999ab9a3370e9000000889805248103505433001155333573466e200052000113300333702900000119b814800000444ca00266e1000c00666e1000800466008004002600e444aa666ae68cdc3a400000222004226600600266e180080048c88c008dd60009803911999aab9f00128001400cc010d5d08014c00cd5d1001200040024646464aa666ae68cdc3a4000004230021155333573466e1d200200211800089803a481035054310035573c0046aae74004dd5000911919192a999ab9a3370e900000108c0084554ccd5cd19b874800800846002600a6ae8400422aa666ae68cdc3a400800423004113007491035054310035573c0046aae74004dd500091919192a999ab9a3370e900000108c004dd71aba10019bad357426ae8800422600a9201035054310035573c0046aae74004dd5000919319ab9c0018001191800800918011198010010009" +} diff --git a/cardano-api/test/cardano-api-test/files/input/protocol-parameters/conway.json b/cardano-api/test/cardano-api-test/files/input/protocol-parameters/conway.json new file mode 100644 index 000000000..f4389997c --- /dev/null +++ b/cardano-api/test/cardano-api-test/files/input/protocol-parameters/conway.json @@ -0,0 +1,671 @@ +{ + "collateralPercentage": 150, + "committeeMaxTermLength": 5000000, + "committeeMinSize": 0, + "costModels": { + "PlutusV1": [ + 197209, + 0, + 1, + 1, + 396231, + 621, + 0, + 1, + 150000, + 1000, + 0, + 1, + 150000, + 32, + 2477736, + 29175, + 4, + 29773, + 100, + 29773, + 100, + 29773, + 100, + 29773, + 100, + 29773, + 100, + 29773, + 100, + 100, + 100, + 29773, + 100, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 1000, + 0, + 1, + 150000, + 32, + 150000, + 1000, + 0, + 8, + 148000, + 425507, + 118, + 0, + 1, + 1, + 150000, + 1000, + 0, + 8, + 150000, + 112536, + 247, + 1, + 150000, + 10000, + 1, + 136542, + 1326, + 1, + 1000, + 150000, + 1000, + 1, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 1, + 1, + 150000, + 1, + 150000, + 4, + 103599, + 248, + 1, + 103599, + 248, + 1, + 145276, + 1366, + 1, + 179690, + 497, + 1, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 148000, + 425507, + 118, + 0, + 1, + 1, + 61516, + 11218, + 0, + 1, + 150000, + 32, + 148000, + 425507, + 118, + 0, + 1, + 1, + 148000, + 425507, + 118, + 0, + 1, + 1, + 2477736, + 29175, + 4, + 0, + 82363, + 4, + 150000, + 5000, + 0, + 1, + 150000, + 32, + 197209, + 0, + 1, + 1, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 150000, + 32, + 3345831, + 1, + 1 + ], + "PlutusV2": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1159724, + 392670, + 0, + 2, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 35892428, + 10, + 9462713, + 1021, + 10, + 38887044, + 32947, + 10, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807, + 9223372036854775807 + ], + "PlutusV3": [ + 100788, + 420, + 1, + 1, + 1000, + 173, + 0, + 1, + 1000, + 59957, + 4, + 1, + 11183, + 32, + 201305, + 8356, + 4, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 100, + 100, + 16000, + 100, + 94375, + 32, + 132994, + 32, + 61462, + 4, + 72010, + 178, + 0, + 1, + 22151, + 32, + 91189, + 769, + 4, + 2, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 1, + 1000, + 42921, + 4, + 2, + 24548, + 29498, + 38, + 1, + 898148, + 27279, + 1, + 51775, + 558, + 1, + 39184, + 1000, + 60594, + 1, + 141895, + 32, + 83150, + 32, + 15299, + 32, + 76049, + 1, + 13169, + 4, + 22100, + 10, + 28999, + 74, + 1, + 28999, + 74, + 1, + 43285, + 552, + 1, + 44749, + 541, + 1, + 33852, + 32, + 68246, + 32, + 72362, + 32, + 7243, + 32, + 7391, + 32, + 11546, + 32, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 90434, + 519, + 0, + 1, + 74433, + 32, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 1, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 955506, + 213312, + 0, + 2, + 270652, + 22588, + 4, + 1457325, + 64566, + 4, + 20467, + 1, + 4, + 0, + 141992, + 32, + 100788, + 420, + 1, + 1, + 81663, + 32, + 59498, + 32, + 20142, + 32, + 24588, + 32, + 20744, + 32, + 25933, + 32, + 24623, + 32, + 43053543, + 10, + 53384111, + 14333, + 10, + 43574283, + 26308, + 10, + 16000, + 100, + 16000, + 100, + 962335, + 18, + 2780678, + 6, + 442008, + 1, + 52538055, + 3756, + 18, + 267929, + 18, + 76433006, + 8868, + 18, + 52948122, + 18, + 1995836, + 36, + 3227919, + 12, + 901022, + 1, + 166917843, + 4307, + 36, + 284546, + 36, + 158221314, + 26549, + 36, + 74698472, + 36, + 333849714, + 1, + 254006273, + 72, + 2174038, + 72, + 2261318, + 64571, + 4, + 207616, + 8310, + 4, + 1293828, + 28716, + 63, + 0, + 1, + 1006041, + 43623, + 251, + 0, + 1 + ] + }, + "dRepActivity": 20, + "dRepDeposit": 2000000, + "dRepVotingThresholds": { + "committeeNoConfidence": 0.51, + "committeeNormal": 0.51, + "hardForkInitiation": 0.51, + "motionNoConfidence": 0.51, + "ppEconomicGroup": 0.51, + "ppGovGroup": 0.51, + "ppNetworkGroup": 0.51, + "ppTechnicalGroup": 0.51, + "treasuryWithdrawal": 0.51, + "updateToConstitution": 0.51 + }, + "executionUnitPrices": { + "priceMemory": 5.77e-2, + "priceSteps": 7.21e-5 + }, + "govActionDeposit": 1000000000, + "govActionLifetime": 100, + "maxBlockBodySize": 65536, + "maxBlockExecutionUnits": { + "memory": 80000000, + "steps": 40000000000 + }, + "maxBlockHeaderSize": 1100, + "maxCollateralInputs": 3, + "maxTxExecutionUnits": { + "memory": 16000000, + "steps": 10000000000 + }, + "maxTxSize": 16384, + "maxValueSize": 5000, + "minFeeRefScriptCostPerByte": 0, + "minPoolCost": 0, + "monetaryExpansion": 0.1, + "poolPledgeInfluence": 0, + "poolRetireMaxEpoch": 18, + "poolVotingThresholds": { + "committeeNoConfidence": 0.51, + "committeeNormal": 0.51, + "hardForkInitiation": 0.51, + "motionNoConfidence": 0.51, + "ppSecurityGroup": 0.51 + }, + "protocolVersion": { + "major": 9, + "minor": 0 + }, + "stakeAddressDeposit": 0, + "stakePoolDeposit": 0, + "stakePoolTargetNum": 100, + "treasuryCut": 0.1, + "txFeeFixed": 155381, + "txFeePerByte": 44, + "utxoCostPerByte": 4310 +} \ No newline at end of file