From 2360183feaba76f83e2a27f8df5e6cd5ef3e6fa8 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Thu, 25 Apr 2024 07:47:33 -0600 Subject: [PATCH] add minFeeRefScriptCostPerByte to create-protocol-param-update + bump cardano-api Signed-off-by: Carlos LopezDeLara --- cabal.project | 5 ++--- cardano-cli/cardano-cli.cabal | 2 +- .../src/Cardano/CLI/EraBased/Options/Common.hs | 2 +- .../CLI/EraBased/Options/Governance/Actions.hs | 11 +++++++++++ .../test/cardano-cli-golden/files/golden/help.cli | 1 + ...nance_action_create-protocol-parameters-update.cli | 3 +++ flake.lock | 6 +++--- 7 files changed, 22 insertions(+), 8 deletions(-) diff --git a/cabal.project b/cabal.project index adce302ff1..6b48fb631f 100644 --- a/cabal.project +++ b/cabal.project @@ -14,8 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2024-04-15T08:36:34Z - , cardano-haskell-packages 2024-04-15T08:36:34Z - + , cardano-haskell-packages 2024-04-24T22:24:37Z packages: cardano-cli @@ -40,4 +39,4 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly --- temporary! Please read the section in CONTRIBUTING about updating dependencies. +-- temporary! Please read the section in CONTRIBUTING about updating dependencies. \ No newline at end of file diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 6bbe24b5e6..fbe028fcac 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -196,7 +196,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.45.0.0 + , cardano-api ^>= 8.45.1.0 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 8149404e1b..7c599eeb2a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -47,8 +47,8 @@ import GHC.Natural (Natural) import Network.Socket (PortNumber) import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt -import qualified Text.Parsec as Parsec import Text.Parsec (()) +import qualified Text.Parsec as Parsec import qualified Text.Parsec.Error as Parsec import qualified Text.Parsec.Language as Parsec import qualified Text.Parsec.String as Parsec diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index f91c4c4a62..5858abc9b6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -13,6 +13,7 @@ import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Actions as Cmd import Cardano.CLI.EraBased.Options.Common import Cardano.CLI.Types.Common +import Cardano.CLI.Parser import Data.Foldable import GHC.Natural (Natural) @@ -218,6 +219,13 @@ pGovernanceActionProtocolParametersUpdateCmd era = do pure $ Cmd.GovernanceActionProtocolParametersUpdateCmd <$> pUpdateProtocolParametersCmd w +pMinFeeRefScriptCostPerByte :: Parser L.NonNegativeInterval +pMinFeeRefScriptCostPerByte = + Opt.option (toNonNegativeIntervalOrErr <$> readRational) $ mconcat + [ Opt.long "ref-script-cost-per-byte" + , Opt.metavar "RATIONAL" + , Opt.help "Reference script cost per byte for free calculation" + ] convertToLedger :: (a -> b) -> Parser (Maybe a) -> Parser (L.StrictMaybe b) convertToLedger conv = fmap (L.maybeToStrictMaybe . fmap conv) @@ -299,6 +307,7 @@ pIntroducedInConwayPParams = <*> convertToLedger id (optional pNewGovActionDeposit) <*> convertToLedger id (optional pDRepDeposit) <*> convertToLedger id (optional pDRepActivity) + <*> convertToLedger id (optional pMinFeeRefScriptCostPerByte) -- Not necessary in Conway era onwards pProtocolParametersUpdateGenesisKeys :: Parser [VerificationKeyFile In] @@ -375,3 +384,5 @@ pNetwork = asum $ mconcat ] ] ] + + 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 82614eb69b..164e7e2a5e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -6419,6 +6419,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update [--new-governance-action-deposit NATURAL] [--drep-deposit LOVELACE] [--drep-activity WORD32] + [--ref-script-cost-per-byte RATIONAL] [--cost-model-file FILE] --out-file FILE 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 8cb97eaf90..abeb2f0a74 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 @@ -56,6 +56,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update [--new-governance-action-deposit NATURAL] [--drep-deposit LOVELACE] [--drep-activity WORD32] + [--ref-script-cost-per-byte RATIONAL] [--cost-model-file FILE] --out-file FILE @@ -196,6 +197,8 @@ Available options: a governance action. --drep-deposit LOVELACE DRep deposit amount. --drep-activity WORD32 DRep activity period, in epochs. + --ref-script-cost-per-byte RATIONAL + Reference script cost per byte for free calculation --cost-model-file FILE Filepath of the JSON formatted cost model --out-file FILE The output file. -h,--help Show this help text diff --git a/flake.lock b/flake.lock index ea89713c02..070c008b5d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1713193436, - "narHash": "sha256-8Xz0kMPvgHp1rsv9FHwEl2N40DzPQv22qk+aUW361mM=", + "lastModified": 1714001377, + "narHash": "sha256-FElLa99dH+HzG3tUkotgJhEB2T/ooyaIb5qwum/x8UE=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "ffc155aa2980891f84f5375164ffd2075518546b", + "rev": "a2e6e0cf123e35bc643ab2f33fcb5c4df5a8abe7", "type": "github" }, "original": {