From 3aaf840c358b3e3147bf4e335ba40d3ada9afcd7 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Mon, 17 Jun 2024 15:33:55 +0200 Subject: [PATCH 1/4] Add the following fields for PV2 cost model: "byteStringToInteger-cpu-arguments-c0" "byteStringToInteger-cpu-arguments-c1" "byteStringToInteger-cpu-arguments-c2" "byteStringToInteger-memory-arguments-intercept" "byteStringToInteger-memory-arguments-slope" "integerToByteString-cpu-arguments-c0" "integerToByteString-cpu-arguments-c1" "integerToByteString-cpu-arguments-c2" "integerToByteString-memory-arguments-intercept" "integerToByteString-memory-arguments-slope" Add the following fields to the PV3 cost model: "divideInteger-cpu-arguments-model-arguments-minimum" "divideInteger-cpu-arguments-model-arguments-c20" "divideInteger-cpu-arguments-model-arguments-c11" "divideInteger-cpu-arguments-model-arguments-c10" "divideInteger-cpu-arguments-model-arguments-c02" "divideInteger-cpu-arguments-model-arguments-c01" "divideInteger-cpu-arguments-model-arguments-c00" "modInteger-cpu-arguments-model-arguments-minimum" "modInteger-cpu-arguments-model-arguments-c20" "modInteger-cpu-arguments-model-arguments-c11" "modInteger-cpu-arguments-model-arguments-c10" "modInteger-cpu-arguments-model-arguments-c02" "modInteger-cpu-arguments-model-arguments-c01" "modInteger-cpu-arguments-model-arguments-c00" "quotientInteger-cpu-arguments-model-arguments-minimum" "quotientInteger-cpu-arguments-model-arguments-c20" "quotientInteger-cpu-arguments-model-arguments-c11" "quotientInteger-cpu-arguments-model-arguments-c10" "quotientInteger-cpu-arguments-model-arguments-c02" "quotientInteger-cpu-arguments-model-arguments-c01" "quotientInteger-cpu-arguments-model-arguments-c00" "remainderInteger-cpu-arguments-model-arguments-c20" "remainderInteger-cpu-arguments-model-arguments-c11" "remainderInteger-cpu-arguments-model-arguments-c10" "remainderInteger-cpu-arguments-model-arguments-c02" "remainderInteger-cpu-arguments-model-arguments-c01" "remainderInteger-cpu-arguments-model-arguments-c00" "remainderInteger-cpu-arguments-model-arguments-minimum" Modify `governanceActionId` to use Word16 instead of Word32 --- .../EraBased/Commands/Governance/Actions.hs | 10 ++--- .../CLI/EraBased/Commands/Governance/Vote.hs | 2 +- .../Cardano/CLI/EraBased/Options/Common.hs | 14 +++---- cardano-cli/src/Cardano/CLI/Read.hs | 2 +- .../CostModelsErrorJSONDecode.txt | 2 +- ...y-create-protocol-parameters-update.action | 2 +- .../cardano-cli-golden/files/golden/help.cli | 12 +++--- ..._governance_action_create-constitution.cli | 4 +- ...nway_governance_action_create-hardfork.cli | 4 +- ...governance_action_create-no-confidence.cli | 4 +- ...tion_create-protocol-parameters-update.cli | 4 +- ...way_governance_action_update-committee.cli | 4 +- .../help/conway_governance_vote_create.cli | 4 +- .../files/input/governance/costmodels.json | 38 +++++++++++++++++++ 14 files changed, 72 insertions(+), 34 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs index 760e7bf67d..ffb080bca6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -54,7 +54,7 @@ data GovernanceActionUpdateCommitteeCmdArgs era , oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey] , newCommitteeVkeySource :: ![(VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey, EpochNo)] , requiredThreshold :: !Rational - , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) + , mPrevGovernanceActionId :: !(Maybe (TxId, Word16)) , outFile :: !(File () Out) } deriving Show @@ -64,7 +64,7 @@ data GovernanceActionCreateConstitutionCmdArgs era , networkId :: !L.Network , deposit :: !L.Coin , stakeCredential :: !StakeIdentifier - , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) + , mPrevGovernanceActionId :: !(Maybe (TxId, Word16)) , proposalUrl :: !ProposalUrl , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , constitutionUrl :: !ConstitutionUrl @@ -93,7 +93,7 @@ data GovernanceActionCreateNoConfidenceCmdArgs era , returnStakeAddress :: !StakeIdentifier , proposalUrl :: !ProposalUrl , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) - , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) + , mPrevGovernanceActionId :: !(Maybe (TxId, Word16)) , outFile :: !(File () Out) } deriving Show @@ -133,7 +133,7 @@ data GovernanceActionHardforkInitCmdArgs era , networkId :: !L.Network , deposit :: !L.Coin , returnStakeAddress :: !StakeIdentifier - , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) + , mPrevGovernanceActionId :: !(Maybe (TxId, Word16)) , proposalUrl :: !ProposalUrl , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , protVer :: !L.ProtVer @@ -156,7 +156,7 @@ data UpdateProtocolParametersConwayOnwards era , returnAddr :: !StakeIdentifier , proposalUrl :: !ProposalUrl , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) - , governanceActionId :: !(Maybe (TxId, Word32)) + , governanceActionId :: !(Maybe (TxId, Word16)) , constitutionScriptHash :: !(Maybe ScriptHash) } diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs index b7ee797aeb..2a86444c6c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs @@ -28,7 +28,7 @@ data GovernanceVoteCreateCmdArgs era = GovernanceVoteCreateCmdArgs { eon :: ConwayEraOnwards era , voteChoice :: Vote - , governanceAction :: (TxId, Word32) + , governanceAction :: (TxId, Word16) , votingStakeCredentialSource :: AnyVotingStakeVerificationKeyOrHashOrFile , mAnchor :: Maybe (VoteUrl, L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: VoteFile Out diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 077e32eab0..51152773c1 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -3284,21 +3284,21 @@ pAnchorDataHash = , Opt.help "Proposal anchor data hash (obtain it with \"cardano-cli conway governance hash anchor-data ...\")" ] -pPreviousGovernanceAction :: Parser (Maybe (TxId, Word32)) +pPreviousGovernanceAction :: Parser (Maybe (TxId, Word16)) pPreviousGovernanceAction = optional $ (,) <$> pTxId "prev-governance-action-tx-id" "Txid of the previous governance action." - <*> pWord32 "prev-governance-action-index" "Action index of the previous governance action." + <*> pWord16 "prev-governance-action-index" "Action index of the previous governance action." -pGovernanceActionId :: Parser (TxId, Word32) +pGovernanceActionId :: Parser (TxId, Word16) pGovernanceActionId = (,) <$> pTxId "governance-action-tx-id" "Txid of the governance action." - <*> pWord32 "governance-action-index" "Tx's governance action index." + <*> pWord16 "governance-action-index" "Tx's governance action index." -pWord32 :: String -> String -> Parser Word32 -pWord32 l h = +pWord16 :: String -> String -> Parser Word16 +pWord16 l h = Opt.option auto $ mconcat [ Opt.long l - , Opt.metavar "WORD32" + , Opt.metavar "WORD16" , Opt.help h ] diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index f5056e93ea..4ba7e9fd12 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -909,7 +909,7 @@ instance Error CostModelsError where CostModelsErrorReadFile e -> "Cannot read cost model: " <> prettyError e CostModelsErrorJSONDecode fp err -> - "Error decoding JSON cost model at " <> pshow fp <> ": " <> pshow err <> formatExplanation + "Error decoding JSON cost model at " <> pshow fp <> ": " <> pretty err <> formatExplanation CostModelsErrorEmpty fp -> "The decoded cost model was empty at: " <> pshow fp <> formatExplanation where diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Read.CostModelsError/CostModelsErrorJSONDecode.txt b/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Read.CostModelsError/CostModelsErrorJSONDecode.txt index 15859578bb..198cbdd1cc 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Read.CostModelsError/CostModelsErrorJSONDecode.txt +++ b/cardano-cli/test/cardano-cli-golden/files/golden/errors/Cardano.CLI.Read.CostModelsError/CostModelsErrorJSONDecode.txt @@ -1,4 +1,4 @@ -Error decoding JSON cost model at "some/file.txt": "some error" +Error decoding JSON cost model at "some/file.txt": some error The expected format of the cost models file is { "PlutusV1" : , diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action index ab4baae9b1..f008b54022 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action @@ -1,5 +1,5 @@ { "type": "Governance proposal", "description": "Update protocol parameters proposal", - "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff029f0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30a01010101010101010101ff029f0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 1ed44f99c8..20d08ac01a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -6702,7 +6702,7 @@ Usage: cardano-cli conway governance action create-constitution | --deposit-return-stake-address ADDRESS ) [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --anchor-url TEXT --anchor-data-hash HASH --constitution-url TEXT @@ -6739,7 +6739,7 @@ Usage: cardano-cli conway governance action update-committee --epoch NATURAL] --threshold RATIONAL [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --out-file FILE Create or update a new committee proposal. @@ -6772,7 +6772,7 @@ Usage: cardano-cli conway governance action create-no-confidence --anchor-url TEXT --anchor-data-hash HASH [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --out-file FILE Create a no confidence proposal. @@ -6791,7 +6791,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update --anchor-url TEXT --anchor-data-hash HASH [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] [--constitution-script-hash HASH] [--min-fee-linear LOVELACE] [--min-fee-constant LOVELACE] @@ -6877,7 +6877,7 @@ Usage: cardano-cli conway governance action create-hardfork | --deposit-return-stake-address ADDRESS ) [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --anchor-url TEXT --anchor-data-hash HASH --protocol-major-version MAJOR @@ -7042,7 +7042,7 @@ Usage: cardano-cli conway governance vote (create | view) Usage: cardano-cli conway governance vote create (--yes | --no | --abstain) --governance-action-tx-id TXID - --governance-action-index WORD32 + --governance-action-index WORD16 ( --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli index efa8460f1b..ef1d1678ce 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-constitution.cli @@ -10,7 +10,7 @@ Usage: cardano-cli conway governance action create-constitution | --deposit-return-stake-address ADDRESS ) [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --anchor-url TEXT --anchor-data-hash HASH --constitution-url TEXT @@ -37,7 +37,7 @@ Available options: Target stake address (bech32 format). --prev-governance-action-tx-id TXID Txid of the previous governance action. - --prev-governance-action-index WORD32 + --prev-governance-action-index WORD16 Action index of the previous governance action. --anchor-url TEXT Anchor URL --anchor-data-hash HASH Proposal anchor data hash (obtain it with diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-hardfork.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-hardfork.cli index 42ceb54aaa..9d88d05f3a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-hardfork.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-hardfork.cli @@ -10,7 +10,7 @@ Usage: cardano-cli conway governance action create-hardfork | --deposit-return-stake-address ADDRESS ) [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --anchor-url TEXT --anchor-data-hash HASH --protocol-major-version MAJOR @@ -36,7 +36,7 @@ Available options: Target stake address (bech32 format). --prev-governance-action-tx-id TXID Txid of the previous governance action. - --prev-governance-action-index WORD32 + --prev-governance-action-index WORD16 Action index of the previous governance action. --anchor-url TEXT Anchor URL --anchor-data-hash HASH Proposal anchor data hash (obtain it with diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli index 18880bc996..78eb1bb6eb 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-no-confidence.cli @@ -12,7 +12,7 @@ Usage: cardano-cli conway governance action create-no-confidence --anchor-url TEXT --anchor-data-hash HASH [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --out-file FILE Create a no confidence proposal. @@ -37,7 +37,7 @@ Available options: "cardano-cli conway governance hash anchor-data ...") --prev-governance-action-tx-id TXID Txid of the previous governance action. - --prev-governance-action-index WORD32 + --prev-governance-action-index WORD16 Action index of the previous governance action. --out-file FILE Output filepath of the no confidence proposal. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli index b5a9187cb1..fc60182e65 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-protocol-parameters-update.cli @@ -12,7 +12,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update --anchor-url TEXT --anchor-data-hash HASH [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] [--constitution-script-hash HASH] [--min-fee-linear LOVELACE] [--min-fee-constant LOVELACE] @@ -82,7 +82,7 @@ Available options: "cardano-cli conway governance hash anchor-data ...") --prev-governance-action-tx-id TXID Txid of the previous governance action. - --prev-governance-action-index WORD32 + --prev-governance-action-index WORD16 Action index of the previous governance action. --constitution-script-hash HASH Constitution script hash (hex-encoded). Obtain it diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_update-committee.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_update-committee.cli index df3cd3add2..6d3cf63196 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_update-committee.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_update-committee.cli @@ -25,7 +25,7 @@ Usage: cardano-cli conway governance action update-committee --epoch NATURAL] --threshold RATIONAL [--prev-governance-action-tx-id TXID - --prev-governance-action-index WORD32] + --prev-governance-action-index WORD16] --out-file FILE Create or update a new committee proposal. @@ -73,7 +73,7 @@ Available options: approving a governance action. --prev-governance-action-tx-id TXID Txid of the previous governance action. - --prev-governance-action-index WORD32 + --prev-governance-action-index WORD16 Action index of the previous governance action. --out-file FILE The output file. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli index 3a618d9dfd..9c68379fb4 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_vote_create.cli @@ -1,6 +1,6 @@ Usage: cardano-cli conway governance vote create (--yes | --no | --abstain) --governance-action-tx-id TXID - --governance-action-index WORD32 + --governance-action-index WORD16 ( --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH @@ -22,7 +22,7 @@ Usage: cardano-cli conway governance vote create (--yes | --no | --abstain) Available options: --governance-action-tx-id TXID Txid of the governance action. - --governance-action-index WORD32 + --governance-action-index WORD16 Tx's governance action index. --drep-verification-key STRING DRep verification key (Bech32 or hex-encoded). diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels.json index 46d9d98702..3882f15e99 100644 --- a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels.json +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels.json @@ -186,6 +186,11 @@ "blake2b_256-cpu-arguments-intercept": 117366, "blake2b_256-cpu-arguments-slope": 10475, "blake2b_256-memory-arguments": 4, + "byteStringToInteger-cpu-arguments-c0": 1, + "byteStringToInteger-cpu-arguments-c1": 1, + "byteStringToInteger-cpu-arguments-c2": 1, + "byteStringToInteger-memory-arguments-intercept": 1, + "byteStringToInteger-memory-arguments-slope": 1, "cekApplyCost-exBudgetCPU": 23000, "cekApplyCost-exBudgetMemory": 100, "cekBuiltinCost-exBudgetCPU": 23000, @@ -250,6 +255,11 @@ "iData-memory-arguments": 32, "ifThenElse-cpu-arguments": 80556, "ifThenElse-memory-arguments": 1, + "integerToByteString-cpu-arguments-c0": 1, + "integerToByteString-cpu-arguments-c1": 1, + "integerToByteString-cpu-arguments-c2": 1, + "integerToByteString-memory-arguments-intercept": 1, + "integerToByteString-memory-arguments-slope": 1, "indexByteString-cpu-arguments": 57667, "indexByteString-memory-arguments": 4, "lengthOfByteString-cpu-arguments": 1000, @@ -451,6 +461,13 @@ "divideInteger-memory-arguments-intercept": 1, "divideInteger-memory-arguments-minimum": 1, "divideInteger-memory-arguments-slope": 1, + "divideInteger-cpu-arguments-model-arguments-minimum": 1, + "divideInteger-cpu-arguments-model-arguments-c20": 1, + "divideInteger-cpu-arguments-model-arguments-c11": 1, + "divideInteger-cpu-arguments-model-arguments-c10": 1, + "divideInteger-cpu-arguments-model-arguments-c02": 1, + "divideInteger-cpu-arguments-model-arguments-c01": 1, + "divideInteger-cpu-arguments-model-arguments-c00": 1, "encodeUtf8-cpu-arguments-intercept": 1, "encodeUtf8-cpu-arguments-slope": 1, "encodeUtf8-memory-arguments-intercept": 1, @@ -519,6 +536,13 @@ "modInteger-memory-arguments-intercept": 1, "modInteger-memory-arguments-minimum": 1, "modInteger-memory-arguments-slope": 1, + "modInteger-cpu-arguments-model-arguments-minimum": 1, + "modInteger-cpu-arguments-model-arguments-c20": 1, + "modInteger-cpu-arguments-model-arguments-c11": 1, + "modInteger-cpu-arguments-model-arguments-c10": 1, + "modInteger-cpu-arguments-model-arguments-c02": 1, + "modInteger-cpu-arguments-model-arguments-c01": 1, + "modInteger-cpu-arguments-model-arguments-c00": 1, "multiplyInteger-cpu-arguments-intercept": 1, "multiplyInteger-cpu-arguments-slope": 1, "multiplyInteger-memory-arguments-intercept": 1, @@ -531,12 +555,26 @@ "quotientInteger-memory-arguments-intercept": 1, "quotientInteger-memory-arguments-minimum": 1, "quotientInteger-memory-arguments-slope": 1, + "quotientInteger-cpu-arguments-model-arguments-minimum": 1, + "quotientInteger-cpu-arguments-model-arguments-c20": 1, + "quotientInteger-cpu-arguments-model-arguments-c11": 1, + "quotientInteger-cpu-arguments-model-arguments-c10": 1, + "quotientInteger-cpu-arguments-model-arguments-c02": 1, + "quotientInteger-cpu-arguments-model-arguments-c01": 1, + "quotientInteger-cpu-arguments-model-arguments-c00": 1, "remainderInteger-cpu-arguments-constant": 1, "remainderInteger-cpu-arguments-model-arguments-intercept": 1, + "remainderInteger-cpu-arguments-model-arguments-minimum": 1, "remainderInteger-cpu-arguments-model-arguments-slope": 1, "remainderInteger-memory-arguments-intercept": 1, "remainderInteger-memory-arguments-minimum": 1, "remainderInteger-memory-arguments-slope": 1, + "remainderInteger-cpu-arguments-model-arguments-c20": 1, + "remainderInteger-cpu-arguments-model-arguments-c11": 1, + "remainderInteger-cpu-arguments-model-arguments-c10": 1, + "remainderInteger-cpu-arguments-model-arguments-c02": 1, + "remainderInteger-cpu-arguments-model-arguments-c01": 1, + "remainderInteger-cpu-arguments-model-arguments-c00": 1, "serialiseData-cpu-arguments-intercept": 1, "serialiseData-cpu-arguments-slope": 1, "serialiseData-memory-arguments-intercept": 1, From 0d9eb83424034095fa4f1d0246e50a1c62130f25 Mon Sep 17 00:00:00 2001 From: Yuriy Lazaryev Date: Wed, 19 Jun 2024 17:03:01 +0200 Subject: [PATCH 2/4] Remove ConwayVote data definition as it was not being used --- cardano-cli/src/Cardano/CLI/Types/Governance.hs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Types/Governance.hs b/cardano-cli/src/Cardano/CLI/Types/Governance.hs index 0b42791a37..c30189f5fc 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Governance.hs @@ -6,22 +6,13 @@ module Cardano.CLI.Types.Governance where import Cardano.Api import Cardano.Api.Shelley -import Cardano.CLI.Types.Key (DRepHashSource, VerificationKeyOrFile, - VerificationKeyOrHashOrFile, VerificationKeyOrHashOrFileOrScriptHash) +import Cardano.CLI.Types.Key (DRepHashSource, VerificationKeyOrHashOrFile, + VerificationKeyOrHashOrFileOrScriptHash) -import Data.Word +data ConwayVote type VoteFile = File ConwayVote -data ConwayVote - = ConwayVote - { cvVoteChoice :: Vote - , cvVoterType :: VType - , cvGovActionId :: (TxId, Word32) - , cvVotingStakeCredential :: VerificationKeyOrFile StakePoolKey - , cvEra :: AnyShelleyBasedEra - , cvFilepath :: VoteFile Out - } deriving Show -- Vote type -- TODO: Conway era - remove me data VType = VCC -- committee From ea6d4003a7dd9f949fc7a5680e9054aee3d324e2 Mon Sep 17 00:00:00 2001 From: Yuriy Lazaryev Date: Wed, 19 Jun 2024 17:03:12 +0200 Subject: [PATCH 3/4] Fix type errors --- cardano-cli/src/Cardano/CLI/Types/Output.hs | 30 ++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Types/Output.hs b/cardano-cli/src/Cardano/CLI/Types/Output.hs index a3750b65ea..84328408f6 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Output.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Output.hs @@ -28,6 +28,7 @@ import qualified Data.List as List import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.Text (Text) +import qualified Data.Text as Text import Data.Time.Clock (UTCTime) import Data.Word @@ -261,7 +262,10 @@ instance ToJSON ScriptCostOutput where data PlutusScriptCostError = PlutusScriptCostErrPlutusScriptNotFound ScriptWitnessIndex | PlutusScriptCostErrExecError ScriptWitnessIndex (Maybe ScriptHash) ScriptExecutionError - | PlutusScriptCostErrRationalExceedsBound L.Prices ExecutionUnits + | PlutusScriptCostErrRationalExceedsBound + [Text] -- ^ Execution logs + L.Prices + ExecutionUnits | PlutusScriptCostErrRefInputNoScript TxIn | PlutusScriptCostErrRefInputNotInUTxO TxIn deriving Show @@ -274,9 +278,17 @@ instance Error PlutusScriptCostError where PlutusScriptCostErrExecError sWitIndex sHash sExecErro -> "Plutus script at: " <> pshow sWitIndex <> " with hash: " <> pshow sHash <> " errored with: " <> prettyError sExecErro - PlutusScriptCostErrRationalExceedsBound eUnitPrices eUnits -> - "Either the execution unit prices: " <> pshow eUnitPrices <> " or the execution units: " <> - pshow eUnits <> " or both are either too precise or not within bounds" + PlutusScriptCostErrRationalExceedsBound executionLogs eUnitPrices eUnits -> + let firstLine = mconcat [ "Either the execution unit prices: " + , pshow eUnitPrices + , " or the execution units: " + , pshow eUnits + , " or both are either too precise or not within bounds" + ] + in vsep [ firstLine + , "Execution logs: " <> pretty (Text.unlines executionLogs) + ] + PlutusScriptCostErrRefInputNoScript txin -> "No reference script found at input: " <> pretty (renderTxIn txin) PlutusScriptCostErrRefInputNotInUTxO txin -> @@ -289,7 +301,7 @@ renderScriptCosts -- ^ Initial mapping of script witness index to actual script. -- We need this in order to know which script corresponds to the -- calculated execution units. - -> Map ScriptWitnessIndex (Either ScriptExecutionError ExecutionUnits) + -> Map ScriptWitnessIndex (Either ScriptExecutionError ([Text], ExecutionUnits)) -- ^ Post execution cost calculation mapping of script witness -- index to execution units. -> Either PlutusScriptCostError [ScriptCostOutput] @@ -302,13 +314,13 @@ renderScriptCosts (UTxO utxo) eUnitPrices scriptMapping executionCostMapping = Just (AnyScriptWitness (PlutusScriptWitness _ pVer (PScript pScript) _ _ _)) -> do let scriptHash = hashScript $ PlutusScript pVer pScript case eExecUnits of - Right execUnits -> + Right (logs, execUnits) -> case calculateExecutionUnitsLovelace eUnitPrices execUnits of Just llCost -> Right (ScriptCostOutput scriptHash execUnits llCost) : accum Nothing -> - Left (PlutusScriptCostErrRationalExceedsBound eUnitPrices execUnits) + Left (PlutusScriptCostErrRationalExceedsBound logs eUnitPrices execUnits) : accum Left err -> Left (PlutusScriptCostErrExecError sWitInd (Just scriptHash) err) : accum -- TODO: Create a new sum type to encapsulate the fact that we can also @@ -321,13 +333,13 @@ renderScriptCosts (UTxO utxo) eUnitPrices scriptMapping executionCostMapping = ReferenceScriptNone -> Left (PlutusScriptCostErrRefInputNoScript refTxIn) : accum ReferenceScript _ (ScriptInAnyLang _ script) -> case eExecUnits of - Right execUnits -> + Right (logs, execUnits) -> case calculateExecutionUnitsLovelace eUnitPrices execUnits of Just llCost -> Right (ScriptCostOutput (hashScript script) execUnits llCost) : accum Nothing -> - Left (PlutusScriptCostErrRationalExceedsBound eUnitPrices execUnits) + Left (PlutusScriptCostErrRationalExceedsBound logs eUnitPrices execUnits) : accum Left err -> Left (PlutusScriptCostErrExecError sWitInd Nothing err) : accum From 478f9f5e939ea0d4b63a4be7663ee8d634b64ab4 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Mon, 17 Jun 2024 15:33:19 +0200 Subject: [PATCH 4/4] Bump CHaP and Cardano API dependency version --- cabal.project | 11 +++---- cardano-cli/cardano-cli.cabal | 12 ++++---- flake.lock | 56 +++++++++++++++++------------------ 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/cabal.project b/cabal.project index 47ebdfe3a0..78b74e449e 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2024-06-12T10:10:17Z - , cardano-haskell-packages 2024-06-12T10:10:17Z + , hackage.haskell.org 2024-06-17T19:25:27Z + , cardano-haskell-packages 2024-06-19T14:54:52Z packages: cardano-cli @@ -31,9 +31,10 @@ package bitvec -- Workaround for windows cross-compilation flags: -simd -constraints: - -- io-classes-mtl-0.1.2.0 is not buildable - io-classes-mtl < 0.1.2.0 +extra-packages: Cabal +if os(windows) + constraints: time ^>=1.14 + allow-newer: *:time tests: True diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 8d38cbe257..2078192197 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -205,7 +205,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.47.0.0 + , cardano-api ^>= 8.48 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 @@ -234,12 +234,12 @@ library , microlens , network , optparse-applicative-fork - , ouroboros-consensus >= 0.17 + , ouroboros-consensus ^>= 0.19 -- TODO: bump consensus back - , ouroboros-consensus-cardano >= 0.15 - , ouroboros-consensus-protocol >= 0.9 - , ouroboros-network-api - , ouroboros-network-protocols ^>=0.8 + , ouroboros-consensus-cardano ^>= 0.17 + , ouroboros-consensus-protocol ^>= 0.9.0.1 + , ouroboros-network-api ^>= 0.7.3 + , ouroboros-network-protocols , parsec , prettyprinter , prettyprinter-ansi-terminal diff --git a/flake.lock b/flake.lock index cc38db0d29..4f5202a1dc 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1718200515, - "narHash": "sha256-LhZDhH/Ii4X7r+bo7LGC+Q//OiUJ8uRwCJ5ULNpbj00=", + "lastModified": 1718810759, + "narHash": "sha256-P2o+f2CO8HPsuOmF7QBUkoWOXdi63sxZRscB9NNupdI=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "b731179078dc9960d68c3d0297d1c26f69e33614", + "rev": "cc41e678ea839c250a21242686f07693e19320b8", "type": "github" }, "original": { @@ -36,17 +36,17 @@ "blst": { "flake": false, "locked": { - "lastModified": 1691598027, - "narHash": "sha256-oqljy+ZXJAXEB/fJtmB8rlAr4UXM+Z2OkDa20gpILNA=", + "lastModified": 1656163412, + "narHash": "sha256-xero1aTe2v4IhWIJaEDUsVDOfE77dOV5zKeHWntHogY=", "owner": "supranational", "repo": "blst", - "rev": "3dd0f804b1819e5d03fb22ca2e6fac105932043a", + "rev": "03b5124029979755c752eec45f3c29674b558446", "type": "github" }, "original": { "owner": "supranational", - "ref": "v0.3.11", "repo": "blst", + "rev": "03b5124029979755c752eec45f3c29674b558446", "type": "github" } }, @@ -210,11 +210,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1716770092, - "narHash": "sha256-N4YGGedV+OfpVPQNqjBfZYfCjBjbWfZ5pdHcapVOScg=", + "lastModified": 1718671049, + "narHash": "sha256-ekvF/Dm545abRWUSMDKxPO/ylkF1JYZcab14XE3ndYc=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "179e52b7d49e43ffc2f1826a01e0c1b750db6073", + "rev": "d975d89cda8e6018df5eadde34b42e0a52bd0f95", "type": "github" }, "original": { @@ -263,11 +263,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1716771027, - "narHash": "sha256-rWtqMkpEDcF1901KEm/Y+hL+y1SidBJA/KdnAePae5c=", + "lastModified": 1718701646, + "narHash": "sha256-068rEjRFuasfvuapoPrzrfm+b6kHGeOmFyrEwg92eBU=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "200be01f6c0390da8044fbd2998dc7b1e49121a3", + "rev": "c019b636f237668d8bbd52c5729732bc0e4f887c", "type": "github" }, "original": { @@ -473,11 +473,11 @@ "nixlib": "nixlib" }, "locked": { - "lastModified": 1669263024, - "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", + "lastModified": 1693483555, + "narHash": "sha256-Beq4WhSeH3jRTZgC1XopTSU10yLpK1nmMcnGoXO0XYo=", "owner": "divnix", "repo": "incl", - "rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca", + "rev": "526751ad3d1e23b07944b14e3f6b7a5948d3007b", "type": "github" }, "original": { @@ -494,11 +494,11 @@ "sodium": "sodium" }, "locked": { - "lastModified": 1708437078, - "narHash": "sha256-EUsAEG0LmnMmX7Z6JW2LX8/VhpAJ2dXVwVGXWn5LmxQ=", + "lastModified": 1702362799, + "narHash": "sha256-cU8cZXNuo5GRwrSvWqdaqoW5tJ2HWwDEOvWwIVPDPmo=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "5ab7134bb21d7bd858dbe1c702761aa7e15eaf88", + "rev": "b426fb9e0b109a9d1dd2e1476f9e0bd8bb715142", "type": "github" }, "original": { @@ -510,11 +510,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1710581758, - "narHash": "sha256-UNUXGiKLGUv1TuQumV70rfjCJERP4w8KZEDxsMG0RHc=", + "lastModified": 1717479972, + "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "50ea210590ab0519149bfd163d5ba199be925fb6", + "rev": "2ed34002247213fc435d0062350b91bab920626e", "type": "github" }, "original": { @@ -738,11 +738,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1684171562, - "narHash": "sha256-BMUWjVWAUdyMWKk0ATMC9H0Bv4qAV/TXwwPUvTiC5IQ=", + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "55af203d468a6f5032a519cba4f41acf5a74b638", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", "type": "github" }, "original": { @@ -819,11 +819,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1716769250, - "narHash": "sha256-oTWTrrliw5GMe1qh27WWY7ToN3nfmPieZUYgSyR2uaM=", + "lastModified": 1718670223, + "narHash": "sha256-/OQ1pAA8prPpajKkS3G+FU9CwSBM9Gk8SsrCotnSu/o=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "d250d0a37d4c8ce39052eeb0174bcea64bc7be33", + "rev": "eec12e078945857d1ee4fc622fe032148ab9edff", "type": "github" }, "original": {