Skip to content

Commit da76429

Browse files
authored
Merge pull request #1968 from IntersectMBO/erikd/ghc-9.12
Make it build with ghc-9.12
2 parents 5c671c2 + a88d16b commit da76429

File tree

94 files changed

+1103
-1078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1103
-1078
lines changed

.github/workflows/haskell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
os: [ubuntu-latest]
2222
# TODO: Add ghc910 when input-output-hk/devx is fixed
23-
compiler-nix-name: [ghc810, ghc96, ghc98]
23+
compiler-nix-name: [ghc810, ghc96, ghc98, ghc912]
2424
include:
2525
# We want a single job, because macOS runners are scarce.
2626
- os: macos-latest

cabal.project

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ repository cardano-haskell-packages
1010
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee
1111

1212
index-state:
13-
, hackage.haskell.org 2024-10-10T00:52:24Z
14-
, cardano-haskell-packages 2024-11-26T16:00:26Z
13+
, hackage.haskell.org 2025-05-23T06:30:40Z
14+
, cardano-haskell-packages 2025-05-16T20:03:45Z
1515

1616
packages:
1717
cardano-db
@@ -67,34 +67,35 @@ package snap-server
6767
-- only if the `cardano-node` is compiled with `+rtview`.
6868
flags: -openssl
6969

70-
allow-newer:
71-
, swagger2:aeson
72-
-- The version of ouroboros-consensus specified by cardano-node uses an earlier version of
73-
-- quickcheck-state-machine that does not compile with ghc-9.10 so we allow a never version
74-
-- that builds with ghc-9.10 (and earlier).
75-
, ouroboros-consensus:quickcheck-state-machine
70+
-- ---------------------------------------------------------
7671

7772
constraints:
78-
-- STM 2.5.2 is broken: https://github.com/haskell/stm/issues/76
79-
, stm >= 2.5.3.1
80-
-- Earlier versions do not compile with ghc-9.10.
81-
, quickcheck-state-machine ^>= 0.10
73+
-- esqueleto >= 3.6 has API chamges
74+
, esqueleto ^>= 3.5.11.2
8275

83-
-- ---------------------------------------------------------
76+
-- New version of `text` exposes a `show` function and in the `node`
77+
-- code,`Data.Text` is being imported unqualified (bad idea IMO) which
78+
-- then clashes with the `show` in `Prelude`.
79+
, text < 2.1.2
80+
81+
, cardano-node ^>= 10.3
82+
83+
if impl (ghc >= 9.12)
84+
allow-newer:
85+
-- https://github.com/kapralVV/Unique/issues/11
86+
, Unique:hashable
87+
88+
-- https://github.com/Gabriella439/Haskell-Pipes-Safe-Library/pull/70
89+
, pipes-safe:base
90+
91+
-- https://github.com/haskellari/postgresql-simple/issues/152
92+
, postgresql-simple:base
93+
, postgresql-simple:template-haskell
94+
95+
-- https://github.com/haskell-hvr/int-cast/issues/10
96+
, int-cast:base
8497

8598
-- The two following one-liners will cut off / restore the remainder of this file (for nix-shell users):
8699
-- when using the "cabal" wrapper script provided by nix-shell.
87100
-- --------------------------- 8< --------------------------
88101
-- Please do not put any `source-repository-package` clause above this line.
89-
90-
source-repository-package
91-
type: git
92-
location: https://github.com/IntersectMBO/cardano-node
93-
tag: 36871ba0cd3e86a5dbcfd6878cdb7168bb4e56a1
94-
--sha256: sha256-v0q8qHdI6LKc8mP43QZt3UGdTNDQXE0aF6QapvZsTvU=
95-
subdir:
96-
cardano-node
97-
cardano-submit-api
98-
trace-dispatcher
99-
trace-forward
100-
trace-resources

cardano-chain-gen/cardano-chain-gen.cabal

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ library
7575
, cardano-ledger-shelley >= 1.12.3.0
7676
, cardano-ledger-mary
7777
, cardano-prelude
78+
, cardano-protocol-tpraos
7879
, cardano-slotting
7980
, cardano-strict-containers
8081
, cborg
@@ -85,6 +86,7 @@ library
8586
, extra
8687
, mtl
8788
, microlens
89+
, network-mux
8890
, nothunks
8991
, ouroboros-consensus
9092
, ouroboros-consensus-cardano
@@ -101,6 +103,7 @@ library
101103
, strict-stm
102104
, text
103105
, typed-protocols
106+
, typed-protocols-stateful
104107

105108
test-suite cardano-chain-gen
106109
type: exitcode-stdio-1.0
@@ -182,6 +185,7 @@ test-suite cardano-chain-gen
182185
, esqueleto
183186
, extra
184187
, filepath
188+
, int-cast
185189
, silently
186190
, stm
187191
, strict-stm

cardano-chain-gen/src/Cardano/Mock/ChainDB.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ replaceGenesisDB chainDB st = chainDB {cchain = Genesis st}
6262
extendChainDB :: LedgerSupportsProtocol block => ChainDB block -> block -> ChainDB block
6363
extendChainDB chainDB blk = do
6464
let !chain = cchain chainDB
65-
!st = tickThenReapply (Consensus.ExtLedgerCfg $ chainConfig chainDB) blk (getTipState chain)
65+
!st = tickThenReapply ComputeLedgerEvents (Consensus.ExtLedgerCfg $ chainConfig chainDB) blk (getTipState chain)
6666
in chainDB {cchain = chain :> (blk, st)}
6767

6868
findFirstPoint :: HasHeader block => [Point block] -> ChainDB block -> Maybe (Point block)

cardano-chain-gen/src/Cardano/Mock/ChainSync/Server.hs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{-# LANGUAGE ConstraintKinds #-}
33
{-# LANGUAGE DataKinds #-}
44
{-# LANGUAGE FlexibleContexts #-}
5+
{-# LANGUAGE FlexibleInstances #-}
56
{-# LANGUAGE NumericUnderscores #-}
67
{-# LANGUAGE RankNTypes #-}
78
{-# LANGUAGE ScopedTypeVariables #-}
@@ -48,11 +49,14 @@ import Data.ByteString.Lazy.Char8 (ByteString)
4849
import qualified Data.Map.Strict as Map
4950
import Data.Maybe (fromJust)
5051
import Data.Void (Void)
51-
import Network.TypedProtocol.Core (Peer (..))
52+
import qualified Network.Mux as Mux
53+
import Network.TypedProtocol.Peer (Peer (..))
54+
import Network.TypedProtocol.Stateful.Codec ()
55+
import qualified Network.TypedProtocol.Stateful.Peer as St
5256
import Ouroboros.Consensus.Block (CodecConfig, HasHeader, Point, StandardHash, castPoint)
5357
import Ouroboros.Consensus.Config (TopLevelConfig, configCodec)
5458
import Ouroboros.Consensus.Ledger.Query (BlockQuery, ShowQuery)
55-
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTx)
59+
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTx, TxId)
5660
import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol)
5761
import Ouroboros.Consensus.Network.NodeToClient (Apps (..), Codecs' (..), DefaultCodecs)
5862
import qualified Ouroboros.Consensus.Network.NodeToClient as NTC
@@ -83,10 +87,11 @@ import Ouroboros.Network.Block (
8387
)
8488
import Ouroboros.Network.Channel (Channel)
8589
import Ouroboros.Network.Driver.Simple (runPeer)
90+
import qualified Ouroboros.Network.Driver.Stateful as St (runPeer)
8691
import Ouroboros.Network.IOManager (IOManager)
8792
import qualified Ouroboros.Network.IOManager as IOManager
8893
import Ouroboros.Network.Magic (NetworkMagic)
89-
import Ouroboros.Network.Mux (MuxMode (..), OuroborosApplicationWithMinimalCtx)
94+
import Ouroboros.Network.Mux (OuroborosApplicationWithMinimalCtx)
9095
import Ouroboros.Network.NodeToClient (NodeToClientVersionData (..))
9196
import qualified Ouroboros.Network.NodeToClient as NodeToClient
9297
import Ouroboros.Network.NodeToNode (Versions)
@@ -98,9 +103,10 @@ import Ouroboros.Network.Protocol.ChainSync.Server (
98103
chainSyncServerPeer,
99104
)
100105
import Ouroboros.Network.Protocol.Handshake.Version (simpleSingletonVersions)
106+
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as LocalStateQuery
101107
import Ouroboros.Network.Snocket (LocalAddress, LocalSnocket, LocalSocket (..))
102108
import qualified Ouroboros.Network.Snocket as Snocket
103-
import Ouroboros.Network.Util.ShowProxy (Proxy (..), ShowProxy)
109+
import Ouroboros.Network.Util.ShowProxy (Proxy (..), ShowProxy (..))
104110

105111
{- HLINT ignore "Use readTVarIO" -}
106112

@@ -157,6 +163,7 @@ type MockServerConstraint blk =
157163
, ShowProxy (GenTx blk)
158164
, SupportedNetworkProtocolVersion blk
159165
, EncodeDisk blk blk
166+
, ShowProxy (TxId (GenTx blk))
160167
)
161168

162169
forkServerThread ::
@@ -216,15 +223,15 @@ runLocalServer iom codecConfig netMagic localDomainSock chainProdState =
216223
Versions
217224
NodeToClientVersion
218225
NodeToClientVersionData
219-
(OuroborosApplicationWithMinimalCtx 'ResponderMode LocalAddress ByteString IO Void ())
226+
(OuroborosApplicationWithMinimalCtx 'Mux.ResponderMode LocalAddress ByteString IO Void ())
220227
versions state =
221228
let version = fromJust $ snd $ latestReleasedNodeVersion (Proxy @blk)
222229
allVersions = supportedNodeToClientVersions (Proxy @blk)
223230
blockVersion = fromJust $ Map.lookup version allVersions
224231
in simpleSingletonVersions
225232
version
226233
(NodeToClientVersionData netMagic False)
227-
(NTC.responder version $ mkApps state version blockVersion (NTC.defaultCodecs codecConfig blockVersion version))
234+
(\versionData -> NTC.responder version versionData $ mkApps state version blockVersion (NTC.defaultCodecs codecConfig blockVersion version))
228235

229236
mkApps ::
230237
StrictTVar IO (ChainProducerState blk) ->
@@ -268,11 +275,12 @@ runLocalServer iom codecConfig netMagic localDomainSock chainProdState =
268275
Channel IO ByteString ->
269276
IO ((), Maybe ByteString)
270277
stateQueryServer _them channel =
271-
runPeer
278+
St.runPeer
272279
nullTracer
273280
(cStateQueryCodec codecs)
274281
channel
275-
(Effect (forever $ threadDelay 3_600_000_000))
282+
LocalStateQuery.StateIdle
283+
(St.Effect (forever $ threadDelay 3_600_000_000))
276284

277285
txMonitorServer ::
278286
localPeer ->
@@ -281,7 +289,7 @@ runLocalServer iom codecConfig netMagic localDomainSock chainProdState =
281289
txMonitorServer _them channel =
282290
runPeer
283291
nullTracer
284-
(cStateQueryCodec codecs)
292+
(cTxMonitorCodec codecs)
285293
channel
286294
(Effect (forever $ threadDelay 3_600_000_000))
287295

cardano-chain-gen/src/Cardano/Mock/Forging/Interpreter.hs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module Cardano.Mock.Forging.Interpreter (
3333
) where
3434

3535
import Cardano.Ledger.Core (txIdTx)
36-
import Cardano.Ledger.Crypto (StandardCrypto)
3736
import qualified Cardano.Ledger.Shelley.API.Mempool as Ledger
3837
import Cardano.Ledger.Shelley.LedgerState (NewEpochState (..))
3938
import qualified Cardano.Ledger.TxIn as Ledger
@@ -75,11 +74,11 @@ import Ouroboros.Consensus.Block (
7574
)
7675
import qualified Ouroboros.Consensus.Block as Block
7776
import Ouroboros.Consensus.Cardano.Block (
77+
AlonzoEra,
78+
BabbageEra,
79+
ConwayEra,
7880
LedgerState (..),
79-
StandardAlonzo,
80-
StandardBabbage,
81-
StandardConway,
82-
StandardShelley,
81+
ShelleyEra,
8382
)
8483
import Ouroboros.Consensus.Cardano.CanHardFork ()
8584
import Ouroboros.Consensus.Config (
@@ -88,12 +87,14 @@ import Ouroboros.Consensus.Config (
8887
configLedger,
8988
topLevelConfigLedger,
9089
)
90+
9191
import Ouroboros.Consensus.Forecast (Forecast (..))
9292
import qualified Ouroboros.Consensus.HardFork.Combinator.AcrossEras as Consensus
9393
import Ouroboros.Consensus.HardFork.Combinator.Ledger ()
9494
import qualified Ouroboros.Consensus.HardFork.Combinator.Mempool as Consensus
9595
import Ouroboros.Consensus.HeaderValidation (headerStateChainDep)
9696
import Ouroboros.Consensus.Ledger.Abstract (TickedLedgerState, applyChainTick)
97+
import Ouroboros.Consensus.Ledger.Basics (ComputeLedgerEvents (..))
9798
import Ouroboros.Consensus.Ledger.Extended (ExtLedgerState, headerState, ledgerState)
9899
import Ouroboros.Consensus.Ledger.SupportsMempool (
99100
ApplyTxErr,
@@ -362,6 +363,7 @@ forgeNextLeaders interpreter txes possibleLeaders = do
362363
let tickedLedgerSt :: Ticked (LedgerState CardanoBlock)
363364
!tickedLedgerSt =
364365
applyChainTick
366+
ComputeLedgerEvents
365367
(configLedger cfg)
366368
currentSlot
367369
(ledgerState . currentState $ istChain interState)
@@ -493,7 +495,7 @@ getCurrentSlot interp = istSlot <$> readTVarIO (interpState interp)
493495

494496
withBabbageLedgerState ::
495497
Interpreter ->
496-
(LedgerState (ShelleyBlock PraosStandard StandardBabbage) -> Either ForgingError a) ->
498+
(LedgerState (ShelleyBlock PraosStandard BabbageEra) -> Either ForgingError a) ->
497499
IO a
498500
withBabbageLedgerState inter mk = do
499501
st <- getCurrentLedgerState inter
@@ -505,7 +507,7 @@ withBabbageLedgerState inter mk = do
505507

506508
withConwayLedgerState ::
507509
Interpreter ->
508-
(LedgerState (ShelleyBlock PraosStandard StandardConway) -> Either ForgingError a) ->
510+
(LedgerState (ShelleyBlock PraosStandard ConwayEra) -> Either ForgingError a) ->
509511
IO a
510512
withConwayLedgerState inter mk = do
511513
st <- getCurrentLedgerState inter
@@ -517,7 +519,7 @@ withConwayLedgerState inter mk = do
517519

518520
withAlonzoLedgerState ::
519521
Interpreter ->
520-
(LedgerState (ShelleyBlock TPraosStandard StandardAlonzo) -> Either ForgingError a) ->
522+
(LedgerState (ShelleyBlock TPraosStandard AlonzoEra) -> Either ForgingError a) ->
521523
IO a
522524
withAlonzoLedgerState inter mk = do
523525
st <- getCurrentLedgerState inter
@@ -529,7 +531,7 @@ withAlonzoLedgerState inter mk = do
529531

530532
withShelleyLedgerState ::
531533
Interpreter ->
532-
(LedgerState (ShelleyBlock TPraosStandard StandardShelley) -> Either ForgingError a) ->
534+
(LedgerState (ShelleyBlock TPraosStandard ShelleyEra) -> Either ForgingError a) ->
533535
IO a
534536
withShelleyLedgerState inter mk = do
535537
st <- getCurrentLedgerState inter
@@ -539,13 +541,13 @@ withShelleyLedgerState inter mk = do
539541
Left err -> throwIO err
540542
_ -> throwIO ExpectedShelleyState
541543

542-
mkTxId :: TxEra -> Ledger.TxId StandardCrypto
544+
mkTxId :: TxEra -> Ledger.TxId
543545
mkTxId txe =
544546
case txe of
545-
TxAlonzo tx -> txIdTx @StandardAlonzo tx
546-
TxBabbage tx -> txIdTx @StandardBabbage tx
547-
TxConway tx -> txIdTx @StandardConway tx
548-
TxShelley tx -> txIdTx @StandardShelley tx
547+
TxAlonzo tx -> txIdTx @AlonzoEra tx
548+
TxBabbage tx -> txIdTx @BabbageEra tx
549+
TxConway tx -> txIdTx @ConwayEra tx
550+
TxShelley tx -> txIdTx @ShelleyEra tx
549551

550552
mkValidated :: TxEra -> Validated (Consensus.GenTx CardanoBlock)
551553
mkValidated txe =

0 commit comments

Comments
 (0)