From 241cf62b5c8b70b1a4206587fa42606ad5de024a Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 10 Feb 2023 12:34:45 +0100 Subject: [PATCH] params: schedule shanghai fork on sepolia (#26662) * params: schedule shanghai fork on sepolia * params: u64 -> newUint64 --- core/forkid/forkid_test.go | 8 +++++--- params/config.go | 3 +++ params/config_test.go | 16 +++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/forkid/forkid_test.go b/core/forkid/forkid_test.go index e0bd1dd389..08a1da706d 100644 --- a/core/forkid/forkid_test.go +++ b/core/forkid/forkid_test.go @@ -122,9 +122,11 @@ func TestCreation(t *testing.T) { params.SepoliaChainConfig, params.SepoliaGenesisHash, []testcase{ - {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 - {1735371, 0, ID{Hash: checksumToBytes(0xb96cbd13), Next: 0}}, // First MergeNetsplit 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 + {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 diff --git a/params/config.go b/params/config.go index 5d217ef70e..701a7269f9 100644 --- a/params/config.go +++ b/params/config.go @@ -50,6 +50,8 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{ GoerliGenesisHash: GoerliCheckpointOracle, } +func newUint64(val uint64) *uint64 { return &val } + var ( 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), TerminalTotalDifficultyPassed: true, MergeNetsplitBlock: big.NewInt(1735371), + ShanghaiTime: newUint64(1677557088), Ethash: new(EthashConfig), } diff --git a/params/config_test.go b/params/config_test.go index f3911f433f..5634569e29 100644 --- a/params/config_test.go +++ b/params/config_test.go @@ -25,8 +25,6 @@ import ( "github.com/ethereum/go-ethereum/common/math" ) -func u64(val uint64) *uint64 { return &val } - func TestCheckCompatible(t *testing.T) { type test struct { stored, new *ChainConfig @@ -95,19 +93,19 @@ func TestCheckCompatible(t *testing.T) { }, }, { - stored: &ChainConfig{ShanghaiTime: u64(10)}, - new: &ChainConfig{ShanghaiTime: u64(20)}, + stored: &ChainConfig{ShanghaiTime: newUint64(10)}, + new: &ChainConfig{ShanghaiTime: newUint64(20)}, headTimestamp: 9, wantErr: nil, }, { - stored: &ChainConfig{ShanghaiTime: u64(10)}, - new: &ChainConfig{ShanghaiTime: u64(20)}, + stored: &ChainConfig{ShanghaiTime: newUint64(10)}, + new: &ChainConfig{ShanghaiTime: newUint64(20)}, headTimestamp: 25, wantErr: &ConfigCompatError{ What: "Shanghai fork timestamp", - StoredTime: u64(10), - NewTime: u64(20), + StoredTime: newUint64(10), + NewTime: newUint64(20), RewindToTime: 9, }, }, @@ -123,7 +121,7 @@ func TestCheckCompatible(t *testing.T) { func TestConfigRules(t *testing.T) { c := &ChainConfig{ - ShanghaiTime: u64(500), + ShanghaiTime: newUint64(500), } var stamp uint64 if r := c.Rules(big.NewInt(0), true, stamp); r.IsShanghai {