Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgenii Akentev committed Nov 14, 2023
1 parent e48e46a commit 01eced2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
7 changes: 1 addition & 6 deletions test/Chainweb/Test/Pact/ModuleCacheOnRestart.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ import Chainweb.Time
import Chainweb.Test.Cut
import Chainweb.Test.Cut.TestBlockDb
import Chainweb.Test.Utils
import Chainweb.Test.Pact.Utils (getPWOByHeader)
import Chainweb.Test.TestVersions(fastForkingCpmTestVersion)
import Chainweb.Utils (T2(..))
import Chainweb.Version
import Chainweb.WebBlockHeaderDB

import Chainweb.Storage.Table (casLookupM)
import Chainweb.Storage.Table.RocksDB

testVer :: ChainwebVersion
Expand Down Expand Up @@ -255,11 +255,6 @@ doNextCoinbase iobdb = do
(valPWO, _g) <- execValidateBlock mempty nextH (payloadWithOutputsToPayloadData pwo)
return (nextH, valPWO)

getPWOByHeader :: BlockHeader -> TestBlockDb -> IO PayloadWithOutputs
getPWOByHeader h (TestBlockDb _ pdb _) = do
pwo <- casLookupM pdb (_blockPayloadHash h)
return pwo

doNextCoinbaseN_
:: (Logger logger, CanReadablePayloadCas cas)
=> Int
Expand Down
8 changes: 1 addition & 7 deletions test/Chainweb/Test/Pact/PactMultiChainTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ rewindTo c = do
Nothing -> error $ "rewindTo: can't find block header for " ++ show cid'

-- reset the parent header using validateBlock
pout <- getPWOByHeader ph
pout <- liftIO $ getPWOByHeader ph bdb
void $ liftIO $ _webPactValidateBlock pact ph (payloadWithOutputsToPayloadData pout)

void $ liftIO $ swapMVar (_bdbCut bdb) c
Expand Down Expand Up @@ -1442,12 +1442,6 @@ getPWO chid = do
pwo <- liftIO $ casLookupM pdb (_blockPayloadHash h)
return (pwo,h)

getPWOByHeader :: BlockHeader -> PactTestM PayloadWithOutputs
getPWOByHeader h = do
(TestBlockDb _ pdb _) <- view menvBdb
pwo <- liftIO $ casLookupM pdb (_blockPayloadHash h)
return pwo

getHeader :: ChainId -> PactTestM BlockHeader
getHeader chid = do
(TestBlockDb _ _ cmv) <- view menvBdb
Expand Down
6 changes: 5 additions & 1 deletion test/Chainweb/Test/Pact/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module Chainweb.Test.Pact.Utils
, someTestVersionHeader
, someBlockHeader
, testPactFilesDir

, getPWOByHeader
) where

import Control.Arrow ((&&&))
Expand Down Expand Up @@ -199,6 +199,7 @@ import Chainweb.Version.Utils (someChainId)
import Chainweb.WebBlockHeaderDB
import Chainweb.WebPactExecutionService

import Chainweb.Storage.Table (casLookupM)
import Chainweb.Storage.Table.RocksDB

-- ----------------------------------------------------------------------- --
Expand Down Expand Up @@ -865,3 +866,6 @@ someBlockHeader v h = (!! (int h - 1))

makeLenses ''CmdBuilder
makeLenses ''CmdSigner

getPWOByHeader :: BlockHeader -> TestBlockDb -> IO PayloadWithOutputs
getPWOByHeader h (TestBlockDb _ pdb _) = casLookupM pdb (_blockPayloadHash h)

0 comments on commit 01eced2

Please sign in to comment.