Skip to content

Commit

Permalink
core, params: change osaka to prague
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Jan 16, 2023
1 parent ed3d3ae commit f10e3fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions core/forkid/forkid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,21 +387,21 @@ func TestValidation(t *testing.T) {
// TODO(karalabe): Enable this when Cancun is specced, update local head and time, next timestamp
//{&timestampedConfig, 21123456, 1678123456, ID{Hash: checksumToBytes(0x71147644), Next: 1678000000}, nil},

// Local is mainnet Osaka, remote announces Shanghai + knowledge about Cancun. Remote
// is definitely out of sync. It may or may not need the Osaka update, we don't know yet.
// Local is mainnet Prague, remote announces Shanghai + knowledge about Cancun. Remote
// is definitely out of sync. It may or may not need the Prague update, we don't know yet.
//
// TODO(karalabe): Enable this when Cancun **and** Osaka is specced, update all the numbers
// TODO(karalabe): Enable this when Cancun **and** Prague is specced, update all the numbers
//{&timestampedConfig, 0, 0, ID{Hash: checksumToBytes(0x3edd5b10), Next: 4370000}, nil},

// Local is mainnet Shanghai, remote announces Cancun. Local is out of sync, accept.
//
// TODO(karalabe): Enable this when Cancun is specced, update remote checksum
//{&timestampedConfig, 21000000, 1678000000, ID{Hash: checksumToBytes(0x00000000), Next: 0}, nil},

// Local is mainnet Shanghai, remote announces Cancun, but is not aware of Osaka. Local
// Local is mainnet Shanghai, remote announces Cancun, but is not aware of Prague. Local
// out of sync. Local also knows about a future fork, but that is uncertain yet.
//
// TODO(karalabe): Enable this when Cancun **and** Osaka is specced, update remote checksum
// TODO(karalabe): Enable this when Cancun **and** Prague is specced, update remote checksum
//{&timestampedConfig, 21000000, 1678000000, ID{Hash: checksumToBytes(0x00000000), Next: 0}, nil},

// Local is mainnet Cancun. remote announces Shanghai but is not aware of further forks.
Expand Down
30 changes: 15 additions & 15 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ var (
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
OsakaTime: nil,
PragueTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: new(EthashConfig),
Expand Down Expand Up @@ -318,7 +318,7 @@ var (
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
OsakaTime: nil,
PragueTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: nil,
Expand Down Expand Up @@ -348,7 +348,7 @@ var (
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
OsakaTime: nil,
PragueTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: new(EthashConfig),
Expand Down Expand Up @@ -378,7 +378,7 @@ var (
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
OsakaTime: nil,
PragueTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: new(EthashConfig),
Expand Down Expand Up @@ -479,7 +479,7 @@ type ChainConfig struct {

ShanghaiTime *big.Int `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
CancunTime *big.Int `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
OsakaTime *big.Int `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
PragueTime *big.Int `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)

// TerminalTotalDifficulty is the amount of total difficulty reached by
// the network that triggers the consensus upgrade.
Expand Down Expand Up @@ -597,8 +597,8 @@ func (c *ChainConfig) Description() string {
if c.CancunTime != nil {
banner += fmt.Sprintf(" - Cancun: @%-10v\n", c.CancunTime)
}
if c.OsakaTime != nil {
banner += fmt.Sprintf(" - Osaka: @%-10v\n", c.OsakaTime)
if c.PragueTime != nil {
banner += fmt.Sprintf(" - Prague: @%-10v\n", c.PragueTime)
}
return banner
}
Expand Down Expand Up @@ -693,9 +693,9 @@ func (c *ChainConfig) IsCancun(time *big.Int) bool {
return isTimestampForked(c.CancunTime, time)
}

// IsOsaka returns whether num is either equal to the Osaka fork time or greater.
func (c *ChainConfig) IsOsaka(time *big.Int) bool {
return isTimestampForked(c.OsakaTime, time)
// IsPrague returns whether num is either equal to the Prague fork time or greater.
func (c *ChainConfig) IsPrague(time *big.Int) bool {
return isTimestampForked(c.PragueTime, time)
}

// CheckCompatible checks whether scheduled fork transitions have been imported
Expand Down Expand Up @@ -751,7 +751,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true},
{name: "shanghaiTime", timestamp: c.ShanghaiTime},
{name: "cancunTime", timestamp: c.CancunTime, optional: true},
{name: "osakaTime", timestamp: c.OsakaTime, optional: true},
{name: "osakaTime", timestamp: c.PragueTime, optional: true},
} {
if lastFork.name != "" {
switch {
Expand Down Expand Up @@ -852,8 +852,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
if isForkTimestampIncompatible(c.CancunTime, newcfg.CancunTime, headTimestamp) {
return newTimestampCompatError("Cancun fork timestamp", c.CancunTime, newcfg.CancunTime)
}
if isForkTimestampIncompatible(c.OsakaTime, newcfg.OsakaTime, headTimestamp) {
return newTimestampCompatError("Osaka fork timestamp", c.OsakaTime, newcfg.OsakaTime)
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) {
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime)
}
return nil
}
Expand Down Expand Up @@ -999,7 +999,7 @@ type Rules struct {
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
IsBerlin, IsLondon bool
IsMerge, IsShanghai, isCancun, isOsaka bool
IsMerge, IsShanghai, isCancun, isPrague bool
}

// Rules ensures c's ChainID is not nil.
Expand All @@ -1023,6 +1023,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp *big.Int) Rule
IsMerge: isMerge,
IsShanghai: c.IsShanghai(timestamp),
isCancun: c.IsCancun(timestamp),
isOsaka: c.IsOsaka(timestamp),
isPrague: c.IsPrague(timestamp),
}
}

0 comments on commit f10e3fd

Please sign in to comment.