params: schedule shanghai fork on sepolia (#26662)

* params: schedule shanghai fork on sepolia

* params: u64 -> newUint64
This commit is contained in:
Marius van der Wijden 2023-02-10 12:34:45 +01:00 committed by GitHub
parent 0ea65d4020
commit 241cf62b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View File

@ -122,9 +122,11 @@ func TestCreation(t *testing.T) {
params.SepoliaChainConfig, params.SepoliaChainConfig,
params.SepoliaGenesisHash, params.SepoliaGenesisHash,
[]testcase{ []testcase{
{0, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople, Petersburg, Istanbul, Berlin and first London block {0, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople, Petersburg, Istanbul, Berlin and first London block
{1735370, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Last London block {1735370, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Last London block
{1735371, 0, ID{Hash: checksumToBytes(0xb96cbd13), Next: 0}}, // First MergeNetsplit block {1735371, 0, ID{Hash: checksumToBytes(0xb96cbd13), Next: 1677557088}}, // First MergeNetsplit block
{1735372, 1677557087, ID{Hash: checksumToBytes(0xb96cbd13), Next: 1677557088}}, // Last MergeNetsplit block
{1735372, 1677557088, ID{Hash: checksumToBytes(0xf7f9bc08), Next: 0}}, // First Shanghai block
}, },
}, },
// Temporary timestamped test cases // Temporary timestamped test cases

View File

@ -50,6 +50,8 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{
GoerliGenesisHash: GoerliCheckpointOracle, GoerliGenesisHash: GoerliCheckpointOracle,
} }
func newUint64(val uint64) *uint64 { return &val }
var ( var (
MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0) MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0)
@ -117,6 +119,7 @@ var (
TerminalTotalDifficulty: big.NewInt(17_000_000_000_000_000), TerminalTotalDifficulty: big.NewInt(17_000_000_000_000_000),
TerminalTotalDifficultyPassed: true, TerminalTotalDifficultyPassed: true,
MergeNetsplitBlock: big.NewInt(1735371), MergeNetsplitBlock: big.NewInt(1735371),
ShanghaiTime: newUint64(1677557088),
Ethash: new(EthashConfig), Ethash: new(EthashConfig),
} }

View File

@ -25,8 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/common/math"
) )
func u64(val uint64) *uint64 { return &val }
func TestCheckCompatible(t *testing.T) { func TestCheckCompatible(t *testing.T) {
type test struct { type test struct {
stored, new *ChainConfig stored, new *ChainConfig
@ -95,19 +93,19 @@ func TestCheckCompatible(t *testing.T) {
}, },
}, },
{ {
stored: &ChainConfig{ShanghaiTime: u64(10)}, stored: &ChainConfig{ShanghaiTime: newUint64(10)},
new: &ChainConfig{ShanghaiTime: u64(20)}, new: &ChainConfig{ShanghaiTime: newUint64(20)},
headTimestamp: 9, headTimestamp: 9,
wantErr: nil, wantErr: nil,
}, },
{ {
stored: &ChainConfig{ShanghaiTime: u64(10)}, stored: &ChainConfig{ShanghaiTime: newUint64(10)},
new: &ChainConfig{ShanghaiTime: u64(20)}, new: &ChainConfig{ShanghaiTime: newUint64(20)},
headTimestamp: 25, headTimestamp: 25,
wantErr: &ConfigCompatError{ wantErr: &ConfigCompatError{
What: "Shanghai fork timestamp", What: "Shanghai fork timestamp",
StoredTime: u64(10), StoredTime: newUint64(10),
NewTime: u64(20), NewTime: newUint64(20),
RewindToTime: 9, RewindToTime: 9,
}, },
}, },
@ -123,7 +121,7 @@ func TestCheckCompatible(t *testing.T) {
func TestConfigRules(t *testing.T) { func TestConfigRules(t *testing.T) {
c := &ChainConfig{ c := &ChainConfig{
ShanghaiTime: u64(500), ShanghaiTime: newUint64(500),
} }
var stamp uint64 var stamp uint64
if r := c.Rules(big.NewInt(0), true, stamp); r.IsShanghai { if r := c.Rules(big.NewInt(0), true, stamp); r.IsShanghai {