Skip to content

Commit 440ee1d

Browse files
committed
Make it build with ghc-9.12
Needed to update the `cardano-node` dependency from `10.1.3` to `10.3` and use all the Cardano dependencies specified by `node`.
1 parent 1e5b7b0 commit 440ee1d

File tree

17 files changed

+125
-104
lines changed

17 files changed

+125
-104
lines changed

cabal.project

Lines changed: 42 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-04-15T19:49:23Z
14+
, cardano-haskell-packages 2025-04-16T02:18:31Z
1515

1616
packages:
1717
cardano-db
@@ -67,34 +67,51 @@ 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+
package cardano-ledger-shelley
71+
flags: -XAllowAmbiguousTypes
72+
73+
-- ---------------------------------------------------------
7674

7775
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
76+
-- esqueleto >= 3.6 has API chamges
77+
, esqueleto ^>= 3.5.11.2
8278

83-
-- ---------------------------------------------------------
79+
-- New version of `text` exposes a `show` function and in the `node`
80+
-- code,`Data.Text` is being imported unqualified (bad idea IMO) which
81+
-- then clashes with the `show` in `Prelude`.
82+
, text < 2.1.2
83+
84+
, cardano-node ^>= 10.3
85+
86+
if impl (ghc >= 9.12)
87+
allow-newer:
88+
-- https://github.com/phadej/vec/issues/118
89+
, bin:base
90+
, fin:base
91+
, ral:base
92+
93+
-- https://github.com/haskellari/tree-diff/issues/97
94+
, tree-diff:base
95+
96+
-- https://github.com/kapralVV/Unique/issues/11
97+
, Unique:hashable
98+
99+
-- https://github.com/Gabriella439/Haskell-Pipes-Safe-Library/pull/70
100+
, pipes-safe:base
101+
102+
-- https://github.com/phadej/insert-ordered-containers/issues/65
103+
, insert-ordered-containers:base
104+
, insert-ordered-containers:hashable
105+
106+
-- https://github.com/GetShopTV/swagger2/issues/256
107+
, swagger2:base
108+
, swagger2:template-haskell
109+
110+
-- https://github.com/haskellari/postgresql-simple/issues/152
111+
, postgresql-simple:base
112+
, postgresql-simple:template-haskell
84113

85114
-- The two following one-liners will cut off / restore the remainder of this file (for nix-shell users):
86115
-- when using the "cabal" wrapper script provided by nix-shell.
87116
-- --------------------------- 8< --------------------------
88117
-- 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-db-sync/cardano-db-sync.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ library
164164
, cardano-ledger-binary
165165
, cardano-ledger-byron
166166
, cardano-ledger-core
167-
, cardano-ledger-conway ^>= 1.17.3
167+
, cardano-ledger-conway >= 1.17.3
168168
, cardano-ledger-binary
169169
, cardano-ledger-mary
170170
, cardano-ledger-shelley >= 1.12.3.0
@@ -222,7 +222,6 @@ library
222222
, time
223223
, transformers
224224
, transformers-except
225-
, typed-protocols
226225
, unix
227226
, vector
228227
, wide-word

cardano-db-sync/src/Cardano/DbSync/Cache/Types.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import Control.Concurrent.Class.MonadSTM.Strict (
4848
import qualified Data.Map.Strict as Map
4949
import Data.Time.Clock (UTCTime)
5050
import Data.WideWord.Word128 (Word128)
51-
import Ouroboros.Consensus.Cardano.Block (StandardCrypto)
5251

5352
type StakePoolCache = Map PoolKeyHash DB.PoolHashId
5453

@@ -79,12 +78,12 @@ data CacheInternal = CacheInternal
7978
, cStake :: !(StrictTVar IO StakeCache)
8079
, cPools :: !(StrictTVar IO StakePoolCache)
8180
, cDatum :: !(StrictTVar IO (LRUCache DataHash DB.DatumId))
82-
, cMultiAssets :: !(StrictTVar IO (LRUCache (PolicyID StandardCrypto, AssetName) DB.MultiAssetId))
81+
, cMultiAssets :: !(StrictTVar IO (LRUCache (PolicyID, AssetName) DB.MultiAssetId))
8382
, cPrevBlock :: !(StrictTVar IO (Maybe (DB.BlockId, ByteString)))
8483
, cStats :: !(StrictTVar IO CacheStatistics)
8584
, cEpoch :: !(StrictTVar IO CacheEpoch)
8685
, cAddress :: !(StrictTVar IO (LRUCache ByteString V.AddressId))
87-
, cTxIds :: !(StrictTVar IO (FIFOCache (Ledger.TxId StandardCrypto) DB.TxId))
86+
, cTxIds :: !(StrictTVar IO (FIFOCache Ledger.TxId DB.TxId))
8887
}
8988

9089
data CacheStatistics = CacheStatistics

cardano-db-sync/src/Cardano/DbSync/Config/Cardano.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import Ouroboros.Consensus.Config (TopLevelConfig (..), emptyCheckpointsMap)
3838
import Ouroboros.Consensus.Ledger.Basics (LedgerConfig)
3939
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo)
4040
import qualified Ouroboros.Consensus.Node.ProtocolInfo as Consensus
41-
import Ouroboros.Consensus.Shelley.Eras (StandardCrypto)
4241
import Ouroboros.Consensus.Shelley.Node (ShelleyGenesis (..))
4342

4443
-- Usually only one constructor, but may have two when we are preparing for a HFC event.
@@ -48,14 +47,14 @@ data GenesisConfig
4847
!Byron.Config
4948
!ShelleyConfig
5049
!AlonzoGenesis
51-
!(ConwayGenesis StandardCrypto)
50+
!ConwayGenesis
5251

5352
genesisProtocolMagicId :: GenesisConfig -> ProtocolMagicId
5453
genesisProtocolMagicId ge =
5554
case ge of
5655
GenesisCardano _cfg _bCfg sCfg _aCfg _cCfg -> shelleyProtocolMagicId (scConfig sCfg)
5756
where
58-
shelleyProtocolMagicId :: ShelleyGenesis StandardCrypto -> ProtocolMagicId
57+
shelleyProtocolMagicId :: ShelleyGenesis -> ProtocolMagicId
5958
shelleyProtocolMagicId sCfg = ProtocolMagicId (sgNetworkMagic sCfg)
6059

6160
readCardanoGenesisConfig ::
@@ -86,7 +85,7 @@ mkTopLevelConfig cfg = Consensus.pInfoConfig $ fst $ mkProtocolInfoCardano cfg [
8685
-- mkProtocolCardano :: GenesisConfig -> Protocol m CardanoBlock CardanoProtocol
8786
mkProtocolInfoCardano ::
8887
GenesisConfig ->
89-
[Consensus.ShelleyLeaderCredentials StandardCrypto] -> -- this is not empty only in tests
88+
[Consensus.ShelleyLeaderCredentials c] -> -- this is not empty only in tests
9089
(ProtocolInfo CardanoBlock, IO [BlockForging IO CardanoBlock])
9190
mkProtocolInfoCardano genesisConfig shelleyCred =
9291
protocolInfoCardano $

cardano-db-sync/src/Cardano/DbSync/Config/Conway.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import Cardano.Ledger.BaseTypes (EpochInterval (..))
1515
import Cardano.Ledger.Coin (Coin (..))
1616
import Cardano.Ledger.Conway.Genesis (ConwayGenesis (..))
1717
import Cardano.Ledger.Conway.PParams (UpgradeConwayPParams (..))
18-
import Cardano.Ledger.Crypto (StandardCrypto ())
1918
import Cardano.Ledger.Plutus.CostModels (mkCostModel)
2019
import Cardano.Ledger.Plutus.Language (Language (..))
2120
import Cardano.Prelude
@@ -37,7 +36,7 @@ data ConwayGenesisError
3736

3837
readConwayGenesisConfig ::
3938
SyncNodeConfig ->
40-
ExceptIO SyncNodeError (ConwayGenesis StandardCrypto)
39+
ExceptIO SyncNodeError ConwayGenesis
4140
readConwayGenesisConfig SyncNodeConfig {..} =
4241
case dncConwayGenesisFile of
4342
Just file -> readConwayGenesisConfig' file dncConwayGenesisHash
@@ -66,7 +65,7 @@ readConwayGenesisConfig SyncNodeConfig {..} =
6665
readGenesis ::
6766
GenesisFile ->
6867
Maybe GenesisHashConway ->
69-
ExceptIO ConwayGenesisError (ConwayGenesis StandardCrypto)
68+
ExceptIO ConwayGenesisError ConwayGenesis
7069
readGenesis (GenesisFile file) expectedHash = do
7170
content <- readFile' file
7271
checkExpectedGenesisHash expectedHash content
@@ -78,7 +77,7 @@ readFile' file =
7877
(GenesisReadError file . show)
7978
(ByteString.readFile file)
8079

81-
decodeGenesis :: (Text -> ConwayGenesisError) -> ByteString -> ExceptIO ConwayGenesisError (ConwayGenesis StandardCrypto)
80+
decodeGenesis :: (Text -> ConwayGenesisError) -> ByteString -> ExceptIO ConwayGenesisError ConwayGenesis
8281
decodeGenesis f =
8382
firstExceptT (f . Text.pack)
8483
. hoistEither

cardano-db-sync/src/Cardano/DbSync/Config/Shelley.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import qualified Data.ByteString.Char8 as BS
2121
import Data.Text (Text)
2222
import qualified Data.Text as Text
2323
import qualified Data.Text.Encoding as Text
24-
import Ouroboros.Consensus.Shelley.Eras (StandardCrypto)
2524
import Ouroboros.Consensus.Shelley.Ledger.Block ()
2625
import Ouroboros.Consensus.Shelley.Node (ShelleyGenesis (..))
2726

2827
-- Everything in this file should be in ouroboros-consensus so that both 'node' and 'db-=sync'
2928
-- can use it.
3029

3130
data ShelleyConfig = ShelleyConfig
32-
{ scConfig :: !(ShelleyGenesis StandardCrypto)
31+
{ scConfig :: !ShelleyGenesis
3332
, scGenesisHash :: !GenesisHashShelley
3433
}
3534

cardano-db-sync/src/Cardano/DbSync/Config/Types.hs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import qualified Cardano.Chain.Update as Byron
7070
import Cardano.Crypto (RequiresNetworkMagic (..))
7171
import qualified Cardano.Crypto.Hash as Crypto
7272
import Cardano.Db (MigrationDir, PGPassSource (..), TxOutTableType (..))
73+
import Cardano.Ledger.Conway (ConwayEra)
7374
import Cardano.Prelude
7475
import Cardano.Slotting.Slot (SlotNo (..))
7576
import Control.Monad (fail)
@@ -79,7 +80,11 @@ import Data.Aeson.Key (fromText)
7980
import Data.Aeson.Types (Pair, Parser, typeMismatch)
8081
import Data.ByteString.Short (ShortByteString (), fromShort, toShort)
8182
import Data.Default.Class (Default (..))
82-
import Ouroboros.Consensus.Cardano.CanHardFork (TriggerHardFork (..))
83+
import Ouroboros.Consensus.Cardano (CardanoHardForkTrigger)
84+
import Ouroboros.Consensus.Cardano.Block (AllegraEra, AlonzoEra, BabbageEra, MaryEra, ShelleyEra, StandardCrypto)
85+
import Ouroboros.Consensus.Protocol.Praos (Praos)
86+
import Ouroboros.Consensus.Protocol.TPraos (TPraos)
87+
import Ouroboros.Consensus.Shelley.Ledger.Block (ShelleyBlock)
8388

8489
newtype LogFileDir = LogFileDir
8590
{ unLogFileDir :: FilePath
@@ -135,12 +140,12 @@ data SyncNodeConfig = SyncNodeConfig
135140
, dncConwayGenesisFile :: !(Maybe GenesisFile)
136141
, dncConwayGenesisHash :: !(Maybe GenesisHashConway)
137142
, dncByronProtocolVersion :: !Byron.ProtocolVersion
138-
, dncShelleyHardFork :: !TriggerHardFork
139-
, dncAllegraHardFork :: !TriggerHardFork
140-
, dncMaryHardFork :: !TriggerHardFork
141-
, dncAlonzoHardFork :: !TriggerHardFork
142-
, dncBabbageHardFork :: !TriggerHardFork
143-
, dncConwayHardFork :: !TriggerHardFork
143+
, dncShelleyHardFork :: !(CardanoHardForkTrigger (ShelleyBlock (Praos StandardCrypto) ShelleyEra))
144+
, dncAllegraHardFork :: !(CardanoHardForkTrigger (ShelleyBlock (Praos StandardCrypto) AllegraEra))
145+
, dncMaryHardFork :: !(CardanoHardForkTrigger (ShelleyBlock (TPraos StandardCrypto) MaryEra))
146+
, dncAlonzoHardFork :: !(CardanoHardForkTrigger (ShelleyBlock (TPraos StandardCrypto) AlonzoEra))
147+
, dncBabbageHardFork :: !(CardanoHardForkTrigger (ShelleyBlock (Praos StandardCrypto) BabbageEra))
148+
, dncConwayHardFork :: !(CardanoHardForkTrigger (ShelleyBlock (Praos StandardCrypto) ConwayEra))
144149
, dncInsertOptions :: !SyncInsertOptions
145150
, dncIpfsGateway :: [Text]
146151
}

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Generic/Metadata.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import qualified Data.Text.Encoding as Text
3535
import qualified Data.Text.Lazy as Text.Lazy
3636
import Data.Tuple.Extra (both)
3737
import qualified Data.Vector as Vector
38-
import Ouroboros.Consensus.Cardano.Block (StandardAllegra, StandardMary, StandardShelley)
38+
import Ouroboros.Consensus.Cardano.Block (AllegraEra, MaryEra, ShelleyEra)
3939

4040
data TxMetadataValue
4141
= TxMetaMap ![(TxMetadataValue, TxMetadataValue)]
@@ -45,19 +45,19 @@ data TxMetadataValue
4545
| TxMetaText !Text
4646
deriving (Eq, Ord, Show)
4747

48-
fromAllegraMetadata :: Allegra.AllegraTxAuxData StandardAllegra -> Map Word64 TxMetadataValue
48+
fromAllegraMetadata :: Allegra.AllegraTxAuxData AllegraEra -> Map Word64 TxMetadataValue
4949
fromAllegraMetadata (Allegra.AllegraTxAuxData mdMap _scripts) =
5050
Map.map fromMetadatum mdMap
5151

5252
fromAlonzoMetadata :: AlonzoEraScript era => Alonzo.AlonzoTxAuxData era -> Map Word64 TxMetadataValue
5353
fromAlonzoMetadata aux =
5454
Map.map fromMetadatum $ Alonzo.atadMetadata aux
5555

56-
fromShelleyMetadata :: Shelley.ShelleyTxAuxData StandardShelley -> Map Word64 TxMetadataValue
56+
fromShelleyMetadata :: Shelley.ShelleyTxAuxData ShelleyEra -> Map Word64 TxMetadataValue
5757
fromShelleyMetadata (Shelley.ShelleyTxAuxData mdMap) =
5858
Map.map fromMetadatum mdMap
5959

60-
fromMaryMetadata :: Allegra.AllegraTxAuxData StandardMary -> Map Word64 TxMetadataValue
60+
fromMaryMetadata :: Allegra.AllegraTxAuxData MaryEra -> Map Word64 TxMetadataValue
6161
fromMaryMetadata (Allegra.AllegraTxAuxData mdMap _scripts) =
6262
Map.map fromMetadatum mdMap
6363

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Generic/Script.hs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ module Cardano.DbSync.Era.Shelley.Generic.Script (
1717

1818
import Cardano.Crypto.Hash.Class
1919
import qualified Cardano.Ledger.Allegra.Scripts as Allegra
20-
import Cardano.Ledger.Core (EraCrypto ())
20+
import Cardano.Ledger.Core (Era (..))
2121
import qualified Cardano.Ledger.Core as Core
22-
import Cardano.Ledger.Crypto
23-
import Cardano.Ledger.Era (Era ())
2422
import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..), coerceKeyRole)
2523
import qualified Cardano.Ledger.Shelley.API.Types as Shelley
2624
import qualified Cardano.Ledger.Shelley.Scripts as Shelley
@@ -78,7 +76,7 @@ instance (Era era, Shelley.ShelleyEraScript era, Core.NativeScript era ~ Shelley
7876
requireSignatureToJSON sig
7977
multiSigToJSON _ = Aeson.Null -- This can never happen
8078

81-
instance (Era era, Shelley.ShelleyEraScript era, Core.NativeScript era ~ Shelley.MultiSig era, EraCrypto era ~ StandardCrypto) => FromJSON (MultiSigScript era) where
79+
instance (Era era, Shelley.ShelleyEraScript era, Core.NativeScript era ~ Shelley.MultiSig era) => FromJSON (MultiSigScript era) where
8280
parseJSON v = MultiSigScript <$> parseMultiSig v
8381

8482
instance (Era era, Allegra.AllegraEraScript era, Core.NativeScript era ~ Allegra.Timelock era) => ToJSON (TimelockScript era) where
@@ -94,10 +92,10 @@ instance (Era era, Allegra.AllegraEraScript era, Core.NativeScript era ~ Allegra
9492
timelockToJSON (Allegra.RequireTimeStart slot) = requireTimeStartToJSON slot
9593
timelockToJSON (Allegra.RequireTimeExpire slot) = requireTimeExpireToJSON slot
9694

97-
instance (Era era, Allegra.AllegraEraScript era, EraCrypto era ~ StandardCrypto, Core.NativeScript era ~ Allegra.Timelock era) => FromJSON (TimelockScript era) where
95+
instance (Era era, Allegra.AllegraEraScript era, Core.NativeScript era ~ Allegra.Timelock era) => FromJSON (TimelockScript era) where
9896
parseJSON v = TimelockScript <$> parseTimelock v
9997

100-
requireSignatureToJSON :: KeyHash discr c -> Aeson.Value
98+
requireSignatureToJSON :: KeyHash discr -> Aeson.Value
10199
requireSignatureToJSON (KeyHash sig) =
102100
Aeson.object
103101
[ "type" .= Aeson.String "sig"
@@ -141,7 +139,7 @@ requireTimeStartToJSON slot =
141139
]
142140

143141
parseMultiSig ::
144-
(Shelley.ShelleyEraScript era, Core.NativeScript era ~ Shelley.MultiSig era, EraCrypto era ~ StandardCrypto) =>
142+
(Shelley.ShelleyEraScript era, Core.NativeScript era ~ Shelley.MultiSig era) =>
145143
Aeson.Value ->
146144
Parser (Shelley.MultiSig era)
147145
parseMultiSig v =
@@ -156,7 +154,7 @@ parseMultiSig v =
156154
parseScriptMOf' = second (fromList . map unMultiSigScript) <$> parseScriptMOf v
157155

158156
parseTimelock ::
159-
(Allegra.AllegraEraScript era, Core.NativeScript era ~ Allegra.Timelock era, EraCrypto era ~ StandardCrypto) =>
157+
(Allegra.AllegraEraScript era, Core.NativeScript era ~ Allegra.Timelock era) =>
160158
Aeson.Value ->
161159
Parser (Allegra.Timelock era)
162160
parseTimelock v =
@@ -174,7 +172,7 @@ parseTimelock v =
174172

175173
parseScriptSig ::
176174
Aeson.Value ->
177-
Parser (KeyHash 'Payment StandardCrypto)
175+
Parser (KeyHash 'Payment)
178176
parseScriptSig = Aeson.withObject "sig" $ \obj -> do
179177
v <- obj .: "type"
180178
case (v :: Text) of
@@ -185,7 +183,7 @@ parseScriptSig = Aeson.withObject "sig" $ \obj -> do
185183

186184
parseKeyHash ::
187185
Text ->
188-
Parser (KeyHash 'Payment StandardCrypto)
186+
Parser (KeyHash 'Payment)
189187
parseKeyHash v = do
190188
let maybeHash = hashFromBytesAsHex $ encodeUtf8 v
191189
maybeKeyHash = KeyHash <$> maybeHash

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Generic/ScriptData.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ module Cardano.DbSync.Era.Shelley.Generic.ScriptData (
88
ScriptData (..),
99
) where
1010

11+
1112
import Cardano.Ledger.Binary (Annotator (..), DecCBOR (..), ToCBOR (..), fromPlainDecoder)
1213
import Cardano.Ledger.Binary.Encoding (EncCBOR (..))
13-
import Cardano.Ledger.Era (Era (..))
14+
import Cardano.Ledger.Core (Era (..))
1415
import Cardano.Ledger.Plutus.Data (Data (..), getPlutusData)
1516
import Cardano.Prelude hiding (show)
1617
import Codec.Serialise (Serialise (..))

0 commit comments

Comments
 (0)