Skip to content

Commit 05d9d4e

Browse files
committed
WIP
1 parent 44e4b20 commit 05d9d4e

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/Serialisation.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import Ouroboros.Consensus.HardFork.History.EpochInfo
3434
import Ouroboros.Consensus.HardFork.Simple
3535
import Ouroboros.Consensus.HeaderValidation
3636
import Ouroboros.Consensus.Ledger.Query
37+
import Ouroboros.Consensus.Ledger.SupportsProtocol
3738
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTxId)
3839
import Ouroboros.Consensus.Ledger.Tables (EmptyMK)
3940
import Ouroboros.Consensus.Node.Run
@@ -294,7 +295,7 @@ instance ShelleyBasedEra era => SerialiseNodeToClient (ShelleyBlock proto era) (
294295
encodeNodeToClient _ _ = toEraCBOR @era
295296
decodeNodeToClient _ _ = fromEraCBOR @era
296297

297-
instance ShelleyCompatible proto era
298+
instance (ShelleyCompatible proto era, LedgerSupportsProtocol (ShelleyBlock proto era))
298299
=> SerialiseNodeToClient (ShelleyBlock proto era) (SomeBlockQuery (BlockQuery (ShelleyBlock proto era))) where
299300
encodeNodeToClient _ version (SomeBlockQuery q)
300301
| blockQueryIsSupportedOnVersion q version

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
{-# LANGUAGE OverloadedStrings #-}
1010
{-# LANGUAGE RecordWildCards #-}
1111
{-# LANGUAGE ScopedTypeVariables #-}
12+
{-# LANGUAGE StandaloneDeriving #-}
1213
{-# LANGUAGE TypeApplications #-}
1314
{-# LANGUAGE TypeFamilies #-}
1415
{-# LANGUAGE TypeOperators #-}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{-# LANGUAGE RecordWildCards #-}
88
{-# LANGUAGE ScopedTypeVariables #-}
99
{-# LANGUAGE TypeApplications #-}
10+
{-# LANGUAGE TypeOperators #-}
1011

1112
{-# OPTIONS_GHC -Wno-orphans #-}
1213
#if __GLASGOW_HASKELL__ >= 908

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ instance (Arbitrary (InstantStake era), CanMock proto era)
204204
<*> arbitrary
205205
<*> pure (LedgerTables EmptyMK)
206206

207-
instance CanMock proto era
207+
instance (Arbitrary (InstantStake era), CanMock proto era)
208208
=> Arbitrary (LedgerState (ShelleyBlock proto era) ValuesMK) where
209209
arbitrary = ShelleyLedgerState
210210
<$> arbitrary

ouroboros-consensus-cardano/test/cardano-test/Test/Consensus/Cardano/Translation.hs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import Test.Consensus.Byron.Generators (genByronLedgerConfig,
6767
genByronLedgerState)
6868
import Test.Consensus.Cardano.MockCrypto (MockCryptoCompatByron)
6969
import Test.Consensus.Shelley.Generators ()
70-
import Test.Consensus.Shelley.MockCrypto
7170
import Test.QuickCheck
7271
import Test.Tasty
7372
import Test.Tasty.QuickCheck
@@ -325,44 +324,41 @@ instance Arbitrary (TestSetup (ShelleyBlock Proto ShelleyEra)
325324
(ShelleyBlock Proto AllegraEra)) where
326325
arbitrary = TestSetup (fixedShelleyLedgerConfig emptyFromByronTranslationContext)
327326
(fixedShelleyLedgerConfig Genesis.NoGenesis)
328-
<$> genShelleyLedgerState
327+
<$> arbitrary
329328
<*> (EpochNo <$> arbitrary)
330329

331330
instance Arbitrary (TestSetup (ShelleyBlock Proto AllegraEra)
332331
(ShelleyBlock Proto MaryEra)) where
333332
arbitrary = TestSetup (fixedShelleyLedgerConfig Genesis.NoGenesis)
334333
(fixedShelleyLedgerConfig Genesis.NoGenesis)
335-
<$> genShelleyLedgerState
334+
<$> arbitrary
336335
<*> (EpochNo <$> arbitrary)
337336

338337
instance Arbitrary (TestSetup (ShelleyBlock Proto MaryEra)
339338
(ShelleyBlock Proto AlonzoEra)) where
340339
arbitrary = TestSetup (fixedShelleyLedgerConfig Genesis.NoGenesis)
341340
<$> (fixedShelleyLedgerConfig <$> arbitrary)
342-
<*> genShelleyLedgerState
341+
<*> arbitrary
343342
<*> (EpochNo <$> arbitrary)
344343

345344
instance Arbitrary (TestSetup (ShelleyBlock (TPraos Crypto) AlonzoEra)
346345
(ShelleyBlock (Praos Crypto) BabbageEra)) where
347346
arbitrary = TestSetup <$> (fixedShelleyLedgerConfig <$> arbitrary)
348347
<*> (pure $ fixedShelleyLedgerConfig Genesis.NoGenesis)
349-
<*> genShelleyLedgerState
348+
<*> arbitrary
350349
<*> (EpochNo <$> arbitrary)
351350

352351
instance Arbitrary (TestSetup (ShelleyBlock (Praos Crypto) BabbageEra)
353352
(ShelleyBlock (Praos Crypto) ConwayEra)) where
354353
arbitrary = TestSetup <$> (pure $ fixedShelleyLedgerConfig Genesis.NoGenesis)
355354
<*> (fixedShelleyLedgerConfig <$> arbitrary)
356-
<*> genShelleyLedgerState
355+
<*> arbitrary
357356
<*> (EpochNo <$> arbitrary)
358357

359358
{-------------------------------------------------------------------------------
360359
Generators
361360
-------------------------------------------------------------------------------}
362361

363-
genShelleyLedgerState :: CanMock proto era => Gen (LedgerState (ShelleyBlock proto era) EmptyMK)
364-
genShelleyLedgerState = arbitrary
365-
366362
-- | A fixed ledger config should be sufficient as the updating of the ledger
367363
-- tables on era transitions does not depend on the configurations of any of
368364
-- the ledgers involved.

ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToClient.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ type ClientCodecs blk m =
179179
defaultCodecs :: forall m blk.
180180
( MonadST m
181181
, SerialiseNodeToClientConstraints blk
182-
, forall fp. ShowQuery (BlockQuery blk fp)
182+
, BlockSupportsLedgerQuery blk
183+
, Show (BlockNodeToClientVersion blk)
183184
, StandardHash blk
184185
, Serialise (HeaderHash blk)
185186
)
@@ -240,7 +241,8 @@ defaultCodecs ccfg version networkVersion = Codecs {
240241
clientCodecs :: forall m blk.
241242
( MonadST m
242243
, SerialiseNodeToClientConstraints blk
243-
, forall fp. ShowQuery (BlockQuery blk fp)
244+
, BlockSupportsLedgerQuery blk
245+
, Show (BlockNodeToClientVersion blk)
244246
, StandardHash blk
245247
, Serialise (HeaderHash blk)
246248
)

0 commit comments

Comments
 (0)