1
1
module Ouroboros.Consensus.HardFork.Combinator.Abstract.NoHardForks (
2
- NoHardForks (.. )
3
- , noHardForksEpochInfo
2
+ ImmutableEraParams (.. )
3
+ , NoHardForks (.. )
4
+ , immutableEpochInfo
4
5
) where
5
6
6
7
import Cardano.Slotting.EpochInfo
@@ -15,28 +16,39 @@ import Ouroboros.Consensus.Ledger.Abstract
15
16
Blocks that don't /have/ any transitions
16
17
-------------------------------------------------------------------------------}
17
18
18
- class SingleEraBlock blk => NoHardForks blk where
19
+ -- | A block type for which the 'EraParams' will /never/ change
20
+ --
21
+ -- Technically, some application of
22
+ -- 'Ouroboros.Consensus.HardFork.Combinator.Basics.HardForkBlock' could have an
23
+ -- instance for this. But that would only be appropriate if two conditions were
24
+ -- met.
25
+ --
26
+ -- * all the eras in that block have the same 'EraParams'
27
+ --
28
+ -- * all eras that will /ever/ be added to that block in the future will also
29
+ -- have those same 'EraParams'
30
+ class ImmutableEraParams blk where
19
31
-- | Extract 'EraParams' from the top-level config
20
32
--
21
33
-- The HFC itself does not care about this, as it must be given the full shape
22
34
-- across /all/ eras.
23
- getEraParams :: TopLevelConfig blk -> EraParams
24
-
35
+ immutableEraParams :: TopLevelConfig blk -> EraParams
25
36
37
+ class (SingleEraBlock blk , ImmutableEraParams blk ) => NoHardForks blk where
26
38
-- | Construct partial ledger config from full ledger config
27
39
--
28
40
-- See also 'toPartialConsensusConfig'
29
41
toPartialLedgerConfig :: proxy blk
30
42
-> LedgerConfig blk -> PartialLedgerConfig blk
31
43
32
- noHardForksEpochInfo :: (Monad m , NoHardForks blk )
33
- => TopLevelConfig blk
34
- -> EpochInfo m
35
- noHardForksEpochInfo cfg =
44
+ immutableEpochInfo :: (Monad m , ImmutableEraParams blk )
45
+ => TopLevelConfig blk
46
+ -> EpochInfo m
47
+ immutableEpochInfo cfg =
36
48
hoistEpochInfo (pure . runIdentity)
37
49
$ fixedEpochInfo
38
50
(History. eraEpochSize params)
39
51
(History. eraSlotLength params)
40
52
where
41
53
params :: EraParams
42
- params = getEraParams cfg
54
+ params = immutableEraParams cfg
0 commit comments