66 "testing"
77
88 "github.com/ElrondNetwork/elrond-go-core/core/check"
9+ "github.com/ElrondNetwork/elrond-go-core/data/block"
910 "github.com/ElrondNetwork/elrond-go/config"
10- "github.com/ElrondNetwork/elrond-go/testscommon/epochNotifier "
11+ "github.com/ElrondNetwork/elrond-go/testscommon/epochstartmock "
1112 "github.com/stretchr/testify/require"
1213)
1314
@@ -16,7 +17,7 @@ func TestNewChainParametersHolder(t *testing.T) {
1617
1718 getDummyArgs := func () ArgsChainParametersHolder {
1819 return ArgsChainParametersHolder {
19- EpochNotifier : & epochNotifier. EpochNotifierStub {},
20+ EpochStartEventNotifier : & epochstartmock. EpochStartNotifierStub {},
2021 ChainParameters : []config.ChainParametersByEpochConfig {
2122 {
2223 EnableEpoch : 0 ,
@@ -32,15 +33,15 @@ func TestNewChainParametersHolder(t *testing.T) {
3233 }
3334 }
3435
35- t .Run ("nil epoch notifier" , func (t * testing.T ) {
36+ t .Run ("nil epoch start event notifier" , func (t * testing.T ) {
3637 t .Parallel ()
3738
3839 args := getDummyArgs ()
39- args .EpochNotifier = nil
40+ args .EpochStartEventNotifier = nil
4041
4142 paramsHolder , err := NewChainParametersHolder (args )
4243 require .True (t , check .IfNil (paramsHolder ))
43- require .Equal (t , ErrNilEpochNotifier , err )
44+ require .Equal (t , ErrNilEpochStartEventNotifier , err )
4445 })
4546
4647 t .Run ("empty chain parameters" , func (t * testing.T ) {
@@ -165,8 +166,8 @@ func TestChainParametersHolder_ChainParametersForEpoch(t *testing.T) {
165166 }
166167
167168 paramsHolder , _ := NewChainParametersHolder (ArgsChainParametersHolder {
168- ChainParameters : params ,
169- EpochNotifier : & epochNotifier. EpochNotifierStub {},
169+ ChainParameters : params ,
170+ EpochStartEventNotifier : & epochstartmock. EpochStartNotifierStub {},
170171 })
171172
172173 res , _ := paramsHolder .ChainParametersForEpoch (0 )
@@ -210,8 +211,8 @@ func TestChainParametersHolder_ChainParametersForEpoch(t *testing.T) {
210211 }
211212
212213 paramsHolder , _ := NewChainParametersHolder (ArgsChainParametersHolder {
213- ChainParameters : params ,
214- EpochNotifier : & epochNotifier. EpochNotifierStub {},
214+ ChainParameters : params ,
215+ EpochStartEventNotifier : & epochstartmock. EpochStartNotifierStub {},
215216 })
216217
217218 for i := 0 ; i < 200 ; i ++ {
@@ -251,20 +252,20 @@ func TestChainParametersHolder_CurrentChainParameters(t *testing.T) {
251252 }
252253
253254 paramsHolder , _ := NewChainParametersHolder (ArgsChainParametersHolder {
254- ChainParameters : params ,
255- EpochNotifier : & epochNotifier. EpochNotifierStub {},
255+ ChainParameters : params ,
256+ EpochStartEventNotifier : & epochstartmock. EpochStartNotifierStub {},
256257 })
257258
258- paramsHolder .EpochConfirmed ( 0 , 0 )
259+ paramsHolder .EpochStartAction ( & block. MetaBlock { Epoch : 0 } )
259260 require .Equal (t , uint32 (5 ), paramsHolder .CurrentChainParameters ().ShardConsensusGroupSize )
260261
261- paramsHolder .EpochConfirmed ( 3 , 0 )
262+ paramsHolder .EpochStartAction ( & block. MetaBlock { Epoch : 3 } )
262263 require .Equal (t , uint32 (5 ), paramsHolder .CurrentChainParameters ().ShardConsensusGroupSize )
263264
264- paramsHolder .EpochConfirmed ( 10 , 0 )
265+ paramsHolder .EpochStartAction ( & block. MetaBlock { Epoch : 10 } )
265266 require .Equal (t , uint32 (50 ), paramsHolder .CurrentChainParameters ().ShardConsensusGroupSize )
266267
267- paramsHolder .EpochConfirmed ( 999 , 0 )
268+ paramsHolder .EpochStartAction ( & block. MetaBlock { Epoch : 999 } )
268269 require .Equal (t , uint32 (50 ), paramsHolder .CurrentChainParameters ().ShardConsensusGroupSize )
269270}
270271
@@ -289,8 +290,8 @@ func TestChainParametersHolder_AllChainParameters(t *testing.T) {
289290 }
290291
291292 paramsHolder , _ := NewChainParametersHolder (ArgsChainParametersHolder {
292- ChainParameters : params ,
293- EpochNotifier : & epochNotifier. EpochNotifierStub {},
293+ ChainParameters : params ,
294+ EpochStartEventNotifier : & epochstartmock. EpochStartNotifierStub {},
294295 })
295296
296297 returnedAllChainsParameters := paramsHolder .AllChainParameters ()
@@ -314,8 +315,8 @@ func TestChainParametersHolder_ConcurrentOperations(t *testing.T) {
314315 }
315316
316317 paramsHolder , _ := NewChainParametersHolder (ArgsChainParametersHolder {
317- ChainParameters : chainParams ,
318- EpochNotifier : & epochNotifier. EpochNotifierStub {},
318+ ChainParameters : chainParams ,
319+ EpochStartEventNotifier : & epochstartmock. EpochStartNotifierStub {},
319320 })
320321
321322 numOperations := 500
@@ -325,7 +326,7 @@ func TestChainParametersHolder_ConcurrentOperations(t *testing.T) {
325326 go func (idx int ) {
326327 switch idx {
327328 case 0 :
328- paramsHolder .EpochConfirmed ( uint32 (idx ), 0 )
329+ paramsHolder .EpochStartAction ( & block. MetaBlock { Epoch : uint32 (idx )} )
329330 case 1 :
330331 _ = paramsHolder .CurrentChainParameters ()
331332 case 2 :
0 commit comments