@@ -110,7 +110,7 @@ type (
110
110
)
111
111
112
112
var (
113
- fixedTime = time .Unix (genesis .Default .Timestamp , 0 )
113
+ fixedTime = time .Unix (genesis .TestDefault () .Timestamp , 0 )
114
114
)
115
115
116
116
func (eb * ExpectedBalance ) Balance () * big.Int {
@@ -546,7 +546,9 @@ func (sct *SmartContractTest) deployContracts(
546
546
func (sct * SmartContractTest ) run (r * require.Assertions ) {
547
547
// prepare blockchain
548
548
ctx := context .Background ()
549
- cfg := deepcopy .Copy (config .Default ).(config.Config )
549
+ defaultCfg := config .Default
550
+ defaultCfg .Genesis = genesis .TestDefault ()
551
+ cfg := deepcopy .Copy (defaultCfg ).(config.Config )
550
552
cfg .Chain .ProducerPrivKey = identityset .PrivateKey (28 ).HexString ()
551
553
cfg .Chain .EnableTrielessStateDB = false
552
554
bc , sf , dao , ap := sct .prepareBlockchain (ctx , cfg , r )
@@ -639,6 +641,7 @@ func TestProtocol_Validate(t *testing.T) {
639
641
p := execution .NewProtocol (func (uint64 ) (hash.Hash256 , error ) {
640
642
return hash .ZeroHash256 , nil
641
643
}, rewarding .DepositGas , getBlockTimeForTest )
644
+ g := genesis .TestDefault ()
642
645
643
646
cases := []struct {
644
647
name string
@@ -648,16 +651,16 @@ func TestProtocol_Validate(t *testing.T) {
648
651
}{
649
652
{"limit 32KB" , 0 , 32683 , nil },
650
653
{"exceed 32KB" , 0 , 32684 , action .ErrOversizedData },
651
- {"limit 48KB" , genesis . Default .SumatraBlockHeight , uint64 (48 * 1024 ), nil },
652
- {"exceed 48KB" , genesis . Default .SumatraBlockHeight , uint64 (48 * 1024 ) + 1 , action .ErrOversizedData },
654
+ {"limit 48KB" , g .SumatraBlockHeight , uint64 (48 * 1024 ), nil },
655
+ {"exceed 48KB" , g .SumatraBlockHeight , uint64 (48 * 1024 ) + 1 , action .ErrOversizedData },
653
656
}
654
657
655
658
builder := action.EnvelopeBuilder {}
656
659
for i := range cases {
657
660
t .Run (cases [i ].name , func (t * testing.T ) {
658
661
ex := action .NewExecution ("2" , big .NewInt (0 ), make ([]byte , cases [i ].size ))
659
662
elp := builder .SetNonce (1 ).SetAction (ex ).Build ()
660
- ctx := genesis .WithGenesisContext (context .Background (), config . Default . Genesis )
663
+ ctx := genesis .WithGenesisContext (context .Background (), g )
661
664
ctx = protocol .WithBlockCtx (ctx , protocol.BlockCtx {
662
665
BlockHeight : cases [i ].height ,
663
666
})
@@ -696,6 +699,7 @@ func TestProtocol_Handle(t *testing.T) {
696
699
cfg .Chain .EnableAsyncIndexWrite = false
697
700
cfg .Genesis .EnableGravityChainVoting = false
698
701
cfg .ActPool .MinGasPriceStr = "0"
702
+ cfg .Genesis = genesis .TestDefault ()
699
703
cfg .Genesis .InitBalanceMap [identityset .Address (27 ).String ()] = unit .ConvertIotxToRau (1000000000 ).String ()
700
704
ctx := genesis .WithGenesisContext (context .Background (), cfg .Genesis )
701
705
@@ -1357,6 +1361,7 @@ func benchmarkHotContractWithFactory(b *testing.B, async bool) {
1357
1361
r := require .New (b )
1358
1362
ctx := context .Background ()
1359
1363
cfg := config .Default
1364
+ cfg .Genesis = genesis .TestDefault ()
1360
1365
cfg .Genesis .NumSubEpochs = uint64 (b .N )
1361
1366
cfg .Chain .EnableTrielessStateDB = false
1362
1367
if async {
@@ -1435,6 +1440,7 @@ func benchmarkHotContractWithStateDB(b *testing.B, cachedStateDBOption bool) {
1435
1440
r := require .New (b )
1436
1441
ctx := context .Background ()
1437
1442
cfg := config .Default
1443
+ cfg .Genesis = genesis .TestDefault ()
1438
1444
cfg .Genesis .NumSubEpochs = uint64 (b .N )
1439
1445
if cachedStateDBOption {
1440
1446
cfg .Chain .EnableStateDBCaching = true
0 commit comments