From cf89bcb276432c67419027b2d91c01b5d26bef5d 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/EraBased/Commands/Query.hs | 15 +++ .../src/Cardano/CLI/EraBased/Options/Query.hs | 25 ++++ .../src/Cardano/CLI/EraBased/Run/Query.hs | 68 +++++++++++ .../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 ++++++ 18 files changed, 498 insertions(+) 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/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index 2aaa055f8c..c8bd9464bf 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 c828ba6b19..e4198c0048 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 inputs." , 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 0455c9e4ee..d747433bc5 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 #-} @@ -81,6 +83,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 @@ -88,6 +91,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 @@ -115,6 +119,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 @@ -672,6 +677,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. @@ -1120,6 +1170,7 @@ runQueryStakePoolsCmd ) & onLeft (left . QueryCmdAcquireFailure) & onLeft left +-- TODO: replace with writeFormattedOutput writeStakePools :: QueryOutputFormat -> Maybe (File () Out) @@ -1138,6 +1189,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/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index e82627fa4f..b22aa691f1 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 + inputs. + Usage: cardano-cli shelley stake-address ( key-gen | key-hash @@ -1625,6 +1641,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 @@ -1820,6 +1837,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 + inputs. + Usage: cardano-cli allegra stake-address ( key-gen | key-hash @@ -2796,6 +2828,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 @@ -2987,6 +3020,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 + inputs. + Usage: cardano-cli mary stake-address ( key-gen | key-hash @@ -3959,6 +4005,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 @@ -4154,6 +4201,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 + inputs. + Usage: cardano-cli alonzo stake-address ( key-gen | key-hash @@ -5157,6 +5219,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 @@ -5352,6 +5415,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 + inputs. + Usage: cardano-cli babbage stake-address ( key-gen | key-hash @@ -6606,6 +6684,7 @@ Usage: cardano-cli conway query | pool-state | tx-mempool | slot-number + | ref-script-size | constitution | gov-state | drep-state @@ -6833,6 +6912,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 + inputs. + Usage: cardano-cli conway query constitution --socket-path SOCKET_PATH [--cardano-mode [--epoch-slots SLOTS]] @@ -7999,6 +8096,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 @@ -8194,6 +8292,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 + inputs. + 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..3bbf0ea761 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 inputs. 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..8d98fe2b48 --- /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 + inputs. + +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..f4c913ddaf 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 inputs. 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..dd07e446cf --- /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 + inputs. + +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..a399cfcf69 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 inputs. 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..2140f3e983 --- /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 + inputs. + +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..824f8e72ea 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 inputs. 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..0f117ee2dc --- /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 + inputs. + +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..1fbd07b292 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 inputs. 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..b880a8beb5 --- /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 + inputs. + +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..57d3afc421 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 inputs. 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..eb78349cff --- /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 + inputs. + +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..23a1d9626a 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 inputs. 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..13e31a4711 --- /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 + inputs. + +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