Skip to content
Open
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
3 changes: 3 additions & 0 deletions common/constants.all.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type constant struct {
eip1559Block *big.Int
cancunBlock *big.Int
pragueBlock *big.Int
osakaBlock *big.Int
dynamicGasLimitBlock *big.Int

trc21IssuerSMC Address
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions common/constants.devnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion common/constants.local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions common/constants.mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var MainnetConstant = constant{
eip1559Block: big.NewInt(math.MaxInt64),
cancunBlock: big.NewInt(math.MaxInt64),
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),
Expand Down
1 change: 1 addition & 0 deletions common/constants.testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 3 additions & 1 deletion core/vm/jump_table_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
37 changes: 33 additions & 4 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -334,6 +334,7 @@ var (
Eip1559Block: nil,
CancunBlock: nil,
PragueBlock: nil,
OsakaBlock: nil,
Ethash: new(EthashConfig),
Clique: nil,
XDPoS: nil,
Expand All @@ -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},
Expand All @@ -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,
Expand Down Expand Up @@ -432,6 +443,7 @@ var (
Eip1559Block: nil,
CancunBlock: nil,
PragueBlock: nil,
OsakaBlock: nil,
Ethash: new(EthashConfig),
Clique: nil,
XDPoS: nil,
Expand All @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -1281,6 +1308,7 @@ type Rules struct {
IsEIP1559 bool
IsCancun bool
IsPrague bool
IsOsaka bool
}

func (c *ChainConfig) Rules(num *big.Int) Rules {
Expand All @@ -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),
}
}
Loading