Skip to content

Commit

Permalink
Merge pull request #529 from IntersectMBO/jordan/bump-chap-20231220
Browse files Browse the repository at this point in the history
Bump CHaP in preparation for cardano-node 8.8
  • Loading branch information
carbolymer authored Feb 6, 2024
2 parents 67e410a + 26fb079 commit 760a6f5
Show file tree
Hide file tree
Showing 49 changed files with 759 additions and 397 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2024-01-24-2"
CABAL_CACHE_VERSION: "2024-02-06-1"

concurrency:
group: >
Expand Down
5 changes: 2 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -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-01-23T08:19:39Z
, cardano-haskell-packages 2024-01-25T13:05:04Z
, hackage.haskell.org 2024-02-06T15:14:59Z
, cardano-haskell-packages 2024-02-06T15:25:20Z

packages:
cardano-cli
Expand Down Expand Up @@ -43,4 +43,3 @@ 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.

5 changes: 2 additions & 3 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.37.1.0
, cardano-api ^>= 8.38.0.0
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
, cardano-crypto-wrapper ^>= 1.5.1
, cardano-data >= 1.1
, cardano-git-rev
, cardano-ledger-alonzo >= 1.5.0.0
, cardano-ledger-alonzo >= 1.6.0.0
, cardano-ledger-binary >= 1.2
, cardano-ledger-byron >= 1.0.0.2
, cardano-ledger-conway >= 1.10
Expand Down Expand Up @@ -306,7 +306,6 @@ test-suite cardano-cli-test
build-tool-depends: tasty-discover:tasty-discover

other-modules: Test.Cli.AddCostModels
Test.Cli.CliIntermediateFormat
Test.Cli.CreateTestnetData
Test.Cli.FilePermissions
Test.Cli.Governance.Hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import Cardano.Api.Shelley

import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Key
import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo
import qualified Cardano.Ledger.BaseTypes as Ledger
import qualified Cardano.Ledger.Crypto as Crypto
import qualified Cardano.Ledger.SafeHash as Ledger

import Data.Text (Text)
import Data.Word
import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo

data GovernanceActionCmds era
= GovernanceActionCreateConstitutionCmd !(GovernanceActionCreateConstitutionCmdArgs era)
Expand Down Expand Up @@ -118,14 +118,15 @@ data GovernanceActionProtocolParametersUpdateCmdArgs era

data GovernanceActionTreasuryWithdrawalCmdArgs era
= GovernanceActionTreasuryWithdrawalCmdArgs
{ eon :: !(ConwayEraOnwards era)
, networkId :: !Ledger.Network
, deposit :: !Lovelace
, returnAddr :: !(VerificationKeyOrHashOrFile StakeKey)
, proposalUrl :: !ProposalUrl
, proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData)
, treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)]
, outFile :: !(File () Out)
{ eon :: !(ConwayEraOnwards era)
, networkId :: !Ledger.Network
, deposit :: !Lovelace
, returnAddr :: !(VerificationKeyOrHashOrFile StakeKey)
, proposalUrl :: !ProposalUrl
, proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData)
, treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)]
, constitutionScriptHash :: !(Maybe ScriptHash)
, outFile :: !(File () Out)
} deriving Show

data GovernanceActionViewCmdArgs era
Expand All @@ -145,6 +146,7 @@ data UpdateProtocolParametersConwayOnwards era
, proposalUrl :: !ProposalUrl
, proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData)
, governanceActionId :: !(Maybe (TxId, Word32))
, constitutionScriptHash :: !(Maybe ScriptHash)
}

data CostModelsFile era
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs
, metadataFiles :: ![MetadataFile]
, mProtocolParamsFile :: !(Maybe ProtocolParamsFile)
, mUpdateProprosalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
, voteFiles :: ![VoteFile In]
, proposalFiles :: ![ProposalFile In]
, voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
, proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
, txBodyOutFile :: !(TxBodyFile Out)
} deriving Show

Expand Down Expand Up @@ -121,8 +121,8 @@ data TransactionBuildCmdArgs era = TransactionBuildCmdArgs
-- ^ Auxiliary scripts
, metadataFiles :: ![MetadataFile]
, mfUpdateProposalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile)))
, voteFiles :: ![VoteFile In]
, proposalFiles :: ![ProposalFile In]
, voteFiles :: ![(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
, proposalFiles :: ![(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
, buildOutputOptions :: !TxBuildOutputOptions
} deriving Show

Expand Down
125 changes: 97 additions & 28 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Cardano.CLI.Types.Key.VerificationKey
import qualified Cardano.Ledger.BaseTypes as L
import qualified Cardano.Ledger.Crypto as Crypto
import qualified Cardano.Ledger.SafeHash as L
import qualified Cardano.Ledger.Shelley.TxBody as Shelley
import qualified Cardano.Ledger.Shelley.API as Shelley

import Control.Monad (mfilter)
import qualified Data.Aeson as Aeson
Expand Down Expand Up @@ -887,13 +887,14 @@ pConstitutionHash =
]

pUrl :: String -> String -> Parser Ledger.Url
pUrl l h = fromMaybe (error "Url longer than 64 bytes")
. Ledger.textToUrl <$>
Opt.strOption (mconcat
[ Opt.long l
, Opt.metavar "TEXT"
, Opt.help h
])
pUrl l h =
let toUrl urlText = fromMaybe (error "Url longer than 64 bytes")
$ Ledger.textToUrl (Text.length urlText) urlText
in fmap toUrl . Opt.strOption
$ mconcat [ Opt.long l
, Opt.metavar "TEXT"
, Opt.help h
]

pGovActionDeposit :: Parser Lovelace
pGovActionDeposit =
Expand Down Expand Up @@ -1116,6 +1117,53 @@ pScriptDataOrFile dataFlagPrefix helpTextForValue helpTextForFile =
Left err -> fail $ docToString $ prettyError err
Right sd -> return sd

pVoteFiles
:: ShelleyBasedEra era
-> BalanceTxExecUnits
-> Parser [(VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
pVoteFiles sbe bExUnits= caseShelleyToBabbageOrConwayEraOnwards
(const $ pure [])
(const . many $ pVoteFile bExUnits)
sbe

pVoteFile :: BalanceTxExecUnits -> Parser (VoteFile In, Maybe (ScriptWitnessFiles WitCtxStake))
pVoteFile balExUnits =
(,) <$> pFileInDirection "vote-file" "Filepath of the vote."
<*> optional (pVoteScriptOrReferenceScriptWitness balExUnits)

where
pVoteScriptOrReferenceScriptWitness
:: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pVoteScriptOrReferenceScriptWitness bExUnits =
pScriptWitnessFiles
WitCtxStake
bExUnits
"vote"
Nothing
"a vote"

pProposalFiles :: ShelleyBasedEra era -> BalanceTxExecUnits -> Parser [(ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))]
pProposalFiles sbe balExUnits = caseShelleyToBabbageOrConwayEraOnwards
(const $ pure [])
(const $ many (pProposalFile balExUnits))
sbe

pProposalFile :: BalanceTxExecUnits -> Parser (ProposalFile In, Maybe (ScriptWitnessFiles WitCtxStake))
pProposalFile balExUnits =
(,) <$> pFileInDirection "proposal-file" "Filepath of the proposal."
<*> optional (pProposingScriptOrReferenceScriptWitness balExUnits)

where
pProposingScriptOrReferenceScriptWitness
:: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxStake)
pProposingScriptOrReferenceScriptWitness bExUnits =
pScriptWitnessFiles
WitCtxStake
bExUnits
"proposal"
Nothing
"a proposal"

--------------------------------------------------------------------------------

pPaymentVerifier :: Parser PaymentVerifier
Expand Down Expand Up @@ -2574,27 +2622,27 @@ pMinPoolCost =
, Opt.help "The minimum allowed cost parameter for stake pools."
]

pMaxBodySize :: Parser Natural
pMaxBodySize :: Parser Word32
pMaxBodySize =
Opt.option Opt.auto $ mconcat
[ Opt.long "max-block-body-size"
, Opt.metavar "NATURAL"
, Opt.metavar "WORD32"
, Opt.help "Maximal block body size."
]

pMaxTransactionSize :: Parser Natural
pMaxTransactionSize :: Parser Word32
pMaxTransactionSize =
Opt.option Opt.auto $ mconcat
[ Opt.long "max-tx-size"
, Opt.metavar "NATURAL"
, Opt.metavar "WORD32"
, Opt.help "Maximum transaction size."
]

pMaxBlockHeaderSize :: Parser Natural
pMaxBlockHeaderSize :: Parser Word16
pMaxBlockHeaderSize =
Opt.option Opt.auto $ mconcat
[ Opt.long "max-block-header-size"
, Opt.metavar "NATURAL"
, Opt.metavar "WORD16"
, Opt.help "Maximum block header size."
]

Expand Down Expand Up @@ -2622,12 +2670,18 @@ pPoolDeposit =
, Opt.help "The amount of a pool registration deposit."
]

pEpochBoundRetirement :: Parser EpochNo
pEpochBoundRetirement :: Parser L.EpochInterval
pEpochBoundRetirement =
fmap EpochNo $ Opt.option (bounded "EPOCH_BOUNDARY") $ mconcat
[ Opt.long "pool-retirement-epoch-boundary"
, Opt.metavar "EPOCH_BOUNDARY"
, Opt.help "Epoch bound on pool retirement."
fmap L.EpochInterval $ asum
[ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat
[ Opt.long "pool-retirement-epoch-interval"
, Opt.metavar "WORD32"
, Opt.help "Epoch interval of pool retirement."
]
, Opt.option (bounded "EPOCH_BOUNDARY") $ mconcat
[ Opt.long "pool-retirement-epoch-boundary"
, Opt.internal
]
]

pNumberOfPools :: Parser Natural
Expand Down Expand Up @@ -2811,6 +2865,7 @@ pPoolVotingThresholds =
<*> pCommitteeNormal
<*> pCommitteeNoConfidence
<*> pHardForkInitiation
<*> pPPSecurityGroup
where
pMotionNoConfidence =
Opt.option (toUnitIntervalOrErr <$> readRationalUnitInterval) $ mconcat
Expand All @@ -2836,6 +2891,12 @@ pPoolVotingThresholds =
, Opt.metavar "RATIONAL"
, Opt.help "Acceptance threshold for stake pool votes on hard fork initiations."
]
pPPSecurityGroup =
Opt.option (toUnitIntervalOrErr <$> readRationalUnitInterval) $ mconcat
[ Opt.long "pool-voting-threshold-pp-security-group"
, Opt.metavar "RATIONAL"
, Opt.help "Acceptance threshold for stake pool votes on protocol parameters for parameters in the 'security' group."
]

pDRepVotingThresholds :: Parser Ledger.DRepVotingThresholds
pDRepVotingThresholds =
Expand Down Expand Up @@ -2920,19 +2981,19 @@ pMinCommitteeSize =
, Opt.help "Minimal size of the constitutional committee."
]

pCommitteeTermLength :: Parser EpochNo
pCommitteeTermLength :: Parser L.EpochInterval
pCommitteeTermLength =
fmap EpochNo $ Opt.option Opt.auto $ mconcat
fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat
[ Opt.long "committee-term-length"
, Opt.metavar "INT"
, Opt.metavar "WORD32"
, Opt.help "Maximal term length for members of the constitutional committee, in epochs."
]

pGovActionLifetime :: Parser EpochNo
pGovActionLifetime :: Parser L.EpochInterval
pGovActionLifetime =
fmap EpochNo $ Opt.option (bounded "EPOCH") $ mconcat
fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat
[ Opt.long "governance-action-lifetime"
, Opt.metavar "NATURAL"
, Opt.metavar "WORD32"
, Opt.help "Maximal lifetime of governance actions, in epochs."
]

Expand All @@ -2944,11 +3005,11 @@ pDRepDeposit =
, Opt.help "DRep deposit amount."
]

pDRepActivity :: Parser EpochNo
pDRepActivity :: Parser L.EpochInterval
pDRepActivity =
fmap EpochNo $ Opt.option (bounded "EPOCH") $ mconcat
fmap L.EpochInterval $ Opt.option (bounded "EPOCH_INTERVAL") $ mconcat
[ Opt.long "drep-activity"
, Opt.metavar "NATURAL"
, Opt.metavar "WORD32"
, Opt.help "DRep activity period, in epochs."
]

Expand Down Expand Up @@ -3054,6 +3115,14 @@ pDRepScriptHash =
, Opt.help "DRep script hash (hex-encoded). Obtain it with \"cardano-cli conway governance hash script ...\"."
]

pConstitutionScriptHash :: Parser ScriptHash
pConstitutionScriptHash =
Opt.option scriptHashReader $ mconcat
[ Opt.long "constitution-script-hash"
, Opt.metavar "HASH"
, Opt.help "Constitution script hash (hex-encoded). Obtain it with \"cardano-cli conway governance hash script ...\"."
]

pDRepVerificationKeyOrHashOrFile
:: Parser (VerificationKeyOrHashOrFile DRepKey)
pDRepVerificationKeyOrHashOrFile =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ pUpdateProtocolParametersPostConway conwayOnwards =
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pPreviousGovernanceAction
<*> optional pConstitutionScriptHash


pUpdateProtocolParametersCmd :: ShelleyBasedEra era -> Parser (Cmd.GovernanceActionProtocolParametersUpdateCmdArgs era)
Expand Down Expand Up @@ -294,7 +295,7 @@ pIntroducedInConwayPParams =
<$> convertToLedger id (optional pPoolVotingThresholds)
<*> convertToLedger id (optional pDRepVotingThresholds)
<*> convertToLedger id (optional pMinCommitteeSize)
<*> convertToLedger id (optional (fromIntegral . unEpochNo <$> pCommitteeTermLength))
<*> convertToLedger id (optional pCommitteeTermLength)
<*> convertToLedger id (optional pGovActionLifetime)
<*> convertToLedger toShelleyLovelace (optional pNewGovActionDeposit)
<*> convertToLedger toShelleyLovelace (optional pDRepDeposit)
Expand Down Expand Up @@ -358,6 +359,7 @@ pGovernanceActionTreasuryWithdrawalCmd era = do
<*> pAnchorUrl
<*> pAnchorDataHash
<*> many ((,) <$> pStakeVerificationKeyOrHashOrFile (Just "funds-receiving") <*> pTransferAmt)
<*> optional pConstitutionScriptHash
<*> pFileOutDirection "out-file" "Output filepath of the treasury withdrawal."
)
$ Opt.progDesc "Create a treasury withdrawal."
Expand Down
Loading

0 comments on commit 760a6f5

Please sign in to comment.