Skip to content

Commit

Permalink
[debug] tx-cost compute cost of contest debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Jun 24, 2022
1 parent 76ac25b commit 7588b53
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions hydra-node/exe/tx-cost/Main.hs
Expand Up @@ -70,26 +70,26 @@ main =

writeTransactionCostMarkdown :: Handle -> IO ()
writeTransactionCostMarkdown hdl = do
initC <- costOfInit
commitC <- costOfCommit
collectComC <- costOfCollectCom
closeC <- costOfClose
-- initC <- costOfInit
-- commitC <- costOfCommit
-- collectComC <- costOfCollectCom
-- closeC <- costOfClose
contestC <- costOfContest
abortC <- costOfAbort
fanoutC <- costOfFanOut
-- abortC <- costOfAbort
-- fanoutC <- costOfFanOut
hPut hdl $
encodeUtf8 $
unlines $
pageHeader
<> intersperse
""
[ initC
, commitC
, collectComC
, closeC
, contestC
, abortC
, fanoutC
-- [ initC
-- , commitC
-- , collectComC
-- , closeC
[ contestC
-- , abortC
-- , fanoutC
]

-- NOTE: Github Actions CI depends on the number of header lines, see
Expand Down
8 changes: 4 additions & 4 deletions hydra-node/exe/tx-cost/TxCost.hs
Expand Up @@ -128,13 +128,13 @@ computeContestCost = do
pure $ interesting <> limit
where
compute numParties = do
(st, tx) <- generate $ genContestTx numParties
(st, tx) <- trace ("generating.." <> show numParties) $ generate $ genContestTx numParties
let utxo = getKnownUTxO st
case checkSizeAndEvaluate tx utxo of
case trace ("evaluating.." <> show numParties) checkSizeAndEvaluate tx utxo of
Just (txSize, memUnit, cpuUnit) ->
pure $ Just (NumParties numParties, txSize, memUnit, cpuUnit)
trace ("got Just for " <> show numParties) pure $ Just (NumParties numParties, txSize, memUnit, cpuUnit)
Nothing ->
pure Nothing
trace ("got Nothing for " <> show numParties) pure Nothing

computeAbortCost :: IO [(NumParties, TxSize, MemUnit, CpuUnit)]
computeAbortCost =
Expand Down

0 comments on commit 7588b53

Please sign in to comment.