Skip to content
15 changes: 15 additions & 0 deletions params/config_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const ArbosVersion_40 = uint64(40)
const ArbosVersion_41 = uint64(41)
const ArbosVersion_50 = uint64(50)
const ArbosVersion_51 = uint64(51)
const ArbosVersion_52 = uint64(52)
const ArbosVersion_60 = uint64(60)

const ArbosVersion_FixRedeemGas = ArbosVersion_11
Expand All @@ -50,6 +51,9 @@ const MaxArbosVersionSupported = ArbosVersion_51
const MaxDebugArbosVersionSupported = ArbosVersion_51
const ArbosVersion_Dia = ArbosVersion_50
const ArbosVersion_MultiConstraintFix = ArbosVersion_51
const ArbosVersion_BatchSize = ArbosVersion_52

const DefaultMaxUncompressedBatchSize = 16 * 1024 * 1024 // 16 MB

type ArbitrumChainParams struct {
EnableArbOS bool
Expand All @@ -60,6 +64,7 @@ type ArbitrumChainParams struct {
GenesisBlockNum uint64
MaxCodeSize uint64 `json:"MaxCodeSize,omitempty"` // Maximum bytecode to permit for a contract. 0 value implies params.DefaultMaxCodeSize
MaxInitCodeSize uint64 `json:"MaxInitCodeSize,omitempty"` // Maximum initcode to permit in a creation transaction and create instructions. 0 value implies params.DefaultMaxInitCodeSize
MaxUncompressedBatchSize uint64 `json:"MaxUncompressedBatchSize,omitempty"`
}

func (c *ChainConfig) IsArbitrum() bool {
Expand Down Expand Up @@ -88,6 +93,13 @@ func (c *ChainConfig) DebugMode() bool {
return c.ArbitrumChainParams.AllowDebugPrecompiles
}

func (c *ChainConfig) MaxUncompressedBatchSize(arbosVersion uint64) uint64 {
if arbosVersion < ArbosVersion_BatchSize || c.ArbitrumChainParams.MaxUncompressedBatchSize == 0 {
return DefaultMaxUncompressedBatchSize
}
return c.ArbitrumChainParams.MaxUncompressedBatchSize
}

func (c *ChainConfig) checkArbitrumCompatible(newcfg *ChainConfig, head *big.Int) *ConfigCompatError {
if c.IsArbitrum() != newcfg.IsArbitrum() {
// This difference applies to the entire chain, so report that the genesis block is where the difference appears.
Expand All @@ -101,6 +113,9 @@ func (c *ChainConfig) checkArbitrumCompatible(newcfg *ChainConfig, head *big.Int
if cArb.GenesisBlockNum != newArb.GenesisBlockNum {
return newBlockCompatError("genesisblocknum", new(big.Int).SetUint64(cArb.GenesisBlockNum), new(big.Int).SetUint64(newArb.GenesisBlockNum))
}
if cArb.MaxUncompressedBatchSize != newArb.MaxUncompressedBatchSize {
return newBlockCompatError("maxuncompressedbatchsize", new(big.Int).SetUint64(cArb.MaxUncompressedBatchSize), new(big.Int).SetUint64(newArb.MaxUncompressedBatchSize))
}
return nil
}

Expand Down
Loading