Skip to content

Commit

Permalink
enable hf in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
temaniarpit27 committed Oct 16, 2023
1 parent c311f3b commit 109a0a1
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4672,6 +4672,9 @@ func TestEIP3651(t *testing.T) {
gspec.Config.TerminalTotalDifficulty = common.Big0
gspec.Config.TerminalTotalDifficultyPassed = true
gspec.Config.ShanghaiBlock = common.Big0
gspec.Config.CancunBlock = common.Big0
gspec.Config.PragueBlock = common.Big0
gspec.Config.VerkleBlock = common.Big0
signer := types.LatestSigner(gspec.Config)

_, blocks, _ := GenerateChainWithGenesis(gspec, engine, 1, func(i int, b *BlockGen) {
Expand Down
3 changes: 3 additions & 0 deletions core/chain_makers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func TestGenerateWithdrawalChain(t *testing.T) {
config.TerminalTotalDifficultyPassed = true
config.TerminalTotalDifficulty = common.Big0
config.ShanghaiBlock = common.Big0
gspec.Config.CancunBlock = common.Big0
gspec.Config.PragueBlock = common.Big0
gspec.Config.VerkleBlock = common.Big0

// init 0xaa with some storage elements
storage := make(map[common.Hash]common.Hash)
Expand Down
3 changes: 3 additions & 0 deletions core/forkid/forkid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func TestValidation(t *testing.T) {
// Config that has not timestamp enabled
legacyConfig := *params.MainnetChainConfig
legacyConfig.ShanghaiBlock = nil
legacyConfig.CancunBlock = nil
legacyConfig.PragueBlock = nil
legacyConfig.VerkleBlock = nil

tests := []struct {
config *params.ChainConfig
Expand Down
2 changes: 2 additions & 0 deletions core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func TestStateProcessorErrors(t *testing.T) {
TerminalTotalDifficultyPassed: true,
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
PragueBlock: big.NewInt(0),
VerkleBlock: big.NewInt(0),
Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
}
signer = types.LatestSigner(config)
Expand Down
5 changes: 5 additions & 0 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1416,5 +1416,10 @@ func overrideConfig(original *params.ChainConfig, override *params.ChainConfig)
canon = false
}

if timestamp := override.VerkleBlock; timestamp != nil {
chainConfigCopy.VerkleBlock = timestamp
canon = false
}

return chainConfigCopy, canon
}
21 changes: 21 additions & 0 deletions params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func TestConfigRules(t *testing.T) {
c := &ChainConfig{
LondonBlock: new(big.Int),
ShanghaiBlock: big.NewInt(10),
CancunBlock: big.NewInt(20),
PragueBlock: big.NewInt(30),
VerkleBlock: big.NewInt(40),
}

block := new(big.Int)
Expand All @@ -129,6 +132,24 @@ func TestConfigRules(t *testing.T) {
t.Errorf("expected %v to be shanghai", 0)
}

block.SetInt64(20)

if r := c.Rules(block, true, 0); !r.IsCancun {
t.Errorf("expected %v to be cancun", 0)
}

block.SetInt64(30)

if r := c.Rules(block, true, 0); !r.IsPrague {
t.Errorf("expected %v to be prague", 0)
}

block.SetInt64(40)

if r := c.Rules(block, true, 0); !r.IsVerkle {
t.Errorf("expected %v to be verkle", 0)
}

block = block.SetInt64(math.MaxInt64)

if r := c.Rules(block, true, 0); !r.IsShanghai {
Expand Down

0 comments on commit 109a0a1

Please sign in to comment.