1
1
module Ouroboros.Consensus.HardFork.Combinator.Abstract.NoHardForks (
2
- HasEraParams (.. )
2
+ ImmutableEraParams (.. )
3
3
, NoHardForks (.. )
4
- , getEpochInfo
4
+ , immutableEpochInfo
5
5
) where
6
6
7
7
import Cardano.Slotting.EpochInfo
@@ -16,30 +16,40 @@ import Ouroboros.Consensus.Ledger.Abstract
16
16
Blocks that don't /have/ any transitions
17
17
-------------------------------------------------------------------------------}
18
18
19
- class HasEraParams 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
20
31
-- | Extract 'EraParams' from the top-level config
21
32
--
22
33
-- The HFC itself does not care about this, as it must be given the full shape
23
34
-- across /all/ eras.
24
- getEraParams :: TopLevelConfig blk -> EraParams
35
+ immutableEraParams :: TopLevelConfig blk -> EraParams
25
36
26
-
27
- class (SingleEraBlock blk , HasEraParams blk ) => NoHardForks blk where
37
+ class (SingleEraBlock blk , ImmutableEraParams blk ) => NoHardForks blk where
28
38
-- | Construct partial ledger config from full ledger config
29
39
--
30
40
-- See also 'toPartialConsensusConfig'
31
41
toPartialLedgerConfig :: proxy blk
32
42
-> LedgerConfig blk -> PartialLedgerConfig blk
33
43
34
- getEpochInfo ::
35
- (Monad m , HasEraParams blk )
44
+ immutableEpochInfo ::
45
+ (Monad m , ImmutableEraParams blk )
36
46
=> TopLevelConfig blk
37
47
-> EpochInfo m
38
- getEpochInfo cfg =
48
+ immutableEpochInfo cfg =
39
49
hoistEpochInfo (pure . runIdentity)
40
50
$ fixedEpochInfo
41
51
(History. eraEpochSize params)
42
52
(History. eraSlotLength params)
43
53
where
44
54
params :: EraParams
45
- params = getEraParams cfg
55
+ params = immutableEraParams cfg
0 commit comments