@@ -111,6 +111,10 @@ data LeiosConfig = forall p. IsPipeline p => LeiosConfig
111111 , variant :: LeiosVariant
112112 , headerDiffusionTime :: NominalDiffTime
113113 -- ^ Δ_{hdr}.
114+ , lateIbInclusion :: Bool
115+ -- ^ Whether an EB also includes IBs from the two previous iterations.
116+ --
117+ -- TODO Merely one previous iteration if 'pipeline' is 'SingleVote'?
114118 , pipelinesToReferenceFromEB :: Int
115119 -- ^ how many older pipelines to reference from an EB when `variant = Full`.
116120 , votingFrequencyPerStage :: Double
@@ -147,6 +151,7 @@ convertConfig disk =
147151 , cleanupPolicies = disk. cleanupPolicies
148152 , variant = disk. leiosVariant
149153 , headerDiffusionTime = realToFrac $ durationMsToDiffTime disk. leiosHeaderDiffusionTimeMs
154+ , lateIbInclusion = disk. leiosLateIbInclusion
150155 , pipelinesToReferenceFromEB =
151156 if disk. leiosVariant == Full
152157 then
@@ -285,6 +290,7 @@ delaysAndSizesAsFull cfg@LeiosConfig{pipeline, voteSendStage} =
285290 , cleanupPolicies = cfg. cleanupPolicies
286291 , variant = cfg. variant
287292 , headerDiffusionTime = cfg. headerDiffusionTime
293+ , lateIbInclusion = cfg. lateIbInclusion
288294 , pipelinesToReferenceFromEB = cfg. pipelinesToReferenceFromEB
289295 , activeVotingStageLength = cfg. activeVotingStageLength
290296 , votingFrequencyPerStage = cfg. votingFrequencyPerStage
@@ -664,13 +670,13 @@ data InputBlocksQuery = InputBlocksQuery
664670 -- ^ This is checked against time the body is downloaded, before validation.
665671 }
666672
667- inputBlocksToEndorse ::
673+ inputBlocksToEndorse1 ::
668674 LeiosConfig ->
669675 -- | current slot
670676 SlotNo ->
671677 InputBlocksSnapshot ->
672678 [InputBlockId ]
673- inputBlocksToEndorse cfg@ LeiosConfig {pipeline = _ :: SingPipeline p } current buffer = fromMaybe [] $ do
679+ inputBlocksToEndorse1 cfg@ LeiosConfig {pipeline = _ :: SingPipeline p } current buffer = fromMaybe [] $ do
674680 generatedBetween <- stageRange @ p cfg Endorse current Propose
675681 receivedBy <- stageEnd @ p cfg Endorse current Deliver2
676682 pure $
@@ -680,6 +686,26 @@ inputBlocksToEndorse cfg@LeiosConfig{pipeline = _ :: SingPipeline p} current buf
680686 , receivedBy
681687 }
682688
689+ -- | Invokes 'inputBlocksToEndorse1' as many times as 'lateIbInclusion'
690+ -- requires
691+ inputBlocksToEndorse ::
692+ LeiosConfig ->
693+ -- | current slot
694+ SlotNo ->
695+ InputBlocksSnapshot ->
696+ [InputBlockId ]
697+ inputBlocksToEndorse cfg current buffer =
698+ concatMap each iterations
699+ where
700+ each sl = inputBlocksToEndorse1 cfg sl buffer
701+ capL = fromIntegral cfg. sliceLength
702+ iterations =
703+ if not cfg. lateIbInclusion
704+ then [current]
705+ else
706+ -- discard underflows
707+ dropWhile (> current) [current - 2 * capL, current - capL, current]
708+
683709-- | Returns possible EBs to reference from current pipeline EB.
684710endorseBlocksToReference ::
685711 LeiosConfig ->
0 commit comments