Skip to content

Commit

Permalink
Make "query pool-state" default to all pools; clarify flags
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhammann committed Dec 11, 2023
1 parent 6947822 commit 6d8e69b
Show file tree
Hide file tree
Showing 24 changed files with 136 additions and 42 deletions.
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ data QueryPoolStateCmdArgs = QueryPoolStateCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, poolIds :: ![Hash StakePoolKey]
, allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey])
} deriving (Generic, Show)

data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pQueryPoolStateCmd envCli =
<$> pSocketPath envCli
<*> pConsensusModeParams
<*> pNetworkId envCli
<*> many (pStakePoolVerificationKeyHash Nothing)
<*> pAllStakePoolsOrOnly

pQueryTxMempoolCmd :: EnvCli -> Parser (QueryCmds era)
pQueryTxMempoolCmd envCli =
Expand Down
8 changes: 6 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ runQueryPoolStateCmd
{ Cmd.nodeSocketPath
, Cmd.consensusModeParams
, Cmd.networkId
, Cmd.poolIds
, Cmd.allOrOnlyPoolIds
} = do
let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath

Expand All @@ -633,7 +633,11 @@ runQueryPoolStateCmd

beo <- requireEon BabbageEra era

result <- lift (queryPoolState beo $ Just $ Set.fromList poolIds)
let poolFilter = case allOrOnlyPoolIds of
All -> Nothing
Only poolIds -> Just $ Set.fromList poolIds

result <- lift (queryPoolState beo poolFilter)
& onLeft (left . QueryCmdUnsupportedNtcVersion)
& onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError)

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ data LegacyQueryPoolStateCmdArgs = LegacyQueryPoolStateCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !ConsensusModeParams
, networkId :: !NetworkId
, poolIds :: ![Hash StakePoolKey]
, allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey])
} deriving (Generic, Show)

data LegacyQueryTxMempoolCmdArgs = LegacyQueryTxMempoolCmdArgs
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ pQueryCmds envCli =
<$> pSocketPath envCli
<*> pConsensusModeParams
<*> pNetworkId envCli
<*> many (pStakePoolVerificationKeyHash Nothing)
<*> pAllStakePoolsOrOnly

pQueryTxMempool :: Parser LegacyQueryCmds
pQueryTxMempool =
Expand Down
72 changes: 54 additions & 18 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,9 @@ Usage: cardano-cli shelley query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -593,7 +595,9 @@ Usage: cardano-cli shelley query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -1710,7 +1714,9 @@ Usage: cardano-cli allegra query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -1751,7 +1757,9 @@ Usage: cardano-cli allegra query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -2865,7 +2873,9 @@ Usage: cardano-cli mary query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -2904,7 +2914,9 @@ Usage: cardano-cli mary query pool-state --socket-path SOCKET_PATH
[--cardano-mode
[--epoch-slots SLOTS]]
(--mainnet | --testnet-magic NATURAL)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -4012,7 +4024,9 @@ Usage: cardano-cli alonzo query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -4053,7 +4067,9 @@ Usage: cardano-cli alonzo query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -5195,7 +5211,9 @@ Usage: cardano-cli babbage query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -5236,7 +5254,9 @@ Usage: cardano-cli babbage query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -6585,7 +6605,9 @@ Usage: cardano-cli conway query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -6626,7 +6648,9 @@ Usage: cardano-cli conway query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -7880,7 +7904,9 @@ Usage: cardano-cli latest query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -7921,7 +7947,9 @@ Usage: cardano-cli latest query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -8906,7 +8934,9 @@ Usage: cardano-cli legacy query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -8947,7 +8977,9 @@ Usage: cardano-cli legacy query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down Expand Up @@ -10139,7 +10171,9 @@ Usage: cardano-cli query stake-snapshot --socket-path SOCKET_PATH
Usage: cardano-cli query pool-params --socket-path SOCKET_PATH
[--cardano-mode [--epoch-slots SLOTS]]
(--mainnet | --testnet-magic NATURAL)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand Down Expand Up @@ -10175,7 +10209,9 @@ Usage: cardano-cli query kes-period-info --socket-path SOCKET_PATH
Usage: cardano-cli query pool-state --socket-path SOCKET_PATH
[--cardano-mode [--epoch-slots SLOTS]]
(--mainnet | --testnet-magic NATURAL)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli allegra query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand All @@ -24,6 +26,7 @@ Available options:
CARDANO_NODE_NETWORK_ID environment variable
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
CARDANO_NODE_NETWORK_ID environment variable
--all-stake-pools Query for all stake pools
--stake-pool-id STAKE_POOL_ID
Stake pool ID/verification key hash (either
Bech32-encoded or hex-encoded). Zero or more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli allegra query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand All @@ -22,6 +24,7 @@ Available options:
CARDANO_NODE_NETWORK_ID environment variable
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
CARDANO_NODE_NETWORK_ID environment variable
--all-stake-pools Query for all stake pools
--stake-pool-id STAKE_POOL_ID
Stake pool ID/verification key hash (either
Bech32-encoded or hex-encoded). Zero or more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli alonzo query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand All @@ -24,6 +26,7 @@ Available options:
CARDANO_NODE_NETWORK_ID environment variable
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
CARDANO_NODE_NETWORK_ID environment variable
--all-stake-pools Query for all stake pools
--stake-pool-id STAKE_POOL_ID
Stake pool ID/verification key hash (either
Bech32-encoded or hex-encoded). Zero or more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli alonzo query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand All @@ -22,6 +24,7 @@ Available options:
CARDANO_NODE_NETWORK_ID environment variable
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
CARDANO_NODE_NETWORK_ID environment variable
--all-stake-pools Query for all stake pools
--stake-pool-id STAKE_POOL_ID
Stake pool ID/verification key hash (either
Bech32-encoded or hex-encoded). Zero or more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli babbage query pool-params --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

DEPRECATED. Use query pool-state instead. Dump the pool parameters
(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced
Expand All @@ -24,6 +26,7 @@ Available options:
CARDANO_NODE_NETWORK_ID environment variable
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
CARDANO_NODE_NETWORK_ID environment variable
--all-stake-pools Query for all stake pools
--stake-pool-id STAKE_POOL_ID
Stake pool ID/verification key hash (either
Bech32-encoded or hex-encoded). Zero or more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Usage: cardano-cli babbage query pool-state --socket-path SOCKET_PATH
( --mainnet
| --testnet-magic NATURAL
)
[--stake-pool-id STAKE_POOL_ID]
[ --all-stake-pools
| [--stake-pool-id STAKE_POOL_ID]
]

Dump the pool state

Expand All @@ -22,6 +24,7 @@ Available options:
CARDANO_NODE_NETWORK_ID environment variable
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
CARDANO_NODE_NETWORK_ID environment variable
--all-stake-pools Query for all stake pools
--stake-pool-id STAKE_POOL_ID
Stake pool ID/verification key hash (either
Bech32-encoded or hex-encoded). Zero or more
Expand Down
Loading

0 comments on commit 6d8e69b

Please sign in to comment.