Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions op-deployer/pkg/deployer/integration_test/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"time"

"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/bootstrap"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/inspect"
"github.com/ethereum/go-ethereum/params"

"github.com/ethereum-optimism/optimism/op-service/testutils"
Expand Down Expand Up @@ -46,6 +47,8 @@ import (
"github.com/stretchr/testify/require"
)

const testCustomGasLimit = uint64(90_123_456)

type deployerKey struct{}

func (d *deployerKey) HDPath() string {
Expand Down Expand Up @@ -247,7 +250,6 @@ func TestGlobalOverrides(t *testing.T) {
defer cancel()

opts, intent, st := setupGenesisChain(t, devnet.DefaultChainID)
expectedGasLimit := strings.ToLower("0x1C9C380")
expectedBaseFeeVaultRecipient := common.HexToAddress("0x0000000000000000000000000000000000000001")
expectedL1FeeVaultRecipient := common.HexToAddress("0x0000000000000000000000000000000000000002")
expectedSequencerFeeVaultRecipient := common.HexToAddress("0x0000000000000000000000000000000000000003")
Expand All @@ -259,7 +261,6 @@ func TestGlobalOverrides(t *testing.T) {
expectedUseFaultProofs := false
intent.GlobalDeployOverrides = map[string]interface{}{
"l2BlockTime": float64(3),
"l2GenesisBlockGasLimit": expectedGasLimit,
Comment thread
bitwiseguy marked this conversation as resolved.
"baseFeeVaultRecipient": expectedBaseFeeVaultRecipient,
"l1FeeVaultRecipient": expectedL1FeeVaultRecipient,
"sequencerFeeVaultRecipient": expectedSequencerFeeVaultRecipient,
Expand All @@ -276,7 +277,6 @@ func TestGlobalOverrides(t *testing.T) {
cfg, err := state.CombineDeployConfig(intent, intent.Chains[0], st, st.Chains[0])
require.NoError(t, err)
require.Equal(t, uint64(3), cfg.L2InitializationConfig.L2CoreDeployConfig.L2BlockTime, "L2 block time should be 3 seconds")
require.Equal(t, expectedGasLimit, strings.ToLower(cfg.L2InitializationConfig.L2GenesisBlockDeployConfig.L2GenesisBlockGasLimit.String()), "L2 Genesis Block Gas Limit should be 30_000_000")
require.Equal(t, expectedBaseFeeVaultRecipient, cfg.L2InitializationConfig.L2VaultsDeployConfig.BaseFeeVaultRecipient, "Base Fee Vault Recipient should be the expected address")
require.Equal(t, expectedL1FeeVaultRecipient, cfg.L2InitializationConfig.L2VaultsDeployConfig.L1FeeVaultRecipient, "L1 Fee Vault Recipient should be the expected address")
require.Equal(t, expectedSequencerFeeVaultRecipient, cfg.L2InitializationConfig.L2VaultsDeployConfig.SequencerFeeVaultRecipient, "Sequencer Fee Vault Recipient should be the expected address")
Expand Down Expand Up @@ -704,6 +704,7 @@ func newChainIntent(t *testing.T, dk *devkeys.MnemonicDevKeys, l1ChainID *big.In
Eip1559DenominatorCanyon: standard.Eip1559DenominatorCanyon,
Eip1559Denominator: standard.Eip1559Denominator,
Eip1559Elasticity: standard.Eip1559Elasticity,
GasLimit: testCustomGasLimit,
Roles: state.ChainRoles{
L1ProxyAdminOwner: addrFor(t, dk, devkeys.L2ProxyAdminOwnerRole.Key(l1ChainID)),
L2ProxyAdminOwner: addrFor(t, dk, devkeys.L2ProxyAdminOwnerRole.Key(l1ChainID)),
Expand Down Expand Up @@ -840,6 +841,12 @@ func validateOPChainDeployment(t *testing.T, cg codeGetter, st *state.State, int
require.False(t, ok, "governance token should not be deployed by default")
}

genesis, rollup, err := inspect.GenesisAndRollup(st, chainState.ID)
require.NoError(t, err)
require.Equal(t, rollup.Genesis.SystemConfig.GasLimit, testCustomGasLimit, "rollup gasLimit")
require.Equal(t, genesis.GasLimit, testCustomGasLimit, "genesis gasLimit")

require.Equal(t, chainIntent.GasLimit, testCustomGasLimit, "chainIntent gasLimit")
require.Equal(t, int(chainIntent.Eip1559Denominator), 50, "EIP1559Denominator should be set")
require.Equal(t, int(chainIntent.Eip1559Elasticity), 6, "EIP1559Elasticity should be set")
}
Expand Down
2 changes: 1 addition & 1 deletion op-deployer/pkg/deployer/pipeline/opchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func makeDCI(intent *state.Intent, thisIntent *state.ChainIntent, chainID common
L2ChainId: chainID.Big(),
Opcm: st.ImplementationsDeployment.OpcmImpl,
SaltMixer: st.Create2Salt.String(), // passing through salt generated at state initialization
GasLimit: standard.GasLimit,
GasLimit: thisIntent.GasLimit,
DisputeGameType: proofParams.DisputeGameType,
DisputeAbsolutePrestate: proofParams.DisputeAbsolutePrestate,
DisputeMaxGameDepth: proofParams.DisputeMaxGameDepth,
Expand Down
7 changes: 7 additions & 0 deletions op-deployer/pkg/deployer/state/chain_intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type ChainIntent struct {
Eip1559DenominatorCanyon uint64 `json:"eip1559DenominatorCanyon" toml:"eip1559DenominatorCanyon"`
Eip1559Denominator uint64 `json:"eip1559Denominator" toml:"eip1559Denominator"`
Eip1559Elasticity uint64 `json:"eip1559Elasticity" toml:"eip1559Elasticity"`
GasLimit uint64 `json:"gasLimit" toml:"gasLimit"`
Roles ChainRoles `json:"roles" toml:"roles"`
DeployOverrides map[string]any `json:"deployOverrides" toml:"deployOverrides"`
DangerousAltDAConfig genesis.AltDADeployConfig `json:"dangerousAltDAConfig,omitempty" toml:"dangerousAltDAConfig,omitempty"`
Expand All @@ -87,6 +88,7 @@ type ChainRoles struct {
}

var ErrFeeVaultZeroAddress = fmt.Errorf("chain has a fee vault set to zero address")
var ErrGasLimitZeroValue = fmt.Errorf("chain has a gas limit set to zero value")
var ErrNonStandardValue = fmt.Errorf("chain contains non-standard config value")
var ErrEip1559ZeroValue = fmt.Errorf("eip1559 param is set to zero value")
var ErrIncompatibleValue = fmt.Errorf("chain contains incompatible config value")
Expand All @@ -105,6 +107,11 @@ func (c *ChainIntent) Check() error {
c.Eip1559Elasticity == 0 {
return fmt.Errorf("%w: chainId=%s", ErrEip1559ZeroValue, c.ID)
}

if c.GasLimit == 0 {
return fmt.Errorf("%w: chainId=%s", ErrGasLimitZeroValue, c.ID)
}

if c.BaseFeeVaultRecipient == emptyAddress ||
c.L1FeeVaultRecipient == emptyAddress ||
c.SequencerFeeVaultRecipient == emptyAddress {
Expand Down
2 changes: 1 addition & 1 deletion op-deployer/pkg/deployer/state/deploy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func CombineDeployConfig(intent *Intent, chainIntent *ChainIntent, state *State,
FundDevAccounts: intent.FundDevAccounts,
},
L2GenesisBlockDeployConfig: genesis.L2GenesisBlockDeployConfig{
L2GenesisBlockGasLimit: 60_000_000,
L2GenesisBlockGasLimit: hexutil.Uint64(chainIntent.GasLimit),
L2GenesisBlockBaseFeePerGas: &l2GenesisBlockBaseFeePerGas,
},
L2VaultsDeployConfig: genesis.L2VaultsDeployConfig{
Expand Down
2 changes: 2 additions & 0 deletions op-deployer/pkg/deployer/state/deploy_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/ethereum-optimism/optimism/op-chain-ops/addresses"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/artifacts"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/stretchr/testify/require"
Expand All @@ -21,6 +22,7 @@ func TestCombineDeployConfig(t *testing.T) {
chainIntent := ChainIntent{
Eip1559Denominator: 1,
Eip1559Elasticity: 2,
GasLimit: standard.GasLimit,
BaseFeeVaultRecipient: common.HexToAddress("0x123"),
L1FeeVaultRecipient: common.HexToAddress("0x456"),
SequencerFeeVaultRecipient: common.HexToAddress("0x789"),
Expand Down
7 changes: 6 additions & 1 deletion op-deployer/pkg/deployer/state/intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ func (c *Intent) validateStandardValues() error {
chain.Eip1559Elasticity != standard.Eip1559Elasticity {
return fmt.Errorf("%w: chainId=%s", ErrNonStandardValue, chain.ID)
}
if chain.GasLimit != standard.GasLimit {
return fmt.Errorf("%w: chainId=%s", ErrNonStandardValue, chain.ID)
}
if len(chain.AdditionalDisputeGames) > 0 {
return fmt.Errorf("%w: chainId=%s additionalDisputeGames must be nil", ErrNonStandardValue, chain.ID)
}
Expand Down Expand Up @@ -293,7 +296,8 @@ func NewIntentCustom(l1ChainId uint64, l2ChainIds []common.Hash) (Intent, error)

for _, l2ChainID := range l2ChainIds {
intent.Chains = append(intent.Chains, &ChainIntent{
ID: l2ChainID,
ID: l2ChainID,
GasLimit: standard.GasLimit,
})
}
return intent, nil
Expand Down Expand Up @@ -332,6 +336,7 @@ func NewIntentStandard(l1ChainId uint64, l2ChainIds []common.Hash) (Intent, erro
Eip1559DenominatorCanyon: standard.Eip1559DenominatorCanyon,
Eip1559Denominator: standard.Eip1559Denominator,
Eip1559Elasticity: standard.Eip1559Elasticity,
GasLimit: standard.GasLimit,
Roles: ChainRoles{
Challenger: challenger,
L1ProxyAdminOwner: l1ProxyAdminOwner,
Expand Down
2 changes: 2 additions & 0 deletions op-e2e/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/artifacts"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/inspect"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -386,6 +387,7 @@ func defaultIntent(root string, loc *artifacts.Locator, deployer common.Address,
Eip1559Denominator: 250,
Eip1559DenominatorCanyon: 250,
Eip1559Elasticity: 6,
GasLimit: standard.GasLimit,
Roles: state.ChainRoles{
// Use deployer as L1PAO to deploy additional dispute impls
L1ProxyAdminOwner: deployer,
Expand Down
1 change: 1 addition & 0 deletions op-e2e/e2eutils/intentbuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func (b *intentBuilder) WithL2(l2ChainID eth.ChainID) (Builder, L2Configurator)
Eip1559DenominatorCanyon: standard.Eip1559DenominatorCanyon,
Eip1559Denominator: standard.Eip1559Denominator,
Eip1559Elasticity: standard.Eip1559Elasticity,
GasLimit: standard.GasLimit,
DeployOverrides: make(map[string]any),
}
b.intent.Chains = append(b.intent.Chains, chainIntent)
Expand Down
2 changes: 2 additions & 0 deletions op-e2e/e2eutils/intentbuilder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/ethereum-optimism/optimism/op-chain-ops/addresses"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/artifacts"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-service/eth"
Expand Down Expand Up @@ -157,6 +158,7 @@ func TestBuilder(t *testing.T) {
Eip1559DenominatorCanyon: 250,
Eip1559Denominator: 50,
Eip1559Elasticity: 10,
GasLimit: standard.GasLimit,
OperatorFeeScalar: 100,
OperatorFeeConstant: 200,
DeployOverrides: map[string]any{
Expand Down