@@ -131,34 +131,34 @@ Next, we instantiate the `ConsensusProtocol` for `SP`:
131
131
132
132
> instance ConsensusProtocol SP where
133
133
> type SelectView SP = BlockNo
134
-
134
+ >
135
135
> type LedgerView SP = ()
136
-
136
+ >
137
137
> type IsLeader SP = SP_IsLeader
138
138
> type CanBeLeader SP = SP_CanBeLeader
139
-
139
+ >
140
140
> type ChainDepState SP = ()
141
141
> type ValidateView SP = ()
142
142
> type ValidationErr SP = Void
143
-
143
+ >
144
144
> checkIsLeader cfg SP_CanBeLeader slot _tcds =
145
145
> if slot `Set.member` cfgsp_slotsLedByMe cfg
146
146
> then Just SP_IsLeader
147
147
> else Nothing
148
-
148
+ >
149
149
> protocolSecurityParam _cfg = k
150
-
150
+ >
151
151
> tickChainDepState _ _ _ _ = TickedTrivial
152
-
152
+ >
153
153
> updateChainDepState _ _ _ _ = return ()
154
-
154
+ >
155
155
> reupdateChainDepState _ _ _ _ = ()
156
156
157
157
Finally we define a few extra things used in this instantiation:
158
158
159
159
> data SP_CanBeLeader = SP_CanBeLeader -- Evidence that we /can/ be a leader
160
160
> data SP_IsLeader = SP_IsLeader -- Evidence that we /are/ leader
161
-
161
+ >
162
162
> k :: SecurityParam
163
163
> k = SecurityParam { maxRollbacks = 1 }
164
164
@@ -535,7 +535,7 @@ number, we materialize that number in the `LedgerState`. We'll also need to
535
535
keep track of some information about the most recent block we have seen.
536
536
537
537
> data instance LedgerState BlockC =
538
-
538
+ >
539
539
> LedgerC
540
540
> -- the hash and slot number of the most recent block
541
541
> { lsbc_tip :: Point BlockC
@@ -570,7 +570,7 @@ types for a ledger. Though we are here using
570
570
> instance IsLedger (LedgerState BlockC ) where
571
571
> type instance LedgerErr (LedgerState BlockC ) = Void
572
572
> type instance AuxLedgerEvent (LedgerState BlockC ) = Void
573
-
573
+ >
574
574
> applyChainTickLedgerResult _cfg _slot ldgrSt =
575
575
> LedgerResult { lrEvents = []
576
576
> , lrResult = TickedLedgerStateC ldgrSt
@@ -625,7 +625,7 @@ the `ApplyBlock` typeclass:
625
625
> pure $ LedgerResult { lrEvents = []
626
626
> , lrResult = block `applyBlockTo` tickedLdgrSt
627
627
> }
628
-
628
+ >
629
629
> reapplyBlockLedgerResult _ldgrCfg block tickedLdgrSt =
630
630
> LedgerResult { lrEvents = []
631
631
> , lrResult = block `applyBlockTo` tickedLdgrSt
0 commit comments