diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index ce73cea2a3..31dd9967a5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -66,6 +66,7 @@ data QueryCmds era | QueryConstitutionCmd !(QueryNoArgCmdArgs era) | QueryGovStateCmd !(QueryNoArgCmdArgs era) | QueryRatifyStateCmd !(QueryNoArgCmdArgs era) + | QueryFuturePParamsCmd !(QueryNoArgCmdArgs era) | QueryDRepStateCmd !(QueryDRepStateCmdArgs era) | QueryDRepStakeDistributionCmd !(QueryDRepStakeDistributionCmdArgs era) | QuerySPOStakeDistributionCmd !(QuerySPOStakeDistributionCmdArgs era) @@ -294,6 +295,8 @@ renderQueryCmds = \case "gov-state" QueryRatifyStateCmd{} -> "ratify-state" + QueryFuturePParamsCmd{} -> + "future-pparams" QueryDRepStateCmd{} -> "drep-state" QueryDRepStakeDistributionCmd{} -> diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index bf547e63bc..948e8342ea 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -290,6 +290,7 @@ pQueryCmds era envCli = , pQueryGetConstitutionCmd era envCli , pQueryGetGovStateCmd era envCli , pQueryGetRatifyStateCmd era envCli + , pQueryFuturePParamsCmd era envCli , pQueryDRepStateCmd era envCli , pQueryDRepStakeDistributionCmd era envCli , pQuerySPOStakeDistributionCmd era envCli @@ -513,6 +514,18 @@ pQueryGetRatifyStateCmd era envCli = do Opt.info (QueryRatifyStateCmd <$> pQueryNoArgCmdArgs w envCli) $ Opt.progDesc "Get the ratification state" +pQueryFuturePParamsCmd + :: () + => ShelleyBasedEra era + -> EnvCli + -> Maybe (Parser (QueryCmds era)) +pQueryFuturePParamsCmd era envCli = do + w <- forShelleyBasedEraMaybeEon era + pure $ + subParser "future-pparams" $ + Opt.info (QueryFuturePParamsCmd <$> pQueryNoArgCmdArgs w envCli) $ + Opt.progDesc "Get the protocol parameters that will apply at the next epoch" + -- TODO Conway: DRep State and DRep Stake Distribution parsers use DRep keys to obtain DRep credentials. This only -- makes use of 'KeyHashObj' constructor of 'Credential kr c'. Should we also support here 'ScriptHashObj'? -- What about 'DRep c' - this means that only 'KeyHash' constructor is in use here: should also diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 24930d96e4..8c1af4b345 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -115,6 +115,7 @@ runQueryCmds = \case Cmd.QueryConstitutionCmd args -> runQueryConstitution args Cmd.QueryGovStateCmd args -> runQueryGovState args Cmd.QueryRatifyStateCmd args -> runQueryRatifyState args + Cmd.QueryFuturePParamsCmd args -> runQueryFuturePParams args Cmd.QueryDRepStateCmd args -> runQueryDRepState args Cmd.QueryDRepStakeDistributionCmd args -> runQueryDRepStakeDistribution args Cmd.QuerySPOStakeDistributionCmd args -> runQuerySPOStakeDistribution args @@ -1607,6 +1608,22 @@ runQueryRatifyState ratifyState <- runQuery nodeConnInfo target $ queryRatifyState eon writeOutput mOutFile ratifyState +runQueryFuturePParams + :: Cmd.QueryNoArgCmdArgs era + -> ExceptT QueryCmdError IO () +runQueryFuturePParams + Cmd.QueryNoArgCmdArgs + { Cmd.eon + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeConnInfo + , Cmd.target + } + , Cmd.mOutFile + } = conwayEraOnwardsConstraints eon $ do + futurePParams <- runQuery nodeConnInfo target $ queryFuturePParams eon + writeOutput mOutFile futurePParams + runQueryDRepState :: Cmd.QueryDRepStateCmdArgs era -> ExceptT QueryCmdError IO () 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 6578e4e54c..815cdd508d 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -7433,6 +7433,7 @@ Usage: cardano-cli conway query | constitution | gov-state | ratify-state + | future-pparams | drep-state | drep-stake-distribution | spo-stake-distribution @@ -7749,6 +7750,20 @@ Usage: cardano-cli conway query ratify-state Get the ratification state +Usage: cardano-cli conway query future-pparams + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the protocol parameters that will apply at the next epoch + Usage: cardano-cli conway query drep-state [--cardano-mode [--epoch-slots SLOTS]] @@ -9503,6 +9518,7 @@ Usage: cardano-cli latest query | constitution | gov-state | ratify-state + | future-pparams | drep-state | drep-stake-distribution | spo-stake-distribution @@ -9819,6 +9835,20 @@ Usage: cardano-cli latest query ratify-state Get the ratification state +Usage: cardano-cli latest query future-pparams + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the protocol parameters that will apply at the next epoch + Usage: cardano-cli latest query drep-state [--cardano-mode [--epoch-slots SLOTS]] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query.cli index 158dd217cd..5138a965f7 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query.cli @@ -18,6 +18,7 @@ Usage: cardano-cli conway query | constitution | gov-state | ratify-state + | future-pparams | drep-state | drep-stake-distribution | spo-stake-distribution @@ -66,6 +67,8 @@ Available commands: constitution Get the constitution gov-state Get the governance state ratify-state Get the ratification state + future-pparams Get the protocol parameters that will apply at the + next epoch drep-state Get the DRep state. drep-stake-distribution Get the DRep stake distribution. spo-stake-distribution Get the SPO stake distribution. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_future-pparams.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_future-pparams.cli new file mode 100644 index 0000000000..69eb5b9d41 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_future-pparams.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli conway query future-pparams + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the protocol parameters that will apply at the next epoch + +Available options: + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query.cli index 5e592fc0f6..bc007e7fc6 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query.cli @@ -18,6 +18,7 @@ Usage: cardano-cli latest query | constitution | gov-state | ratify-state + | future-pparams | drep-state | drep-stake-distribution | spo-stake-distribution @@ -66,6 +67,8 @@ Available commands: constitution Get the constitution gov-state Get the governance state ratify-state Get the ratification state + future-pparams Get the protocol parameters that will apply at the + next epoch drep-state Get the DRep state. drep-stake-distribution Get the DRep stake distribution. spo-stake-distribution Get the SPO stake distribution. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_future-pparams.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_future-pparams.cli new file mode 100644 index 0000000000..183302326b --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_future-pparams.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli latest query future-pparams + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the protocol parameters that will apply at the next epoch + +Available options: + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text