Skip to content

Commit 726b589

Browse files
MariusVanDerWijdenlightclient
authored andcommitted
params: start osaka fork (#31125)
This PR defines the Osaka fork. An easy first step to start our work on the next hardfork (This is needed for EOF testing as well) --------- Co-authored-by: lightclient <[email protected]>
1 parent a8e41bf commit 726b589

File tree

6 files changed

+81
-8
lines changed

6 files changed

+81
-8
lines changed

core/genesis_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ func TestVerkleGenesisCommit(t *testing.T) {
279279
ShanghaiTime: &verkleTime,
280280
CancunTime: &verkleTime,
281281
PragueTime: &verkleTime,
282+
OsakaTime: &verkleTime,
282283
VerkleTime: &verkleTime,
283284
TerminalTotalDifficulty: big.NewInt(0),
284285
EnableVerkleAtGenesis: true,

core/vm/jump_table_export.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
2828
switch {
2929
case rules.IsVerkle:
3030
return newCancunInstructionSet(), errors.New("verkle-fork not defined yet")
31+
case rules.IsOsaka:
32+
return newPragueInstructionSet(), errors.New("osaka-fork not defined yet")
3133
case rules.IsPrague:
32-
return newCancunInstructionSet(), errors.New("prague-fork not defined yet")
34+
return newPragueInstructionSet(), nil
3335
case rules.IsCancun:
3436
return newCancunInstructionSet(), nil
3537
case rules.IsNeoXDKG:

eth/tracers/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,10 @@ func overrideConfig(original *params.ChainConfig, override *params.ChainConfig)
10961096
copy.PragueTime = timestamp
10971097
canon = false
10981098
}
1099+
if timestamp := override.OsakaTime; timestamp != nil {
1100+
copy.OsakaTime = timestamp
1101+
canon = false
1102+
}
10991103
if timestamp := override.VerkleTime; timestamp != nil {
11001104
copy.VerkleTime = timestamp
11011105
canon = false

params/config.go

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ var (
133133
ShanghaiTime: nil,
134134
CancunTime: nil,
135135
PragueTime: nil,
136+
OsakaTime: nil,
136137
VerkleTime: nil,
137138
Ethash: new(EthashConfig),
138139
Clique: nil,
@@ -182,6 +183,7 @@ var (
182183
ShanghaiTime: nil,
183184
CancunTime: nil,
184185
PragueTime: nil,
186+
OsakaTime: nil,
185187
VerkleTime: nil,
186188
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
187189
Ethash: nil,
@@ -211,6 +213,7 @@ var (
211213
ShanghaiTime: nil,
212214
CancunTime: nil,
213215
PragueTime: nil,
216+
OsakaTime: nil,
214217
VerkleTime: nil,
215218
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
216219
Ethash: new(EthashConfig),
@@ -240,6 +243,7 @@ var (
240243
ShanghaiTime: newUint64(0),
241244
CancunTime: newUint64(0),
242245
PragueTime: newUint64(0),
246+
OsakaTime: nil,
243247
VerkleTime: nil,
244248
TerminalTotalDifficulty: big.NewInt(0),
245249
Ethash: new(EthashConfig),
@@ -269,6 +273,7 @@ var (
269273
ShanghaiTime: nil,
270274
CancunTime: nil,
271275
PragueTime: nil,
276+
OsakaTime: nil,
272277
VerkleTime: nil,
273278
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
274279
Ethash: new(EthashConfig),
@@ -321,6 +326,7 @@ type ChainConfig struct {
321326
NeoXEthSigBlock *big.Int `json:"neoXEthSigBlock,omitempty"` // Block-based switch to fix block signature from NeoXAMEVBlock (nil = no fork, 0 = already activated)
322327
CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
323328
PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
329+
OsakaTime *uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
324330
VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
325331

326332
// TerminalTotalDifficulty is the amount of total difficulty reached by
@@ -459,6 +465,9 @@ func (c *ChainConfig) Description() string {
459465
if c.PragueTime != nil {
460466
banner += fmt.Sprintf(" - Prague: @%-10v\n", *c.PragueTime)
461467
}
468+
if c.OsakaTime != nil {
469+
banner += fmt.Sprintf(" - Osaka: @%-10v\n", *c.OsakaTime)
470+
}
462471
if c.VerkleTime != nil {
463472
banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime)
464473
}
@@ -575,6 +584,11 @@ func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool {
575584
return c.IsLondon(num) && isTimestampForked(c.PragueTime, time)
576585
}
577586

587+
// IsOsaka returns whether time is either equal to the Osaka fork time or greater.
588+
func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool {
589+
return c.IsLondon(num) && isTimestampForked(c.OsakaTime, time)
590+
}
591+
578592
// IsVerkle returns whether time is either equal to the Verkle fork time or greater.
579593
func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool {
580594
return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time)
@@ -656,6 +670,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
656670
{name: "neoXEthSigBlock", block: c.NeoXEthSigBlock, optional: true},
657671
{name: "cancunTime", timestamp: c.CancunTime, optional: true},
658672
{name: "pragueTime", timestamp: c.PragueTime, optional: true},
673+
{name: "osakaTime", timestamp: c.OsakaTime, optional: true},
659674
{name: "verkleTime", timestamp: c.VerkleTime, optional: true},
660675
} {
661676
if lastFork.name != "" {
@@ -769,6 +784,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
769784
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) {
770785
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime)
771786
}
787+
if isForkTimestampIncompatible(c.OsakaTime, newcfg.OsakaTime, headTimestamp) {
788+
return newTimestampCompatError("Osaka fork timestamp", c.OsakaTime, newcfg.OsakaTime)
789+
}
772790
if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) {
773791
return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime)
774792
}
@@ -815,6 +833,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
815833
london := c.LondonBlock
816834

817835
switch {
836+
case c.IsOsaka(london, time):
837+
return forks.Osaka
818838
case c.IsPrague(london, time):
819839
return forks.Prague
820840
case c.IsCancun(london, time):
@@ -961,13 +981,13 @@ func (err *ConfigCompatError) Error() string {
961981
// Rules is a one time interface meaning that it shouldn't be used in between transition
962982
// phases.
963983
type Rules struct {
964-
ChainID *big.Int
965-
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
966-
IsEIP2929, IsEIP4762 bool
967-
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
968-
IsBerlin, IsLondon bool
969-
IsMerge, IsShanghai, IsNeoXDKG, IsCancun, IsPrague bool
970-
IsVerkle bool
984+
ChainID *big.Int
985+
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
986+
IsEIP2929, IsEIP4762 bool
987+
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
988+
IsBerlin, IsLondon bool
989+
IsMerge, IsShanghai, IsNeoXDKG, IsCancun, IsPrague, IsOsaka bool
990+
IsVerkle bool
971991
}
972992

973993
// Rules ensures c's ChainID is not nil.
@@ -995,6 +1015,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
9951015
IsNeoXDKG: c.IsNeoXDKG(num),
9961016
IsCancun: c.IsCancun(num, timestamp),
9971017
IsPrague: c.IsPrague(num, timestamp),
1018+
IsOsaka: c.IsOsaka(num, timestamp),
9981019
IsVerkle: isVerkle,
9991020
IsEIP4762: isVerkle,
10001021
}

params/forks/forks.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ const (
3939
Shanghai
4040
Cancun
4141
Prague
42+
Osaka
4243
)

tests/init.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,50 @@ var Forks = map[string]*params.ChainConfig{
416416
PragueTime: u64(15_000),
417417
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
418418
},
419+
"Osaka": {
420+
ChainID: big.NewInt(1),
421+
HomesteadBlock: big.NewInt(0),
422+
EIP150Block: big.NewInt(0),
423+
EIP155Block: big.NewInt(0),
424+
EIP158Block: big.NewInt(0),
425+
ByzantiumBlock: big.NewInt(0),
426+
ConstantinopleBlock: big.NewInt(0),
427+
PetersburgBlock: big.NewInt(0),
428+
IstanbulBlock: big.NewInt(0),
429+
MuirGlacierBlock: big.NewInt(0),
430+
BerlinBlock: big.NewInt(0),
431+
LondonBlock: big.NewInt(0),
432+
ArrowGlacierBlock: big.NewInt(0),
433+
MergeNetsplitBlock: big.NewInt(0),
434+
TerminalTotalDifficulty: big.NewInt(0),
435+
ShanghaiTime: u64(0),
436+
CancunTime: u64(0),
437+
PragueTime: u64(0),
438+
OsakaTime: u64(0),
439+
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
440+
},
441+
"PragueToOsakaAtTime15k": {
442+
ChainID: big.NewInt(1),
443+
HomesteadBlock: big.NewInt(0),
444+
EIP150Block: big.NewInt(0),
445+
EIP155Block: big.NewInt(0),
446+
EIP158Block: big.NewInt(0),
447+
ByzantiumBlock: big.NewInt(0),
448+
ConstantinopleBlock: big.NewInt(0),
449+
PetersburgBlock: big.NewInt(0),
450+
IstanbulBlock: big.NewInt(0),
451+
MuirGlacierBlock: big.NewInt(0),
452+
BerlinBlock: big.NewInt(0),
453+
LondonBlock: big.NewInt(0),
454+
ArrowGlacierBlock: big.NewInt(0),
455+
MergeNetsplitBlock: big.NewInt(0),
456+
TerminalTotalDifficulty: big.NewInt(0),
457+
ShanghaiTime: u64(0),
458+
CancunTime: u64(0),
459+
PragueTime: u64(0),
460+
OsakaTime: u64(15_000),
461+
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
462+
},
419463
}
420464

421465
// AvailableForks returns the set of defined fork names

0 commit comments

Comments
 (0)