diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index 5b284be30..26920648c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -28,6 +28,7 @@ module Cardano.CLI.EraBased.Commands.Query , QueryDRepStakeDistributionCmdArgs (..) , QuerySPOStakeDistributionCmdArgs (..) , QueryTreasuryValueCmdArgs (..) + , QueryLedgerPeerSnapshotCmdArgs (..) , renderQueryCmds , IncludeStake (..) ) @@ -69,6 +70,7 @@ data QueryCmds era | QueryCommitteeMembersStateCmd !(QueryCommitteeMembersStateCmdArgs era) | QueryTreasuryValueCmd !(QueryTreasuryValueCmdArgs era) | QueryProposalsCmd !(QueryProposalsCmdArgs era) + | QueryLedgerPeerSnapshotCmd !QueryLedgerPeerSnapshotCmdArgs deriving (Generic, Show) -- | Fields that are common to most queries @@ -140,6 +142,12 @@ data QueryLedgerStateCmdArgs = QueryLedgerStateCmdArgs } deriving (Generic, Show) +data QueryLedgerPeerSnapshotCmdArgs = QueryLedgerPeerSnapshotCmdArgs + { commons :: !QueryCommons + , outFile :: !(Maybe (File () Out)) + } + deriving (Generic, Show) + data QueryProtocolStateCmdArgs = QueryProtocolStateCmdArgs { commons :: !QueryCommons , mOutFile :: !(Maybe (File () Out)) @@ -266,6 +274,8 @@ renderQueryCmds = \case "query utxo" QueryLedgerStateCmd{} -> "query ledger-state" + QueryLedgerPeerSnapshotCmd{} -> + "query ledger-peer-snapshot" QueryProtocolStateCmd{} -> "query protocol-state" QueryStakeSnapshotCmd{} -> diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index d1e84b593..dd920ee50 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -46,6 +46,7 @@ pQueryCmdsTopLevel envCli = , pPoolState envCli , pTxMempool envCli , pSlotNumber envCli + , pQueryLedgerPeerSnapshot envCli ] i = Opt.progDesc $ @@ -164,6 +165,20 @@ pSlotNumber envCli = Opt.info (pQuerySlotNumberCmd ShelleyBasedEraConway envCli) $ Opt.progDesc "Query slot number for UTC timestamp" +pQueryLedgerPeerSnapshot :: EnvCli -> Parser (QueryCmds ConwayEra) +pQueryLedgerPeerSnapshot envCli = + subParser "ledger-peer-snapshot" $ + Opt.info (pQueryLedgerPeerSnapshotCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "Dump the current snapshot of big ledger peers. " + , "These are the largest pools that cumulatively hold " + , "90% of total stake." + ] + +-- \^ TODO use bigLedgerPeerQuota from Ouroboros.Network.PeerSelection.LedgerPeers.Utils +-- which must be re-exposed thru cardano-api + pQueryCmds :: () => ShelleyBasedEra era @@ -216,6 +231,17 @@ pQueryCmds era envCli = [ "Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command)" ] , Just $ + subParser "ledger-peer-snapshot" $ + Opt.info (pQueryLedgerPeerSnapshotCmd era envCli) $ + Opt.progDesc $ + mconcat + [ "Dump the current snapshot of ledger peers." + , "These are the largest pools that cumulatively hold " + , "90% of total stake." + ] + , -- \^ TODO use bigLedgerPeerQuota from Ouroboros.Network.PeerSelection.LedgerPeers.Utils + -- which must be re-exposed thru cardano-api + Just $ subParser "protocol-state" $ Opt.info (pQueryProtocolStateCmd era envCli) $ Opt.progDesc $ @@ -327,6 +353,13 @@ pQueryLedgerStateCmd era envCli = <$> pQueryCommons era envCli <*> pMaybeOutputFile +pQueryLedgerPeerSnapshotCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) +pQueryLedgerPeerSnapshotCmd era envCli = + fmap QueryLedgerPeerSnapshotCmd $ + QueryLedgerPeerSnapshotCmdArgs + <$> pQueryCommons era envCli + <*> pMaybeOutputFile + pQueryProtocolStateCmd :: ShelleyBasedEra era -> EnvCli -> Parser (QueryCmds era) pQueryProtocolStateCmd era envCli = fmap QueryProtocolStateCmd $ diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 3a03a2692..ea0940b85 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -10,7 +10,6 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeOperators #-} @@ -19,6 +18,7 @@ module Cardano.CLI.EraBased.Run.Query , runQueryKesPeriodInfoCmd , runQueryLeadershipScheduleCmd , runQueryLedgerStateCmd + , runQueryLedgerPeerSnapshot , runQueryPoolStateCmd , runQueryProtocolParametersCmd , runQueryProtocolStateCmd @@ -43,7 +43,7 @@ import qualified Cardano.Api as Api import qualified Cardano.Api.Consensus as Consensus import Cardano.Api.Ledger (StandardCrypto, strictMaybeToMaybe) import qualified Cardano.Api.Ledger as L -import Cardano.Api.Network (Serialised (..)) +import Cardano.Api.Network (LedgerPeerSnapshot, Serialised (..)) import qualified Cardano.Api.Network as Consensus import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) @@ -103,6 +103,7 @@ runQueryCmds = \case Cmd.QueryStakeDistributionCmd args -> runQueryStakeDistributionCmd args Cmd.QueryStakeAddressInfoCmd args -> runQueryStakeAddressInfoCmd args Cmd.QueryLedgerStateCmd args -> runQueryLedgerStateCmd args + Cmd.QueryLedgerPeerSnapshotCmd args -> runQueryLedgerPeerSnapshot args Cmd.QueryStakeSnapshotCmd args -> runQueryStakeSnapshotCmd args Cmd.QueryProtocolStateCmd args -> runQueryProtocolStateCmd args Cmd.QueryUTxOCmd args -> runQueryUTxOCmd args @@ -834,6 +835,41 @@ runQueryLedgerStateCmd & onLeft (left . QueryCmdAcquireFailure) & onLeft left +runQueryLedgerPeerSnapshot + :: () + => Cmd.QueryLedgerPeerSnapshotCmdArgs + -> ExceptT QueryCmdError IO () +runQueryLedgerPeerSnapshot + Cmd.QueryLedgerPeerSnapshotCmdArgs + { Cmd.commons = + Cmd.QueryCommons + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.networkId + , Cmd.target + } + , Cmd.outFile + } = do + let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath + + join $ + lift + ( executeLocalStateQueryExpr localNodeConnInfo target $ runExceptT $ do + AnyCardanoEra era <- + lift queryCurrentEra + & onLeft (left . QueryCmdUnsupportedNtcVersion) + + sbe <- + requireShelleyBasedEra era + & onNothing (left QueryCmdByronEra) + + result <- easyRunQuery (queryLedgerPeerSnapshot sbe) + + pure $ shelleyBasedEraConstraints sbe (writeLedgerPeerSnapshot outFile) result + ) + & onLeft (left . QueryCmdAcquireFailure) + & onLeft left + runQueryProtocolStateCmd :: () => Cmd.QueryProtocolStateCmdArgs @@ -1040,6 +1076,23 @@ writeLedgerState mOutFile qState@(SerialisedDebugLedgerState serLedgerState) = LBS.writeFile fpath $ unSerialised serLedgerState +-- | Writes JSON-encoded big ledger peer snapshot +writeLedgerPeerSnapshot + :: Maybe (File () Out) + -> Serialised LedgerPeerSnapshot + -> ExceptT QueryCmdError IO () +writeLedgerPeerSnapshot mOutPath serBigLedgerPeerSnapshot = do + case decodeBigLedgerPeerSnapshot serBigLedgerPeerSnapshot of + Left (bs, _decoderError) -> + firstExceptT QueryCmdHelpersError $ pPrintCBOR bs + Right snapshot -> + case mOutPath of + Nothing -> liftIO . LBS.putStrLn $ Aeson.encode snapshot + Just fpath -> + firstExceptT QueryCmdWriteFileError $ + newExceptT . writeLazyByteStringFile fpath $ + encodePretty snapshot + writeStakeSnapshots :: forall era ledgerera . () 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 0e3ec11f5..03d43386d 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -218,6 +218,7 @@ Usage: cardano-cli query | pool-state | tx-mempool | slot-number + | ledger-peer-snapshot ) Node query commands. Will query the local node whose Unix domain socket is @@ -401,6 +402,20 @@ Usage: cardano-cli query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Dump the current snapshot of big ledger peers. These are the largest pools + that cumulatively hold 90% of total stake. + Usage: cardano-cli legacy Legacy commands Legacy commands @@ -1360,6 +1375,7 @@ Usage: cardano-cli shelley query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -1448,6 +1464,17 @@ Usage: cardano-cli shelley query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli shelley query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli shelley query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -2412,6 +2439,7 @@ Usage: cardano-cli allegra query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -2500,6 +2528,17 @@ Usage: cardano-cli allegra query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli allegra query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli allegra query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -3462,6 +3501,7 @@ Usage: cardano-cli mary query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -3550,6 +3590,17 @@ Usage: cardano-cli mary query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli mary query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli mary query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -4511,6 +4562,7 @@ Usage: cardano-cli alonzo query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -4599,6 +4651,17 @@ Usage: cardano-cli alonzo query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli alonzo query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli alonzo query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -5609,6 +5672,7 @@ Usage: cardano-cli babbage query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -5697,6 +5761,17 @@ Usage: cardano-cli babbage query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli babbage query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli babbage query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -7248,6 +7323,7 @@ Usage: cardano-cli conway query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -7356,6 +7432,20 @@ Usage: cardano-cli conway query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli conway query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli conway query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -9270,6 +9360,7 @@ Usage: cardano-cli latest query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -9378,6 +9469,20 @@ Usage: cardano-cli latest query ledger-state --socket-path SOCKET_PATH Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) +Usage: cardano-cli latest query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + Usage: cardano-cli latest query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query.cli index 3bbf0ea76..c978049a8 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query.cli @@ -6,6 +6,7 @@ Usage: cardano-cli allegra query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -33,6 +34,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..f56ebabc6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ledger-peer-snapshot.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli allegra query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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/alonzo_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query.cli index f4c913dda..84fc61f18 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query.cli @@ -6,6 +6,7 @@ Usage: cardano-cli alonzo query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -33,6 +34,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..f8f679df1 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ledger-peer-snapshot.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli alonzo query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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/babbage_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query.cli index a399cfcf6..e8ae04408 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query.cli @@ -6,6 +6,7 @@ Usage: cardano-cli babbage query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -33,6 +34,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..dc265967f --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ledger-peer-snapshot.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli babbage query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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/conway_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query.cli index 694e2d48a..b1043a23d 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 @@ -6,6 +6,7 @@ Usage: cardano-cli conway query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -41,6 +42,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..bec9b93bd --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ledger-peer-snapshot.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli conway query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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 0d73ff560..df9b838e0 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 @@ -6,6 +6,7 @@ Usage: cardano-cli latest query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -41,6 +42,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..86ad4020c --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ledger-peer-snapshot.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli latest query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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/mary_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query.cli index 57d3afc42..f424fec40 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query.cli @@ -6,6 +6,7 @@ Usage: cardano-cli mary query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -33,6 +34,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..17bfa8925 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ledger-peer-snapshot.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli mary query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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/query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query.cli index 9db00062d..24b690878 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query.cli @@ -13,6 +13,7 @@ Usage: cardano-cli query | pool-state | tx-mempool | slot-number + | ledger-peer-snapshot ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,6 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ledger-peer-snapshot Dump the current snapshot of big ledger peers. These + are the largest pools that cumulatively hold 90% of + total stake. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..953ba60d9 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_ledger-peer-snapshot.cli @@ -0,0 +1,33 @@ +Usage: cardano-cli query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [--out-file FILEPATH] + + Dump the current snapshot of big ledger peers. These are the largest pools + that cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --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/shelley_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query.cli index 23a1d9626..0a1bd7f20 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query.cli @@ -6,6 +6,7 @@ Usage: cardano-cli shelley query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -33,6 +34,9 @@ Available commands: address or the whole. ledger-state Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command) + ledger-peer-snapshot Dump the current snapshot of ledger peers.These are + the largest pools that cumulatively hold 90% of total + stake. protocol-state Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command) stake-snapshot Obtain the three stake snapshots for a pool, plus the diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ledger-peer-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ledger-peer-snapshot.cli new file mode 100644 index 000000000..df7488c2a --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ledger-peer-snapshot.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli shelley query ledger-peer-snapshot --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Dump the current snapshot of ledger peers.These are the largest pools that + cumulatively hold 90% of total stake. + +Available options: + --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. + --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 + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text