diff --git a/op-chain-ops/genesis/config.go b/op-chain-ops/genesis/config.go index a58e5925cdef..4e9d3fe24f0b 100644 --- a/op-chain-ops/genesis/config.go +++ b/op-chain-ops/genesis/config.go @@ -20,7 +20,6 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum-optimism/optimism/op-chain-ops/upgrades" "github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-service/eth" ) @@ -28,6 +27,24 @@ import ( var ( ErrInvalidDeployConfig = errors.New("invalid deploy config") ErrInvalidImmutablesConfig = errors.New("invalid immutables config") + // MaximumBaseFee represents the max base fee for deposits, since + // there is an on chain EIP-1559 curve for deposits purchasing L2 gas. + // It is type(uint128).max in solidity. + MaximumBaseFee, _ = new(big.Int).SetString("ffffffffffffffffffffffffffffffff", 16) +) + +const ( + // MaxResourceLimit represents the maximum amount of L2 gas that a single deposit can use. + MaxResourceLimit = 20_000_000 + // ElasticityMultiplier represents the elasticity of the deposit EIP-1559 fee market. + ElasticityMultiplier = 10 + // BaseFeeMaxChangeDenominator represents the maximum change in base fee per block. + BaseFeeMaxChangeDenominator = 8 + // MinimumBaseFee represents the minimum base fee for deposits. + MinimumBaseFee = params.GWei + // SystemTxMaxGas represents the maximum gas that a system transaction can use + // when it is included with user deposits. + SystemTxMaxGas = 1_000_000 ) // DeployConfig represents the deployment configuration for an OP Stack chain. diff --git a/op-chain-ops/upgrades/check.go b/op-chain-ops/upgrades/check.go index 4a4bb1ce6333..c773df18d5d6 100644 --- a/op-chain-ops/upgrades/check.go +++ b/op-chain-ops/upgrades/check.go @@ -3,41 +3,29 @@ package upgrades import ( "context" "fmt" - "math/big" "strings" + "github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/upgrades/bindings" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum-optimism/superchain-registry/superchain" ) var ( - // uint128Max is type(uint128).max and is set in the init function. - uint128Max = new(big.Int) // The default values for the ResourceConfig, used as part of // an EIP-1559 curve for deposit gas. DefaultResourceConfig = bindings.ResourceMeteringResourceConfig{ - MaxResourceLimit: 20_000_000, - ElasticityMultiplier: 10, - BaseFeeMaxChangeDenominator: 8, - MinimumBaseFee: params.GWei, - SystemTxMaxGas: 1_000_000, + MaxResourceLimit: genesis.MaxResourceLimit, + ElasticityMultiplier: genesis.ElasticityMultiplier, + BaseFeeMaxChangeDenominator: genesis.BaseFeeMaxChangeDenominator, + MinimumBaseFee: genesis.MinimumBaseFee, + SystemTxMaxGas: genesis.SystemTxMaxGas, + MaximumBaseFee: genesis.MaximumBaseFee, } ) -func init() { - var ok bool - uint128Max, ok = new(big.Int).SetString("ffffffffffffffffffffffffffffffff", 16) - if !ok { - panic("bad uint128Max") - } - // Set the maximum base fee on the default config. - DefaultResourceConfig.MaximumBaseFee = uint128Max -} - // CheckL1 will check that the versions of the contracts on L1 match the versions // in the superchain registry. func CheckL1(ctx context.Context, list *superchain.ImplementationList, backend bind.ContractBackend) error {