Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundnoble committed Dec 16, 2024
3 parents ed10e1b + a9f5262 + a2b7863 commit 4a37f6b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 36 deletions.
2 changes: 0 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ allow-newer: servant:*
-- These packages are tightly bound to the GHC version and these
-- settings ensure that we use the versions that are shipped with the
-- GHC version that we are using.
allow-newer: *:Cabal
allow-newer: *:Cabal-syntax
allow-newer: *:array
allow-newer: *:base
allow-newer: *:bytestring
Expand Down
4 changes: 2 additions & 2 deletions cabal.project.freeze
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
active-repositories: hackage.haskell.org:merge
constraints: any.Cabal ==3.10.2.0,
any.Cabal-syntax ==3.10.2.0,
constraints: any.Cabal ==3.12.1.0,
any.Cabal-syntax ==3.12.1.0,
any.Decimal ==0.5.2,
any.Diff ==1.0.2,
any.Glob ==0.10.2,
Expand Down
20 changes: 1 addition & 19 deletions test/unit/Chainweb/Test/Pact5/CutFixture.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import Control.Monad.IO.Class
import Control.Monad.Trans.Resource (ResourceT, allocate)
import Data.ByteString.Lazy qualified as LBS
import Data.ByteString.Short qualified as SBS
import Data.Foldable
import Data.Function
import Data.HashMap.Strict qualified as HashMap
import Data.HashSet qualified as HashSet
Expand All @@ -83,8 +82,6 @@ import GHC.Stack
import Network.HTTP.Client qualified as HTTP
import Pact.Core.Command.Types
import Pact.Core.Hash qualified as Pact5
import Streaming.Prelude qualified as S
import Test.QuickCheck

data Fixture = Fixture
{ _fixtureCutDb :: CutDb RocksDbTable
Expand Down Expand Up @@ -264,21 +261,6 @@ solveWork w n t =
$ set blockCreationTime (BlockCreationTime t)
$ set blockNonce n
$ hdr
-- | Return a random chain id from a cut that is not blocked.
--
getRandomUnblockedChain :: Cut -> IO ChainId
getRandomUnblockedChain c = do
shuffled <- generate $ shuffle $ toList $ _cutMap c
S.each shuffled
& S.filter isUnblocked
& S.map (view blockChainId)
& S.head_
& fmap fromJuste
where
isUnblocked h =
let bh = view blockHeight h
cid = view blockChainId h
in all (>= bh) $ fmap (view blockHeight) $ toList $ cutAdjs c cid

-- | Build a linear chainweb (no forks). No POW or poison delay is applied.
-- Block times are real times.
Expand Down Expand Up @@ -319,4 +301,4 @@ data MineFailure
| BadAdjacents
-- ^ This could mean that the chain is blocked.
deriving stock (Show)
deriving anyclass (Exception)
deriving anyclass (Exception)
16 changes: 3 additions & 13 deletions test/unit/Chainweb/Test/Pact5/RemotePactTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,20 @@ module Chainweb.Test.Pact5.RemotePactTest
( tests
) where

import Data.Foldable qualified as F
import Pact.Core.DefPacts.Types
import Pact.Core.SPV
import Data.ByteString.Base64.URL qualified as B64U
import Data.ByteString.Lazy qualified as BL
import Data.Aeson qualified as A
import Pact.Core.Command.RPC (ContMsg(..))
import Control.Monad (forM_, replicateM_)
import Control.Monad (replicateM_)
import Chainweb.SPV.CreateProof (createTransactionOutputProof_)
import Chainweb.Cut (cutMap)
import Chainweb.BlockHeader (blockHeight)
import Data.Maybe (fromMaybe)
import Chainweb.CutDB (cut)
import Pact.Core.Names
import Pact.Core.Capabilities
import Pact.Core.PactValue
import Pact.Core.Command.Server qualified as Pact5
import Pact.Core.Evaluate (Info)
import Chainweb.CutDB.RestAPI.Server (someCutGetServer)
import Network.Connection qualified as HTTP
import Network.HTTP.Client.TLS qualified as HTTP
Expand All @@ -65,39 +61,33 @@ import Chainweb.Test.Pact5.CutFixture qualified as CutFixture
import Chainweb.Test.Pact5.Utils
import Chainweb.Test.TestVersions
import Chainweb.Test.Utils (deadbeef, TestPact5CommandResult)
import Chainweb.Test.Utils (testRetryPolicy)
import Chainweb.Utils
import Chainweb.Version
import Chainweb.WebPactExecutionService
import Control.Concurrent
import Control.Exception (Exception, AsyncException(..))
import Control.Lens
import Control.Monad.Catch (Handler(..), throwM)
import Control.Monad.Catch (throwM)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Resource (ResourceT, runResourceT, allocate)
import Control.Retry
import Data.Aeson qualified as Aeson
import Data.Vector qualified as Vector
import Data.HashMap.Strict (HashMap)
import Data.Map.Strict qualified as Map
import Data.HashMap.Strict qualified as HashMap
import Data.HashSet qualified as HashSet
import Data.List qualified as List
import Data.List.NonEmpty (NonEmpty)
import Data.List.NonEmpty qualified as NE
import Data.Text (Text)
import Data.Text qualified as Text
import Network.X509.SelfSigned
import Pact.Core.Command.Types
import Pact.Core.Errors
import Pact.Core.Gas.Types
import Pact.Core.Hash qualified as Pact5
import Pact.JSON.Encode qualified as J
import PropertyMatchers ((?))
import PropertyMatchers qualified as P
import Servant.Client
import Test.Tasty
import Test.Tasty.HUnit (assertBool, assertEqual, assertFailure, testCase)
import Test.Tasty.HUnit (assertEqual, testCase)
import qualified Pact.Types.Command as Pact4

data Fixture = Fixture
Expand Down
1 change: 1 addition & 0 deletions test/unit/Chainweb/Test/Rosetta/RestAPI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ accountBalanceTests tio envIo =
where
req = AccountBalanceReq nid (AccountId "sender00" Nothing Nothing) Nothing

checkBalance :: HasCallStack => AccountBalanceResp -> Decimal -> IO ()
checkBalance resp bal1 = do
let b0 = head $ _accountBalanceResp_balances resp
b1 = kdaToRosettaAmount bal1
Expand Down

0 comments on commit 4a37f6b

Please sign in to comment.