@@ -539,14 +539,18 @@ mkInputBlock _cfg header bodySize = assert (messageSizeBytes ib >= segmentSize)
539539mkEndorseBlock ::
540540 LeiosConfig -> EndorseBlockId -> SlotNo -> NodeId -> [EndorseBlockId ] -> [InputBlockId ] -> EndorseBlock
541541mkEndorseBlock cfg@ LeiosConfig {pipeline = _ :: SingPipeline p } id slot producer endorseBlocksEarlierPipeline inputBlocks =
542- assert (cfg. variant == Full || null endorseBlocksEarlierPipeline) $
542+ assert
543+ ( (cfg. variant == Full && length endorseBlocksEarlierPipeline <= cfg. pipelinesToReferenceFromEB)
544+ || null endorseBlocksEarlierPipeline
545+ )
546+ $
543547 -- Endorse blocks are produced at the beginning of the stage.
544- assert (stageStart @ p cfg Endorse slot Endorse == Just slot) $
545- rnf endorseBlocksEarlierPipeline `seq`
546- rnf inputBlocks `seq`
547- fixSize
548- cfg
549- EndorseBlock {endorseBlocksEarlierStage = [] , size = 0 , .. }
548+ assert (stageStart @ p cfg Endorse slot Endorse == Just slot)
549+ $ rnf endorseBlocksEarlierPipeline
550+ `seq` rnf inputBlocks
551+ `seq` fixSize
552+ cfg
553+ EndorseBlock {endorseBlocksEarlierStage = [] , size = 0 , .. }
550554
551555mockEndorseBlock :: LeiosConfig -> Int -> EndorseBlock
552556mockEndorseBlock cfg n =
@@ -648,8 +652,7 @@ newtype InputBlocksSnapshot = InputBlocksSnapshot
648652
649653data EndorseBlocksSnapshot = EndorseBlocksSnapshot
650654 { validEndorseBlocks :: (SlotNo , SlotNo ) -> [EndorseBlock ]
651- , -- , endorseBlocksInChain :: (SlotNo, SlotNo) -> [EndorseBlock]
652- certifiedEndorseBlocks :: (PipelineNo , PipelineNo ) -> [(PipelineNo , [(EndorseBlock , Certificate , UTCTime )])]
655+ , certifiedEndorseBlocks :: (PipelineNo , PipelineNo ) -> [(PipelineNo , [(EndorseBlock , Certificate , UTCTime )])]
653656 }
654657
655658-- | Both constraints are inclusive.
@@ -684,11 +687,18 @@ endorseBlocksToReference ::
684687 [(PipelineNo , [EndorseBlock ])]
685688endorseBlocksToReference LeiosConfig {variant = Short } _ _ _ = []
686689endorseBlocksToReference cfg@ LeiosConfig {variant = Full } pl EndorseBlocksSnapshot {.. } checkDeliveryTime =
687- [ (p, [eb | (eb, _, _) <- es])
688- | plRange <- maybeToList $ pipelinesToReferenceFromEB cfg. pipelinesToReferenceFromEB pl
689- , (p, es) <- certifiedEndorseBlocks plRange
690- , or [checkDeliveryTime p t | (_, _, t) <- es]
691- ]
690+ assert
691+ ( all (\ (p, ebs) -> all (\ eb -> p == endorseBlockPipeline cfg eb) ebs && succ (succ p) <= pl) result
692+ && (\ ps -> sort ps == ps) (map fst result)
693+ )
694+ result
695+ where
696+ result =
697+ [ (p, [eb | (eb, _, _) <- es])
698+ | plRange <- maybeToList $ pipelinesToReferenceFromEB cfg. pipelinesToReferenceFromEB pl
699+ , (p, es) <- certifiedEndorseBlocks plRange
700+ , or [checkDeliveryTime p t | (_, _, t) <- es]
701+ ]
692702
693703pipelinesToReferenceFromEB :: Int -> PipelineNo -> Maybe (PipelineNo , PipelineNo )
694704pipelinesToReferenceFromEB n pl = do
0 commit comments