@@ -110,7 +110,7 @@ type (
110110)
111111
112112var (
113- fixedTime = time .Unix (genesis .Default .Timestamp , 0 )
113+ fixedTime = time .Unix (genesis .TestDefault () .Timestamp , 0 )
114114)
115115
116116func (eb * ExpectedBalance ) Balance () * big.Int {
@@ -546,7 +546,9 @@ func (sct *SmartContractTest) deployContracts(
546546func (sct * SmartContractTest ) run (r * require.Assertions ) {
547547 // prepare blockchain
548548 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 )
550552 cfg .Chain .ProducerPrivKey = identityset .PrivateKey (28 ).HexString ()
551553 cfg .Chain .EnableTrielessStateDB = false
552554 bc , sf , dao , ap := sct .prepareBlockchain (ctx , cfg , r )
@@ -639,6 +641,7 @@ func TestProtocol_Validate(t *testing.T) {
639641 p := execution .NewProtocol (func (uint64 ) (hash.Hash256 , error ) {
640642 return hash .ZeroHash256 , nil
641643 }, rewarding .DepositGas , getBlockTimeForTest )
644+ g := genesis .TestDefault ()
642645
643646 cases := []struct {
644647 name string
@@ -648,16 +651,16 @@ func TestProtocol_Validate(t *testing.T) {
648651 }{
649652 {"limit 32KB" , 0 , 32683 , nil },
650653 {"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 },
653656 }
654657
655658 builder := action.EnvelopeBuilder {}
656659 for i := range cases {
657660 t .Run (cases [i ].name , func (t * testing.T ) {
658661 ex := action .NewExecution ("2" , big .NewInt (0 ), make ([]byte , cases [i ].size ))
659662 elp := builder .SetNonce (1 ).SetAction (ex ).Build ()
660- ctx := genesis .WithGenesisContext (context .Background (), config . Default . Genesis )
663+ ctx := genesis .WithGenesisContext (context .Background (), g )
661664 ctx = protocol .WithBlockCtx (ctx , protocol.BlockCtx {
662665 BlockHeight : cases [i ].height ,
663666 })
@@ -696,6 +699,7 @@ func TestProtocol_Handle(t *testing.T) {
696699 cfg .Chain .EnableAsyncIndexWrite = false
697700 cfg .Genesis .EnableGravityChainVoting = false
698701 cfg .ActPool .MinGasPriceStr = "0"
702+ cfg .Genesis = genesis .TestDefault ()
699703 cfg .Genesis .InitBalanceMap [identityset .Address (27 ).String ()] = unit .ConvertIotxToRau (1000000000 ).String ()
700704 ctx := genesis .WithGenesisContext (context .Background (), cfg .Genesis )
701705
@@ -1357,6 +1361,7 @@ func benchmarkHotContractWithFactory(b *testing.B, async bool) {
13571361 r := require .New (b )
13581362 ctx := context .Background ()
13591363 cfg := config .Default
1364+ cfg .Genesis = genesis .TestDefault ()
13601365 cfg .Genesis .NumSubEpochs = uint64 (b .N )
13611366 cfg .Chain .EnableTrielessStateDB = false
13621367 if async {
@@ -1435,6 +1440,7 @@ func benchmarkHotContractWithStateDB(b *testing.B, cachedStateDBOption bool) {
14351440 r := require .New (b )
14361441 ctx := context .Background ()
14371442 cfg := config .Default
1443+ cfg .Genesis = genesis .TestDefault ()
14381444 cfg .Genesis .NumSubEpochs = uint64 (b .N )
14391445 if cachedStateDBOption {
14401446 cfg .Chain .EnableStateDBCaching = true
0 commit comments