core, params: replace time based hardforks in config to block based

This commit is contained in:
Manav Darji 2025-03-26 02:03:28 +05:30
parent 6bb20a79e4
commit aee9a5cc07
No known key found for this signature in database
GPG key ID: A426F0124435F36E
5 changed files with 61 additions and 60 deletions

View file

@ -380,9 +380,9 @@ func TestTimeBasedForkInGenesis(t *testing.T) {
LondonBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0),
ShanghaiTime: &shanghai,
CancunTime: &cancun,
Ethash: new(params.EthashConfig),
// ShanghaiBlock: &shanghai,
// CancunBlock: &cancun,
Ethash: new(params.EthashConfig),
}
}
)

View file

@ -283,10 +283,10 @@ func TestVerkleGenesisCommit(t *testing.T) {
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: nil,
ShanghaiTime: &verkleTime,
CancunTime: &verkleTime,
PragueTime: &verkleTime,
VerkleTime: &verkleTime,
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
PragueBlock: big.NewInt(0),
VerkleBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
Ethash: nil,
Clique: nil,

View file

@ -60,8 +60,8 @@ func TestStateProcessorErrors(t *testing.T) {
LondonBlock: big.NewInt(0),
Ethash: new(params.EthashConfig),
TerminalTotalDifficulty: big.NewInt(0),
ShanghaiTime: new(uint64),
CancunTime: new(uint64),
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
}
signer = types.LatestSigner(config)

View file

@ -54,8 +54,8 @@ var (
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
Ethash: new(params.EthashConfig),
ShanghaiTime: u64(0),
VerkleTime: u64(0),
ShanghaiBlock: big.NewInt(0),
VerkleBlock: big.NewInt(0),
TerminalTotalDifficulty: common.Big0,
// TODO uncomment when proof generation is merged
// ProofInBlocks: true,
@ -74,13 +74,14 @@ var (
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
Ethash: new(params.EthashConfig),
ShanghaiTime: u64(0),
VerkleTime: u64(0),
ShanghaiBlock: big.NewInt(0),
VerkleBlock: big.NewInt(0),
TerminalTotalDifficulty: common.Big0,
}
)
func TestProcessVerkle(t *testing.T) {
t.Skip("verkle trie is not yet supported in bor")
var (
code = common.FromHex(`6060604052600a8060106000396000f360606040526008565b00`)
intrinsicContractCreationGas, _ = IntrinsicGas(code, nil, true, true, true, true)
@ -112,7 +113,7 @@ func TestProcessVerkle(t *testing.T) {
// genesis := gspec.MustCommit(bcdb, triedb)
cacheConfig := DefaultCacheConfigWithScheme(rawdb.PathScheme)
cacheConfig.SnapshotLimit = 0
blockchain, _ := NewBlockChain(bcdb, cacheConfig, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil)
blockchain, _ := NewBlockChain(bcdb, cacheConfig, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil, nil)
defer blockchain.Stop()
txCost1 := params.TxGas

View file

@ -43,6 +43,9 @@ var (
var (
MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0)
// Note: for "eth" based chains, all hardforks post merge are removed as they're timebased while
// our configs are block based.
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = &ChainConfig{
ChainID: big.NewInt(1),
@ -62,8 +65,6 @@ var (
ArrowGlacierBlock: big.NewInt(13_773_000),
GrayGlacierBlock: big.NewInt(15_050_000),
TerminalTotalDifficulty: MainnetTerminalTotalDifficulty, // 58_750_000_000_000_000_000_000
ShanghaiTime: newUint64(1681338455),
CancunTime: newUint64(1710338135),
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cbb839cbe05303d7705fa"),
Ethash: new(EthashConfig),
}
@ -87,8 +88,6 @@ var (
GrayGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(0),
MergeNetsplitBlock: nil,
ShanghaiTime: newUint64(1696000704),
CancunTime: newUint64(1707305664),
Ethash: new(EthashConfig),
}
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
@ -111,29 +110,26 @@ var (
GrayGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(17_000_000_000_000_000),
MergeNetsplitBlock: big.NewInt(1735371),
ShanghaiTime: newUint64(1677557088),
CancunTime: newUint64(1706655072),
Ethash: new(EthashConfig),
}
// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
GoerliChainConfig = &ChainConfig{
ChainID: big.NewInt(5),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(1_561_651),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(4_460_644),
LondonBlock: big.NewInt(5_062_605),
ArrowGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(10_790_000),
TerminalTotalDifficultyPassed: true,
ChainID: big.NewInt(5),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(1_561_651),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(4_460_644),
LondonBlock: big.NewInt(5_062_605),
ArrowGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(10_790_000),
Clique: &CliqueConfig{
Period: 15,
Epoch: 30000,
@ -175,6 +171,8 @@ var (
"0": "0x00000000000000000000000000000000000000000",
},
},
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
}
BorUnittestChainConfig = &ChainConfig{
ChainID: big.NewInt(80003),
@ -210,6 +208,8 @@ var (
"0": "0x00000000000000000000000000000000000000000",
},
},
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
}
// MumbaiChainConfig contains the chain parameters to run a node on the Mumbai test network.
@ -462,10 +462,10 @@ var (
GrayGlacierBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
ShanghaiBlock: nil,
CancunBlock: nil,
PragueBlock: nil,
VerkleBlock: nil,
Ethash: new(EthashConfig),
Clique: nil,
Bor: &BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
@ -486,10 +486,10 @@ var (
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
PragueTime: newUint64(0),
PragueBlock: big.NewInt(0),
Bor: &BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
}
@ -513,10 +513,10 @@ var (
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
ShanghaiBlock: nil,
CancunBlock: nil,
PragueBlock: nil,
VerkleBlock: nil,
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
Ethash: nil,
Clique: &CliqueConfig{Period: 0, Epoch: 30000},
@ -543,10 +543,10 @@ var (
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
ShanghaiBlock: nil,
CancunBlock: nil,
PragueBlock: nil,
VerkleBlock: nil,
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
Ethash: new(EthashConfig),
Clique: nil,
@ -576,10 +576,10 @@ var (
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
PragueTime: newUint64(0),
VerkleTime: nil,
ShanghaiBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
PragueBlock: big.NewInt(0),
VerkleBlock: nil,
TerminalTotalDifficulty: big.NewInt(0),
Ethash: new(EthashConfig),
Clique: nil,
@ -609,10 +609,10 @@ var (
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
ShanghaiBlock: nil,
CancunBlock: nil,
PragueBlock: nil,
VerkleBlock: nil,
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
Ethash: new(EthashConfig),
Clique: nil,