Skip to content

Commit

Permalink
Change the timing of initializing global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Mdaiki0730 committed Jan 23, 2025
1 parent 29f0f5b commit e44856e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions tests/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"testing"

"github.com/kaiachain/kaia/blockchain"
"github.com/kaiachain/kaia/blockchain/types"
"github.com/kaiachain/kaia/common"
"github.com/stretchr/testify/suite"
)
Expand Down Expand Up @@ -71,7 +70,6 @@ func (suite *ExecutionSpecBlockTestSuite) TearDownSuite() {
// Reset global variables for test
common.IsPrecompiledContractAddress = suite.originalIsPrecompiledContractAddress
blockchain.CreateContractWithCodeFormatInExecutionSpecTest = false
types.IsPragueInExecutionSpecTest = false
}

func (suite *ExecutionSpecBlockTestSuite) TestExecutionSpecBlock() {
Expand Down
6 changes: 6 additions & 0 deletions tests/block_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func (t *BlockTest) Run() error {
blockchain.ProcessParentBlockHash(header, vmenv, state, chain.Config().Rules(header.Number))
}
}
defer func() {
gxhash.CustomInitialize = nil
}()

gasChanges := map[vm.OpCode]uint64{}
if config.Rules(gblock.Number()).IsCancun {
Expand Down Expand Up @@ -274,6 +277,9 @@ func (t *BlockTest) insertBlocksFromTx(bc *blockchain.BlockChain, gBlock types.B
if bc.Config().IsIstanbulForkEnabled(bc.CurrentHeader().Number) {
types.IsPragueInExecutionSpecTest = true
}
defer func() {
types.IsPragueInExecutionSpecTest = false
}()

// var maxFeePerGas *big.Int
blocks, receiptsList := blockchain.GenerateChain(bc.Config(), preBlock, bc.Engine(), db, 1, func(i int, b *blockchain.BlockGen) {
Expand Down

0 comments on commit e44856e

Please sign in to comment.