Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
carbolymer committed Mar 26, 2024
1 parent 52819a2 commit 3292df5
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3292df5

Please sign in to comment.