@@ -532,19 +532,32 @@ splitIntoSubSlots (NetworkRate r)
532
532
replicate q fq
533
533
534
534
inputBlockRate :: LeiosConfig -> StakeFraction -> SlotNo -> Maybe (Double -> Word64 )
535
- inputBlockRate cfg@ LeiosConfig {inputBlockFrequencyPerSlot, pipeline = _ :: SingPipeline p } stake = \ slot ->
536
- assert (isStage @ p cfg Propose slot) $ Just f
535
+ inputBlockRate cfg@ LeiosConfig {inputBlockFrequencyPerSlot, pipeline = _ :: SingPipeline p } stake
536
+ | inputBlockFrequencyPerSlot > 1 =
537
+ case sortition stake networkRate of
538
+ Sortition f -> checkSlot f
539
+ | otherwise =
540
+ case nodeRate stake networkRate of
541
+ NodeRate r -> checkSlot (\ p -> if p <= r then 1 else 0 )
537
542
where
538
- ! (Sortition f) = sortition stake $ NetworkRate inputBlockFrequencyPerSlot
543
+ networkRate = NetworkRate inputBlockFrequencyPerSlot
544
+ checkSlot g slot = assert (isStage @ p cfg Propose slot) $ Just g
539
545
540
546
endorseBlockRate :: LeiosConfig -> StakeFraction -> SlotNo -> Maybe (Double -> Word64 )
541
- endorseBlockRate cfg@ LeiosConfig {pipeline = _ :: SingPipeline p } stake = \ slot -> do
542
- guard $ isStage @ p cfg Endorse slot
543
- startEndorse <- stageStart @ p cfg Endorse slot Endorse
544
- guard $ startEndorse == slot
545
- return $ min 1 . f
547
+ endorseBlockRate cfg@ LeiosConfig {pipeline = _ :: SingPipeline p } stake
548
+ | cfg. endorseBlockFrequencyPerStage > 1 =
549
+ case sortition stake networkRate of
550
+ Sortition f -> checkSlot f
551
+ | otherwise =
552
+ case nodeRate stake networkRate of
553
+ NodeRate r -> checkSlot (\ p -> if p <= r then 1 else 0 )
546
554
where
547
- ! (Sortition f) = sortition stake $ NetworkRate cfg. endorseBlockFrequencyPerStage
555
+ networkRate = NetworkRate cfg. endorseBlockFrequencyPerStage
556
+ checkSlot f = \ slot -> do
557
+ guard $ isStage @ p cfg Endorse slot
558
+ startEndorse <- stageStart @ p cfg Endorse slot Endorse
559
+ guard $ startEndorse == slot
560
+ return $ min 1 . f
548
561
549
562
votingRanges :: LeiosConfig -> [(SlotNo , SlotNo )]
550
563
votingRanges cfg@ LeiosConfig {voteSendStage} = go 0
0 commit comments