Skip to content

Commit

Permalink
Merge pull request #388 from OffchainLabs/Consolidate_arbos_constants
Browse files Browse the repository at this point in the history
[NIT-1285] Consolidate ArbOS version constants into a single file
  • Loading branch information
amsanghi authored Dec 23, 2024
2 parents d99138f + cb93ba1 commit 5cb0b54
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
4 changes: 2 additions & 2 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,15 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi
// IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64, currentArbosVersion uint64) bool {
if c.IsArbitrum() {
return currentArbosVersion >= 11
return currentArbosVersion >= ArbosVersion_11
}
return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
}

// IsCancun returns whether num is either equal to the Cancun fork time or greater.
func (c *ChainConfig) IsCancun(num *big.Int, time uint64, currentArbosVersion uint64) bool {
if c.IsArbitrum() {
return currentArbosVersion >= 20
return currentArbosVersion >= ArbosVersion_20
}
return c.IsLondon(num) && isTimestampForked(c.CancunTime, time)
}
Expand Down
25 changes: 21 additions & 4 deletions params/config_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,27 @@ import (
"github.com/ethereum/go-ethereum/common"
)

const ArbosVersion_FixRedeemGas = uint64(11)
const ArbosVersion_Stylus = uint64(30)
const ArbosVersion_StylusFixes = uint64(31)
const ArbosVersion_StylusChargingFixes = uint64(32)
const ArbosVersion_2 = uint64(2)
const ArbosVersion_3 = uint64(3)
const ArbosVersion_4 = uint64(4)
const ArbosVersion_5 = uint64(5)
const ArbosVersion_6 = uint64(6)
const ArbosVersion_7 = uint64(7)
const ArbosVersion_8 = uint64(8)
const ArbosVersion_9 = uint64(9)
const ArbosVersion_10 = uint64(10)
const ArbosVersion_11 = uint64(11)
const ArbosVersion_20 = uint64(20)
const ArbosVersion_30 = uint64(30)
const ArbosVersion_31 = uint64(31)
const ArbosVersion_32 = uint64(32)

const ArbosVersion_FixRedeemGas = ArbosVersion_11
const ArbosVersion_Stylus = ArbosVersion_30
const ArbosVersion_StylusFixes = ArbosVersion_31
const ArbosVersion_StylusChargingFixes = ArbosVersion_32
const MaxArbosVersionSupported = ArbosVersion_32
const MaxDebugArbosVersionSupported = ArbosVersion_32

type ArbitrumChainParams struct {
EnableArbOS bool
Expand Down
2 changes: 1 addition & 1 deletion params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestConfigRules(t *testing.T) {
t.Errorf("expected %v to not be shanghai", currentArbosVersion)
}
stamp = 500
currentArbosVersion = 11
currentArbosVersion = ArbosVersion_11
if r := c.Rules(big.NewInt(0), true, stamp, currentArbosVersion); !r.IsShanghai {
t.Errorf("expected %v to be shanghai", currentArbosVersion)
}
Expand Down

0 comments on commit 5cb0b54

Please sign in to comment.