Skip to content

Commit

Permalink
Don't use splitUTxO in tx-cost benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Jul 9, 2024
1 parent 5c28382 commit bc3aebd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions hydra-node/bench/tx-cost/TxCost.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import Hydra.Chain.Direct.State (
initialize,
observeClose,
pickChainContext,
splitUTxO,
unsafeAbort,
unsafeClose,
unsafeCollect,
Expand Down Expand Up @@ -189,10 +188,9 @@ computeContestCost = do
genContestTx numParties = do
ctx <- genHydraContextFor numParties
utxo <- arbitrary
let (inHead, toDecremenetC) = splitUTxO utxo
(closedSnapshotNumber, inHead', toDecremenetC', stClosed@ClosedState{headId}) <- genStClosed ctx inHead (Just toDecremenetC)
(closedSnapshotNumber, _, _, stClosed@ClosedState{headId}) <- genStClosed ctx utxo mempty
cctx <- pickChainContext ctx
snapshot <- genConfirmedSnapshot headId (succ closedSnapshotNumber) 0 inHead' toDecremenetC' (ctxHydraSigningKeys ctx)
snapshot <- genConfirmedSnapshot headId (succ closedSnapshotNumber) 0 utxo mempty (ctxHydraSigningKeys ctx)
pointInTime <- genPointInTimeBefore (getContestationDeadline stClosed)
let cp = ctxContestationPeriod ctx
let contestUtxo = getKnownUTxO stClosed <> getKnownUTxO cctx
Expand Down Expand Up @@ -248,17 +246,16 @@ computeFanOutCost = do
utxo <- genUTxOAdaOnlyOfSize numOutputs
ctx <- genHydraContextFor numParties
(_committed, stOpen@OpenState{headId, seedTxIn}) <- genStOpen ctx
let (inHead, toDecremenetC) = splitUTxO utxo
let version = 1
snapshot <- genConfirmedSnapshot headId 1 version inHead (Just toDecremenetC) [] -- We do not validate the signatures
snapshot <- genConfirmedSnapshot headId 1 version utxo mempty [] -- We do not validate the signatures
cctx <- pickChainContext ctx
let cp = ctxContestationPeriod ctx
(startSlot, closePoint) <- genValidityBoundsFromContestationPeriod cp
let closeTx = unsafeClose cctx (getKnownUTxO stOpen) headId (ctxHeadParameters ctx) snapshot startSlot closePoint version
stClosed = snd . fromJust $ observeClose stOpen closeTx
deadlineSlotNo = slotNoFromUTCTime systemStart slotLength (getContestationDeadline stClosed)
utxoToFanout = getKnownUTxO stClosed <> getKnownUTxO cctx
pure (utxo, unsafeFanout cctx utxoToFanout seedTxIn inHead (Just toDecremenetC) deadlineSlotNo, getKnownUTxO stClosed <> getKnownUTxO cctx)
pure (utxo, unsafeFanout cctx utxoToFanout seedTxIn utxo mempty deadlineSlotNo, getKnownUTxO stClosed <> getKnownUTxO cctx)

newtype NumParties = NumParties Int
deriving newtype (Eq, Show, Ord, Num, Real, Enum, Integral)
Expand Down

0 comments on commit bc3aebd

Please sign in to comment.