diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index 4346483bd2..ce73cea2a3 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -65,6 +65,7 @@ data QueryCmds era | QueryRefScriptSizeCmd !QueryRefScriptSizeCmdArgs | QueryConstitutionCmd !(QueryNoArgCmdArgs era) | QueryGovStateCmd !(QueryNoArgCmdArgs era) + | QueryRatifyStateCmd !(QueryNoArgCmdArgs era) | QueryDRepStateCmd !(QueryDRepStateCmdArgs era) | QueryDRepStakeDistributionCmd !(QueryDRepStakeDistributionCmdArgs era) | QuerySPOStakeDistributionCmd !(QuerySPOStakeDistributionCmdArgs era) @@ -291,6 +292,8 @@ renderQueryCmds = \case "constitution" QueryGovStateCmd{} -> "gov-state" + QueryRatifyStateCmd{} -> + "ratify-state" 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 e4eb1fd60a..bf547e63bc 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -289,6 +289,7 @@ pQueryCmds era envCli = $ Opt.progDesc "Calculate the reference input scripts size in bytes for provided transaction inputs." , pQueryGetConstitutionCmd era envCli , pQueryGetGovStateCmd era envCli + , pQueryGetRatifyStateCmd era envCli , pQueryDRepStateCmd era envCli , pQueryDRepStakeDistributionCmd era envCli , pQuerySPOStakeDistributionCmd era envCli @@ -500,6 +501,18 @@ pQueryGetGovStateCmd era envCli = do Opt.info (QueryGovStateCmd <$> pQueryNoArgCmdArgs w envCli) $ Opt.progDesc "Get the governance state" +pQueryGetRatifyStateCmd + :: () + => ShelleyBasedEra era + -> EnvCli + -> Maybe (Parser (QueryCmds era)) +pQueryGetRatifyStateCmd era envCli = do + w <- forShelleyBasedEraMaybeEon era + pure $ + subParser "ratify-state" $ + Opt.info (QueryRatifyStateCmd <$> pQueryNoArgCmdArgs w envCli) $ + Opt.progDesc "Get the ratification state" + -- 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 70e85f1353..eb93a749b6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -114,6 +114,7 @@ runQueryCmds = \case Cmd.QueryRefScriptSizeCmd args -> runQueryRefScriptSizeCmd args Cmd.QueryConstitutionCmd args -> runQueryConstitution args Cmd.QueryGovStateCmd args -> runQueryGovState args + Cmd.QueryRatifyStateCmd args -> runQueryRatifyState args Cmd.QueryDRepStateCmd args -> runQueryDRepState args Cmd.QueryDRepStakeDistributionCmd args -> runQueryDRepStakeDistribution args Cmd.QuerySPOStakeDistributionCmd args -> runQuerySPOStakeDistribution args @@ -1562,6 +1563,22 @@ runQueryGovState govState <- runQuery nodeConnInfo target $ queryGovState eon writeOutput mOutFile govState +runQueryRatifyState + :: Cmd.QueryNoArgCmdArgs era + -> ExceptT QueryCmdError IO () +runQueryRatifyState + Cmd.QueryNoArgCmdArgs + { Cmd.eon + , Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeConnInfo + , Cmd.target + } + , Cmd.mOutFile + } = conwayEraOnwardsConstraints eon $ do + ratifyState <- runQuery nodeConnInfo target $ queryRatifyState eon + writeOutput mOutFile ratifyState + 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 82f14de783..53476e7f39 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -7409,6 +7409,7 @@ Usage: cardano-cli conway query | ref-script-size | constitution | gov-state + | ratify-state | drep-state | drep-stake-distribution | spo-stake-distribution @@ -7711,6 +7712,20 @@ Usage: cardano-cli conway query gov-state [--cardano-mode [--epoch-slots SLOTS]] Get the governance state +Usage: cardano-cli conway query ratify-state + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the ratification state + Usage: cardano-cli conway query drep-state [--cardano-mode [--epoch-slots SLOTS]] @@ -9464,6 +9479,7 @@ Usage: cardano-cli latest query | ref-script-size | constitution | gov-state + | ratify-state | drep-state | drep-stake-distribution | spo-stake-distribution @@ -9766,6 +9782,20 @@ Usage: cardano-cli latest query gov-state [--cardano-mode [--epoch-slots SLOTS]] Get the governance state +Usage: cardano-cli latest query ratify-state + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the ratification state + 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 b1043a23d0..158dd217cd 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 @@ -17,6 +17,7 @@ Usage: cardano-cli conway query | ref-script-size | constitution | gov-state + | ratify-state | drep-state | drep-stake-distribution | spo-stake-distribution @@ -64,6 +65,7 @@ Available commands: for provided transaction inputs. constitution Get the constitution gov-state Get the governance state + ratify-state Get the ratification state 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_ratify-state.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ratify-state.cli new file mode 100644 index 0000000000..3c8ef0fbc1 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ratify-state.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli conway query ratify-state + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the ratification state + +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 df9b838e00..5e592fc0f6 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 @@ -17,6 +17,7 @@ Usage: cardano-cli latest query | ref-script-size | constitution | gov-state + | ratify-state | drep-state | drep-stake-distribution | spo-stake-distribution @@ -64,6 +65,7 @@ Available commands: for provided transaction inputs. constitution Get the constitution gov-state Get the governance state + ratify-state Get the ratification state 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_ratify-state.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ratify-state.cli new file mode 100644 index 0000000000..351cd8dbea --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ratify-state.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli latest query ratify-state + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --socket-path SOCKET_PATH + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Get the ratification state + +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