@@ -1833,7 +1833,7 @@ func Test_checkShardHeadersValidityAndFinalityProposal(t *testing.T) {
18331833 dataPoolMock .SetProofsPool (proofsPool )
18341834
18351835 marshaller := & marshal.GogoProtoMarshalizer {}
1836- storage := & storageStubs.ChainStorerStub {
1836+ st := & storageStubs.ChainStorerStub {
18371837 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
18381838 return & storageStubs.StorerStub {
18391839 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -1859,7 +1859,7 @@ func Test_checkShardHeadersValidityAndFinalityProposal(t *testing.T) {
18591859 },
18601860 "dataPool" : dataPoolMock ,
18611861 "proofsPool" : proofsPool ,
1862- "store" : storage ,
1862+ "store" : st ,
18631863 })
18641864 require .Nil (t , err )
18651865
@@ -1893,7 +1893,7 @@ func Test_checkShardHeadersValidityAndFinalityProposal(t *testing.T) {
18931893 dataPoolMock .SetProofsPool (proofsPool )
18941894
18951895 marshaller := & marshal.GogoProtoMarshalizer {}
1896- storage := & storageStubs.ChainStorerStub {
1896+ st := & storageStubs.ChainStorerStub {
18971897 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
18981898 return & storageStubs.StorerStub {
18991899 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -1929,7 +1929,7 @@ func Test_checkShardHeadersValidityAndFinalityProposal(t *testing.T) {
19291929 },
19301930 },
19311931 "proofsPool" : proofsPool ,
1932- "store" : storage ,
1932+ "store" : st ,
19331933 })
19341934 require .Nil (t , err )
19351935
@@ -3041,7 +3041,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
30413041 dataPoolMock .SetHeadersPool (headersPoolMock )
30423042
30433043 marshaller := & marshal.GogoProtoMarshalizer {}
3044- storage := & storageStubs.ChainStorerStub {
3044+ st := & storageStubs.ChainStorerStub {
30453045 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
30463046 return & storageStubs.StorerStub {
30473047 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3062,7 +3062,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
30623062 },
30633063 },
30643064 "marshalizer" : & marshal.GogoProtoMarshalizer {},
3065- "store" : storage ,
3065+ "store" : st ,
30663066 "epochStartTrigger" : & testscommon.EpochStartTriggerStub {
30673067 EpochCalled : func () uint32 {
30683068 return 1
@@ -3101,7 +3101,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
31013101 dataPoolMock .SetHeadersPool (headersPoolMock )
31023102
31033103 marshaller := & marshal.GogoProtoMarshalizer {}
3104- storage := & storageStubs.ChainStorerStub {
3104+ st := & storageStubs.ChainStorerStub {
31053105 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
31063106 return & storageStubs.StorerStub {
31073107 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3123,7 +3123,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
31233123 return 1
31243124 }},
31253125 "marshalizer" : marshaller ,
3126- "store" : storage ,
3126+ "store" : st ,
31273127 })
31283128 require .Nil (t , err )
31293129
@@ -3164,7 +3164,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
31643164 dataPoolMock .SetHeadersPool (headersPoolMock )
31653165
31663166 marshaller := & marshal.GogoProtoMarshalizer {}
3167- storage := & storageStubs.ChainStorerStub {
3167+ st := & storageStubs.ChainStorerStub {
31683168 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
31693169 return & storageStubs.StorerStub {
31703170 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3188,7 +3188,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
31883188 return 1
31893189 }},
31903190 "marshalizer" : marshaller ,
3191- "store" : storage ,
3191+ "store" : st ,
31923192 })
31933193 require .Nil (t , err )
31943194
@@ -3227,7 +3227,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
32273227 dataPoolMock .SetHeadersPool (headersPoolMock )
32283228
32293229 marshaller := & marshal.GogoProtoMarshalizer {}
3230- storage := & storageStubs.ChainStorerStub {
3230+ st := & storageStubs.ChainStorerStub {
32313231 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
32323232 return & storageStubs.StorerStub {
32333233 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3250,7 +3250,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
32503250 "epochStartTrigger" : & testscommon.EpochStartTriggerStub {EpochCalled : func () uint32 {
32513251 return 1
32523252 }},
3253- "store" : storage ,
3253+ "store" : st ,
32543254 "marshalizer" : marshaller ,
32553255 })
32563256 require .Nil (t , err )
@@ -3293,7 +3293,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
32933293 dataPoolMock .SetHeadersPool (headersPoolMock )
32943294
32953295 marshaller := & marshal.GogoProtoMarshalizer {}
3296- storage := & storageStubs.ChainStorerStub {
3296+ st := & storageStubs.ChainStorerStub {
32973297 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
32983298 return & storageStubs.StorerStub {
32993299 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3317,7 +3317,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
33173317 return 1
33183318 }},
33193319 "marshalizer" : & marshal.GogoProtoMarshalizer {},
3320- "store" : storage ,
3320+ "store" : st ,
33213321 })
33223322 require .Nil (t , err )
33233323 mp .SetEpochStartData (& blproc.EpochStartDataWrapper {
@@ -3363,7 +3363,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
33633363 dataPoolMock .SetHeadersPool (headersPoolMock )
33643364
33653365 marshaller := & marshal.GogoProtoMarshalizer {}
3366- storage := & storageStubs.ChainStorerStub {
3366+ st := & storageStubs.ChainStorerStub {
33673367 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
33683368 return & storageStubs.StorerStub {
33693369 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3386,7 +3386,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
33863386 "epochStartTrigger" : & testscommon.EpochStartTriggerStub {EpochCalled : func () uint32 {
33873387 return 1
33883388 }},
3389- "store" : storage ,
3389+ "store" : st ,
33903390 "marshalizer" : & marshal.GogoProtoMarshalizer {},
33913391 })
33923392 mp .SetEpochStartData (& blproc.EpochStartDataWrapper {
@@ -3428,7 +3428,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
34283428 dataPoolMock .SetHeadersPool (headersPoolMock )
34293429
34303430 marshaller := & marshal.GogoProtoMarshalizer {}
3431- storage := & storageStubs.ChainStorerStub {
3431+ st := & storageStubs.ChainStorerStub {
34323432 GetStorerCalled : func (unitType dataRetriever.UnitType ) (storage.Storer , error ) {
34333433 return & storageStubs.StorerStub {
34343434 GetCalled : func (key []byte ) ([]byte , error ) {
@@ -3452,7 +3452,7 @@ func TestMetaProcessor_checkEpochCorrectnessV3(t *testing.T) {
34523452 "epochStartTrigger" : & testscommon.EpochStartTriggerStub {EpochCalled : func () uint32 {
34533453 return 1
34543454 }},
3455- "store" : storage ,
3455+ "store" : st ,
34563456 })
34573457 mp .SetEpochStartData (& blproc.EpochStartDataWrapper {
34583458 Epoch : 2 ,
@@ -3595,6 +3595,33 @@ func TestMetaProcessor_checkHeadersSequenceCorrectness(t *testing.T) {
35953595 require .Equal (t , expectedErr , err )
35963596 })
35973597
3598+ t .Run ("should return error for quarantined header" , func (t * testing.T ) {
3599+ t .Parallel ()
3600+
3601+ quarantinedHash := []byte ("quarantined hash" )
3602+ mp , err := blproc .ConstructPartialMetaBlockProcessorForTest (map [string ]interface {}{
3603+ "headerValidator" : & processMocks.HeaderValidatorMock {
3604+ IsHeaderConstructionValidCalled : func (currHdr , prevHdr data.HeaderHandler ) error {
3605+ return nil
3606+ },
3607+ },
3608+ "blockTracker" : & integrationTestsMock.BlockTrackerStub {
3609+ IsHeaderQuarantinedCalled : func (hash []byte ) bool {
3610+ return bytes .Equal (hash , quarantinedHash )
3611+ },
3612+ },
3613+ })
3614+ require .Nil (t , err )
3615+
3616+ err = mp .CheckHeadersSequenceCorrectness ([]blproc.ShardHeaderInfo {
3617+ {
3618+ Header : & block.Header {Nonce : 2 },
3619+ Hash : quarantinedHash ,
3620+ },
3621+ }, blproc.ShardHeaderInfo {})
3622+ require .ErrorContains (t , err , "included quarantined header" )
3623+ })
3624+
35983625 t .Run ("should work" , func (t * testing.T ) {
35993626 t .Parallel ()
36003627
0 commit comments