feat(params): start osaka fork #31125 (#2013)

This commit is contained in:
Daniel Liu 2026-02-06 17:10:58 +08:00 committed by GitHub
parent d8ce54db87
commit 75c05e5dde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 44 additions and 6 deletions

View file

@ -65,6 +65,7 @@ type constant struct {
eip1559Block *big.Int
cancunBlock *big.Int
pragueBlock *big.Int
osakaBlock *big.Int
dynamicGasLimitBlock *big.Int
trc21IssuerSMC Address
@ -101,6 +102,7 @@ var (
Eip1559Block = MainnetConstant.eip1559Block
CancunBlock = MainnetConstant.cancunBlock
PragueBlock = MainnetConstant.pragueBlock
OsakaBlock = MainnetConstant.osakaBlock
DynamicGasLimitBlock = MainnetConstant.dynamicGasLimitBlock
TIPUpgradeReward = MainnetConstant.tipUpgradeReward
TipUpgradePenalty = MainnetConstant.tipUpgradePenalty
@ -165,6 +167,7 @@ func CopyConstants(chainID uint64) {
Eip1559Block = c.eip1559Block
CancunBlock = c.cancunBlock
PragueBlock = c.pragueBlock
OsakaBlock = c.osakaBlock
DynamicGasLimitBlock = c.dynamicGasLimitBlock
TIPUpgradeReward = c.tipUpgradeReward
TipUpgradePenalty = c.tipUpgradePenalty

View file

@ -30,6 +30,7 @@ var DevnetConstant = constant{
eip1559Block: big.NewInt(32400),
cancunBlock: big.NewInt(43200),
pragueBlock: big.NewInt(math.MaxInt64),
osakaBlock: big.NewInt(math.MaxInt64),
dynamicGasLimitBlock: big.NewInt(math.MaxInt64),
tipUpgradeReward: big.NewInt(math.MaxInt64),
tipUpgradePenalty: big.NewInt(math.MaxInt64),

View file

@ -29,7 +29,8 @@ var localConstant = constant{
tipXDCXReceiverDisable: big.NewInt(0),
eip1559Block: big.NewInt(0),
cancunBlock: big.NewInt(0),
pragueBlock: big.NewInt(math.MaxInt64),
pragueBlock: big.NewInt(0),
osakaBlock: big.NewInt(0),
dynamicGasLimitBlock: big.NewInt(0),
tipUpgradeReward: big.NewInt(math.MaxInt64),
tipUpgradePenalty: big.NewInt(math.MaxInt64),

View file

@ -30,6 +30,7 @@ var MainnetConstant = constant{
eip1559Block: big.NewInt(98800200), // Target 28th Jan 2026
cancunBlock: big.NewInt(98802000), // Target 28th Jan 2026
pragueBlock: big.NewInt(math.MaxInt64),
osakaBlock: big.NewInt(math.MaxInt64),
dynamicGasLimitBlock: big.NewInt(math.MaxInt64),
tipUpgradeReward: big.NewInt(math.MaxInt64),
tipUpgradePenalty: big.NewInt(math.MaxInt64),

View file

@ -30,6 +30,7 @@ var TestnetConstant = constant{
eip1559Block: big.NewInt(71550000), // Target 14th Feb 2025
cancunBlock: big.NewInt(71551800),
pragueBlock: big.NewInt(math.MaxInt64),
osakaBlock: big.NewInt(math.MaxInt64),
dynamicGasLimitBlock: big.NewInt(math.MaxInt64),
tipUpgradeReward: big.NewInt(math.MaxInt64),
tipUpgradePenalty: big.NewInt(math.MaxInt64),

View file

@ -26,8 +26,10 @@ import (
// the rules.
func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
switch {
case rules.IsOsaka:
return newPragueInstructionSet(), errors.New("osaka-fork not defined yet")
case rules.IsPrague:
return newCancunInstructionSet(), errors.New("prague-fork not defined yet")
return newPragueInstructionSet(), nil
case rules.IsCancun:
return newCancunInstructionSet(), nil
case rules.IsEIP1559:

View file

@ -263,7 +263,7 @@ var (
Ethash: new(EthashConfig),
}
// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
// TestnetChainConfig contains the chain parameters to run a node on the Apothem testnet.
TestnetChainConfig = &ChainConfig{
ChainID: big.NewInt(51),
HomesteadBlock: big.NewInt(1),
@ -290,7 +290,7 @@ var (
},
}
// DevnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
// DevnetChainConfig contains the chain parameters to run a node on the devnet.
DevnetChainConfig = &ChainConfig{
ChainID: big.NewInt(551),
HomesteadBlock: big.NewInt(0),
@ -334,6 +334,7 @@ var (
Eip1559Block: nil,
CancunBlock: nil,
PragueBlock: nil,
OsakaBlock: nil,
Ethash: new(EthashConfig),
Clique: nil,
XDPoS: nil,
@ -353,7 +354,16 @@ var (
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: nil,
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0),
Eip1559Block: big.NewInt(0),
CancunBlock: big.NewInt(0),
PragueBlock: big.NewInt(0),
OsakaBlock: big.NewInt(0),
Ethash: nil,
Clique: nil,
XDPoS: &XDPoSConfig{Period: 0, Epoch: 900},
@ -376,9 +386,10 @@ var (
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0),
Eip1559Block: nil,
Eip1559Block: big.NewInt(0),
CancunBlock: nil,
PragueBlock: nil,
OsakaBlock: nil,
Ethash: nil,
Clique: &CliqueConfig{Period: 0, Epoch: 900},
XDPoS: nil,
@ -432,6 +443,7 @@ var (
Eip1559Block: nil,
CancunBlock: nil,
PragueBlock: nil,
OsakaBlock: nil,
Ethash: new(EthashConfig),
Clique: nil,
XDPoS: nil,
@ -457,6 +469,7 @@ var (
Eip1559Block: big.NewInt(0),
CancunBlock: big.NewInt(0),
PragueBlock: big.NewInt(0),
OsakaBlock: big.NewInt(0),
Ethash: new(EthashConfig),
Clique: nil,
XDPoS: nil,
@ -494,6 +507,7 @@ type ChainConfig struct {
Eip1559Block *big.Int `json:"eip1559Block,omitempty"`
CancunBlock *big.Int `json:"cancunBlock,omitempty"`
PragueBlock *big.Int `json:"pragueBlock,omitempty"`
OsakaBlock *big.Int `json:"osakaBlock,omitempty"`
DynamicGasLimitBlock *big.Int `json:"dynamicGasLimitBlock,omitempty"` // Dynamic gas limit adjustment algorithm activation block (nil = no fork)
@ -912,6 +926,10 @@ func (c *ChainConfig) Description() string {
if c.PragueBlock != nil {
pragueBlock = c.PragueBlock
}
osakaBlock := common.OsakaBlock
if c.OsakaBlock != nil {
osakaBlock = c.OsakaBlock
}
dynamicGasLimitBlock := common.DynamicGasLimitBlock
if c.DynamicGasLimitBlock != nil {
dynamicGasLimitBlock = c.DynamicGasLimitBlock
@ -948,6 +966,7 @@ func (c *ChainConfig) Description() string {
banner += fmt.Sprintf(" - Eip1559: %-8v\n", eip1559Block)
banner += fmt.Sprintf(" - Cancun: %-8v\n", cancunBlock)
banner += fmt.Sprintf(" - Prague: %-8v\n", pragueBlock)
banner += fmt.Sprintf(" - Osaka: %-8v\n", osakaBlock)
banner += fmt.Sprintf(" - DynamicGasLimitBlock: %-8v\n", dynamicGasLimitBlock)
banner += fmt.Sprintf(" - TIPUpgradeReward: %-8v\n", common.TIPUpgradeReward)
banner += fmt.Sprintf(" - TipUpgradePenalty: %-8v\n", common.TipUpgradePenalty)
@ -1034,6 +1053,11 @@ func (c *ChainConfig) IsPrague(num *big.Int) bool {
return isForked(common.PragueBlock, num) || isForked(c.PragueBlock, num)
}
// IsOsaka returns whether num is either equal to the Osaka fork block or greater.
func (c *ChainConfig) IsOsaka(num *big.Int) bool {
return isForked(common.OsakaBlock, num) || isForked(c.OsakaBlock, num)
}
// IsDynamicGasLimitBlock returns whether num is either equal to the DynamicGasLimitBlock fork block or greater.
func (c *ChainConfig) IsDynamicGasLimitBlock(num *big.Int) bool {
return isForked(common.DynamicGasLimitBlock, num) || isForked(c.DynamicGasLimitBlock, num)
@ -1189,6 +1213,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible(c.PragueBlock, newcfg.PragueBlock, head) {
return newCompatError("Prague fork block", c.PragueBlock, newcfg.PragueBlock)
}
if isForkIncompatible(c.OsakaBlock, newcfg.OsakaBlock, head) {
return newCompatError("Osaka fork block", c.OsakaBlock, newcfg.OsakaBlock)
}
if !XDPoSConfigEqual(c.XDPoS, newcfg.XDPoS) {
storedblock := big.NewInt(1)
if c.XDPoS != nil && c.XDPoS.V2 != nil && c.XDPoS.V2.SwitchBlock != nil {
@ -1281,6 +1308,7 @@ type Rules struct {
IsEIP1559 bool
IsCancun bool
IsPrague bool
IsOsaka bool
}
func (c *ChainConfig) Rules(num *big.Int) Rules {
@ -1306,5 +1334,6 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
IsEIP1559: c.IsEIP1559(num),
IsCancun: c.IsCancun(num),
IsPrague: c.IsPrague(num),
IsOsaka: c.IsOsaka(num),
}
}