Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions core/forkid/forkid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,14 @@ func TestCreation(t *testing.T) {
{1735372, 1706655071, ID{Hash: checksumToBytes(0xf7f9bc08), Next: 1706655072}}, // Last Shanghai block
{1735372, 1706655072, ID{Hash: checksumToBytes(0x88cf81d9), Next: 1741159776}}, // First Cancun block
{1735372, 1741159775, ID{Hash: checksumToBytes(0x88cf81d9), Next: 1741159776}}, // Last Cancun block
{1735372, 1741159776, ID{Hash: checksumToBytes(0xed88b5fd), Next: 0}}, // First Prague block
{1735372, 2741159776, ID{Hash: checksumToBytes(0xed88b5fd), Next: 0}}, // Future Prague block
{1735372, 1741159776, ID{Hash: checksumToBytes(0xed88b5fd), Next: 1760427360}}, // First Prague block
{1735372, 1760427359, ID{Hash: checksumToBytes(0xed88b5fd), Next: 1760427360}}, // Last Prague block
{1735372, 1760427360, ID{Hash: checksumToBytes(0xe2ae4999), Next: 1761017184}}, // First Osaka block
{1735372, 1761017183, ID{Hash: checksumToBytes(0xe2ae4999), Next: 1761017184}}, // Last Osaka block
{1735372, 1761017184, ID{Hash: checksumToBytes(0x56078a1e), Next: 1761607008}}, // First BPO1 block
{1735372, 1761607007, ID{Hash: checksumToBytes(0x56078a1e), Next: 1761607008}}, // Last BPO1 block
{1735372, 1761607008, ID{Hash: checksumToBytes(0x268956b6), Next: 0}}, // First BPO2 block
{1735372, 2000000000, ID{Hash: checksumToBytes(0x268956b6), Next: 0}}, // Future BPO2 block
},
},
// Holesky test cases
Expand All @@ -110,8 +116,14 @@ func TestCreation(t *testing.T) {
{123, 1707305663, ID{Hash: checksumToBytes(0xfd4f016b), Next: 1707305664}}, // Last Shanghai block
{123, 1707305664, ID{Hash: checksumToBytes(0x9b192ad0), Next: 1740434112}}, // First Cancun block
{123, 1740434111, ID{Hash: checksumToBytes(0x9b192ad0), Next: 1740434112}}, // Last Cancun block
{123, 1740434112, ID{Hash: checksumToBytes(0xdfbd9bed), Next: 0}}, // First Prague block
{123, 2740434112, ID{Hash: checksumToBytes(0xdfbd9bed), Next: 0}}, // Future Prague block
{123, 1740434112, ID{Hash: checksumToBytes(0xdfbd9bed), Next: 1759308480}}, // First Prague block
{123, 1759308479, ID{Hash: checksumToBytes(0xdfbd9bed), Next: 1759308480}}, // Last Prague block
{123, 1759308480, ID{Hash: checksumToBytes(0x783def52), Next: 1759800000}}, // First Osaka block
{123, 1759799999, ID{Hash: checksumToBytes(0x783def52), Next: 1759800000}}, // Last Osaka block
{123, 1759800000, ID{Hash: checksumToBytes(0xa280a45c), Next: 1760389824}}, // First BPO1 block
{123, 1760389823, ID{Hash: checksumToBytes(0xa280a45c), Next: 1760389824}}, // Last BPO1 block
{123, 1760389824, ID{Hash: checksumToBytes(0x9bc6cb31), Next: 0}}, // First BPO2 block
{123, 2000000000, ID{Hash: checksumToBytes(0x9bc6cb31), Next: 0}}, // Future BPO1 block
},
},
// Hoodi test cases
Expand All @@ -121,8 +133,14 @@ func TestCreation(t *testing.T) {
[]testcase{
{0, 0, ID{Hash: checksumToBytes(0xbef71d30), Next: 1742999832}}, // Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris, Shanghai, Cancun block
{123, 1742999831, ID{Hash: checksumToBytes(0xbef71d30), Next: 1742999832}}, // Last Cancun block
{123, 1742999832, ID{Hash: checksumToBytes(0x0929e24e), Next: 0}}, // First Prague block
{123, 2740434112, ID{Hash: checksumToBytes(0x0929e24e), Next: 0}}, // Future Prague block
{123, 1742999832, ID{Hash: checksumToBytes(0x0929e24e), Next: 1761677592}}, // First Prague block
{123, 1761677591, ID{Hash: checksumToBytes(0x0929e24e), Next: 1761677592}}, // Last Prague block
{123, 1761677592, ID{Hash: checksumToBytes(0xe7e0e7ff), Next: 1762365720}}, // First Osaka block
{123, 1762365719, ID{Hash: checksumToBytes(0xe7e0e7ff), Next: 1762365720}}, // Last Osaka block
{123, 1762365720, ID{Hash: checksumToBytes(0x3893353e), Next: 1762955544}}, // First BPO1 block
{123, 1762955543, ID{Hash: checksumToBytes(0x3893353e), Next: 1762955544}}, // Last BPO1 block
{123, 1762955544, ID{Hash: checksumToBytes(0x23aa1351), Next: 0}}, // First BPO2 block
{123, 2000000000, ID{Hash: checksumToBytes(0x23aa1351), Next: 0}}, // Future BPO2 block
},
},
}
Expand Down
78 changes: 75 additions & 3 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,17 @@ var (
ShanghaiTime: newUint64(1696000704),
CancunTime: newUint64(1707305664),
PragueTime: newUint64(1740434112),
OsakaTime: newUint64(1759308480),
BPO1Time: newUint64(1759800000),
BPO2Time: newUint64(1760389824),
DepositContractAddress: common.HexToAddress("0x4242424242424242424242424242424242424242"),
Ethash: new(EthashConfig),
BlobScheduleConfig: &BlobScheduleConfig{
Cancun: DefaultCancunBlobConfig,
Prague: DefaultPragueBlobConfig,
Osaka: DefaultOsakaBlobConfig,
BPO1: DefaultBPO1BlobConfig,
BPO2: DefaultBPO2BlobConfig,
},
}
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
Expand All @@ -128,11 +134,17 @@ var (
ShanghaiTime: newUint64(1677557088),
CancunTime: newUint64(1706655072),
PragueTime: newUint64(1741159776),
OsakaTime: newUint64(1760427360),
BPO1Time: newUint64(1761017184),
BPO2Time: newUint64(1761607008),
DepositContractAddress: common.HexToAddress("0x7f02c3e3c98b133055b8b348b2ac625669ed295d"),
Ethash: new(EthashConfig),
BlobScheduleConfig: &BlobScheduleConfig{
Cancun: DefaultCancunBlobConfig,
Prague: DefaultPragueBlobConfig,
Osaka: DefaultOsakaBlobConfig,
BPO1: DefaultBPO1BlobConfig,
BPO2: DefaultBPO2BlobConfig,
},
}
// HoodiChainConfig contains the chain parameters to run a node on the Hoodi test network.
Expand All @@ -158,11 +170,17 @@ var (
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
PragueTime: newUint64(1742999832),
OsakaTime: newUint64(1761677592),
BPO1Time: newUint64(1762365720),
BPO2Time: newUint64(1762955544),
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cBB839Cbe05303d7705Fa"),
Ethash: new(EthashConfig),
BlobScheduleConfig: &BlobScheduleConfig{
Cancun: DefaultCancunBlobConfig,
Prague: DefaultPragueBlobConfig,
Osaka: DefaultOsakaBlobConfig,
BPO1: DefaultBPO1BlobConfig,
BPO2: DefaultBPO2BlobConfig,
},
}
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
Expand Down Expand Up @@ -394,6 +412,30 @@ var (
Max: 9,
UpdateFraction: 5007716,
}
// DefaultBPO1BlobConfig is the default blob configuration for the Osaka fork.
DefaultBPO1BlobConfig = &BlobConfig{
Target: 10,
Max: 15,
UpdateFraction: 8346193,
}
// DefaultBPO1BlobConfig is the default blob configuration for the Osaka fork.
DefaultBPO2BlobConfig = &BlobConfig{
Target: 14,
Max: 21,
UpdateFraction: 11684671,
}
// DefaultBPO1BlobConfig is the default blob configuration for the Osaka fork.
DefaultBPO3BlobConfig = &BlobConfig{
Target: 21,
Max: 32,
UpdateFraction: 20609697,
}
// DefaultBPO1BlobConfig is the default blob configuration for the Osaka fork.
DefaultBPO4BlobConfig = &BlobConfig{
Target: 14,
Max: 21,
UpdateFraction: 13739630,
}
// DefaultBlobSchedule is the latest configured blob schedule for Ethereum mainnet.
DefaultBlobSchedule = &BlobScheduleConfig{
Cancun: DefaultCancunBlobConfig,
Expand Down Expand Up @@ -1205,6 +1247,16 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
london := c.LondonBlock

switch {
case c.IsBPO5(london, time):
return forks.BPO5
case c.IsBPO4(london, time):
return forks.BPO4
case c.IsBPO3(london, time):
return forks.BPO3
case c.IsBPO2(london, time):
return forks.BPO2
case c.IsBPO1(london, time):
return forks.BPO1
case c.IsOsaka(london, time):
return forks.Osaka
case c.IsPrague(london, time):
Expand All @@ -1223,12 +1275,22 @@ func (c *ChainConfig) BlobConfig(fork forks.Fork) *BlobConfig {
// TODO: https://github.com/ethereum-optimism/op-geth/issues/685
// This function has a bug.
switch fork {
case forks.BPO5:
return c.BlobScheduleConfig.BPO5
case forks.BPO4:
return c.BlobScheduleConfig.BPO4
case forks.BPO3:
return c.BlobScheduleConfig.BPO3
case forks.BPO2:
return c.BlobScheduleConfig.BPO2
case forks.BPO1:
return c.BlobScheduleConfig.BPO1
case forks.Osaka:
return DefaultOsakaBlobConfig
return c.BlobScheduleConfig.Osaka
case forks.Prague:
return DefaultPragueBlobConfig
return c.BlobScheduleConfig.Prague
case forks.Cancun:
return DefaultCancunBlobConfig
return c.BlobScheduleConfig.Cancun
default:
return nil
}
Expand Down Expand Up @@ -1258,6 +1320,16 @@ func (c *ChainConfig) ActiveSystemContracts(time uint64) map[string]common.Addre
// the fork isn't defined or isn't a time-based fork.
func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
switch {
case fork == forks.BPO5:
return c.BPO5Time
case fork == forks.BPO4:
return c.BPO4Time
case fork == forks.BPO3:
return c.BPO3Time
case fork == forks.BPO2:
return c.BPO2Time
case fork == forks.BPO1:
return c.BPO1Time
case fork == forks.Osaka:
return c.OsakaTime
case fork == forks.Prague:
Expand Down
5 changes: 5 additions & 0 deletions params/forks/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const (
Cancun
Prague
Osaka
BPO1
BPO2
BPO3
BPO4
BPO5
)

// String implements fmt.Stringer.
Expand Down
Loading