Skip to content

Commit f2f72e5

Browse files
committed
Get past GHC hurdle using GHCI resolve more changes
1 parent 7b5611f commit f2f72e5

File tree

14 files changed

+61
-72
lines changed

14 files changed

+61
-72
lines changed

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module Ouroboros.Consensus.Shelley.Ledger.PeerSelection () where
1111
import Cardano.Ledger.BaseTypes
1212
import qualified Cardano.Ledger.Keys as SL
1313
import qualified Cardano.Ledger.Shelley.API as SL
14-
import qualified Cardano.Ledger.State as SL
1514
import Control.DeepSeq (force)
1615
import Data.Bifunctor (second)
1716
import Data.Foldable (toList)

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/Consensus/Cardano/Examples.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,22 @@ byronEraParams :: History.EraParams
147147
byronEraParams = Byron.byronEraParams Byron.ledgerConfig
148148

149149
shelleyEraParams :: History.EraParams
150-
shelleyEraParams = Shelley.shelleyEraParams @StandardCrypto Shelley.testShelleyGenesis
150+
shelleyEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
151151

152152
allegraEraParams :: History.EraParams
153-
allegraEraParams = Shelley.shelleyEraParams @StandardCrypto Shelley.testShelleyGenesis
153+
allegraEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
154154

155155
maryEraParams :: History.EraParams
156-
maryEraParams = Shelley.shelleyEraParams @StandardCrypto Shelley.testShelleyGenesis
156+
maryEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
157157

158158
alonzoEraParams :: History.EraParams
159-
alonzoEraParams = Shelley.shelleyEraParams @StandardCrypto Shelley.testShelleyGenesis
159+
alonzoEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
160160

161161
babbageEraParams :: History.EraParams
162-
babbageEraParams = Shelley.shelleyEraParams @StandardCrypto Shelley.testShelleyGenesis
162+
babbageEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
163163

164164
conwayEraParams :: History.EraParams
165-
conwayEraParams = Shelley.shelleyEraParams @StandardCrypto Shelley.testShelleyGenesis
165+
conwayEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
166166

167167
-- | We use 10, 20, 30, 40, ... as the transition epochs
168168
shelleyTransitionEpoch :: EpochNo
@@ -249,8 +249,8 @@ summary =
249249
eraInfoByron :: SingleEraInfo ByronBlock
250250
eraInfoByron = singleEraInfo (Proxy @ByronBlock)
251251

252-
eraInfoShelley :: SingleEraInfo (ShelleyBlock (TPraos StandardCrypto) StandardShelley)
253-
eraInfoShelley = singleEraInfo (Proxy @(ShelleyBlock (TPraos StandardCrypto) StandardShelley))
252+
eraInfoShelley :: SingleEraInfo (ShelleyBlock (TPraos StandardCrypto) ShelleyEra)
253+
eraInfoShelley = singleEraInfo (Proxy @(ShelleyBlock (TPraos StandardCrypto) ShelleyEra))
254254

255255
codecConfig :: CardanoCodecConfig Crypto
256256
codecConfig =

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/Consensus/Cardano/Generators.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ instance Arbitrary (Coherent (CardanoBlock MockCryptoCompatByron)) where
113113
instance Arbitrary (CardanoHeader MockCryptoCompatByron) where
114114
arbitrary = getHeader <$> arbitrary
115115

116-
instance (CanMock (TPraos c) (ShelleyEra c), CardanoHardForkConstraints c)
116+
instance (CanMock (TPraos c) ShelleyEra, CardanoHardForkConstraints c)
117117
=> Arbitrary (OneEraHash (CardanoEras c)) where
118118
arbitrary = inj <$> arbitrary
119119
where
@@ -125,7 +125,7 @@ instance (CanMock (TPraos c) (ShelleyEra c), CardanoHardForkConstraints c)
125125
=> WrapHeaderHash blk -> K (OneEraHash (CardanoEras c)) blk
126126
aux = K . OneEraHash . toShortRawHash (Proxy @blk) . unwrapHeaderHash
127127

128-
instance (c ~ MockCryptoCompatByron, ShelleyBasedEra (ShelleyEra c))
128+
instance (c ~ MockCryptoCompatByron, ShelleyBasedEra ShelleyEra)
129129
=> Arbitrary (AnnTip (CardanoBlock c)) where
130130
arbitrary = AnnTip
131131
<$> (SlotNo <$> arbitrary)

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/Consensus/Cardano/MockCrypto.hs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
module Test.Consensus.Cardano.MockCrypto (MockCryptoCompatByron) where
88

9-
import Cardano.Crypto.DSIGN (Ed25519DSIGN)
10-
import Cardano.Crypto.Hash (Blake2b_224, Blake2b_256)
119
import Cardano.Crypto.KES (MockKES)
1210
import Cardano.Crypto.VRF (MockVRF)
13-
import Cardano.Ledger.Crypto (Crypto (..))
11+
import Cardano.Protocol.Crypto (Crypto (..))
1412
import qualified Ouroboros.Consensus.Protocol.Praos as Praos
1513
import qualified Ouroboros.Consensus.Protocol.TPraos as TPraos
1614

@@ -35,9 +33,6 @@ import qualified Ouroboros.Consensus.Protocol.TPraos as TPraos
3533
data MockCryptoCompatByron
3634

3735
instance Crypto MockCryptoCompatByron where
38-
type ADDRHASH MockCryptoCompatByron = Blake2b_224
39-
type DSIGN MockCryptoCompatByron = Ed25519DSIGN
40-
type HASH MockCryptoCompatByron = Blake2b_256
4136
type KES MockCryptoCompatByron = MockKES 10
4237
type VRF MockCryptoCompatByron = MockVRF
4338

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/Consensus/Cardano/ProtocolInfo.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ module Test.Consensus.Cardano.ProtocolInfo (
2323

2424
import qualified Cardano.Chain.Genesis as CC.Genesis
2525
import qualified Cardano.Chain.Update as CC.Update
26-
import Cardano.Ledger.Api.Era (StandardCrypto)
2726
import qualified Cardano.Ledger.Api.Transition as L
2827
import qualified Cardano.Ledger.BaseTypes as SL
28+
import Cardano.Protocol.Crypto (StandardCrypto)
2929
import qualified Cardano.Protocol.TPraos.OCert as SL
3030
import qualified Cardano.Slotting.Time as Time
3131
import Data.Proxy (Proxy (..))
@@ -190,7 +190,7 @@ mkSimpleTestProtocolInfo
190190
(genesisByron, generatedSecretsByron) =
191191
Byron.generateGenesisConfig (toSlotLength byronSlotLenghtInSeconds) pbftParams
192192

193-
shelleyGenesis :: ShelleyGenesis c
193+
shelleyGenesis :: ShelleyGenesis
194194
shelleyGenesis =
195195
Shelley.mkGenesisConfig
196196
protocolVersion
@@ -199,7 +199,7 @@ mkSimpleTestProtocolInfo
199199
decentralizationParam
200200
maxLovelaceSupply
201201
(toSlotLength shelleySlotLengthInSeconds)
202-
(Shelley.mkKesConfig (Proxy @c) numSlots)
202+
(Shelley.mkKesConfig (Proxy @StandardCrypto) numSlots)
203203
[coreNodeShelley]
204204
where
205205
maxLovelaceSupply :: Word64
@@ -217,7 +217,7 @@ mkTestProtocolInfo ::
217217
. (CardanoHardForkConstraints c, IOLike m, c ~ StandardCrypto)
218218
=> (CoreNodeId, Shelley.CoreNode c)
219219
-- ^ Id of the node for which the protocol info will be elaborated.
220-
-> ShelleyGenesis c
220+
-> ShelleyGenesis
221221
-- ^ These nodes will be part of the initial delegation mapping, and funds
222222
-- will be allocated to these nodes.
223223
-> CC.Update.ProtocolVersion

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/TxGen/Allegra.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Test.ThreadNet.TxGen (TxGen (..))
1212

1313
-- | Dummy generator until CAD-2119 is done, i.e., the transaction generator in
1414
-- the ledger has been generalised over the eras.
15-
instance TxGen (ShelleyBlock (TPraos c) (AllegraEra c)) where
15+
instance TxGen (ShelleyBlock (TPraos c) AllegraEra) where
1616

1717
type TxGenExtra _ = ()
1818

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/TxGen/Alonzo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Test.ThreadNet.TxGen (TxGen (..))
1212

1313
-- | Dummy generator until CAD-2119 is done, i.e., the transaction generator in
1414
-- the ledger has been generalised over the eras.
15-
instance TxGen (ShelleyBlock (TPraos c) (AlonzoEra c)) where
15+
instance TxGen (ShelleyBlock (TPraos c) AlonzoEra) where
1616

1717
type TxGenExtra _ = ()
1818

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/TxGen/Babbage.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Test.ThreadNet.TxGen (TxGen (..))
1212

1313
-- | Dummy generator until CAD-2119 is done, i.e., the transaction generator in
1414
-- the ledger has been generalised over the eras.
15-
instance TxGen (ShelleyBlock (Praos c) (BabbageEra c)) where
15+
instance TxGen (ShelleyBlock (Praos c) BabbageEra) where
1616

1717
type TxGenExtra _ = ()
1818

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/TxGen/Cardano.hs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{-# LANGUAGE LambdaCase #-}
55
{-# LANGUAGE NamedFieldPuns #-}
66
{-# LANGUAGE ScopedTypeVariables #-}
7+
{-# LANGUAGE TypeApplications #-}
78
{-# LANGUAGE TypeFamilies #-}
89

910
{-# OPTIONS_GHC -Wno-orphans #-}
@@ -21,6 +22,7 @@ import qualified Cardano.Ledger.SafeHash as SL
2122
import qualified Cardano.Ledger.Shelley.API as SL
2223
import qualified Cardano.Ledger.Shelley.Core as SL
2324
import Cardano.Ledger.Val ((<->))
25+
import Cardano.Protocol.Crypto (StandardCrypto)
2426
import Control.Exception (assert)
2527
import Data.Map.Strict (Map)
2628
import qualified Data.Map.Strict as Map
@@ -98,7 +100,7 @@ instance CardanoHardForkConstraints c => TxGen (CardanoBlock c) where
98100

99101
-- Reuse the payment key as the pool key, since it's an individual
100102
-- stake pool and the namespaces are separate.
101-
poolSK :: SL.SignKeyDSIGN c
103+
poolSK :: SL.SignKeyDSIGN
102104
poolSK = paymentSK
103105

104106
-- | See 'migrateUTxO'
@@ -107,10 +109,10 @@ data MigrationInfo c = MigrationInfo
107109
-- ^ Needed for creating a Byron address.
108110
, byronSK :: Byron.SigningKey
109111
-- ^ The core node's Byron secret.
110-
, paymentSK :: SL.SignKeyDSIGN c
111-
, poolSK :: SL.SignKeyDSIGN c
112-
, stakingSK :: SL.SignKeyDSIGN c
113-
, vrfSK :: SL.SignKeyVRF c
112+
, paymentSK :: SL.SignKeyDSIGN
113+
, poolSK :: SL.SignKeyDSIGN
114+
, stakingSK :: SL.SignKeyDSIGN
115+
, vrfSK :: SL.SignKeyVRF c
114116
-- ^ To be re-used by the individual pool.
115117
}
116118

@@ -133,7 +135,7 @@ migrateUTxO ::
133135
migrateUTxO migrationInfo curSlot lcfg lst
134136
| Just utxo <- mbUTxO =
135137

136-
let picked :: Map (SL.TxIn c) (SL.TxOut (ShelleyEra c))
138+
let picked :: Map SL.TxIn (SL.TxOut ShelleyEra)
137139
picked = Map.filter pick $ SL.unUTxO utxo
138140
where
139141
pick (SL.ShelleyTxOut addr _) =
@@ -156,7 +158,7 @@ migrateUTxO migrationInfo curSlot lcfg lst
156158
assert (pickedCoin > spentCoin) $
157159
pickedCoin <-> spentCoin
158160

159-
body :: SL.TxBody (ShelleyEra c)
161+
body :: SL.TxBody ShelleyEra
160162
body = SL.mkBasicTxBody
161163
& SL.certsTxBodyL .~ StrictSeq.fromList
162164
[ SL.RegTxCert $ Shelley.mkCredential stakingSK
@@ -170,24 +172,24 @@ migrateUTxO migrationInfo curSlot lcfg lst
170172
& SL.ttlTxBodyL .~ SlotNo maxBound
171173
& SL.feeTxBodyL .~ fee
172174

173-
bodyHash :: SL.SafeHash c SL.EraIndependentTxBody
175+
bodyHash :: SL.SafeHash SL.EraIndependentTxBody
174176
bodyHash = SL.hashAnnotated body
175177

176178
-- Witness the use of bootstrap address's utxo.
177-
byronWit :: SL.BootstrapWitness c
179+
byronWit :: SL.BootstrapWitness
178180
byronWit =
179181
SL.makeBootstrapWitness (SL.extractHash bodyHash) byronSK $
180182
Byron.addrAttributes byronAddr
181183

182184
-- Witness the stake delegation.
183-
delegWit :: SL.WitVKey 'SL.Witness c
185+
delegWit :: SL.WitVKey 'SL.Witness
184186
delegWit =
185187
TL.mkWitnessVKey
186188
bodyHash
187189
(Shelley.mkKeyPair stakingSK)
188190

189191
-- Witness the pool registration.
190-
poolWit :: SL.WitVKey 'SL.Witness c
192+
poolWit :: SL.WitVKey 'SL.Witness
191193
poolWit =
192194
TL.mkWitnessVKey
193195
bodyHash
@@ -207,7 +209,7 @@ migrateUTxO migrationInfo curSlot lcfg lst
207209
| otherwise = Nothing
208210

209211
where
210-
mbUTxO :: Maybe (SL.UTxO (ShelleyEra c))
212+
mbUTxO :: Maybe (SL.UTxO ShelleyEra)
211213
mbUTxO =
212214
fmap getUTxOShelley $
213215
ejectShelleyTickedLedgerState $
@@ -229,14 +231,14 @@ migrateUTxO migrationInfo curSlot lcfg lst
229231

230232
-- We use a base reference for the stake so that we can refer to it in the
231233
-- same tx that registers it.
232-
shelleyAddr :: SL.Addr c
234+
shelleyAddr :: SL.Addr
233235
shelleyAddr =
234236
SL.Addr Shelley.networkId
235237
(Shelley.mkCredential paymentSK)
236238
(SL.StakeRefBase $ Shelley.mkCredential stakingSK)
237239

238240
-- A simplistic individual pool
239-
poolParams :: SL.Coin -> SL.PoolParams c
241+
poolParams :: SL.Coin -> SL.PoolParams
240242
poolParams pledge = SL.PoolParams
241243
{ SL.ppCost = SL.Coin 1
242244
, SL.ppMetadata = SL.SNothing
@@ -247,14 +249,14 @@ migrateUTxO migrationInfo curSlot lcfg lst
247249
, SL.ppRewardAccount =
248250
SL.RewardAccount Shelley.networkId $ Shelley.mkCredential poolSK
249251
, SL.ppRelays = StrictSeq.empty
250-
, SL.ppVrf = Shelley.mkKeyHashVrf vrfSK
252+
, SL.ppVrf = Shelley.mkKeyHashVrf @StandardCrypto vrfSK
251253
}
252254

253255
-----
254256

255257
ejectShelleyNS ::
256258
NS f (CardanoEras c)
257-
-> Maybe (f (ShelleyBlock (TPraos c) (ShelleyEra c)))
259+
-> Maybe (f (ShelleyBlock (TPraos c) ShelleyEra))
258260
ejectShelleyNS = \case
259261
S (Z x) -> Just x
260262
_ -> Nothing
@@ -270,7 +272,7 @@ getUTxOShelley tls =
270272

271273
ejectShelleyTickedLedgerState ::
272274
Ticked (LedgerState (CardanoBlock c))
273-
-> Maybe (Ticked (LedgerState (ShelleyBlock (TPraos c) (ShelleyEra c))))
275+
-> Maybe (Ticked (LedgerState (ShelleyBlock (TPraos c) ShelleyEra)))
274276
ejectShelleyTickedLedgerState ls =
275277
fmap (unComp . currentState) $
276278
ejectShelleyNS $

ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/TxGen/Mary.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Test.ThreadNet.TxGen (TxGen (..))
1212

1313
-- | Dummy generator until CAD-2119 is done, i.e., the transaction generator in
1414
-- the ledger has been generalised over the eras.
15-
instance TxGen (ShelleyBlock (TPraos c) (MaryEra c)) where
15+
instance TxGen (ShelleyBlock (TPraos c) MaryEra) where
1616

1717
type TxGenExtra _ = ()
1818

ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/ThreadNet/Infra/Shelley.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import qualified Test.Cardano.Ledger.Core.KeyPair as TL (KeyPair (..),
9797
mkWitnessesVKey)
9898
import qualified Test.Cardano.Ledger.Shelley.Generator.Core as Gen
9999
import Test.Cardano.Ledger.Shelley.Utils (unsafeBoundRational)
100+
import Test.Consensus.Shelley.MockCrypto (MockCrypto)
100101
import Test.QuickCheck
101102
import Test.Util.Orphans.Arbitrary ()
102103
import Test.Util.Slots (NumSlots (..))
@@ -176,15 +177,14 @@ coreNodeKeys CoreNode{cnGenesisKey, cnDelegateKey, cnStakingKey} =
176177
}
177178

178179
genCoreNode ::
179-
forall c. PraosCrypto c
180-
=> SL.KESPeriod
181-
-> Gen (CoreNode c)
180+
SL.KESPeriod
181+
-> Gen (CoreNode MockCrypto)
182182
genCoreNode startKESPeriod = do
183183
genKey <- genKeyDSIGN <$> genSeed (seedSizeDSIGN (Proxy @LK.DSIGN))
184184
delKey <- genKeyDSIGN <$> genSeed (seedSizeDSIGN (Proxy @LK.DSIGN))
185185
stkKey <- genKeyDSIGN <$> genSeed (seedSizeDSIGN (Proxy @LK.DSIGN))
186-
vrfKey <- genKeyVRF <$> genSeed (seedSizeVRF (Proxy @(VRF c)))
187-
kesKey <- unsoundPureGenKeyKES <$> genSeed (seedSizeKES (Proxy @(KES c)))
186+
vrfKey <- genKeyVRF <$> genSeed (seedSizeVRF (Proxy @(VRF MockCrypto)))
187+
kesKey <- unsoundPureGenKeyKES <$> genSeed (seedSizeKES (Proxy @(KES MockCrypto)))
188188
let kesPub = unsoundPureDeriveVerKeyKES kesKey
189189
sigma = LK.signedDSIGN
190190
delKey

ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/ShelleyAllegra.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,8 @@ import Test.Util.Orphans.Arbitrary ()
6868
import Test.Util.Slots (NumSlots (..))
6969
import Test.Util.TestEnv
7070

71-
-- | No Byron era, so our crypto can be trivial.
72-
type Crypto = MockCrypto ShortHash
73-
7471
type ShelleyAllegraBlock =
75-
ShelleyBasedHardForkBlock (TPraos Crypto) (ShelleyEra Crypto) (TPraos Crypto) (AllegraEra Crypto)
72+
ShelleyBasedHardForkBlock (TPraos MockCrypto) ShelleyEra (TPraos MockCrypto) AllegraEra
7673

7774
-- | The varying data of this test
7875
--
@@ -277,7 +274,7 @@ prop_simple_shelleyAllegra_convergence TestSetup
277274
initialKESPeriod :: SL.KESPeriod
278275
initialKESPeriod = SL.KESPeriod 0
279276

280-
coreNodes :: [Shelley.CoreNode Crypto]
277+
coreNodes :: [Shelley.CoreNode MockCrypto]
281278
coreNodes = runGen initSeed $
282279
replicateM (fromIntegral n) $
283280
Shelley.genCoreNode initialKESPeriod
@@ -288,7 +285,7 @@ prop_simple_shelleyAllegra_convergence TestSetup
288285
maxLovelaceSupply =
289286
fromIntegral (length coreNodes) * Shelley.initialLovelacePerCoreNode
290287

291-
genesisShelley :: ShelleyGenesis Crypto
288+
genesisShelley :: ShelleyGenesis MockCrypto
292289
genesisShelley =
293290
Shelley.mkGenesisConfig
294291
(SL.ProtVer majorVersion1 0)
@@ -297,7 +294,7 @@ prop_simple_shelleyAllegra_convergence TestSetup
297294
setupD
298295
maxLovelaceSupply
299296
setupSlotLength
300-
(Shelley.mkKesConfig (Proxy @Crypto) numSlots)
297+
(Shelley.mkKesConfig (Proxy @MockCrypto) numSlots)
301298
coreNodes
302299

303300
-- the Shelley ledger is designed to use a fixed epoch size, so this test

0 commit comments

Comments
 (0)