@@ -111,6 +111,10 @@ data LeiosConfig = forall p. IsPipeline p => LeiosConfig
111111 , variant :: LeiosVariant
112112 , headerDiffusionTime :: NominalDiffTime
113113 -- ^ Δ_{hdr}.
114+ , leiosLateIbInclusion :: 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+ , leiosLateIbInclusion = 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+ , leiosLateIbInclusion = cfg. leiosLateIbInclusion
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,23 @@ inputBlocksToEndorse cfg@LeiosConfig{pipeline = _ :: SingPipeline p} current buf
680686 , receivedBy
681687 }
682688
689+ -- | Invokes 'inputBlocksToEndorse1' as many times as 'leiosLateIbInclusion' requires
690+ inputBlocksToEndorse ::
691+ LeiosConfig ->
692+ -- | current slot
693+ SlotNo ->
694+ InputBlocksSnapshot ->
695+ [InputBlockId ]
696+ inputBlocksToEndorse cfg current buffer =
697+ concatMap each iterations
698+ where
699+ each sl = inputBlocksToEndorse1 cfg sl buffer
700+ capL = fromIntegral cfg. sliceLength
701+ iterations =
702+ if not cfg. leiosLateIbInclusion then [current] else
703+ -- discard underflows
704+ dropWhile (> current) [ current - 2 * capL, current - capL, current ]
705+
683706-- | Returns possible EBs to reference from current pipeline EB.
684707endorseBlocksToReference ::
685708 LeiosConfig ->
0 commit comments