Skip to content

Commit

Permalink
dead-code: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes committed May 13, 2024
1 parent e2c2068 commit 4c31c51
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
19 changes: 18 additions & 1 deletion op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,31 @@ 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"
)

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.
Expand Down
26 changes: 7 additions & 19 deletions op-chain-ops/upgrades/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4c31c51

Please sign in to comment.