Skip to content

Commit 513e46e

Browse files
committed
Consolidate ArbOS version constants into a single file
1 parent de229c2 commit 513e46e

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

params/config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,15 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi
574574
// IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
575575
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64, currentArbosVersion uint64) bool {
576576
if c.IsArbitrum() {
577-
return currentArbosVersion >= 11
577+
return currentArbosVersion >= ArbosVersion_11
578578
}
579579
return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
580580
}
581581

582582
// IsCancun returns whether num is either equal to the Cancun fork time or greater.
583583
func (c *ChainConfig) IsCancun(num *big.Int, time uint64, currentArbosVersion uint64) bool {
584584
if c.IsArbitrum() {
585-
return currentArbosVersion >= 20
585+
return currentArbosVersion >= ArbosVersion_20
586586
}
587587
return c.IsLondon(num) && isTimestampForked(c.CancunTime, time)
588588
}

params/config_arbitrum.go

+21-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,27 @@ import (
2222
"github.com/ethereum/go-ethereum/common"
2323
)
2424

25-
const ArbosVersion_FixRedeemGas = uint64(11)
26-
const ArbosVersion_Stylus = uint64(30)
27-
const ArbosVersion_StylusFixes = uint64(31)
28-
const ArbosVersion_StylusChargingFixes = uint64(32)
25+
const ArbosVersion_2 = uint64(2)
26+
const ArbosVersion_3 = uint64(3)
27+
const ArbosVersion_4 = uint64(4)
28+
const ArbosVersion_5 = uint64(5)
29+
const ArbosVersion_6 = uint64(6)
30+
const ArbosVersion_7 = uint64(7)
31+
const ArbosVersion_8 = uint64(8)
32+
const ArbosVersion_9 = uint64(9)
33+
const ArbosVersion_10 = uint64(10)
34+
const ArbosVersion_11 = uint64(11)
35+
const ArbosVersion_20 = uint64(20)
36+
const ArbosVersion_30 = uint64(30)
37+
const ArbosVersion_31 = uint64(31)
38+
const ArbosVersion_32 = uint64(32)
39+
40+
const ArbosVersion_FixRedeemGas = ArbosVersion_11
41+
const ArbosVersion_Stylus = ArbosVersion_30
42+
const ArbosVersion_StylusFixes = ArbosVersion_31
43+
const ArbosVersion_StylusChargingFixes = ArbosVersion_32
44+
const MaxArbosVersionSupported = ArbosVersion_32
45+
const MaxDebugArbosVersionSupported = ArbosVersion_32
2946

3047
type ArbitrumChainParams struct {
3148
EnableArbOS bool

params/config_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func TestConfigRules(t *testing.T) {
131131
t.Errorf("expected %v to not be shanghai", currentArbosVersion)
132132
}
133133
stamp = 500
134-
currentArbosVersion = 11
134+
currentArbosVersion = ArbosVersion_11
135135
if r := c.Rules(big.NewInt(0), true, stamp, currentArbosVersion); !r.IsShanghai {
136136
t.Errorf("expected %v to be shanghai", currentArbosVersion)
137137
}

0 commit comments

Comments
 (0)