Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Haskell stackage snapshot to LTS-22.9 #1114

Merged
merged 18 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ on:
workflow_dispatch: # allow manual trigger

env:
dummy: 15 # change to force cache invalidation
dummy: 16 # change to force cache invalidation
CARGO_TERM_COLOR: always # implicitly adds '--color=always' to all cargo commands
TEST_LEVEL: 1 # for stack tests

Expand Down Expand Up @@ -126,8 +126,13 @@ jobs:
matrix:
plan:
- rust: 1.68
ghc: 9.6.4

steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
td202 marked this conversation as resolved.
Show resolved Hide resolved
- name: Checkout
uses: actions/checkout@v2
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
CPUs.
- The option `--grpc2-max-concurrent-streams` now defaults to `200` from the
previous unbounded value. This makes the node defaults safer.
- Update GHC version to 9.6.4 (lts-22.9).

## 6.2.3

Expand Down
10 changes: 6 additions & 4 deletions concordium-consensus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rustup default stable-x86_64-pc-windows-gnu
```

### `user specified .o/.so/.DLL could not be loaded (addDLL: pthread or dependencies not loaded. (Win32 error 5)) whilst trying to load: (dynamic) pthread`
Copy `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.2.7\mingw\bin\libwinpthread-1.dll` to `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.2.7\mingw\bin\pthread.dll`.
Copy `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.6.4\mingw\bin\libwinpthread-1.dll` to `%LOCALAPPDATA%\Programs\stack\x86_64-windows\ghc-9.6.4\mingw\bin\pthread.dll`.

# The library and dependencies

Expand Down Expand Up @@ -61,9 +61,11 @@ parts
tree layer with block processing and execution is spread between
[src/Concordium/Skov](./src/Concordium/Skov) and
[src/Concordium/Birk/](./src/Concordium/Birk/). The rest are auxiliary modules.
- [src/Concordium/External.hs](./src/Concordium/External.hs) is the external
interface of the library in the form of a number of FFI exports. This is how
the library is integrated into the [concordium-node](../concordium-node/).

The foreign function interface (FFI) to the library is defined in [src-lib](./src-lib).
This is how the library is integrated into the [concordium-node](../concordium-node/).
Depending on the build configuration, the library may be statically or dynamically linked
in the node.

# Tests

Expand Down
81 changes: 68 additions & 13 deletions concordium-consensus/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ default-extensions:
- MultiParamTypeClasses
- RecordWildCards
- TupleSections
- TypeOperators

flags:
dynamic:
Expand All @@ -79,7 +80,6 @@ flags:
library:
source-dirs: src
ghc-options:
- -fPIC
- -Wall
- -Wcompat
- -Werror=missing-fields
Expand All @@ -91,19 +91,74 @@ library:
extra-libraries: concordium_smart_contract_engine

when:
- condition: os(windows)
then:
ghc-options: -threaded -static -shared lib.def -L../concordium-base/smart-contracts/lib -lconcordium_smart_contract_engine
else:
when:
- condition: flag(dynamic)
then:
ghc-options: -shared -dynamic
else:
ghc-options: -static
- condition: "!(os(windows)) && !(flag(dynamic))"
# When we are building a statically linked node, we include the ffi interface in the
# library, and will not build the foreign-library.
ghc-options: -fPIC -static -fno-link-rts
source-dirs: src-lib

# Other options might be needed, such has -dynamic -lHSrts or -lHSrts-ghc8.4.3
# Possibly this depends on the platform
# We use a foreign-library stanza to build the consensus library for dynamic linking.
# This is more robust than the previous approach where the library as a whole was built as a
# DLL or shared object with specific ghc-options. At the time of writing, stack does not support
# the foreign-library stanza, so we include it in a verbatim block as it will be output in the
# cabal file.

# On Windows, the previous build setup produced HSdll.dll in the `concordium-consensus` directory.
# The new approach builds a `concordium-consensus.dll` under `.stack-work\install\...\lib`.
# Since the mod-def-file is specified in its own field (rather than under ghc-options), it does not
# interfere with building the haddock documentation on Windows.

verbatim: |
foreign-library concordium-consensus
type: native-shared
ghc-options: -Wall -Wcompat -Werror=missing-fields -Werror=missing-methods -Wredundant-constraints -O2 -fno-ignore-asserts -threaded
if os(Windows)
options: standalone
mod-def-file: lib.def
-- -fPIC casues issues on Windows: https://gitlab.haskell.org/ghc/ghc/-/issues/24016
-- However, it should not do anything on Windows anyway, so we disable it.
-- (Otherwise, cabal enables it.)
ghc-options: -fno-PIC
else
if flag(dynamic)
ghc-options: -fPIC
else
-- The foreign library should not be built when doing a static build of the node.
buildable: False

other-modules:
Concordium.External
Concordium.External.DryRun
Concordium.External.Helpers
Concordium.External.GRPC2
td202 marked this conversation as resolved.
Show resolved Hide resolved
hs-source-dirs: src-lib
build-depends:
aeson
, bytestring
, cereal
, containers
, directory
, filepath
, microlens-platform
, proto-lens
, transformers
, vector
, base
, text
, concordium-base
, concordium-consensus
default-language: Haskell2010
default-extensions:
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GeneralizedNewtypeDeriving
KindSignatures
LambdaCase
MultiParamTypeClasses
RecordWildCards
TupleSections
TypeOperators

executables:
Concordium-exe:
Expand Down
2 changes: 2 additions & 0 deletions concordium-consensus/src/Concordium/Afgjort/ABBA.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ module Concordium.Afgjort.ABBA (
) where

import Control.Arrow
import Control.Monad
import Control.Monad.RWS.Strict
import qualified Data.ByteString as BS
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe
import Data.Monoid
import Data.Sequence (Seq (..), (|>))
import qualified Data.Sequence as Seq
import qualified Data.Serialize as Ser
Expand Down
1 change: 1 addition & 0 deletions concordium-consensus/src/Concordium/Afgjort/Buffer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Concordium.Afgjort.Buffer where

import Control.Monad
import Control.Monad.State
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
Expand Down
2 changes: 2 additions & 0 deletions concordium-consensus/src/Concordium/Afgjort/CSS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ module Concordium.Afgjort.CSS (
PartySet (..),
) where

import Control.Monad
import Control.Monad.RWS.Strict
import Data.List (foldl')
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe
import Data.Monoid
import Lens.Micro.Platform

import qualified Concordium.Afgjort.CSS.BitSet as BitSet
Expand Down
3 changes: 0 additions & 3 deletions concordium-consensus/src/Concordium/Afgjort/Finalize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- FIXME: This is to suppress compiler warnings for derived instances of BlockStateOperations.
-- This may be fixed in GHC 9.0.1.
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

module Concordium.Afgjort.Finalize (
FinalizationStateMonad,
Expand Down
2 changes: 2 additions & 0 deletions concordium-consensus/src/Concordium/Afgjort/Freeze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ module Concordium.Afgjort.Freeze (
) where

import Control.Exception (assert)
import Control.Monad
import Control.Monad.RWS.Strict
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Monoid
import qualified Data.Serialize as S
import Data.Set (Set)
import qualified Data.Set as Set
Expand Down
2 changes: 2 additions & 0 deletions concordium-consensus/src/Concordium/Afgjort/WMVBA.hs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ module Concordium.Afgjort.WMVBA (
WMVBAState (WMVBAState),
) where

import Control.Monad
import Control.Monad.RWS.Strict
import Data.Bits
import qualified Data.ByteString as BS
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
import Data.Monoid
import qualified Data.Serialize as S
import Data.Serialize.Get
import Data.Serialize.Put
Expand Down
1 change: 0 additions & 1 deletion concordium-consensus/src/Concordium/GlobalState/Account.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

module Concordium.GlobalState.Account where

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

-- | This module exposes an account map backed by a LMDB database.
-- The account map is a simple key/value store where the keys consists of the
-- canonical 'AccountAddress' and the values are the assoicated 'AccountIndex'.
-- canonical 'AccountAddress' and the values are the associated 'AccountIndex'.
--
-- The LMDB account map only stores accounts that are finalized.
-- Non finalized accounts are being kept in a 'DifferenceMap' which
Expand All @@ -34,6 +34,7 @@
module Concordium.GlobalState.AccountMap.LMDB where

import Control.Concurrent
import Control.Monad
import Control.Monad.Catch
import Control.Monad.IO.Class
import Control.Monad.Identity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

module Concordium.GlobalState.Basic.BlockState.Account (
module Concordium.GlobalState.Account,
Expand Down
3 changes: 0 additions & 3 deletions concordium-consensus/src/Concordium/GlobalState/BlockState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE UndecidableInstances #-}
-- FIXME: This is to suppress compiler warnings for derived instances of BlockStateOperations.
-- This may be fixed in GHC 9.0.1.
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

-- |
-- Definition of the API of every BlockState implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import Concordium.Types
import Concordium.Types.HashableTo
import Concordium.Types.Option (Option (..))
import Concordium.Utils.Serialization.Put
import Control.Monad
import Control.Monad.Reader
import Data.Foldable (foldlM)
import Data.IORef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
-- FIXME: GHC 9.2.5 reports that `MonadBlobStore m` is a redundant constraint in a
-- number if instance declarations such as:
--
-- instance (MonadBlobStore m, BlobStorable m a) => DirectBlobStorable m a where
-- ...
--
-- but throws an error complaining it is missing once removed. The following is added
-- to squelch it. Comment it out to reproduce.
--
-- An issue for this exists at https://gitlab.haskell.org/ghc/ghc/-/issues/22151
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

-- |
-- Module : Concordium.GlobalState.Persistent.BlobStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import Concordium.Utils.Serialization
import Concordium.Utils.Serialization.Put
import qualified Concordium.Wasm as Wasm
import Control.Exception
import Control.Monad
import qualified Control.Monad.Catch as MonadCatch
import qualified Control.Monad.Except as MTL
import Control.Monad.Reader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module Concordium.GlobalState.Persistent.Cache where

import Control.Concurrent.MVar
import Control.Monad
import Control.Monad.Except (ExceptT)
import Control.Monad.IO.Class
import Control.Monad.Reader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ import qualified Concordium.Types as Types
import qualified Concordium.Types.Parameters as Types
import qualified Concordium.Types.SeedState as Types

import qualified Control.Monad as MTL
import qualified Control.Monad.Except as MTL
import qualified Control.Monad.IO.Class as MTL
import Data.IORef (newIORef)
import qualified Data.Map.Strict as Map
import Data.Maybe (fromMaybe)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import Concordium.Types.Transactions as T
import Concordium.Types.Updates
import Concordium.Utils
import Control.Exception hiding (handle)
import Control.Monad
import Control.Monad.Except
import Control.Monad.Reader
import Control.Monad.State
Expand Down Expand Up @@ -561,9 +562,9 @@ getWeakPointer ::
MonadIO (PersistentTreeStateMonad state m),
BlockStateStorage (PersistentTreeStateMonad state m),
MPV m ~ pv,
HasSkovPersistentData pv s,
HasSkovPersistentData pv state,
BlockState (PersistentTreeStateMonad state m) ~ PBS.HashedPersistentBlockState pv,
MonadState s (PersistentTreeStateMonad state m),
MonadState state (PersistentTreeStateMonad state m),
MonadProtocolVersion m
) =>
Weak (PersistentBlockPointer (MPV m) (PBS.HashedPersistentBlockState pv)) ->
Expand Down Expand Up @@ -629,7 +630,6 @@ constructBlock StoredBlockWithStateHash{sbshStoredBlock = StoredBlock{..}, ..} =
instance
( MonadState state m,
HasSkovPersistentData pv state,
BlockStateQuery m,
BlockState m ~ PBS.HashedPersistentBlockState pv,
MonadProtocolVersion m,
MPV m ~ pv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

module Concordium.KonsensusV1.Consensus where

import Control.Monad
import Control.Monad.Reader.Class
import Control.Monad.State
import Data.Foldable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Concordium.KonsensusV1.Consensus.Blocks where

import Control.Applicative
import Control.Exception
import Control.Monad
import Control.Monad.Catch
import Control.Monad.Reader
import Control.Monad.State
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module Concordium.KonsensusV1.Consensus.CatchUp (
)
where

import Control.Monad
import Control.Monad.Catch
import Control.Monad.Reader
import Control.Monad.State
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module Concordium.KonsensusV1.Consensus.Finality where

import Control.Exception
import Control.Monad
import Control.Monad.Catch
import Control.Monad.State
import qualified Data.List as List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-- verifying quorum signatures that is used for the consensus v1 protocol.
module Concordium.KonsensusV1.Consensus.Quorum where

import Control.Monad
import Control.Monad.Catch
import Control.Monad.State
import qualified Data.Map.Strict as Map
Expand Down
Loading
Loading