@@ -291,8 +291,8 @@ func TestSealingSegment(t *testing.T) {
291291 // build a valid child B3 to ensure we have a QC
292292 buildBlock (t , state , unittest .BlockWithParentFixture (block3 .Header ))
293293
294- // sealing segment should contain B1 and B2
295- // B2 is reference of snapshot, B1 is latest sealed
294+ // sealing segment should contain B1, B2, B3
295+ // B3 is reference of snapshot, B1 is latest sealed
296296 unittest .AssertEqualBlocksLenAndOrder (t , []* flow.Block {block1 , block2 , block3 }, segment .Blocks )
297297 assert .Len (t , segment .ExecutionResults , 1 )
298298 assertSealingSegmentBlocksQueryableAfterBootstrap (t , state .AtBlockID (block3 .ID ()))
@@ -316,7 +316,11 @@ func TestSealingSegment(t *testing.T) {
316316 // build a large chain of intermediary blocks
317317 for i := 0 ; i < 100 ; i ++ {
318318 next := unittest .BlockWithParentFixture (parent .Header )
319- next .SetPayload (unittest .PayloadFixture (unittest .WithReceipts (receipt1 )))
319+ if i == 0 {
320+ // Repetitions of the same receipt in one fork would be a protocol violation.
321+ // Hence, we include the result only once in the direct child of B1.
322+ next .SetPayload (unittest .PayloadFixture (unittest .WithReceipts (receipt1 )))
323+ }
320324 buildFinalizedBlock (t , state , next )
321325 parent = next
322326 }
@@ -833,17 +837,17 @@ func TestLatestSealedResult(t *testing.T) {
833837 err = state .ExtendCertified (context .Background (), block4 , block5 .Header .QuorumCertificate ())
834838 require .NoError (t , err )
835839
836- // B1 <- B2(S1) <- B3(S1)
840+ // B1 <- B2(S1) <- B3(S1) <- B4(R2,R3)
837841 // querying B3 should still return (R1,S1) even though they are in parent block
838842 t .Run ("reference block contains no seal" , func (t * testing.T ) {
839- gotResult , gotSeal , err := state .AtBlockID (block3 .ID ()).SealedResult ()
843+ gotResult , gotSeal , err := state .AtBlockID (block4 .ID ()).SealedResult ()
840844 require .NoError (t , err )
841845 assert .Equal (t , & receipt1 .ExecutionResult , gotResult )
842846 assert .Equal (t , seal1 , gotSeal )
843847 })
844848
845849 // B1 <- B2(R1) <- B3(S1) <- B4(R2,R3) <- B5(S2,S3)
846- // There are two seals in B4 - should return latest by height (S3,R3)
850+ // There are two seals in B5 - should return latest by height (S3,R3)
847851 t .Run ("reference block contains multiple seals" , func (t * testing.T ) {
848852 err = state .ExtendCertified (context .Background (), block5 , unittest .CertifyBlock (block5 .Header ))
849853 require .NoError (t , err )
0 commit comments