From f582c37a469d5898f23ee9115fc6243a80f29d1b Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Fri, 22 Mar 2024 12:47:21 +0100 Subject: [PATCH] #667 Add ref-script-size query command --- cardano-cli/cardano-cli.cabal | 2 +- .../Cardano/CLI/EraBased/Commands/Query.hs | 15 +++ .../src/Cardano/CLI/EraBased/Options/Query.hs | 25 ++++ .../src/Cardano/CLI/EraBased/Run/Query.hs | 68 +++++++++++ .../cardano-cli-golden/Test/Golden/Help.hs | 1 + .../cardano-cli-golden/files/golden/help.cli | 113 ++++++++++++++++++ .../files/golden/help/allegra_query.cli | 3 + .../help/allegra_query_ref-script-size.cli | 36 ++++++ .../files/golden/help/alonzo_query.cli | 3 + .../help/alonzo_query_ref-script-size.cli | 36 ++++++ .../files/golden/help/babbage_query.cli | 3 + .../help/babbage_query_ref-script-size.cli | 36 ++++++ .../files/golden/help/conway_query.cli | 3 + .../help/conway_query_ref-script-size.cli | 42 +++++++ .../files/golden/help/latest_query.cli | 3 + .../help/latest_query_ref-script-size.cli | 36 ++++++ .../files/golden/help/mary_query.cli | 3 + .../help/mary_query_ref-script-size.cli | 34 ++++++ .../files/golden/help/shelley_query.cli | 3 + .../help/shelley_query_ref-script-size.cli | 36 ++++++ 20 files changed, 500 insertions(+), 1 deletion(-) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ref-script-size.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ref-script-size.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ref-script-size.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ref-script-size.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ref-script-size.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ref-script-size.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ref-script-size.cli diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index c096a6f8de..9c902fde94 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -195,7 +195,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.42.0.0 + , cardano-api ^>= 8.43.0.0 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index f0d86dc270..543474c849 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -21,6 +21,7 @@ module Cardano.CLI.EraBased.Commands.Query , QueryPoolStateCmdArgs(..) , QueryTxMempoolCmdArgs(..) , QuerySlotNumberCmdArgs(..) + , QueryRefScriptSizeCmdArgs(..) , QueryNoArgCmdArgs(..) , QueryDRepStateCmdArgs(..) , QueryDRepStakeDistributionCmdArgs(..) @@ -34,6 +35,7 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus +import Data.Set (Set) import Data.Text (Text) import Data.Time.Clock import GHC.Generics @@ -54,6 +56,7 @@ data QueryCmds era | QueryPoolStateCmd !QueryPoolStateCmdArgs | QueryTxMempoolCmd !QueryTxMempoolCmdArgs | QuerySlotNumberCmd !QuerySlotNumberCmdArgs + | QueryRefScriptSizeCmd !QueryRefScriptSizeCmdArgs | QueryConstitutionCmd !(QueryNoArgCmdArgs era) | QueryGovStateCmd !(QueryNoArgCmdArgs era) | QueryDRepStateCmd !(QueryDRepStateCmdArgs era) @@ -193,6 +196,16 @@ data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs , utcTime :: !UTCTime } deriving (Generic, Show) +data QueryRefScriptSizeCmdArgs = QueryRefScriptSizeCmdArgs + { nodeSocketPath :: !SocketPath + , consensusModeParams :: !ConsensusModeParams + , transactionInputs :: !(Set TxIn) + , networkId :: !NetworkId + , target :: !(Consensus.Target ChainPoint) + , format :: Maybe QueryOutputFormat + , mOutFile :: !(Maybe (File () Out)) + } deriving (Generic, Show) + data QueryNoArgCmdArgs era = QueryNoArgCmdArgs { eon :: !(ConwayEraOnwards era) , nodeSocketPath :: !SocketPath @@ -272,6 +285,8 @@ renderQueryCmds = \case "query tx-mempool" <> renderTxMempoolQuery q QuerySlotNumberCmd {} -> "query slot-number" + QueryRefScriptSizeCmd {} -> + "query ref-script-size" QueryConstitutionCmd {} -> "constitution" QueryGovStateCmd {} -> diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index 1c8341f9bb..5e6d9202f1 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -18,6 +18,7 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key import Data.Foldable +import GHC.Exts (IsList (..)) import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt @@ -109,6 +110,10 @@ pQueryCmds era envCli = $ subParser "slot-number" $ Opt.info (pQuerySlotNumberCmd era envCli) $ Opt.progDesc "Query slot number for UTC timestamp" + , Just + . subParser "ref-script-size" + . Opt.info (pQueryRefScriptSizeCmd era envCli) + $ Opt.progDesc "Calculate the reference input scripts size in bytes for provided transaction ids" , pQueryGetConstitutionCmd era envCli , pQueryGetGovStateCmd era envCli , pQueryDRepStateCmd era envCli @@ -295,6 +300,26 @@ pQuerySlotNumberCmd era envCli = , Opt.help "UTC timestamp in YYYY-MM-DDThh:mm:ssZ format" ] +pQueryRefScriptSizeCmd :: CardanoEra era -> EnvCli -> Parser (QueryCmds era) +pQueryRefScriptSizeCmd era envCli = + fmap QueryRefScriptSizeCmd $ + QueryRefScriptSizeCmdArgs + <$> pSocketPath envCli + <*> pConsensusModeParams + <*> (fromList <$> some pByTxIn) + <*> pNetworkId envCli + <*> pTarget era + <*> (optional $ pQueryOutputFormat "reference inputs") + <*> pMaybeOutputFile + where + pByTxIn :: Parser TxIn + pByTxIn = + Opt.option (readerFromParsecParser parseTxIn) $ mconcat + [ Opt.long "tx-in" + , Opt.metavar "TX-IN" + , Opt.help "Transaction input (TxId#TxIx)." + ] + pQueryGetConstitutionCmd :: () => CardanoEra era -> EnvCli diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 82797975b2..e3fc57da33 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -1,4 +1,6 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} @@ -82,6 +84,7 @@ import qualified Data.Map.Strict as Map import Data.Proxy (Proxy (..)) import Data.Set (Set) import qualified Data.Set as Set +import Data.String import Data.Text (Text) import qualified Data.Text as Text import qualified Data.Text.Encoding as Text @@ -89,6 +92,7 @@ import qualified Data.Text.IO as T import qualified Data.Text.IO as Text import qualified Data.Text.Lazy.IO as LT import Data.Time.Clock +import GHC.Generics import Lens.Micro ((^.)) import Numeric (showEFloat) import Prettyprinter @@ -116,6 +120,7 @@ runQueryCmds = \case Cmd.QueryPoolStateCmd args -> runQueryPoolStateCmd args Cmd.QueryTxMempoolCmd args -> runQueryTxMempoolCmd args Cmd.QuerySlotNumberCmd args -> runQuerySlotNumberCmd args + Cmd.QueryRefScriptSizeCmd args -> runQueryRefScriptSizeCmd args Cmd.QueryConstitutionCmd args -> runQueryConstitution args Cmd.QueryGovStateCmd args -> runQueryGovState args Cmd.QueryDRepStateCmd args -> runQueryDRepState args @@ -673,6 +678,51 @@ runQuerySlotNumberCmd SlotNo slotNo <- utcTimeToSlotNo nodeSocketPath consensusModeParams networkId target utcTime liftIO . putStr $ show slotNo +runQueryRefScriptSizeCmd + :: () + => Cmd.QueryRefScriptSizeCmdArgs + -> ExceptT QueryCmdError IO () +runQueryRefScriptSizeCmd + Cmd.QueryRefScriptSizeCmdArgs + { Cmd.nodeSocketPath + , Cmd.consensusModeParams + , Cmd.transactionInputs + , Cmd.networkId + , Cmd.target + , Cmd.format + , Cmd.mOutFile + } = 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) + + beo <- requireEon BabbageEra era + + utxo <- lift (queryUtxo sbe $ QueryUTxOByTxIn transactionInputs) + & onLeft (left . QueryCmdUnsupportedNtcVersion) + & onLeft (left . QueryCmdLocalStateQueryError . EraMismatchError) + + pure $ + writeFormattedOutput format mOutFile $ + RefInputScriptSize $ + getReferenceInputsSizeForTxIds beo (toLedgerUTxO sbe utxo) transactionInputs + ) + & onLeft (left . QueryCmdAcquireFailure) + & onLeft left + +newtype RefInputScriptSize = RefInputScriptSize { refInputScriptSize :: Int } + deriving (Generic) + deriving anyclass (ToJSON) + +instance Pretty RefInputScriptSize where + pretty (RefInputScriptSize s) = "Reference inputs scripts size is" <+> pretty s <+> "bytes." + -- | Obtain stake snapshot information for a pool, plus information about the total active stake. -- This information can be used for leader slot calculation, for example, and has been requested by SPOs. -- Obtaining the information directly is significantly more time and memory efficient than using a full ledger state dump. @@ -1121,6 +1171,7 @@ runQueryStakePoolsCmd ) & onLeft (left . QueryCmdAcquireFailure) & onLeft left +-- TODO: replace with writeFormattedOutput writeStakePools :: QueryOutputFormat -> Maybe (File () Out) @@ -1139,6 +1190,23 @@ writeStakePools format mOutFile stakePools = QueryOutputFormatJson -> encodePretty stakePools +writeFormattedOutput + :: MonadIOTransError QueryCmdError t m + => ToJSON a + => Pretty a + => Maybe QueryOutputFormat + -> Maybe (File b Out) + -> a + -> t m () +writeFormattedOutput mFormat mOutFile value = + modifyError QueryCmdWriteFileError . hoistIOEither $ + writeLazyByteStringOutput mOutFile toWrite + where + toWrite :: LBS.ByteString = + case newOutputFormat mFormat mOutFile of + QueryOutputFormatText -> fromString . docToString $ pretty value + QueryOutputFormatJson -> encodePretty value + runQueryStakeDistributionCmd :: () => Cmd.QueryStakeDistributionCmdArgs -> ExceptT QueryCmdError IO () diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Help.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Help.hs index daf04b18ad..eb4bdbd685 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Help.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Help.hs @@ -97,6 +97,7 @@ hprop_golden_HelpCmds = let usages = List.filter (not . null) $ fmap extractCmd $ maybeToList . selectCmd =<< lines forM_ usages $ \usage -> do + -- FIXME: this is sloow H.noteShow_ usage let expectedCmdHelpFp = "test/cardano-cli-golden/files/golden/help" Text.unpack (Text.intercalate "_" usage) <> ".cli" 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 0a414b22e3..056df0bc9b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -452,6 +452,7 @@ Usage: cardano-cli shelley query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -647,6 +648,21 @@ Usage: cardano-cli shelley query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli shelley query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli shelley stake-address ( key-gen | key-hash @@ -1624,6 +1640,7 @@ Usage: cardano-cli allegra query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -1819,6 +1836,21 @@ Usage: cardano-cli allegra query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli allegra query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli allegra stake-address ( key-gen | key-hash @@ -2794,6 +2826,7 @@ Usage: cardano-cli mary query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -2985,6 +3018,19 @@ Usage: cardano-cli mary query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli mary query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [--output-json | --output-text] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli mary stake-address ( key-gen | key-hash @@ -3956,6 +4002,7 @@ Usage: cardano-cli alonzo query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -4151,6 +4198,21 @@ Usage: cardano-cli alonzo query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli alonzo query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli alonzo stake-address ( key-gen | key-hash @@ -5153,6 +5215,7 @@ Usage: cardano-cli babbage query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -5348,6 +5411,21 @@ Usage: cardano-cli babbage query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli babbage query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli babbage stake-address ( key-gen | key-hash @@ -6601,6 +6679,7 @@ Usage: cardano-cli conway query | pool-state | tx-mempool | slot-number + | ref-script-size | constitution | gov-state | drep-state @@ -6828,6 +6907,24 @@ Usage: cardano-cli conway query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli conway query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli conway query constitution --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -7991,6 +8088,7 @@ Usage: cardano-cli latest query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -8186,6 +8284,21 @@ Usage: cardano-cli latest query slot-number --socket-path SOCKET_PATH Query slot number for UTC timestamp +Usage: cardano-cli latest query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + Usage: cardano-cli latest stake-address ( key-gen | key-hash 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 96755ee947..65748d934b 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 @@ -13,6 +13,7 @@ Usage: cardano-cli allegra query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,5 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ref-script-size.cli new file mode 100644 index 0000000000..34657bb1e6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_query_ref-script-size.cli @@ -0,0 +1,36 @@ +Usage: cardano-cli allegra query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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 + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE 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 6f512f5f29..a42c8f5542 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 @@ -13,6 +13,7 @@ Usage: cardano-cli alonzo query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,5 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ref-script-size.cli new file mode 100644 index 0000000000..ddf7f51ded --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/alonzo_query_ref-script-size.cli @@ -0,0 +1,36 @@ +Usage: cardano-cli alonzo query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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 + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE 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 38b72073ed..a9e23749bc 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 @@ -13,6 +13,7 @@ Usage: cardano-cli babbage query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,5 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ref-script-size.cli new file mode 100644 index 0000000000..26dd932bf2 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/babbage_query_ref-script-size.cli @@ -0,0 +1,36 @@ +Usage: cardano-cli babbage query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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 + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE 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 6f10067656..2549bb1237 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 @@ -13,6 +13,7 @@ Usage: cardano-cli conway query | pool-state | tx-mempool | slot-number + | ref-script-size | constitution | gov-state | drep-state @@ -52,6 +53,8 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids constitution Get the constitution gov-state Get the governance state drep-state Get the DRep state. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ref-script-size.cli new file mode 100644 index 0000000000..2da6ec2194 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_query_ref-script-size.cli @@ -0,0 +1,42 @@ +Usage: cardano-cli conway query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --volatile-tip + | --immutable-tip + ] + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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. + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE 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 ac7d1d7624..738199d088 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 @@ -13,6 +13,7 @@ Usage: cardano-cli latest query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,5 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ref-script-size.cli new file mode 100644 index 0000000000..6c3d5fce5c --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_query_ref-script-size.cli @@ -0,0 +1,36 @@ +Usage: cardano-cli latest query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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 + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE 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 19c6ea0e20..af12e067bf 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 @@ -13,6 +13,7 @@ Usage: cardano-cli mary query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,5 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ref-script-size.cli new file mode 100644 index 0000000000..b77247cf5b --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/mary_query_ref-script-size.cli @@ -0,0 +1,34 @@ +Usage: cardano-cli mary query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [--output-json | --output-text] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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 + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE 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 b79366e2d7..25aed568f9 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 @@ -13,6 +13,7 @@ Usage: cardano-cli shelley query | pool-state | tx-mempool | slot-number + | ref-script-size ) Node query commands. Will query the local node whose Unix domain socket is @@ -47,3 +48,5 @@ Available commands: pool-state Dump the pool state tx-mempool Local Mempool info slot-number Query slot number for UTC timestamp + ref-script-size Calculate the reference input scripts size in bytes + for provided transaction ids diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ref-script-size.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ref-script-size.cli new file mode 100644 index 0000000000..1921bd2f70 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_query_ref-script-size.cli @@ -0,0 +1,36 @@ +Usage: cardano-cli shelley query ref-script-size --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--tx-in TX-IN) + ( --mainnet + | --testnet-magic NATURAL + ) + [ --output-json + | --output-text + ] + [--out-file FILE] + + Calculate the reference input scripts size in bytes for provided transaction + ids + +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) + --tx-in TX-IN Transaction input (TxId#TxIx). + --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 + --output-json Format reference inputs query output to JSON. Default + format when writing to a file + --output-text Format reference inputs query output to TEXT. Default + format when writing to stdout + --out-file FILE Optional output file. Default is to write to stdout. + -h,--help Show this help text