Skip to content

Commit

Permalink
Merge pull request #385 from input-output-hk/td/ledger-consensus-and-…
Browse files Browse the repository at this point in the history
…api-for-8.6

Integrate latest ledger, consensus and api for 8.6.0
  • Loading branch information
CarlosLopezDeLara authored Oct 27, 2023
2 parents e86aa60 + f1928f9 commit 5c0897b
Show file tree
Hide file tree
Showing 26 changed files with 301 additions and 106 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2023-08-08T19:56:09Z
, cardano-haskell-packages 2023-10-20T00:31:44Z
, cardano-haskell-packages 2023-10-27T12:25:48Z

packages:
cardano-cli
Expand Down
20 changes: 10 additions & 10 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,19 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.28.0.0
, cardano-api ^>= 8.29.0.0
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
, cardano-crypto-wrapper ^>= 1.5.1
, cardano-data >= 1.0
, cardano-data >= 1.1
, cardano-git-rev
, cardano-ledger-alonzo >= 1.3.1.1
, cardano-ledger-binary >= 1.0
, cardano-ledger-alonzo >= 1.5.0.0
, cardano-ledger-binary >= 1.2
, cardano-ledger-byron >= 1.0.0.2
, cardano-ledger-conway >= 1.5
, cardano-ledger-core >= 1.2
, cardano-ledger-shelley >=1.4.1.0
, cardano-ledger-conway >= 1.10
, cardano-ledger-core >= 1.8
, cardano-ledger-shelley >=1.7.0.0
, cardano-ping ^>= 0.2.0.5
, cardano-prelude
, cardano-slotting ^>= 0.1
Expand All @@ -234,9 +234,9 @@ library
, microlens
, network
, optparse-applicative-fork
, ouroboros-consensus >= 0.12
, ouroboros-consensus-cardano >= 0.10
, ouroboros-consensus-protocol >= 0.5.0.4
, ouroboros-consensus >= 0.13
, ouroboros-consensus-cardano >= 0.11
, ouroboros-consensus-protocol >= 0.6.0.0
, ouroboros-network-api
, ouroboros-network-protocols
, parsec
Expand Down
12 changes: 4 additions & 8 deletions cardano-cli/src/Cardano/CLI/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ txSpendGenesisUTxOByronPBFT gc nId sk (ByronAddress bAddr) outs = do
, txTotalCollateral = TxTotalCollateralNone
, txReturnCollateral = TxReturnCollateralNone
, txFee = TxFeeImplicit ByronEraOnlyByron
, txValidityRange =
( TxValidityNoLowerBound
, defaultTxValidityUpperBound ByronEra
)
, txValidityLowerBound = TxValidityNoLowerBound
, txValidityUpperBound = defaultTxValidityUpperBound ByronEra
, txMetadata = TxMetadataNone
, txAuxScripts = TxAuxScriptsNone
, txExtraKeyWits = TxExtraKeyWitnessesNone
Expand Down Expand Up @@ -207,10 +205,8 @@ txSpendUTxOByronPBFT nId sk txIns outs = do
, txTotalCollateral = TxTotalCollateralNone
, txReturnCollateral = TxReturnCollateralNone
, txFee = TxFeeImplicit ByronEraOnlyByron
, txValidityRange =
( TxValidityNoLowerBound
, defaultTxValidityUpperBound ByronEra
)
, txValidityLowerBound = TxValidityNoLowerBound
, txValidityUpperBound = defaultTxValidityUpperBound ByronEra
, txMetadata = TxMetadataNone
, txAuxScripts = TxAuxScriptsNone
, txExtraKeyWits = TxExtraKeyWitnessesNone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module Cardano.CLI.EraBased.Commands.Governance.Committee
) where

import Cardano.Api
import qualified Cardano.Api.Ledger as Ledger
import Cardano.Api.Shelley

import Cardano.CLI.Types.Key
import Cardano.CLI.Types.Key.VerificationKey
Expand Down Expand Up @@ -59,6 +61,7 @@ data GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs era =
GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs
{ eon :: !(ConwayEraOnwards era)
, vkeyColdKeySource :: !(VerificationKeyOrHashOrFile CommitteeColdKey)
, anchor :: !(Maybe (Ledger.Anchor (Ledger.EraCrypto (ShelleyLedgerEra era))))
, outFile :: !(File () Out)
} deriving Show

Expand Down
16 changes: 14 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

module Cardano.CLI.EraBased.Commands.Query
( QueryCmds (..)
, QueryCommitteeMembersStateCmdArgs(..)
, QueryLeadershipScheduleCmdArgs(..)
, QueryProtocolParametersCmdArgs(..)
, QueryConstitutionHashCmdArgs(..)
Expand Down Expand Up @@ -55,7 +56,7 @@ data QueryCmds era
| QueryGovStateCmd !(QueryNoArgCmdArgs era)
| QueryDRepStateCmd !(QueryDRepStateCmdArgs era)
| QueryDRepStakeDistributionCmd !(QueryDRepStakeDistributionCmdArgs era)
| QueryCommitteeStateCmd !(QueryNoArgCmdArgs era)
| QueryCommitteeMembersStateCmd !(QueryCommitteeMembersStateCmdArgs era)
deriving (Generic, Show)

data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs
Expand Down Expand Up @@ -199,6 +200,17 @@ data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs
, mOutFile :: !(Maybe (File () Out))
} deriving Show

data QueryCommitteeMembersStateCmdArgs era = QueryCommitteeMembersStateCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, networkId :: !NetworkId
, committeeColdKeys :: ![VerificationKeyOrHashOrFile CommitteeColdKey]
, committeeHotKeys :: ![VerificationKeyOrHashOrFile CommitteeHotKey]
, memberStatuses :: ![MemberStatus]
, mOutFile :: !(Maybe (File () Out))
} deriving Show

renderQueryCmds :: QueryCmds era -> Text
renderQueryCmds = \case
QueryLeadershipScheduleCmd {} ->
Expand Down Expand Up @@ -239,7 +251,7 @@ renderQueryCmds = \case
"drep-state"
QueryDRepStakeDistributionCmd {} ->
"drep-stake-distribution"
QueryCommitteeStateCmd {} ->
QueryCommitteeMembersStateCmd {} ->
"committee-state"

renderTxMempoolQuery :: TxMempoolQuery -> Text
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs
-- ^ Multi-Asset value with script witness
, mValidityLowerBound :: !(Maybe SlotNo)
-- ^ Transaction validity lower bound
, mValidityUpperBound :: !(Maybe SlotNo)
, mValidityUpperBound :: !(TxValidityUpperBound era)
-- ^ Transaction validity upper bound
, fee :: !(Maybe Lovelace)
-- ^ Transaction fee
Expand Down Expand Up @@ -110,7 +110,7 @@ data TransactionBuildCmdArgs era = TransactionBuildCmdArgs
-- ^ Multi-Asset value with script witness
, mValidityLowerBound :: !(Maybe SlotNo)
-- ^ Transaction validity lower bound
, mValidityUpperBound :: !(Maybe SlotNo)
, mValidityUpperBound :: !(TxValidityUpperBound era)
-- ^ Transaction validity upper bound
, certificates :: ![(CertificateFile, Maybe (ScriptWitnessFiles WitCtxStake))]
-- ^ Certificates with potential script witness
Expand Down
75 changes: 53 additions & 22 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2077,30 +2077,62 @@ pInvalidBefore = fmap SlotNo $ asum
]
]

pInvalidHereafter :: Parser SlotNo
pInvalidHereafter =
pLegacyInvalidHereafter :: Parser SlotNo
pLegacyInvalidHereafter =
fmap SlotNo $ asum
[ Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "invalid-hereafter"
, Opt.metavar "SLOT"
, Opt.help "Time that transaction is valid until (in slots)."
]
, Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "upper-bound"
, Opt.metavar "SLOT"
, Opt.help $ mconcat
[ "Time that transaction is valid until (in slots) "
, "(deprecated; use --invalid-hereafter instead)."
[ Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "invalid-hereafter"
, Opt.metavar "SLOT"
, Opt.help "Time that transaction is valid until (in slots)."
]
, Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "upper-bound"
, Opt.metavar "SLOT"
, Opt.help $ mconcat
[ "Time that transaction is valid until (in slots) "
, "(deprecated; use --invalid-hereafter instead)."
]
, Opt.internal
]
, Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "ttl"
, Opt.metavar "SLOT"
, Opt.help "Time to live (in slots) (deprecated; use --invalid-hereafter instead)."
, Opt.internal
]
, Opt.internal
]
, Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "ttl"
, Opt.metavar "SLOT"
, Opt.help "Time to live (in slots) (deprecated; use --invalid-hereafter instead)."
, Opt.internal
]
]

pInvalidHereafter :: ()
=> CardanoEra era
-> Parser (TxValidityUpperBound era)
pInvalidHereafter =
caseByronOrShelleyBasedEra
(pure . TxValidityNoUpperBound)
(\eon ->
fmap (TxValidityUpperBound eon) $ asum
[ fmap (Just . SlotNo) $ Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "invalid-hereafter"
, Opt.metavar "SLOT"
, Opt.help "Time that transaction is valid until (in slots)."
]
, fmap (Just . SlotNo) $ Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "upper-bound"
, Opt.metavar "SLOT"
, Opt.help $ mconcat
[ "Time that transaction is valid until (in slots) "
, "(deprecated; use --invalid-hereafter instead)."
]
, Opt.internal
]
, fmap (Just . SlotNo) $ Opt.option (bounded "SLOT") $ mconcat
[ Opt.long "ttl"
, Opt.metavar "SLOT"
, Opt.help "Time to live (in slots) (deprecated; use --invalid-hereafter instead)."
, Opt.internal
]
, pure Nothing
]
)

pTxFee :: Parser Lovelace
pTxFee =
Expand Down Expand Up @@ -2560,7 +2592,6 @@ pProtocolParametersUpdate =
<*> optional pPoolInfluence
<*> optional pMonetaryExpansion
<*> optional pTreasuryExpansion
<*> pure Nothing
<*> pure mempty
<*> optional pExecutionUnitPrices
<*> optional pMaxTxExecutionUnits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ pDeprecatedAfterMaryPParams =
DeprecatedAfterMaryPParams
<$> convertToLedger toShelleyLovelace (optional pMinUTxOValue)

pShelleyToAlonzoPParams :: Parser (ShelleyToAlonzoPParams' ledgerera)
pShelleyToAlonzoPParams :: Parser (ShelleyToAlonzoPParams ledgerera)
pShelleyToAlonzoPParams =
ShelleyToAlonzoPParams'
ShelleyToAlonzoPParams
<$> convertToLedger id (optional $ toLedgerNonce <$> pExtraEntropy)
<*> convertToLedger toUnitIntervalOrErr (optional pDecentralParam)

Expand Down Expand Up @@ -318,7 +318,6 @@ dpGovActionProtocolParametersUpdate = \case
<$> pCommonProtocolParameters
<*> pShelleyToAlonzoPParams
<*> pAlonzoOnwardsPParams
<*> pure (ShelleyToAlonzoPParams SNothing)
ShelleyBasedEraBabbage ->
BabbageEraBasedProtocolParametersUpdate
<$> pCommonProtocolParameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}

module Cardano.CLI.EraBased.Options.Governance.Committee
( pGovernanceCommitteeCmds
Expand All @@ -8,6 +9,10 @@ import Cardano.Api

import Cardano.CLI.EraBased.Commands.Governance.Committee
import Cardano.CLI.EraBased.Options.Common
import Cardano.CLI.Read
import qualified Cardano.Ledger.BaseTypes as L
import qualified Cardano.Ledger.Crypto as Crypto
import qualified Cardano.Ledger.SafeHash as L

import Options.Applicative (Parser)
import qualified Options.Applicative as Opt
Expand Down Expand Up @@ -116,13 +121,36 @@ pGovernanceCommitteeCreateColdKeyResignationCertificateCmd era = do
w <- forEraMaybeEon era
pure
$ subParser "create-cold-key-resignation-certificate"
$ Opt.info
( fmap GovernanceCommitteeCreateColdKeyResignationCertificateCmd $
GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs w
<$> pCommitteeColdVerificationKeyOrHashOrFile
<*> pOutputFile
)
$ Opt.info (conwayEraOnwardsConstraints w $ mkParser w)
$ Opt.progDesc
$ mconcat
[ "Create cold key resignation certificate for a Constitutional Committee Member"
]
where
mkParser w = GovernanceCommitteeCreateColdKeyResignationCertificateCmd <$>
(
GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs w <$>
pCommitteeColdVerificationKeyOrHashOrFile <*>
pAnchor <*>
pOutputFile
)

pAnchor :: Parser (Maybe (L.Anchor Crypto.StandardCrypto))
pAnchor =
Opt.optional $
L.Anchor
<$> fmap unAnchorUrl pAnchorUrl
<*> pSafeHash

pAnchorUrl :: Parser AnchorUrl
pAnchorUrl =
AnchorUrl
<$> pUrl "resignation-metadata-url" "Constitutional Committee cold key resignation certificate URL"

pSafeHash :: Parser (L.SafeHash Crypto.StandardCrypto L.AnchorData)
pSafeHash =
Opt.option readSafeHash $ mconcat
[ Opt.long "resignation-metadata-hash"
, Opt.metavar "HASH"
, Opt.help "Constitutional Committee cold key resignation certificate metadata hash"
]
30 changes: 29 additions & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Cardano.CLI.EraBased.Options.Query
) where

import Cardano.Api hiding (QueryInShelleyBasedEra (..))
import qualified Cardano.Api as MemberStatus (MemberStatus (..))
import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..))

import Cardano.CLI.Environment (EnvCli (..))
Expand Down Expand Up @@ -351,8 +352,35 @@ pQueryGetCommitteeStateCmd era envCli = do
w <- forEraMaybeEon era
pure
$ subParser "committee-state"
$ Opt.info (QueryCommitteeStateCmd <$> pQueryNoArgCmdArgs w envCli)
$ Opt.info (QueryCommitteeMembersStateCmd <$> pQueryCommitteeMembersStateArgs w)
$ Opt.progDesc "Get the committee state"
where
pQueryCommitteeMembersStateArgs :: ConwayEraOnwards era -> Parser (QueryCommitteeMembersStateCmdArgs era)
pQueryCommitteeMembersStateArgs w = QueryCommitteeMembersStateCmdArgs w
<$> pSocketPath envCli
<*> pConsensusModeParams
<*> pNetworkId envCli
<*> many pCommitteeColdVerificationKeyOrHashOrFile
<*> many pCommitteeHotKeyOrHashOrFile
<*> many pMemberStatus
<*> optional pOutputFile

pMemberStatus :: Parser MemberStatus
pMemberStatus =
asum
[ Opt.flag' MemberStatus.Active $ mconcat
[ Opt.long "active"
, Opt.help "Active committee members (members whose vote will count during ratification)"
]
, Opt.flag' MemberStatus.Expired $ mconcat
[ Opt.long "expired"
, Opt.help "Expired committee members"
]
, Opt.flag' MemberStatus.Unrecognized $ mconcat
[ Opt.long "unrecognized"
, Opt.help "Unrecognized committe members: a hot credential for an unknown cold credential"
]
]

pQueryNoArgCmdArgs :: ()
=> ConwayEraOnwards era
Expand Down
Loading

0 comments on commit 5c0897b

Please sign in to comment.