From 159e8e9833e897db858c0d6278db7d7892cb4feb Mon Sep 17 00:00:00 2001 From: Edmund Noble Date: Tue, 17 Dec 2024 13:58:18 -0500 Subject: [PATCH] Remove the version argument from advanceAllChains --- test/unit/Chainweb/Test/Pact5/CutFixture.hs | 13 ++++++------- test/unit/Chainweb/Test/Pact5/RemotePactTest.hs | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/test/unit/Chainweb/Test/Pact5/CutFixture.hs b/test/unit/Chainweb/Test/Pact5/CutFixture.hs index d9f2ac562..b86ba0bd0 100644 --- a/test/unit/Chainweb/Test/Pact5/CutFixture.hs +++ b/test/unit/Chainweb/Test/Pact5/CutFixture.hs @@ -115,7 +115,7 @@ mkFixture v pactServiceConfig baseRdb = do , _fixtureMempools = OnChains $ fst <$> perChain , _fixturePactQueues = OnChains $ snd <$> perChain } - _ <- liftIO $ advanceAllChains v fixture + _ <- liftIO $ advanceAllChains fixture return fixture -- | Advance all chains by one block, filling that block with whatever is in @@ -123,10 +123,10 @@ mkFixture v pactServiceConfig baseRdb = do -- advanceAllChains :: HasCallStack - => ChainwebVersion - -> Fixture + => Fixture -> IO (Cut, ChainMap (Vector (CommandResult Pact5.Hash Text))) -advanceAllChains v Fixture{..} = do +advanceAllChains Fixture{..} = do + let v = _chainwebVersion _fixtureCutDb latestCut <- liftIO $ _fixtureCutDb ^. cut let blockHeights = fmap (view blockHeight) $ latestCut ^. cutMap let latestBlockHeight = maximum blockHeights @@ -149,10 +149,9 @@ advanceAllChains v Fixture{..} = do advanceAllChains_ :: HasCallStack - => ChainwebVersion - -> Fixture + => Fixture -> IO () -advanceAllChains_ v f = void $ advanceAllChains v f +advanceAllChains_ f = void $ advanceAllChains f withTestCutDb :: (Logger logger) => logger diff --git a/test/unit/Chainweb/Test/Pact5/RemotePactTest.hs b/test/unit/Chainweb/Test/Pact5/RemotePactTest.hs index 623943b95..b8b884a35 100644 --- a/test/unit/Chainweb/Test/Pact5/RemotePactTest.hs +++ b/test/unit/Chainweb/Test/Pact5/RemotePactTest.hs @@ -171,7 +171,7 @@ pollingConfirmationDepthTest baseRdb = runResourceT $ do pollingWithDepth v cid clientEnv rks (Just (ConfirmationDepth 0)) >>= \response -> do assertEqual "there are no command results at depth 0" response HashMap.empty - CutFixture.advanceAllChains_ v (fixture ^. cutFixture) + CutFixture.advanceAllChains_ (fixture ^. cutFixture) pollingWithDepth v cid clientEnv rks Nothing >>= \response -> do assertEqual "results are visible at depth 0" 2 (HashMap.size response) @@ -180,7 +180,7 @@ pollingConfirmationDepthTest baseRdb = runResourceT $ do pollingWithDepth v cid clientEnv rks (Just (ConfirmationDepth 1)) >>= \response -> do assertEqual "results are not visible at depth 1" 0 (HashMap.size response) - CutFixture.advanceAllChains_ v (fixture ^. cutFixture) + CutFixture.advanceAllChains_ (fixture ^. cutFixture) pollingWithDepth v cid clientEnv rks Nothing >>= \response -> do assertEqual "results are visible at depth 0" 2 (HashMap.size response) @@ -191,7 +191,7 @@ pollingConfirmationDepthTest baseRdb = runResourceT $ do pollingWithDepth v cid clientEnv rks (Just (ConfirmationDepth 2)) >>= \response -> do assertEqual "results are not visible at depth 2" 0 (HashMap.size response) - CutFixture.advanceAllChains_ v (fixture ^. cutFixture) + CutFixture.advanceAllChains_ (fixture ^. cutFixture) pollingWithDepth v cid clientEnv rks Nothing >>= \response -> do assertEqual "results are visible at depth 0" 2 (HashMap.size response) @@ -236,12 +236,12 @@ spvTest baseRdb = runResourceT $ do $ defaultCmd sendReqKey <- fmap NE.head $ sending v srcChain clientEnv (NE.singleton send) - (sendCut, _) <- CutFixture.advanceAllChains v (fixture ^. cutFixture) + (sendCut, _) <- CutFixture.advanceAllChains (fixture ^. cutFixture) sendCr <- fmap (HashMap.! sendReqKey) $ pollingWithDepth v srcChain clientEnv (NE.singleton sendReqKey) (Just (ConfirmationDepth 0)) let cont = fromMaybe (error "missing continuation") (_crContinuation sendCr) _ <- replicateM_ 10 $ do - CutFixture.advanceAllChains v (fixture ^. cutFixture) + CutFixture.advanceAllChains (fixture ^. cutFixture) let sendHeight = sendCut ^?! ixg srcChain . blockHeight spvProof <- createTransactionOutputProof_ (fixture ^. cutFixture . CutFixture.fixtureWebBlockHeaderDb) (fixture ^. cutFixture . CutFixture.fixturePayloadDb) targetChain srcChain sendHeight 0 let contMsg = ContMsg @@ -264,7 +264,7 @@ spvTest baseRdb = runResourceT $ do $ set cbGasLimit (GasLimit (Gas 1_000)) $ defaultCmd recvReqKey <- fmap NE.head $ sending v targetChain clientEnv (NE.singleton recv) - _ <- CutFixture.advanceAllChains v (fixture ^. cutFixture) + _ <- CutFixture.advanceAllChains (fixture ^. cutFixture) recvCr <- fmap (HashMap.! recvReqKey) $ polling v targetChain clientEnv (NE.singleton recvReqKey) recvCr & P.allTrue