Skip to content

Commit e192c82

Browse files
committed
fixes
1 parent ecc55ce commit e192c82

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

block/internal/syncing/da_retriever_test.go

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -577,35 +577,38 @@ func TestDARetriever_RetrieveForcedIncludedTxsFromDA_ExceedsMaxBlobSize(t *testi
577577
mockDA := testmocks.NewMockDA(t)
578578

579579
// With DAStartHeight=1000, epoch size=3, daHeight=1000 -> epoch boundaries are [1000, 1002]
580+
// RetrieveWithHelpers calls in order: start (1000), end (1002), then intermediate (1001)
581+
580582
// Check epoch start
581583
mockDA.EXPECT().GetIDs(mock.Anything, uint64(1000), mock.MatchedBy(func(ns []byte) bool {
582584
return bytes.Equal(ns, namespaceForcedInclusionBz)
583585
})).Return(&coreda.GetIDsResult{IDs: [][]byte{[]byte("fi1")}, Timestamp: time.Now()}, nil).Once()
584586

587+
// Fetch epoch start data (height 1000)
588+
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
589+
return bytes.Equal(ns, namespaceForcedInclusionBz)
590+
})).Return([][]byte{dataBin1}, nil).Once()
591+
585592
// Check epoch end
586593
mockDA.EXPECT().GetIDs(mock.Anything, uint64(1002), mock.MatchedBy(func(ns []byte) bool {
587594
return bytes.Equal(ns, namespaceForcedInclusionBz)
588595
})).Return(&coreda.GetIDsResult{IDs: [][]byte{[]byte("fi3")}, Timestamp: time.Now()}, nil).Once()
589596

590-
// Fetch epoch start data
597+
// Fetch epoch end data (height 1002) - should be retrieved but skipped due to size limit
591598
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
592599
return bytes.Equal(ns, namespaceForcedInclusionBz)
593-
})).Return([][]byte{dataBin1}, nil).Once()
600+
})).Return([][]byte{dataBin3}, nil).Once()
594601

595-
// Second height in epoch - should succeed
602+
// Check intermediate height in epoch (height 1001)
596603
mockDA.EXPECT().GetIDs(mock.Anything, uint64(1001), mock.MatchedBy(func(ns []byte) bool {
597604
return bytes.Equal(ns, namespaceForcedInclusionBz)
598605
})).Return(&coreda.GetIDsResult{IDs: [][]byte{[]byte("fi2")}, Timestamp: time.Now()}, nil).Once()
599606

607+
// Fetch intermediate height data (height 1001)
600608
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
601609
return bytes.Equal(ns, namespaceForcedInclusionBz)
602610
})).Return([][]byte{dataBin2}, nil).Once()
603611

604-
// Fetch epoch end data - should be retrieved but skipped due to size limit
605-
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
606-
return bytes.Equal(ns, namespaceForcedInclusionBz)
607-
})).Return([][]byte{dataBin3}, nil).Once()
608-
609612
r := NewDARetriever(mockDA, cm, cfg, gen, zerolog.Nop())
610613

611614
result, err := r.RetrieveForcedIncludedTxsFromDA(context.Background(), 1000)
@@ -741,37 +744,38 @@ func TestDARetriever_RetrieveForcedIncludedTxsFromDA_CompleteEpoch(t *testing.T)
741744
mockDA := testmocks.NewMockDA(t)
742745

743746
// With DAStartHeight=2000, epoch size=3, daHeight=2000 -> epoch boundaries are [2000, 2002]
744-
// All heights available
747+
// RetrieveWithHelpers calls in order: start (2000), end (2002), then intermediate (2001)
745748

746749
// Check epoch start (2000)
747750
mockDA.EXPECT().GetIDs(mock.Anything, uint64(2000), mock.MatchedBy(func(ns []byte) bool {
748751
return bytes.Equal(ns, namespaceForcedInclusionBz)
749752
})).Return(&coreda.GetIDsResult{IDs: [][]byte{[]byte("fi1")}, Timestamp: time.Now()}, nil).Once()
750753

754+
// Fetch epoch start data (height 2000)
755+
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
756+
return bytes.Equal(ns, namespaceForcedInclusionBz)
757+
})).Return([][]byte{dataBin1}, nil).Once()
758+
751759
// Check epoch end (2002)
752760
mockDA.EXPECT().GetIDs(mock.Anything, uint64(2002), mock.MatchedBy(func(ns []byte) bool {
753761
return bytes.Equal(ns, namespaceForcedInclusionBz)
754762
})).Return(&coreda.GetIDsResult{IDs: [][]byte{[]byte("fi3")}, Timestamp: time.Now()}, nil).Once()
755763

756-
// Fetch epoch start data
764+
// Fetch epoch end data (height 2002)
757765
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
758766
return bytes.Equal(ns, namespaceForcedInclusionBz)
759-
})).Return([][]byte{dataBin1}, nil).Once()
767+
})).Return([][]byte{dataBin3}, nil).Once()
760768

761769
// Fetch middle height (2001)
762770
mockDA.EXPECT().GetIDs(mock.Anything, uint64(2001), mock.MatchedBy(func(ns []byte) bool {
763771
return bytes.Equal(ns, namespaceForcedInclusionBz)
764772
})).Return(&coreda.GetIDsResult{IDs: [][]byte{[]byte("fi2")}, Timestamp: time.Now()}, nil).Once()
765773

774+
// Fetch intermediate height data (height 2001)
766775
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
767776
return bytes.Equal(ns, namespaceForcedInclusionBz)
768777
})).Return([][]byte{dataBin2}, nil).Once()
769778

770-
// Fetch epoch end data
771-
mockDA.EXPECT().Get(mock.Anything, mock.Anything, mock.MatchedBy(func(ns []byte) bool {
772-
return bytes.Equal(ns, namespaceForcedInclusionBz)
773-
})).Return([][]byte{dataBin3}, nil).Once()
774-
775779
r := NewDARetriever(mockDA, cm, cfg, gen, zerolog.Nop())
776780

777781
result, err := r.RetrieveForcedIncludedTxsFromDA(context.Background(), 2000)

0 commit comments

Comments
 (0)