Skip to content

Commit

Permalink
Merge pull request #1038 from IntersectMBO/cl/query-future-pparams
Browse files Browse the repository at this point in the history
Cl/query future pparams
  • Loading branch information
smelc authored Feb 7, 2025
2 parents 8e3cb63 + 88fcc75 commit 83f45d5
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -294,6 +295,8 @@ renderQueryCmds = \case
"gov-state"
QueryRatifyStateCmd{} ->
"ratify-state"
QueryFuturePParamsCmd{} ->
"future-pparams"
QueryDRepStateCmd{} ->
"drep-state"
QueryDRepStakeDistributionCmd{} ->
Expand Down
13 changes: 13 additions & 0 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ()
Expand Down
30 changes: 30 additions & 0 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -7433,6 +7433,7 @@ Usage: cardano-cli conway query
| constitution
| gov-state
| ratify-state
| future-pparams
| drep-state
| drep-stake-distribution
| spo-stake-distribution
Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -9503,6 +9518,7 @@ Usage: cardano-cli latest query
| constitution
| gov-state
| ratify-state
| future-pparams
| drep-state
| drep-stake-distribution
| spo-stake-distribution
Expand Down Expand Up @@ -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]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Usage: cardano-cli conway query
| constitution
| gov-state
| ratify-state
| future-pparams
| drep-state
| drep-stake-distribution
| spo-stake-distribution
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Usage: cardano-cli latest query
| constitution
| gov-state
| ratify-state
| future-pparams
| drep-state
| drep-stake-distribution
| spo-stake-distribution
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 83f45d5

Please sign in to comment.