Skip to content

Commit

Permalink
Merge pull request #430 from input-output-hk/mgalazyn/feature/integra…
Browse files Browse the repository at this point in the history
…te-api-8.30

Upgrade cardano-api to 8.30
  • Loading branch information
carbolymer authored Nov 3, 2023
2 parents 38c9583 + ef144e0 commit c2c19d7
Show file tree
Hide file tree
Showing 27 changed files with 178 additions and 402 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-27T12:25:48Z
, cardano-haskell-packages 2023-11-03T08:46:06Z

packages:
cardano-cli
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Byron/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ module Cardano.CLI.EraBased.Commands.Governance.Actions
, UpdateProtocolParametersConwayOnwards(..)
, UpdateProtocolParametersPreConway(..)
, renderGovernanceActionCmds

, AnyStakeIdentifier(..)
) where

import Cardano.Api
Expand Down Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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))
Expand Down Expand Up @@ -170,8 +168,3 @@ renderGovernanceActionCmds = ("governance action " <>) . \case

GovernanceActionViewCmd {} ->
"view"

data AnyStakeIdentifier
= AnyStakeKey (VerificationKeyOrHashOrFile StakeKey)
| AnyStakePoolKey (VerificationKeyOrHashOrFile StakePoolKey)
deriving Show
38 changes: 19 additions & 19 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ data QueryCmds era

data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, genesisFp :: !GenesisFile
, poolColdVerKeyFile :: !(VerificationKeyOrHashOrFile StakePoolKey)
Expand All @@ -72,95 +72,95 @@ 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))
} deriving (Generic, Show)

data QueryUTxOCmdArgs = QueryUTxOCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, queryFilter :: !QueryUTxOFilter
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

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))
} deriving (Generic, Show)

data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, nodeOpCertFp :: !(File () In) -- ^ Node operational certificate
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

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))
Expand All @@ -169,23 +169,23 @@ data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs

data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, utcTime :: !UTCTime
} deriving (Generic, Show)

data QueryNoArgCmdArgs era = QueryNoArgCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving Show

data QueryDRepStateCmdArgs era = QueryDRepStateCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, drepKeys :: ![VerificationKeyOrHashOrFile DRepKey]
, mOutFile :: !(Maybe (File () Out))
Expand All @@ -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))
Expand All @@ -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]
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 @@ -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
Expand Down Expand Up @@ -148,7 +148,7 @@ data TransactionSignWitnessCmdArgs = TransactionSignWitnessCmdArgs

data TransactionSubmitCmdArgs = TransactionSubmitCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, txFile :: !FilePath
} deriving Show
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
22 changes: 7 additions & 15 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand All @@ -88,7 +88,7 @@ pGovernanceActionNewConstitutionCmd era = do
Cmd.GovernanceActionCreateConstitutionCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pStakeVerificationKeyOrHashOrFile Nothing
<*> pPreviousGovernanceAction
<*> pProposalUrl
<*> pProposalHashSource
Expand Down Expand Up @@ -118,7 +118,7 @@ pUpdateCommitteeCmd eon =
Cmd.GoveranceActionUpdateCommitteeCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pStakeVerificationKeyOrHashOrFile Nothing
<*> pProposalUrl
<*> pProposalHashSource
<*> many pRemoveCommitteeColdVerificationKeyOrHashOrFile
Expand All @@ -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."
Expand All @@ -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
Expand All @@ -171,7 +163,7 @@ pUpdateProtocolParametersPostConway conwayOnwards =
Cmd.UpdateProtocolParametersConwayOnwards conwayOnwards
<$> pNetwork
<*> pGovActionDeposit
<*> pAnyStakeIdentifier Nothing
<*> pStakeVerificationKeyOrHashOrFile Nothing
<*> pProposalUrl
<*> pProposalHashSource
<*> pPreviousGovernanceAction
Expand Down Expand Up @@ -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."
Expand Down
Loading

0 comments on commit c2c19d7

Please sign in to comment.