diff --git a/cabal.project b/cabal.project index c91076e926..fee28e5cad 100644 --- a/cabal.project +++ b/cabal.project @@ -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-27T12:25:48Z + , cardano-haskell-packages 2023-11-03T08:46:06Z packages: cardano-cli diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 91155427e4..6c20d6859d 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -202,7 +202,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.29.0.0 + , cardano-api ^>= 8.30.0.0 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 diff --git a/cardano-cli/src/Cardano/CLI/Byron/Run.hs b/cardano-cli/src/Cardano/CLI/Byron/Run.hs index 0aa26a0e62..3437ff00a3 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Run.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Run.hs @@ -177,7 +177,7 @@ runSubmitTx nodeSocketPath network fp = do runGetTxId :: TxFile In -> ExceptT ByronClientCmdError IO () runGetTxId fp = firstExceptT ByronCmdTxError $ do tx <- readByronTx fp - let txbody = getTxBody (ByronTx tx) + let txbody = getTxBody (ByronTx ByronEraOnlyByron tx) txid = getTxId txbody liftIO $ BS.putStrLn $ serialiseToRawBytesHex txid diff --git a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs index 1518ab6be2..a70be26fdf 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs @@ -244,12 +244,12 @@ nodeSubmitTx nodeSocketPath network gentx = do localNodeNetworkId = network, localConsensusModeParams = CardanoModeParams (EpochSlots 21600) } - res <- liftIO $ submitTxToNodeLocal connctInfo (TxInByronSpecial gentx ByronEraInCardanoMode) + res <- liftIO $ submitTxToNodeLocal connctInfo (TxInByronSpecial ByronEraOnlyByron gentx) case res of Net.Tx.SubmitSuccess -> liftIO $ Text.putStrLn "Transaction successfully submitted." Net.Tx.SubmitFail reason -> case reason of - TxValidationErrorInMode err _eraInMode -> left . ByronTxSubmitError . Text.pack $ show err + TxValidationErrorInCardanoMode err -> left . ByronTxSubmitError . Text.pack $ show err TxValidationEraMismatch mismatchErr -> left $ ByronTxSubmitErrorEraMismatch mismatchErr return () 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 f1940cddd6..ce152623a7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -18,8 +18,6 @@ module Cardano.CLI.EraBased.Commands.Governance.Actions , UpdateProtocolParametersConwayOnwards(..) , UpdateProtocolParametersPreConway(..) , renderGovernanceActionCmds - - , AnyStakeIdentifier(..) ) where import Cardano.Api @@ -47,7 +45,7 @@ data GoveranceActionUpdateCommitteeCmdArgs era { eon :: !(ConwayEraOnwards era) , networkId :: !Ledger.Network , deposit :: !Lovelace - , returnAddress :: !AnyStakeIdentifier + , returnAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl , proposalHashSource :: !ProposalHashSource , oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFile CommitteeColdKey] @@ -62,7 +60,7 @@ data GovernanceActionCreateConstitutionCmdArgs era { eon :: !(ConwayEraOnwards era) , networkId :: !Ledger.Network , deposit :: !Lovelace - , stakeCredential :: !AnyStakeIdentifier + , stakeCredential :: !(VerificationKeyOrHashOrFile StakeKey) , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) , proposalUrl :: !ProposalUrl , proposalHashSource :: !ProposalHashSource @@ -77,7 +75,7 @@ data GovernanceActionInfoCmdArgs era { eon :: !(ConwayEraOnwards era) , networkId :: !Ledger.Network , deposit :: !Lovelace - , returnStakeAddress :: !AnyStakeIdentifier + , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl , proposalHashSource :: !ProposalHashSource , outFile :: !(File () Out) @@ -88,7 +86,7 @@ data GovernanceActionCreateNoConfidenceCmdArgs era { eon :: !(ConwayEraOnwards era) , networkId :: !Ledger.Network , deposit :: !Lovelace - , returnStakeAddress :: !AnyStakeIdentifier + , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl , proposalHashSource :: !ProposalHashSource , governanceActionId :: !TxId @@ -110,10 +108,10 @@ data GovernanceActionTreasuryWithdrawalCmdArgs era { eon :: !(ConwayEraOnwards era) , networkId :: !Ledger.Network , deposit :: !Lovelace - , returnAddr :: !AnyStakeIdentifier + , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl , proposalHashSource :: !ProposalHashSource - , treasuryWithdrawal :: ![(AnyStakeIdentifier, Lovelace)] + , treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)] , outFile :: !(File () Out) } deriving Show @@ -130,7 +128,7 @@ data UpdateProtocolParametersConwayOnwards era { eon :: !(ConwayEraOnwards era) , networkId :: !Ledger.Network , deposit :: !Lovelace - , returnAddr :: !AnyStakeIdentifier + , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl , proposalHashSource :: !ProposalHashSource , governanceActionId :: !(Maybe (TxId, Word32)) @@ -170,8 +168,3 @@ renderGovernanceActionCmds = ("governance action " <>) . \case GovernanceActionViewCmd {} -> "view" - -data AnyStakeIdentifier - = AnyStakeKey (VerificationKeyOrHashOrFile StakeKey) - | AnyStakePoolKey (VerificationKeyOrHashOrFile StakePoolKey) - deriving Show diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index 06e8de96f9..5a3ffbc4e2 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -61,7 +61,7 @@ data QueryCmds era data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , genesisFp :: !GenesisFile , poolColdVerKeyFile :: !(VerificationKeyOrHashOrFile StakePoolKey) @@ -72,42 +72,42 @@ data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs data QueryProtocolParametersCmdArgs = QueryProtocolParametersCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryConstitutionHashCmdArgs = QueryConstitutionHashCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryTipCmdArgs = QueryTipCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryStakePoolsCmdArgs = QueryStakePoolsCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryStakeDistributionCmdArgs = QueryStakeDistributionCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryStakeAddressInfoCmdArgs = QueryStakeAddressInfoCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , addr :: !StakeAddress , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) @@ -115,7 +115,7 @@ data QueryStakeAddressInfoCmdArgs = QueryStakeAddressInfoCmdArgs data QueryUTxOCmdArgs = QueryUTxOCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , queryFilter :: !QueryUTxOFilter , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) @@ -123,21 +123,21 @@ data QueryUTxOCmdArgs = QueryUTxOCmdArgs data QueryLedgerStateCmdArgs = QueryLedgerStateCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryProtocolStateCmdArgs = QueryProtocolStateCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data QueryStakeSnapshotCmdArgs = QueryStakeSnapshotCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey]) , mOutFile :: !(Maybe (File () Out)) @@ -145,7 +145,7 @@ data QueryStakeSnapshotCmdArgs = QueryStakeSnapshotCmdArgs data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , nodeOpCertFp :: !(File () In) -- ^ Node operational certificate , mOutFile :: !(Maybe (File () Out)) @@ -153,14 +153,14 @@ data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs data QueryPoolStateCmdArgs = QueryPoolStateCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , poolIds :: ![Hash StakePoolKey] } deriving (Generic, Show) data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , query :: !TxMempoolQuery , mOutFile :: !(Maybe (File () Out)) @@ -169,7 +169,7 @@ data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , utcTime :: !UTCTime } deriving (Generic, Show) @@ -177,7 +177,7 @@ data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs data QueryNoArgCmdArgs era = QueryNoArgCmdArgs { eon :: !(ConwayEraOnwards era) , nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving Show @@ -185,7 +185,7 @@ data QueryNoArgCmdArgs era = QueryNoArgCmdArgs data QueryDRepStateCmdArgs era = QueryDRepStateCmdArgs { eon :: !(ConwayEraOnwards era) , nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , drepKeys :: ![VerificationKeyOrHashOrFile DRepKey] , mOutFile :: !(Maybe (File () Out)) @@ -194,7 +194,7 @@ data QueryDRepStateCmdArgs era = QueryDRepStateCmdArgs data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs { eon :: !(ConwayEraOnwards era) , nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , drepKeys :: ![VerificationKeyOrHashOrFile DRepKey] , mOutFile :: !(Maybe (File () Out)) @@ -203,7 +203,7 @@ data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs data QueryCommitteeMembersStateCmdArgs era = QueryCommitteeMembersStateCmdArgs { eon :: !(ConwayEraOnwards era) , nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , committeeColdKeys :: ![VerificationKeyOrHashOrFile CommitteeColdKey] , committeeHotKeys :: ![VerificationKeyOrHashOrFile CommitteeHotKey] diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs index 8919f2dedd..2002f6fdb5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs @@ -84,7 +84,7 @@ data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs data TransactionBuildCmdArgs era = TransactionBuildCmdArgs { eon :: !(ShelleyBasedEra era) , nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mScriptValidity :: !(Maybe ScriptValidity) -- ^ Mark script as expected to pass or fail validation @@ -148,7 +148,7 @@ data TransactionSignWitnessCmdArgs = TransactionSignWitnessCmdArgs data TransactionSubmitCmdArgs = TransactionSubmitCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , txFile :: !FilePath } deriving Show diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 896a35364a..be8a3a1a2c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -109,7 +109,7 @@ toUnitIntervalOrErr r = case Ledger.boundRational r of ] Just n -> n -pConsensusModeParams :: Parser (ConsensusModeParams CardanoMode) +pConsensusModeParams :: Parser ConsensusModeParams pConsensusModeParams = asum [ pCardanoMode *> pCardanoConsensusMode , pDefaultConsensusMode @@ -122,10 +122,10 @@ pConsensusModeParams = asum , Opt.help "For talking to a node running in full Cardano mode (default)." ] - pCardanoConsensusMode :: Parser (ConsensusModeParams CardanoMode) + pCardanoConsensusMode :: Parser ConsensusModeParams pCardanoConsensusMode = CardanoModeParams <$> pEpochSlots - pDefaultConsensusMode :: Parser (ConsensusModeParams CardanoMode) + pDefaultConsensusMode :: Parser ConsensusModeParams pDefaultConsensusMode = pure . CardanoModeParams $ EpochSlots defaultByronEpochSlots 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 f5070c12bb..4235eaa118 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -68,7 +68,7 @@ pGovernanceActionNewInfoCmd era = do Cmd.GovernanceActionInfoCmdArgs eon <$> pNetwork <*> pGovActionDeposit - <*> pAnyStakeIdentifier Nothing + <*> pStakeVerificationKeyOrHashOrFile Nothing <*> pProposalUrl <*> pProposalHashSource <*> pFileOutDirection "out-file" "Path to action file to be used later on with build or build-raw " @@ -88,7 +88,7 @@ pGovernanceActionNewConstitutionCmd era = do Cmd.GovernanceActionCreateConstitutionCmdArgs eon <$> pNetwork <*> pGovActionDeposit - <*> pAnyStakeIdentifier Nothing + <*> pStakeVerificationKeyOrHashOrFile Nothing <*> pPreviousGovernanceAction <*> pProposalUrl <*> pProposalHashSource @@ -118,7 +118,7 @@ pUpdateCommitteeCmd eon = Cmd.GoveranceActionUpdateCommitteeCmdArgs eon <$> pNetwork <*> pGovActionDeposit - <*> pAnyStakeIdentifier Nothing + <*> pStakeVerificationKeyOrHashOrFile Nothing <*> pProposalUrl <*> pProposalHashSource <*> many pRemoveCommitteeColdVerificationKeyOrHashOrFile @@ -143,7 +143,7 @@ pGovernanceActionNoConfidenceCmd era = do Cmd.GovernanceActionCreateNoConfidenceCmdArgs eon <$> pNetwork <*> pGovActionDeposit - <*> pAnyStakeIdentifier Nothing + <*> pStakeVerificationKeyOrHashOrFile Nothing <*> pProposalUrl <*> pProposalHashSource <*> pTxId "governance-action-tx-id" "Previous txid of `NoConfidence` or `NewCommittee` governance action." @@ -152,14 +152,6 @@ pGovernanceActionNoConfidenceCmd era = do ) $ Opt.progDesc "Create a no confidence proposal." --- | The first argument is the optional prefix. -pAnyStakeIdentifier :: Maybe String -> Parser Cmd.AnyStakeIdentifier -pAnyStakeIdentifier prefix = - asum - [ Cmd.AnyStakePoolKey <$> pStakePoolVerificationKeyOrHashOrFile prefix - , Cmd.AnyStakeKey <$> pStakeVerificationKeyOrHashOrFile prefix - ] - pUpdateProtocolParametersPreConway :: ShelleyToBabbageEra era -> Parser (Cmd.UpdateProtocolParametersPreConway era) pUpdateProtocolParametersPreConway shelleyToBab = Cmd.UpdateProtocolParametersPreConway shelleyToBab @@ -171,7 +163,7 @@ pUpdateProtocolParametersPostConway conwayOnwards = Cmd.UpdateProtocolParametersConwayOnwards conwayOnwards <$> pNetwork <*> pGovActionDeposit - <*> pAnyStakeIdentifier Nothing + <*> pStakeVerificationKeyOrHashOrFile Nothing <*> pProposalUrl <*> pProposalHashSource <*> pPreviousGovernanceAction @@ -340,10 +332,10 @@ pGovernanceActionTreasuryWithdrawalCmd era = do Cmd.GovernanceActionTreasuryWithdrawalCmdArgs eon <$> pNetwork <*> pGovActionDeposit - <*> pAnyStakeIdentifier (Just "deposit-return") + <*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return") <*> pProposalUrl <*> pProposalHashSource - <*> many ((,) <$> pAnyStakeIdentifier (Just "funds-receiving") <*> pTransferAmt) + <*> many ((,) <$> pStakeVerificationKeyOrHashOrFile (Just "funds-receiving") <*> pTransferAmt) <*> pFileOutDirection "out-file" "Output filepath of the treasury withdrawal." ) $ Opt.progDesc "Create a treasury withdrawal." diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 4c64465f87..509ff8bb3d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -3,7 +3,6 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} module Cardano.CLI.EraBased.Run.Governance.Actions @@ -12,7 +11,6 @@ module Cardano.CLI.EraBased.Run.Governance.Actions ) where import Cardano.Api -import Cardano.Api.Ledger (coerceKeyRole) import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley @@ -302,18 +300,10 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do ) sbe - -readStakeKeyHash :: AnyStakeIdentifier -> ExceptT GovernanceActionsError IO (Hash StakeKey) -readStakeKeyHash anyStake = - case anyStake of - AnyStakeKey stake -> - firstExceptT GovernanceActionsCmdReadFileError - . newExceptT $ readVerificationKeyOrHashOrFile AsStakeKey stake - - AnyStakePoolKey stake -> do - StakePoolKeyHash t <- firstExceptT GovernanceActionsCmdReadFileError - . newExceptT $ readVerificationKeyOrHashOrFile AsStakePoolKey stake - return $ StakeKeyHash $ coerceKeyRole t +readStakeKeyHash :: VerificationKeyOrHashOrFile StakeKey -> ExceptT GovernanceActionsError IO (Hash StakeKey) +readStakeKeyHash stake = + firstExceptT GovernanceActionsCmdReadFileError + . newExceptT $ readVerificationKeyOrHashOrFile AsStakeKey stake runGovernanceActionTreasuryWithdrawalCmd :: () => GovernanceActionTreasuryWithdrawalCmdArgs era @@ -341,10 +331,9 @@ runGovernanceActionTreasuryWithdrawalCmd returnKeyHash <- readStakeKeyHash returnAddr - withdrawals <- sequence - [ (networkId, , ll) <$> stakeIdentifiertoCredential stakeIdentifier - | (stakeIdentifier,ll) <- treasuryWithdrawal - ] + withdrawals <- forM treasuryWithdrawal $ \(verificationKeyOrHashOrFile, lovelace) -> do + stakeKeyHash <- readStakeKeyHash verificationKeyOrHashOrFile + pure (networkId, StakeCredentialByKey stakeKeyHash, lovelace) let sbe = conwayEraOnwardsToShelleyBasedEra eon treasuryWithdrawals = TreasuryWithdrawal withdrawals @@ -353,16 +342,3 @@ runGovernanceActionTreasuryWithdrawalCmd firstExceptT GovernanceActionsCmdWriteFileError . newExceptT $ conwayEraOnwardsConstraints eon $ writeFileTextEnvelope outFile Nothing proposal - -stakeIdentifiertoCredential :: AnyStakeIdentifier -> ExceptT GovernanceActionsError IO StakeCredential -stakeIdentifiertoCredential anyStake = - case anyStake of - AnyStakeKey stake -> do - hash <- firstExceptT GovernanceActionsCmdReadFileError - . newExceptT $ readVerificationKeyOrHashOrFile AsStakeKey stake - return $ StakeCredentialByKey hash - AnyStakePoolKey stake -> do - StakePoolKeyHash t <- firstExceptT GovernanceActionsCmdReadFileError - . newExceptT $ readVerificationKeyOrHashOrFile AsStakePoolKey stake - -- TODO: Conway era - don't use coerceKeyRole - return . StakeCredentialByKey $ StakeKeyHash $ coerceKeyRole t diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index 1db8c9dee8..4234c4a49c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -113,8 +113,7 @@ runGovernanceDRepRegistrationCertificateCmd . newExceptT $ readVerificationKeyOrHashOrFile AsDRepKey drepVkeyHashSource let drepCred = Ledger.KeyHashObj $ conwayEraOnwardsConstraints w drepKeyHash - votingCredential = VotingCredential drepCred - req = DRepRegistrationRequirements w votingCredential deposit + req = DRepRegistrationRequirements w drepCred deposit registrationCert = makeDrepRegistrationCertificate req mAnchor description = Just @TextEnvelopeDescr "DRep Key Registration Certificate" @@ -138,7 +137,7 @@ runGovernanceDRepRetirementCertificateCmd DRepKeyHash drepKeyHash <- firstExceptT GovernanceCmdKeyReadError . newExceptT $ readVerificationKeyOrHashOrFile AsDRepKey vkeyHashSource - makeDrepUnregistrationCertificate (DRepUnregistrationRequirements w (VotingCredential $ KeyHashObj drepKeyHash) deposit) + makeDrepUnregistrationCertificate (DRepUnregistrationRequirements w (KeyHashObj drepKeyHash) deposit) & writeFileTextEnvelope outFile (Just genKeyDelegCertDesc) & firstExceptT GovernanceCmdTextEnvWriteError . newExceptT diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index aae3fb6372..11bfddbddd 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -21,12 +21,10 @@ import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceVoteCmdError import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key -import Cardano.Ledger.Keys (coerceKeyRole) import Control.Monad.Trans.Except import Control.Monad.Trans.Except.Extra import Data.Aeson.Encode.Pretty -import Data.Bifunctor import Data.Function import qualified Data.Yaml.Pretty as Yaml @@ -62,39 +60,25 @@ runGovernanceVoteCreateCmd let voteAnchor = Ledger.Anchor { Ledger.anchorUrl = url, Ledger.anchorDataHash = voteHash } VotingProcedure votingProcedureWithoutAnchor = createVotingProcedure eon voteChoice Nothing votingProcedureWithAnchor = VotingProcedure $ votingProcedureWithoutAnchor { Ledger.vProcAnchor = Ledger.SJust voteAnchor } - return votingProcedureWithAnchor + pure votingProcedureWithAnchor shelleyBasedEraConstraints sbe $ do - case votingStakeCredentialSource of + voter <- firstExceptT GovernanceVoteCmdReadVerificationKeyError $ case votingStakeCredentialSource of AnyDRepVerificationKeyOrHashOrFile stake -> do - DRepKeyHash h <- firstExceptT GovernanceVoteCmdReadVerificationKeyError - . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake - let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h - - votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential eon vStakeCred - let voter = Ledger.DRepVoter (unVotingCredential votingCred) - govActIdentifier = createGovernanceActionId govActionTxId govActionIndex - votingProcedures = singletonVotingProcedures eon voter govActIdentifier (unVotingProcedure voteProcedure) - firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope outFile Nothing votingProcedures + DRepKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake + pure $ Ledger.DRepVoter $ Ledger.KeyHashObj h AnyStakePoolVerificationKeyOrHashOrFile stake -> do - h <- firstExceptT GovernanceVoteCmdReadVerificationKeyError - . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsStakePoolKey stake - - let voter = Ledger.StakePoolVoter (unStakePoolKeyHash h) - govActIdentifier = createGovernanceActionId govActionTxId govActionIndex - votingProcedures = singletonVotingProcedures eon voter govActIdentifier (unVotingProcedure voteProcedure) - firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope outFile Nothing votingProcedures + StakePoolKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsStakePoolKey stake + pure $ Ledger.StakePoolVoter h AnyCommitteeHotVerificationKeyOrHashOrFile stake -> do - CommitteeHotKeyHash h <- firstExceptT GovernanceVoteCmdReadVerificationKeyError - . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake - let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h - votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential eon vStakeCred - let voter = Ledger.CommitteeVoter (Ledger.coerceKeyRole (unVotingCredential votingCred)) -- TODO Conway - remove coerceKeyRole - govActIdentifier = createGovernanceActionId govActionTxId govActionIndex - votingProcedures = singletonVotingProcedures eon voter govActIdentifier (unVotingProcedure voteProcedure) - firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope outFile Nothing votingProcedures + CommitteeHotKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake + pure $ Ledger.CommitteeVoter $ Ledger.KeyHashObj h + + let govActIdentifier = createGovernanceActionId govActionTxId govActionIndex + votingProcedures = singletonVotingProcedures eon voter govActIdentifier (unVotingProcedure voteProcedure) + firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope outFile Nothing votingProcedures runGovernanceVoteViewCmd :: () => Cmd.GovernanceVoteViewCmdArgs era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 43cf4d76c4..cb06d0c17c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -144,15 +144,12 @@ runQueryConstitutionHashCmd let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath result <- liftIO $ executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) - & onLeft (left . QueryCmdUnsupportedNtcVersion) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - lift (shelleyBasedEraConstraints sbe (queryConstitutionHash eraInMode sbe)) + lift (shelleyBasedEraConstraints sbe (queryConstitutionHash sbe)) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdEraMismatch) @@ -180,15 +177,11 @@ runQueryProtocolParametersCmd , Cmd.mOutFile } = do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath - AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ newExceptT $ determineEra consensusModeParams localNodeConnInfo - sbe <- case cardanoEraStyle era of - LegacyByronEra -> left QueryCmdByronEra - ShelleyBasedEra sbe -> return sbe - let eraInMode = toEraInCardanoMode era - - let qInMode = QueryInEra eraInMode $ QueryInShelleyBasedEra sbe Api.QueryProtocolParameters + AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ newExceptT $ determineEra localNodeConnInfo + sbe <- forEraInEon @ShelleyBasedEra era (left QueryCmdByronEra) pure + let qInMode = QueryInEra $ QueryInShelleyBasedEra sbe Api.QueryProtocolParameters pp <- firstExceptT QueryCmdConvenienceError - . newExceptT $ executeQueryAnyMode era localNodeConnInfo qInMode + . newExceptT $ executeQueryAnyMode localNodeConnInfo qInMode writeProtocolParameters sbe mOutFile pp where -- TODO: Conway era - use ledger PParams JSON @@ -233,7 +226,7 @@ relativeTimeSeconds (RelativeTime dt) = floor (nominalDiffTimeToSeconds dt) -- | Query the chain tip via the chain sync protocol. -- -- This is a fallback query to support older versions of node to client protocol. -queryChainTipViaChainSync :: MonadIO m => LocalNodeConnectInfo mode -> m ChainTip +queryChainTipViaChainSync :: MonadIO m => LocalNodeConnectInfo -> m ChainTip queryChainTipViaChainSync localNodeConnInfo = do liftIO . T.hPutStrLn IO.stderr $ "Warning: Local header state query unavailable. Falling back to chain sync query" @@ -337,15 +330,13 @@ runQueryUTxOCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - utxo <- lift (queryUtxo eraInMode sbe queryFilter) + utxo <- lift (queryUtxo sbe queryFilter) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -373,17 +364,15 @@ runQueryKesPeriodInfoCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - -- We check that the KES period specified in the operational certificate is correct -- based on the KES period defined in the genesis parameters and the current slot number - gParams <- lift (queryGenesisParameters eraInMode sbe) + gParams <- lift (queryGenesisParameters sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -394,7 +383,7 @@ runQueryKesPeriodInfoCmd -- We get the operational certificate counter from the protocol state and check that -- it is equivalent to what we have on disk. - ptclState <- lift (queryProtocolState eraInMode sbe) + ptclState <- lift (queryProtocolState sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -642,15 +631,13 @@ runQueryPoolStateCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - result <- lift (queryPoolState eraInMode sbe $ Just $ Set.fromList poolIds) + result <- lift (queryPoolState sbe $ Just $ Set.fromList poolIds) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -676,11 +663,9 @@ runQueryTxMempoolCmd localQuery <- case query of TxMempoolQueryTxExists tx -> do - AnyCardanoEra era <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing (determineEraExpr consensusModeParams)) + AnyCardanoEra era <- lift (determineEra localNodeConnInfo) & onLeft (left . QueryCmdAcquireFailure) - & onLeft (left . QueryCmdUnsupportedNtcVersion) - let eraInMode = toEraInCardanoMode era - pure $ LocalTxMonitoringQueryTx $ TxIdInMode tx eraInMode + pure $ LocalTxMonitoringQueryTx $ TxIdInMode era tx TxMempoolQueryNextTx -> pure LocalTxMonitoringSendNextTx TxMempoolQueryInfo -> pure LocalTxMonitoringMempoolInformation @@ -722,19 +707,17 @@ runQueryStakeSnapshotCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - let poolFilter = case allOrOnlyPoolIds of All -> Nothing Only poolIds -> Just $ Set.fromList poolIds - result <- lift (queryStakeSnapshot eraInMode sbe poolFilter) + result <- lift (queryStakeSnapshot sbe poolFilter) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -758,15 +741,13 @@ runQueryLedgerStateCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - result <- lift (queryDebugLedgerState eraInMode sbe) + result <- lift (queryDebugLedgerState sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -790,15 +771,13 @@ runQueryProtocolStateCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - result <- lift (queryProtocolState eraInMode sbe) + result <- lift (queryProtocolState sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -825,21 +804,19 @@ runQueryStakeAddressInfoCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - let stakeAddr = Set.singleton $ fromShelleyStakeCredential addr - (stakeRewardAccountBalances, stakePools) <- lift (queryStakeAddresses eraInMode sbe stakeAddr networkId) + (stakeRewardAccountBalances, stakePools) <- lift (queryStakeAddresses sbe stakeAddr networkId) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) - stakeDelegDeposits <- lift (queryStakeDelegDeposits eraInMode sbe stakeAddr) + stakeDelegDeposits <- lift (queryStakeDelegDeposits sbe stakeAddr) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -1091,12 +1068,10 @@ runQueryStakePoolsCmd ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT @QueryCmdError $ do AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) - let eraInMode = toEraInCardanoMode era - sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - poolIds <- lift (queryStakePools eraInMode sbe) + poolIds <- lift (queryStakePools sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdEraMismatch) @@ -1131,15 +1106,13 @@ runQueryStakeDistributionCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - result <- lift (queryStakeDistribution eraInMode sbe) + result <- lift (queryStakeDistribution sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -1211,19 +1184,17 @@ runQueryLeadershipScheduleCmd join $ lift ( executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ do - AnyCardanoEra era <- lift (determineEraExpr consensusModeParams) + AnyCardanoEra era <- lift queryCurrentEra & onLeft (left . QueryCmdUnsupportedNtcVersion) sbe <- requireShelleyBasedEra era & onNothing (left QueryCmdByronEra) - let eraInMode = toEraInCardanoMode era - - pparams <- lift (queryProtocolParameters eraInMode sbe) + pparams <- lift (queryProtocolParameters sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) - ptclState <- lift (queryProtocolState eraInMode sbe) + ptclState <- lift (queryProtocolState sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -1232,13 +1203,13 @@ runQueryLeadershipScheduleCmd let eInfo = toEpochInfo eraHistory - curentEpoch <- lift (queryEpoch eraInMode sbe) + curentEpoch <- lift (queryEpoch sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) case whichSchedule of CurrentEpoch -> do - serCurrentEpochState <- lift (queryPoolDistribution eraInMode sbe (Just (Set.singleton poolid))) + serCurrentEpochState <- lift (queryPoolDistribution sbe (Just (Set.singleton poolid))) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -1259,7 +1230,7 @@ runQueryLeadershipScheduleCmd writeSchedule mOutFile eInfo shelleyGenesis schedule NextEpoch -> do - serCurrentEpochState <- lift (queryCurrentEpochState eraInMode sbe) + serCurrentEpochState <- lift (queryCurrentEpochState sbe) & onLeft (left . QueryCmdUnsupportedNtcVersion) & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) @@ -1356,11 +1327,8 @@ runQueryConstitution } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath sbe = conwayEraOnwardsToShelleyBasedEra eon - cEra = conwayEraOnwardsToCardanoEra eon - - let eraInMode = toEraInCardanoMode cEra - constitution <- runQuery localNodeConnInfo $ queryConstitution eraInMode sbe + constitution <- runQuery localNodeConnInfo $ queryConstitution sbe writeOutput mOutFile constitution runQueryGovState @@ -1376,11 +1344,8 @@ runQueryGovState } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath sbe = conwayEraOnwardsToShelleyBasedEra eon - cEra = conwayEraOnwardsToCardanoEra eon - let eraInMode = toEraInCardanoMode cEra - - govState <- runQuery localNodeConnInfo $ queryGovState eraInMode sbe + govState <- runQuery localNodeConnInfo $ queryGovState sbe writeOutput mOutFile govState runQueryDRepState @@ -1397,13 +1362,10 @@ runQueryDRepState } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath sbe = conwayEraOnwardsToShelleyBasedEra eon - cEra = conwayEraOnwardsToCardanoEra eon - - let eraInMode = toEraInCardanoMode cEra drepCreds <- Set.fromList <$> mapM (firstExceptT QueryCmdDRepKeyError . getDRepCredentialFromVerKeyHashOrFile) drepKeys - drepState <- runQuery localNodeConnInfo $ queryDRepState eraInMode sbe drepCreds + drepState <- runQuery localNodeConnInfo $ queryDRepState sbe drepCreds writeOutput mOutFile $ second drepStateToJson <$> Map.assocs drepState where @@ -1427,16 +1389,13 @@ runQueryDRepStakeDistribution } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath sbe = conwayEraOnwardsToShelleyBasedEra eon - cEra = conwayEraOnwardsToCardanoEra eon let drepFromVrfKey = fmap Ledger.DRepCredential . firstExceptT QueryCmdDRepKeyError . getDRepCredentialFromVerKeyHashOrFile dreps <- Set.fromList <$> mapM drepFromVrfKey drepKeys - let eraInMode = toEraInCardanoMode cEra - - drepStakeDistribution <- runQuery localNodeConnInfo $ queryDRepStakeDistribution eraInMode sbe dreps + drepStakeDistribution <- runQuery localNodeConnInfo $ queryDRepStakeDistribution sbe dreps writeOutput mOutFile $ Map.assocs drepStakeDistribution @@ -1456,7 +1415,6 @@ runQueryCommitteeMembersState } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath sbe = conwayEraOnwardsToShelleyBasedEra eon - cEra = conwayEraOnwardsToCardanoEra eon let coldKeysFromVerKeyHashOrFile = firstExceptT QueryCmdCommitteeColdKeyError . getCommitteeColdCredentialFromVerKeyHashOrFile @@ -1466,17 +1424,15 @@ runQueryCommitteeMembersState firstExceptT QueryCmdCommitteeHotKeyError . getCommitteeHotCredentialFromVerKeyHashOrFile hotKeys <- Set.fromList <$> mapM hotKeysFromVerKeyHashOrFile hotCredKeys - let eraInMode = toEraInCardanoMode cEra - committeeState <- runQuery localNodeConnInfo $ - queryCommitteeMembersState eraInMode sbe coldKeys hotKeys (Set.fromList memberStatuses) + queryCommitteeMembersState sbe coldKeys hotKeys (Set.fromList memberStatuses) writeOutput mOutFile $ A.toJSON committeeState -runQuery :: LocalNodeConnectInfo mode +runQuery :: LocalNodeConnectInfo -> LocalStateQueryExpr - (BlockInMode mode) + BlockInMode ChainPoint - (QueryInMode mode) + QueryInMode () IO (Either @@ -1502,8 +1458,8 @@ writeOutput mOutFile content = case mOutFile of -- Helpers -toEpochInfo :: EraHistory CardanoMode -> EpochInfo (Either Text) -toEpochInfo (EraHistory _ interpreter) = +toEpochInfo :: EraHistory -> EpochInfo (Either Text) +toEpochInfo (EraHistory interpreter) = hoistEpochInfo (first (Text.pack . show) . runExcept) $ Consensus.interpreterToEpochInfo interpreter @@ -1517,8 +1473,8 @@ newtype Tentative a = Tentative { tentative :: a } deriving (Eq, Show) -- This interpreter will compute accurate values into the future as long as a -- a hard fork does not happen in the intervening time. Those values are thus -- "tentative" because they can change in the event of a hard fork. -toTentativeEpochInfo :: EraHistory CardanoMode -> Tentative (EpochInfo (Either Text)) -toTentativeEpochInfo (EraHistory _ interpreter) = +toTentativeEpochInfo :: EraHistory -> Tentative (EpochInfo (Either Text)) +toTentativeEpochInfo (EraHistory interpreter) = Tentative $ hoistEpochInfo (first (Text.pack . show) . runExcept) $ Consensus.interpreterToEpochInfo (Consensus.unsafeExtendSafeZone interpreter) @@ -1527,7 +1483,7 @@ toTentativeEpochInfo (EraHistory _ interpreter) = -- | Get slot number for timestamp, or an error if the UTC timestamp is before 'SystemStart' or after N+1 era utcTimeToSlotNo :: SocketPath - -> ConsensusModeParams CardanoMode + -> ConsensusModeParams -> NetworkId -> UTCTime -> ExceptT QueryCmdError IO SlotNo diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 916d56271c..8d74b09651 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -7,6 +7,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} @@ -36,7 +37,6 @@ import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Transaction as Cmd import Cardano.CLI.EraBased.Run.Genesis -import Cardano.CLI.Helpers import Cardano.CLI.Json.Friendly (FriendlyFormat (..), friendlyTx, friendlyTxBody) import Cardano.CLI.Read import Cardano.CLI.Types.Common @@ -184,7 +184,7 @@ runTransactionBuildCmd -- We need to construct the txBodycontent outside of runTxBuild BalancedTxBody txBodyContent balancedTxBody _ _ <- runTxBuild - eon nodeSocketPath consensusModeParams networkId mScriptValidity inputsAndMaybeScriptWits readOnlyReferenceInputs + eon nodeSocketPath networkId mScriptValidity inputsAndMaybeScriptWits readOnlyReferenceInputs filteredTxinsc mReturnCollateral mTotalCollateral txOuts changeAddresses valuesWithScriptWits mValidityLowerBound mValidityUpperBound certsAndMaybeScriptWits withdrawalsAndMaybeScriptWits requiredSigners txAuxScripts txMetadata mProp mOverrideWitnesses votingProcedures proposals buildOutputOptions @@ -212,7 +212,7 @@ runTransactionBuildCmd pparams <- pure mTxProtocolParams & onNothing (left TxCmdProtocolParametersNotPresentInTxBody) executionUnitPrices <- pure (getExecutionUnitPrices era pparams) & onNothing (left TxCmdPParamExecutionUnitsNotAvailable) - AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing (determineEraExpr consensusModeParams)) + AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing queryCurrentEra) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError . QceUnsupportedNtcVersion) @@ -226,7 +226,7 @@ runTransactionBuildCmd scriptExecUnitsMap <- firstExceptT TxCmdTxExecUnitsErr $ hoistEither - $ evaluateTransactionExecutionUnits + $ evaluateTransactionExecutionUnits era systemStart (toLedgerEpochInfo eraHistory) pparams txEraUtxo balancedTxBody @@ -245,15 +245,10 @@ runTransactionBuildCmd & onLeft (left . TxCmdWriteFileError) getExecutionUnitPrices :: CardanoEra era -> LedgerProtocolParameters era -> Maybe Ledger.Prices -getExecutionUnitPrices cEra (LedgerProtocolParameters pp) = do - ShelleyBasedEra sbe <- pure $ cardanoEraStyle cEra - case sbe of - ShelleyBasedEraShelley -> Nothing - ShelleyBasedEraAllegra -> Nothing - ShelleyBasedEraMary -> Nothing - ShelleyBasedEraAlonzo -> Just $ pp ^. Ledger.ppPricesL - ShelleyBasedEraBabbage -> Just $ pp ^. Ledger.ppPricesL - ShelleyBasedEraConway -> Just $ pp ^. Ledger.ppPricesL +getExecutionUnitPrices cEra (LedgerProtocolParameters pp) = + forEraInEonMaybe cEra $ \aeo -> + alonzoEraOnwardsConstraints aeo $ + pp ^. Ledger.ppPricesL runTransactionBuildRawCmd :: () => Cmd.TransactionBuildRawCmdArgs era @@ -291,15 +286,13 @@ runTransactionBuildRawCmd -- TODO: Conway era - How can we make this more composable? certsAndMaybeScriptWits <- - case cardanoEraStyle eon of - LegacyByronEra -> return [] - ShelleyBasedEra sbe -> - shelleyBasedEraConstraints sbe $ - sequence - [ fmap (,mSwit) (firstExceptT TxCmdReadTextViewFileError . newExceptT $ - readFileTextEnvelope AsCertificate (File certFile)) - | (CertificateFile certFile, mSwit) <- certFilesAndMaybeScriptWits - ] + forEraInEon eon (pure mempty) $ \sbe -> + shelleyBasedEraConstraints sbe $ + sequence + [ fmap (,mSwit) (firstExceptT TxCmdReadTextViewFileError . newExceptT $ + readFileTextEnvelope AsCertificate (File certFile)) + | (CertificateFile certFile, mSwit) <- certFilesAndMaybeScriptWits + ] withdrawalsAndMaybeScriptWits <- firstExceptT TxCmdScriptWitnessError $ readScriptWitnessFilesThruple eon withdrawals @@ -314,9 +307,8 @@ runTransactionBuildRawCmd pparams <- forM mProtocolParamsFile $ \ppf -> firstExceptT TxCmdProtocolParamsError (readProtocolParameters ppf) - mLedgerPParams <- case cardanoEraStyle eon of - LegacyByronEra -> return Nothing - ShelleyBasedEra sbe -> + mLedgerPParams <- + forEraInEon eon (pure Nothing) $ \sbe -> forM pparams $ \pp -> firstExceptT TxCmdProtocolParamsConverstionError . hoistEither $ convertToLedgerProtocolParameters sbe pp @@ -461,7 +453,6 @@ runTxBuildRaw era runTxBuild :: () => ShelleyBasedEra era -> SocketPath - -> ConsensusModeParams CardanoMode -> NetworkId -> Maybe ScriptValidity -- ^ Mark script as expected to pass or fail validation @@ -499,7 +490,7 @@ runTxBuild :: () -> TxBuildOutputOptions -> ExceptT TxCmdError IO (BalancedTxBody era) runTxBuild - sbe socketPath consensusModeParams networkId mScriptValidity + sbe socketPath networkId mScriptValidity inputsAndMaybeScriptWits readOnlyRefIns txinsc mReturnCollateral mTotCollateral txouts (TxOutChangeAddress changeAddr) valuesWithScriptWits mLowerBound mUpperBound certsAndMaybeScriptWits withdrawals reqSigners txAuxScripts txMetadata @@ -537,7 +528,7 @@ runTxBuild , localNodeSocketPath = socketPath } - AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing (determineEraExpr consensusModeParams)) + AnyCardanoEra nodeEra <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing queryCurrentEra) & onLeft (left . TxCmdQueryConvenienceError . AcqFailure) & onLeft (left . TxCmdQueryConvenienceError . QceUnsupportedNtcVersion) @@ -930,8 +921,7 @@ runTransactionSubmitCmd } = do txFileOrPipe <- liftIO $ fileOrPipe txFile InAnyCardanoEra era tx <- lift (readFileTx txFileOrPipe) & onLeft (left . TxCmdCddlError) - let eraInMode = toEraInCardanoMode era - let txInMode = TxInMode tx eraInMode + let txInMode = TxInMode era tx localNodeConnInfo = LocalNodeConnectInfo { localConsensusModeParams = consensusModeParams , localNodeNetworkId = networkId @@ -943,7 +933,7 @@ runTransactionSubmitCmd Net.Tx.SubmitSuccess -> liftIO $ Text.putStrLn "Transaction successfully submitted." Net.Tx.SubmitFail reason -> case reason of - TxValidationErrorInMode err _eraInMode -> left . TxCmdTxSubmitError . Text.pack $ show err + TxValidationErrorInCardanoMode err -> left . TxCmdTxSubmitError . Text.pack $ show err TxValidationEraMismatch mismatchErr -> left $ TxCmdTxSubmitErrorEraMismatch mismatchErr -- ---------------------------------------------------------------------------- @@ -1014,14 +1004,13 @@ runTransactionCalculateMinValueCmd } = do pp <- firstExceptT TxCmdProtocolParamsError (readProtocolParameters protocolParamsFile) out <- toTxOutInAnyEra eon txOut - case cardanoEraStyle eon of - LegacyByronEra -> error "runTransactionCalculateMinValueCmd: Byron era not implemented yet" - ShelleyBasedEra sbe -> do - firstExceptT TxCmdPParamsErr . hoistEither - $ checkProtocolParameters sbe pp - pp' <- hoistEither . first TxCmdProtocolParamsConverstionError $ toLedgerPParams sbe pp - let minValue = calculateMinimumUTxO sbe out pp' - liftIO . IO.print $ minValue + -- TODO: shouldn't we just require shelley based era here instead of error-ing for byron? + forEraInEon eon (error "runTransactionCalculateMinValueCmd: Byron era not implemented yet") $ \sbe -> do + firstExceptT TxCmdPParamsErr . hoistEither + $ checkProtocolParameters sbe pp + pp' <- hoistEither . first TxCmdProtocolParamsConverstionError $ toLedgerPParams sbe pp + let minValue = calculateMinimumUTxO sbe out pp' + liftIO . IO.print $ minValue runTransactionPolicyIdCmd :: () => Cmd.TransactionPolicyIdCmdArgs @@ -1268,6 +1257,5 @@ onlyInShelleyBasedEras :: () -> InAnyCardanoEra a -> ExceptT TxCmdError IO (InAnyShelleyBasedEra a) onlyInShelleyBasedEras notImplMsg (InAnyCardanoEra era x) = - case cardanoEraStyle era of - LegacyByronEra -> left (TxCmdNotImplemented notImplMsg) - ShelleyBasedEra sbe -> shelleyBasedEraConstraints sbe $ return (InAnyShelleyBasedEra sbe x) + forEraInEon era (left $ TxCmdNotImplemented notImplMsg) $ \sbe -> + shelleyBasedEraConstraints sbe $ return (InAnyShelleyBasedEra sbe x) diff --git a/cardano-cli/src/Cardano/CLI/Helpers.hs b/cardano-cli/src/Cardano/CLI/Helpers.hs index 911432fcd6..475a218f14 100644 --- a/cardano-cli/src/Cardano/CLI/Helpers.hs +++ b/cardano-cli/src/Cardano/CLI/Helpers.hs @@ -1,5 +1,4 @@ {-# LANGUAGE GADTs #-} -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -14,11 +13,8 @@ module Cardano.CLI.Helpers , readCBOR , renderHelpersError , validateCBOR - , toEraInCardanoMode ) where -import Cardano.Api (CardanoEra (..), CardanoMode, EraInMode (..)) - import Cardano.Chain.Block (decCBORABlockOrBoundary) import qualified Cardano.Chain.Delegation as Delegation import qualified Cardano.Chain.Update as Update @@ -133,13 +129,3 @@ validateCBOR cborObject bs = CBORVoteByron -> do void $ decodeCBOR bs (fromCBOR :: Decoder s Update.Vote) Right "Valid Byron vote." - -toEraInCardanoMode :: CardanoEra era -> EraInMode era CardanoMode -toEraInCardanoMode = \case - ByronEra -> ByronEraInCardanoMode - ShelleyEra -> ShelleyEraInCardanoMode - AllegraEra -> AllegraEraInCardanoMode - MaryEra -> MaryEraInCardanoMode - AlonzoEra -> AlonzoEraInCardanoMode - BabbageEra -> BabbageEraInCardanoMode - ConwayEra -> ConwayEraInCardanoMode diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs index 879230794a..7dd87051dc 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs @@ -52,7 +52,7 @@ data LegacyQueryCmds data LegacyQueryLeadershipScheduleCmdArgs = LegacyQueryLeadershipScheduleCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , genesisFp :: !GenesisFile , poolColdVerKeyFile :: !(VerificationKeyOrHashOrFile StakePoolKey) @@ -63,42 +63,42 @@ data LegacyQueryLeadershipScheduleCmdArgs = LegacyQueryLeadershipScheduleCmdArgs data LegacyQueryProtocolParametersCmdArgs = LegacyQueryProtocolParametersCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryConstitutionHashCmdArgs = LegacyQueryConstitutionHashCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryTipCmdArgs = LegacyQueryTipCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryStakePoolsCmdArgs = LegacyQueryStakePoolsCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryStakeDistributionCmdArgs = LegacyQueryStakeDistributionCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryStakeAddressInfoCmdArgs = LegacyQueryStakeAddressInfoCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , addr :: !StakeAddress , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) @@ -106,7 +106,7 @@ data LegacyQueryStakeAddressInfoCmdArgs = LegacyQueryStakeAddressInfoCmdArgs data LegacyQueryUTxOCmdArgs = LegacyQueryUTxOCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , queryFilter :: !QueryUTxOFilter , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) @@ -114,21 +114,21 @@ data LegacyQueryUTxOCmdArgs = LegacyQueryUTxOCmdArgs data LegacyQueryLedgerStateCmdArgs = LegacyQueryLedgerStateCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryProtocolStateCmdArgs = LegacyQueryProtocolStateCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , mOutFile :: !(Maybe (File () Out)) } deriving (Generic, Show) data LegacyQueryStakeSnapshotCmdArgs = LegacyQueryStakeSnapshotCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey]) , mOutFile :: !(Maybe (File () Out)) @@ -136,7 +136,7 @@ data LegacyQueryStakeSnapshotCmdArgs = LegacyQueryStakeSnapshotCmdArgs data LegacyQueryKesPeriodInfoCmdArgs = LegacyQueryKesPeriodInfoCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , nodeOpCertFp :: !(File () In) -- ^ Node operational certificate , mOutFile :: !(Maybe (File () Out)) @@ -144,14 +144,14 @@ data LegacyQueryKesPeriodInfoCmdArgs = LegacyQueryKesPeriodInfoCmdArgs data LegacyQueryPoolStateCmdArgs = LegacyQueryPoolStateCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , poolIds :: ![Hash StakePoolKey] } deriving (Generic, Show) data LegacyQueryTxMempoolCmdArgs = LegacyQueryTxMempoolCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , query :: !TxMempoolQuery , mOutFile :: !(Maybe (File () Out)) @@ -160,7 +160,7 @@ data LegacyQueryTxMempoolCmdArgs = LegacyQueryTxMempoolCmdArgs data LegacyQuerySlotNumberCmdArgs = LegacyQuerySlotNumberCmdArgs { nodeSocketPath :: !SocketPath - , consensusModeParams :: !(ConsensusModeParams CardanoMode) + , consensusModeParams :: !ConsensusModeParams , networkId :: !NetworkId , utcTime :: !UTCTime } deriving (Generic, Show) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs index a3f9cc10ad..89a654c575 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Transaction.hs @@ -54,7 +54,7 @@ data LegacyTransactionCmds | TransactionBuildCmd SocketPath (EraInEon ShelleyBasedEra) - (ConsensusModeParams CardanoMode) + ConsensusModeParams NetworkId (Maybe ScriptValidity) -- ^ Mark script as expected to pass or fail validation (Maybe Word) @@ -109,7 +109,7 @@ data LegacyTransactionCmds (File () Out) | TransactionSubmitCmd SocketPath - (ConsensusModeParams CardanoMode) + ConsensusModeParams NetworkId FilePath | TransactionPolicyIdCmd diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index cdd6d79a96..79eca31535 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -67,7 +67,7 @@ runLegacyTransactionCmds = \case runLegacyTransactionBuildCmd :: () => SocketPath -> EraInEon ShelleyBasedEra - -> ConsensusModeParams CardanoMode + -> ConsensusModeParams -> NetworkId -> Maybe ScriptValidity -> Maybe Word -- ^ Override the required number of tx witnesses @@ -185,7 +185,7 @@ runLegacyTransactionSignCmd runLegacyTransactionSubmitCmd :: () => SocketPath - -> ConsensusModeParams CardanoMode + -> ConsensusModeParams -> NetworkId -> FilePath -> ExceptT TxCmdError IO () diff --git a/cardano-cli/src/Cardano/CLI/Types/Output.hs b/cardano-cli/src/Cardano/CLI/Types/Output.hs index 4ddd3bea10..d9ba4b9039 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Output.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Output.hs @@ -142,7 +142,7 @@ createOpCertIntervalInfo c@(CurrentKesPeriod cKesPeriod) data QueryTipLocalState mode = QueryTipLocalState { era :: AnyCardanoEra - , eraHistory :: EraHistory CardanoMode + , eraHistory :: EraHistory , mSystemStart :: Maybe SystemStart , mChainTip :: Maybe ChainTip } 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 a763e0f662..b2375e1074 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -5915,10 +5915,7 @@ Usage: cardano-cli conway governance action create-constitution | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -5943,10 +5940,7 @@ Usage: cardano-cli conway governance action update-committee | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -5974,10 +5968,7 @@ Usage: cardano-cli conway governance action update-committee Usage: cardano-cli conway governance action create-info (--mainnet | --testnet) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -5995,10 +5986,7 @@ Usage: cardano-cli conway governance action create-no-confidence | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -6018,10 +6006,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -6084,10 +6069,7 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal | --testnet ) --governance-action-deposit NATURAL - ( --deposit-return-stake-pool-verification-key STRING - | --deposit-return-cold-verification-key-file FILE - | --deposit-return-stake-pool-id STAKE_POOL_ID - | --deposit-return-stake-verification-key STRING + ( --deposit-return-stake-verification-key STRING | --deposit-return-stake-verification-key-file FILE | --deposit-return-stake-key-hash HASH ) @@ -6097,10 +6079,7 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal | --proposal-anchor-metadata-hash HASH ) [ - ( --funds-receiving-stake-pool-verification-key STRING - | --funds-receiving-cold-verification-key-file FILE - | --funds-receiving-stake-pool-id STAKE_POOL_ID - | --funds-receiving-stake-verification-key STRING + ( --funds-receiving-stake-verification-key STRING | --funds-receiving-stake-verification-key-file FILE | --funds-receiving-stake-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 b6d602f07f..a9dd22e4f0 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 @@ -3,10 +3,7 @@ Usage: cardano-cli conway governance action create-constitution | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -31,14 +28,6 @@ Available options: --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. - --stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --cold-verification-key-file FILE - Filepath of the stake pool verification key. - --stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --stake-verification-key-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-info.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-info.cli index 307bf1f5eb..d9b20e1019 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-info.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-info.cli @@ -1,9 +1,6 @@ Usage: cardano-cli conway governance action create-info (--mainnet | --testnet) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -21,14 +18,6 @@ Available options: --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. - --stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --cold-verification-key-file FILE - Filepath of the stake pool verification key. - --stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --stake-verification-key-file FILE 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 2531d8a3f2..0e2e456eb4 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 @@ -3,10 +3,7 @@ Usage: cardano-cli conway governance action create-no-confidence | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -26,14 +23,6 @@ Available options: --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. - --stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --cold-verification-key-file FILE - Filepath of the stake pool verification key. - --stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --stake-verification-key-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 a833646b87..83b31c4446 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 @@ -3,10 +3,7 @@ Usage: cardano-cli conway governance action create-protocol-parameters-update | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -69,14 +66,6 @@ Available options: --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. - --stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --cold-verification-key-file FILE - Filepath of the stake pool verification key. - --stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --stake-verification-key-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli index 7a42d97aba..0542b7420b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_governance_action_create-treasury-withdrawal.cli @@ -3,10 +3,7 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal | --testnet ) --governance-action-deposit NATURAL - ( --deposit-return-stake-pool-verification-key STRING - | --deposit-return-cold-verification-key-file FILE - | --deposit-return-stake-pool-id STAKE_POOL_ID - | --deposit-return-stake-verification-key STRING + ( --deposit-return-stake-verification-key STRING | --deposit-return-stake-verification-key-file FILE | --deposit-return-stake-key-hash HASH ) @@ -16,10 +13,7 @@ Usage: cardano-cli conway governance action create-treasury-withdrawal | --proposal-anchor-metadata-hash HASH ) [ - ( --funds-receiving-stake-pool-verification-key STRING - | --funds-receiving-cold-verification-key-file FILE - | --funds-receiving-stake-pool-id STAKE_POOL_ID - | --funds-receiving-stake-verification-key STRING + ( --funds-receiving-stake-verification-key STRING | --funds-receiving-stake-verification-key-file FILE | --funds-receiving-stake-key-hash HASH ) @@ -33,14 +27,6 @@ Available options: --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. - --deposit-return-stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --deposit-return-cold-verification-key-file FILE - Filepath of the stake pool verification key. - --deposit-return-stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --deposit-return-stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --deposit-return-stake-verification-key-file FILE @@ -55,14 +41,6 @@ Available options: Proposal anchor contents as a text file. --proposal-anchor-metadata-hash HASH Proposal anchor data hash. - --funds-receiving-stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --funds-receiving-cold-verification-key-file FILE - Filepath of the stake pool verification key. - --funds-receiving-stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --funds-receiving-stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --funds-receiving-stake-verification-key-file FILE 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 71e87b3b25..a880250f8c 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 @@ -3,10 +3,7 @@ Usage: cardano-cli conway governance action update-committee | --testnet ) --governance-action-deposit NATURAL - ( --stake-pool-verification-key STRING - | --cold-verification-key-file FILE - | --stake-pool-id STAKE_POOL_ID - | --stake-verification-key STRING + ( --stake-verification-key STRING | --stake-verification-key-file FILE | --stake-key-hash HASH ) @@ -37,14 +34,6 @@ Available options: --testnet Use the testnet magic id. --governance-action-deposit NATURAL Deposit required to submit a governance action. - --stake-pool-verification-key STRING - Stake pool verification key (Bech32 or hex-encoded). - --cold-verification-key-file FILE - Filepath of the stake pool verification key. - --stake-pool-id STAKE_POOL_ID - Stake pool ID/verification key hash (either - Bech32-encoded or hex-encoded). Zero or more - occurences of this option is allowed. --stake-verification-key STRING Stake verification key (Bech32 or hex-encoded). --stake-verification-key-file FILE diff --git a/flake.lock b/flake.lock index 32dedb0bb4..4fc708f359 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1698409315, - "narHash": "sha256-0h8SwdLnp/c02K9dXMlT37nTtmhgA1hKVaMjHLEtFYE=", + "lastModified": 1699002072, + "narHash": "sha256-WEhB4QGcO2tw4Kyi/217Oe0Sl7FJzQdWaiwsoqZuHac=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "9313f1f20599a693e4828600b67a19dbf7db2e30", + "rev": "79dd4bb1db3da3ea342bf8759821c7fe46a188f3", "type": "github" }, "original": {