Skip to content

Commit

Permalink
support ghc-9.10
Browse files Browse the repository at this point in the history
  • Loading branch information
larskuhtz committed Jul 2, 2024
1 parent f258a70 commit 62d731b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 445 deletions.
11 changes: 6 additions & 5 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ package yet-another-logger
source-repository-package
type: git
location: https://github.com/kadena-io/pact.git
tag: 4c0acc5fb322014b120c4a5942db8505968ab046
--sha256: 0kyh6xwm06npbw73dil5xpngfr7h6ppsn5jz7hjkirq9hj33aqqv
tag: 6098d8034a7e4efc3bf40b1c5b9d180a13772c3d
--sha256: 11yh6xwm06npbw73dil5xpngfr7h6ppsn5jz7hjkirq9hj33aqqv

source-repository-package
type: git
Expand Down Expand Up @@ -123,12 +123,13 @@ source-repository-package
tag: d8019c3404d6f3b3c0b0416e9899cfdf614ef425
--sha256: 09msayidg23rsdz97fcfqqalm4pbawx3c1qihgab8hnlmjxby103

-- Patch merged into master (upcoming version 10.0). We are currently using 9.2
-- Patch merged into master (upcoming verison 10.0). We are currently using 9.2.
-- This fork contains additional fixes for using 9.2 with recent compilers.
source-repository-package
type: git
location: https://github.com/larskuhtz/sbv
tag: b66e3a04c20f753213fe7e5115a95b3fe34109f9
--sha256: 0dca5pl56nz8ijnqavnpxw5f47qmpalszd5w0ag8bq3fd0l3839m
tag: 1f2d042718fcf9a140398bd3dedac77c207cce27
--sha256: sha256-Y2ZRU9lkrClYiNc8apwy4uO1TAvJ8JZEPKF73ZuGdlA=

-- Required for non-canonical decode in base64-bytestring (remove after 2.20 fork)
source-repository-package
Expand Down
6 changes: 4 additions & 2 deletions chainweb.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ library
, Network.X509.SelfSigned

, Numeric.Cast
, Numeric.Additive
, Numeric.AffineSpace

, P2P.BootstrapNodes
, P2P.Node
Expand Down Expand Up @@ -416,6 +414,7 @@ library
, optparse-applicative >= 0.14
, pact >= 4.2.0.1
, pact-json >= 0.1
, pact-time:numeric >=0.3.0.1
, parallel >= 3.2.2.0
, patience >= 0.3
, pem >=0.2
Expand Down Expand Up @@ -595,6 +594,7 @@ test-suite chainweb-tests
, http-client-tls >=0.3
, pact
, pact-json >= 0.1
, pact-time:numeric >=0.3.0.1
, quickcheck-instances >= 0.3
, random >= 1.2
, resource-pool >= 0.4
Expand Down Expand Up @@ -778,6 +778,7 @@ executable cwtool
, optparse-applicative >= 0.14
, pact
, pact-json
, pact-time:numeric >=0.3.0.1
, patience >= 0.3
, process >= 1.5
, quickcheck-instances >= 0.3
Expand Down Expand Up @@ -856,6 +857,7 @@ benchmark bench
, merkle-log >=0.2
, mtl >= 2.3
, pact
, pact-time:numeric >=0.3.0.1
, random >= 1.2
, streaming
, text >= 2.0
Expand Down
3 changes: 3 additions & 0 deletions src/Chainweb/Mempool/CurrentTxs.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down Expand Up @@ -35,7 +36,9 @@ module Chainweb.Mempool.CurrentTxs

import qualified Data.ByteString as B
import qualified Data.ByteString.Short as BS
#if !MIN_VERSION_base(4,20,0)
import Data.Foldable
#endif
import qualified Data.List as L
import qualified Data.Set as S
import qualified Data.Vector as V
Expand Down
5 changes: 5 additions & 0 deletions src/Chainweb/Mempool/InMem.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NumericUnderscores #-}
Expand Down Expand Up @@ -36,7 +37,11 @@ import Data.Aeson
import Data.Bifunctor (bimap)
import qualified Data.ByteString.Short as SB
import Data.Decimal
#if MIN_VERSION_base(4,20,0)
import Data.Foldable (foldlM)
#else
import Data.Foldable (foldl', foldlM)
#endif
import Data.Function (on)
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HashMap
Expand Down
24 changes: 13 additions & 11 deletions src/Chainweb/Pact/Backend/RelationalCheckpointer.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NumericUnderscores #-}
Expand Down Expand Up @@ -31,7 +32,9 @@ import Control.Monad.IO.Class

import Data.ByteString (intercalate)
import qualified Data.ByteString.Short as BS
#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
#endif
import Data.Int
import qualified Data.Map.Strict as M
import Data.Maybe
Expand Down Expand Up @@ -277,8 +280,7 @@ doGetEarliestBlock db = do
[] -> return Nothing
(!o:_) -> return (Just o)
where
qtext = "SELECT blockheight, hash FROM BlockHistory \
\ ORDER BY blockheight ASC LIMIT 1"
qtext = "SELECT blockheight, hash FROM BlockHistory ORDER BY blockheight ASC LIMIT 1"

go [SInt hgt, SBlob blob] =
let hash = either error id $ runGetEitherS decodeBlockHash blob
Expand All @@ -292,8 +294,7 @@ doGetLatestBlock db = do
[] -> return Nothing
(!o:_) -> return (Just o)
where
qtext = "SELECT blockheight, hash FROM BlockHistory \
\ ORDER BY blockheight DESC LIMIT 1"
qtext = "SELECT blockheight, hash FROM BlockHistory ORDER BY blockheight DESC LIMIT 1"

go [SInt hgt, SBlob blob] =
let hash = either error id $ runGetEitherS decodeBlockHash blob
Expand All @@ -308,8 +309,7 @@ doLookupBlock db (bheight, bhash) = do
[SInt n] -> return $! n == 1
_ -> internalError "doLookupBlock: output type mismatch"
where
qtext = "SELECT COUNT(*) FROM BlockHistory WHERE blockheight = ? \
\ AND hash = ?;"
qtext = "SELECT COUNT(*) FROM BlockHistory WHERE blockheight = ? AND hash = ?;"

doGetBlockParent :: ChainwebVersion -> ChainId -> SQLiteEnv -> (BlockHeight, BlockHash) -> IO (Maybe BlockHash)
doGetBlockParent v cid db (bh, hash)
Expand All @@ -335,11 +335,13 @@ doLookupSuccessful curHeight hashes = do
callDb "doLookupSuccessful" $ \db -> do
let
hss = V.toList hashes
params = Utf8 $ intercalate "," (map (const "?") hss)
qtext = "SELECT blockheight, hash, txhash FROM \
\TransactionIndex INNER JOIN BlockHistory \
\USING (blockheight) WHERE txhash IN (" <> params <> ")"
<> " AND blockheight <= ?;"
params = intercalate "," (map (const "?") hss)
qtext = Utf8 $ intercalate " "
[ "SELECT blockheight, hash, txhash"
, "FROM TransactionIndex"
, "INNER JOIN BlockHistory USING (blockheight)"
, "WHERE txhash IN (" <> params <> ")" <> " AND blockheight <= ?;"
]
qvals
-- match query params above. first, hashes
= map (\(TypedHash h) -> SBlob $ BS.fromShort h) hss
Expand Down
5 changes: 5 additions & 0 deletions src/Chainweb/Rosetta/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand All @@ -24,7 +25,11 @@ import Control.Monad.Except (throwError)
import Control.Monad.IO.Class
import Control.Monad.Trans.Except
import Data.Map (Map)
#if MIN_VERSION_base(4,20,0)
import Data.List (find)
#else
import Data.List (foldl', find)
#endif
import Data.Default (def)
import Data.Decimal
import Data.Word (Word64)
Expand Down
3 changes: 3 additions & 0 deletions src/Chainweb/Rosetta/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
Expand All @@ -18,7 +19,9 @@ import Data.Aeson
import Data.Aeson.Types (Pair)
import qualified Data.Aeson.KeyMap as KM
import Data.Bifunctor (first)
#if !MIN_VERSION_base(4,20,0)
import Data.Foldable (foldl')
#endif
import Data.Decimal ( Decimal, DecimalRaw(Decimal) )
import Data.Hashable (Hashable(..))
import Data.List (sortOn, inits)
Expand Down
Loading

0 comments on commit 62d731b

Please sign in to comment.