-
Notifications
You must be signed in to change notification settings - Fork 20
/
ModChainSel.hs
44 lines (36 loc) · 1.51 KB
/
ModChainSel.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
module Ouroboros.Consensus.Protocol.ModChainSel (
ModChainSel
-- * Type family instances
, ConsensusConfig (..)
) where
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)
import Ouroboros.Consensus.Protocol.Abstract
data ModChainSel p s
newtype instance ConsensusConfig (ModChainSel p s) = McsConsensusConfig {
mcsConfigP :: ConsensusConfig p
}
deriving (Generic)
instance ( ConsensusProtocol p
, ChainOrder s
, Show s
, Typeable s
, NoThunks s
) => ConsensusProtocol (ModChainSel p s) where
type SelectView (ModChainSel p s) = s
type ChainDepState (ModChainSel p s) = ChainDepState p
type IsLeader (ModChainSel p s) = IsLeader p
type CanBeLeader (ModChainSel p s) = CanBeLeader p
type LedgerView (ModChainSel p s) = LedgerView p
type ValidationErr (ModChainSel p s) = ValidationErr p
type ValidateView (ModChainSel p s) = ValidateView p
checkIsLeader = checkIsLeader . mcsConfigP
tickChainDepState = tickChainDepState . mcsConfigP
updateChainDepState = updateChainDepState . mcsConfigP
reupdateChainDepState = reupdateChainDepState . mcsConfigP
protocolSecurityParam = protocolSecurityParam . mcsConfigP
instance ConsensusProtocol p => NoThunks (ConsensusConfig (ModChainSel p s))