@@ -31,6 +31,7 @@ import (
31
31
"github.com/iotexproject/iotex-core/action/protocol/account"
32
32
accountutil "github.com/iotexproject/iotex-core/action/protocol/account/util"
33
33
"github.com/iotexproject/iotex-core/action/protocol/execution/evm"
34
+ "github.com/iotexproject/iotex-core/action/protocol/rewarding"
34
35
"github.com/iotexproject/iotex-core/action/protocol/rolldpos"
35
36
"github.com/iotexproject/iotex-core/blockchain"
36
37
"github.com/iotexproject/iotex-core/blockchain/genesis"
@@ -258,22 +259,25 @@ func (sct *SmartContractTest) prepareBlockchain(
258
259
cfg .Chain .EnableAsyncIndexWrite = false
259
260
cfg .Genesis .EnableGravityChainVoting = false
260
261
registry := protocol.Registry {}
261
- acc := account .NewProtocol ()
262
- registry .Register (account .ProtocolID , acc )
262
+ acc := account .NewProtocol (0 )
263
+ r . NoError ( registry .Register (account .ProtocolID , acc ) )
263
264
rp := rolldpos .NewProtocol (cfg .Genesis .NumCandidateDelegates , cfg .Genesis .NumDelegates , cfg .Genesis .NumSubEpochs )
264
- registry .Register (rolldpos .ProtocolID , rp )
265
+ r . NoError ( registry .Register (rolldpos .ProtocolID , rp ) )
265
266
bc := blockchain .NewBlockchain (
266
267
cfg ,
267
268
blockchain .InMemDaoOption (),
268
269
blockchain .InMemStateFactoryOption (),
269
270
blockchain .RegistryOption (& registry ),
270
271
)
272
+ reward := rewarding .NewProtocol (bc , rp )
273
+ r .NoError (registry .Register (rewarding .ProtocolID , reward ))
274
+
271
275
r .NotNil (bc )
272
276
bc .Validator ().AddActionEnvelopeValidators (protocol .NewGenericValidator (bc , genesis .Default .ActionGasLimit ))
273
- bc .Validator ().AddActionValidators (account .NewProtocol (), NewProtocol (bc ) )
277
+ bc .Validator ().AddActionValidators (account .NewProtocol (0 ), NewProtocol (bc , 0 ), reward )
274
278
sf := bc .GetFactory ()
275
279
r .NotNil (sf )
276
- sf .AddActionHandlers (NewProtocol (bc ) )
280
+ sf .AddActionHandlers (NewProtocol (bc , 0 ), reward )
277
281
r .NoError (bc .Start (ctx ))
278
282
ws , err := sf .NewWorkingSet ()
279
283
r .NoError (err )
@@ -408,21 +412,21 @@ func TestProtocol_Handle(t *testing.T) {
408
412
cfg .Chain .EnableAsyncIndexWrite = false
409
413
cfg .Genesis .EnableGravityChainVoting = false
410
414
registry := protocol.Registry {}
411
- acc := account .NewProtocol ()
412
- registry .Register (account .ProtocolID , acc )
415
+ acc := account .NewProtocol (0 )
416
+ require . NoError ( registry .Register (account .ProtocolID , acc ) )
413
417
rp := rolldpos .NewProtocol (cfg .Genesis .NumCandidateDelegates , cfg .Genesis .NumDelegates , cfg .Genesis .NumSubEpochs )
414
- registry .Register (rolldpos .ProtocolID , rp )
418
+ require . NoError ( registry .Register (rolldpos .ProtocolID , rp ) )
415
419
bc := blockchain .NewBlockchain (
416
420
cfg ,
417
421
blockchain .DefaultStateFactoryOption (),
418
422
blockchain .BoltDBDaoOption (),
419
423
blockchain .RegistryOption (& registry ),
420
424
)
421
425
bc .Validator ().AddActionEnvelopeValidators (protocol .NewGenericValidator (bc , genesis .Default .ActionGasLimit ))
422
- bc .Validator ().AddActionValidators (account .NewProtocol (), NewProtocol (bc ))
426
+ bc .Validator ().AddActionValidators (account .NewProtocol (0 ), NewProtocol (bc , 0 ))
423
427
sf := bc .GetFactory ()
424
428
require .NotNil (sf )
425
- sf .AddActionHandlers (NewProtocol (bc ))
429
+ sf .AddActionHandlers (NewProtocol (bc , 0 ))
426
430
427
431
require .NoError (bc .Start (ctx ))
428
432
require .NotNil (bc )
@@ -691,7 +695,7 @@ func TestProtocol_Validate(t *testing.T) {
691
695
defer ctrl .Finish ()
692
696
693
697
mbc := mock_blockchain .NewMockBlockchain (ctrl )
694
- protocol := NewProtocol (mbc )
698
+ protocol := NewProtocol (mbc , 0 )
695
699
// Case I: Oversized data
696
700
tmpPayload := [32769 ]byte {}
697
701
data := tmpPayload [:]
0 commit comments