diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 82797975b2..1f7434af5f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -116,6 +116,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 +674,46 @@ 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.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) + + let refScripts = L.getReferenceScriptsNonDistinct utxo transactionInputs + refScriptsSize = getSum $ foldMap (Sum . originalBytesSize . snd) refScripts + + liftIO $ print result + undefined + -- pure $ do + -- shelleyBasedEraConstraints sbe (writePoolState mOutFile) result + ) + & onLeft (left . QueryCmdAcquireFailure) + & onLeft left + -- | 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.