@@ -99,6 +99,8 @@ data LeiosConfig = forall p. IsPipeline p => LeiosConfig
99
99
-- ^ expected EndorseBlock generation rate per stage, at most one per _node_ in each (pipeline, stage).
100
100
, activeVotingStageLength :: Int
101
101
-- ^ prefix of the voting stage where new votes are generated, <= sliceLength.
102
+ , maxEndorseBlockAgeSlots :: Int
103
+ -- ^ maximum age of a certified endorsement block before it expires
102
104
, votingFrequencyPerStage :: Double
103
105
, voteSendStage :: Stage p
104
106
, votesForCertificate :: Int
@@ -127,6 +129,7 @@ convertConfig disk =
127
129
, sliceLength = fromIntegral disk. leiosStageLengthSlots
128
130
, inputBlockFrequencyPerSlot = disk. ibGenerationProbability
129
131
, endorseBlockFrequencyPerStage = disk. ebGenerationProbability
132
+ , maxEndorseBlockAgeSlots = fromIntegral disk. ebMaxAgeSlots
130
133
, activeVotingStageLength = fromIntegral disk. leiosStageActiveVotingSlots
131
134
, votingFrequencyPerStage = disk. voteGenerationProbability
132
135
, votesForCertificate = fromIntegral disk. voteThreshold
@@ -253,6 +256,7 @@ delaysAndSizesAsFull cfg@LeiosConfig{pipeline, voteSendStage} =
253
256
, sliceLength = cfg. sliceLength
254
257
, inputBlockFrequencyPerSlot = cfg. inputBlockFrequencyPerSlot
255
258
, endorseBlockFrequencyPerStage = cfg. endorseBlockFrequencyPerStage
259
+ , maxEndorseBlockAgeSlots = cfg. maxEndorseBlockAgeSlots
256
260
, activeVotingStageLength = cfg. activeVotingStageLength
257
261
, votingFrequencyPerStage = cfg. votingFrequencyPerStage
258
262
, voteSendStage = voteSendStage
@@ -355,9 +359,13 @@ instance FixSize body => FixSize (Block body) where
355
359
data Pipeline = SingleVote | SplitVote
356
360
357
361
data Stage :: Pipeline -> Type where
358
- Propose , Deliver1 , Deliver2 , Endorse :: Stage a
362
+ Propose :: Stage a
363
+ Deliver1 :: Stage a
364
+ Deliver2 :: Stage a
365
+ Endorse :: Stage a
359
366
Vote :: Stage SingleVote
360
- VoteSend , VoteRecv :: Stage SplitVote
367
+ VoteSend :: Stage SplitVote
368
+ VoteRecv :: Stage SplitVote
361
369
362
370
deriving instance Eq (Stage a )
363
371
deriving instance Ord (Stage a )
@@ -439,6 +447,24 @@ pipelineOf cfg stage sl =
439
447
forEachPipeline :: (forall p . Stage p ) -> (forall p . IsPipeline p => Stage p -> a ) -> [a ]
440
448
forEachPipeline s k = [k @ SingleVote s, k @ SplitVote s]
441
449
450
+ lastVoteSend :: LeiosConfig -> PipelineNo -> SlotNo
451
+ lastVoteSend leios@ LeiosConfig {pipeline} pipelineNo = case pipeline of
452
+ SingSingleVote -> snd (stageRangeOf leios pipelineNo Vote )
453
+ SingSplitVote -> snd (stageRangeOf leios pipelineNo VoteSend )
454
+
455
+ lastVoteRecv :: LeiosConfig -> PipelineNo -> SlotNo
456
+ lastVoteRecv leios@ LeiosConfig {pipeline} pipelineNo = case pipeline of
457
+ SingSingleVote -> snd (stageRangeOf leios pipelineNo Vote )
458
+ SingSplitVote -> snd (stageRangeOf leios pipelineNo VoteRecv )
459
+
460
+ endorseRange :: LeiosConfig -> PipelineNo -> (SlotNo , SlotNo )
461
+ endorseRange cfg@ LeiosConfig {pipeline = (_ :: SingPipeline p )} p =
462
+ stageRangeOf @ p cfg p Endorse
463
+
464
+ lastUnadoptedEB :: LeiosConfig -> PipelineNo -> SlotNo
465
+ lastUnadoptedEB leios@ LeiosConfig {pipeline = (_ :: SingPipeline p ), maxEndorseBlockAgeSlots} pipelineNo =
466
+ lastVoteRecv leios pipelineNo + toEnum maxEndorseBlockAgeSlots
467
+
442
468
----------------------------------------------------------------------------------------------
443
469
---- Smart constructors
444
470
----------------------------------------------------------------------------------------------
0 commit comments