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..5bdffc059 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,19 @@ 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 @@ -215,6 +229,17 @@ pQueryCmds era envCli = mconcat [ "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) $ @@ -327,6 +352,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..92a5bfccb 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -19,6 +19,7 @@ module Cardano.CLI.EraBased.Run.Query , runQueryKesPeriodInfoCmd , runQueryLeadershipScheduleCmd , runQueryLedgerStateCmd + , runQueryLedgerPeerSnapshot , runQueryPoolStateCmd , runQueryProtocolParametersCmd , runQueryProtocolStateCmd @@ -43,7 +44,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 +104,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 +836,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 +1077,22 @@ 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..dab8d5367 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -1360,6 +1360,7 @@ Usage: cardano-cli shelley query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -1448,6 +1449,16 @@ 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 + Usage: cardano-cli shelley query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -2412,6 +2423,7 @@ Usage: cardano-cli allegra query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -2500,6 +2512,16 @@ 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 + Usage: cardano-cli allegra query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -3462,6 +3484,7 @@ Usage: cardano-cli mary query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -3550,6 +3573,16 @@ 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 + Usage: cardano-cli mary query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -4511,6 +4544,7 @@ Usage: cardano-cli alonzo query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -4599,6 +4633,16 @@ 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 + Usage: cardano-cli alonzo query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -5609,6 +5653,7 @@ Usage: cardano-cli babbage query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -5697,6 +5742,16 @@ 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 + Usage: cardano-cli babbage query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -7248,6 +7303,7 @@ Usage: cardano-cli conway query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -7356,6 +7412,19 @@ 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 + Usage: cardano-cli conway query protocol-state --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -9270,6 +9339,7 @@ Usage: cardano-cli latest query | stake-address-info | utxo | ledger-state + | ledger-peer-snapshot | protocol-state | stake-snapshot | leadership-schedule @@ -9378,6 +9448,19 @@ 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 + 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..7236fcc60 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,7 @@ 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 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..9665eb8f5 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ledger-peer-snapshot.cli @@ -0,0 +1,26 @@ +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 + +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..b4903b484 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,7 @@ 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 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..c8ddf8e32 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ledger-peer-snapshot.cli @@ -0,0 +1,26 @@ +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 + +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..c9f5923cf 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,7 @@ 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 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..8a3f093aa --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ledger-peer-snapshot.cli @@ -0,0 +1,26 @@ +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 + +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..0ba9f647e 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,7 @@ 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 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..e9a6cc2bd --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ledger-peer-snapshot.cli @@ -0,0 +1,32 @@ +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 + +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..a811abbd4 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,7 @@ 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 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..32a18e88d --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ledger-peer-snapshot.cli @@ -0,0 +1,32 @@ +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 + +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..e8afda045 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,7 @@ 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 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..94050e6a6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ledger-peer-snapshot.cli @@ -0,0 +1,26 @@ +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 + +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/shelley_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query.cli index 23a1d9626..864458256 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,7 @@ 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 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..8a3729785 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ledger-peer-snapshot.cli @@ -0,0 +1,26 @@ +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 + +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