diff --git a/op-deployer/pkg/deployer/integration_test/apply_test.go b/op-deployer/pkg/deployer/integration_test/apply_test.go index 39d29ed6d88..108f7930cc9 100644 --- a/op-deployer/pkg/deployer/integration_test/apply_test.go +++ b/op-deployer/pkg/deployer/integration_test/apply_test.go @@ -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" @@ -46,6 +47,8 @@ import ( "github.com/stretchr/testify/require" ) +const testCustomGasLimit = uint64(90_123_456) + type deployerKey struct{} func (d *deployerKey) HDPath() string { @@ -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") @@ -259,7 +261,6 @@ func TestGlobalOverrides(t *testing.T) { expectedUseFaultProofs := false intent.GlobalDeployOverrides = map[string]interface{}{ "l2BlockTime": float64(3), - "l2GenesisBlockGasLimit": expectedGasLimit, "baseFeeVaultRecipient": expectedBaseFeeVaultRecipient, "l1FeeVaultRecipient": expectedL1FeeVaultRecipient, "sequencerFeeVaultRecipient": expectedSequencerFeeVaultRecipient, @@ -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") @@ -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)), @@ -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") } diff --git a/op-deployer/pkg/deployer/pipeline/opchain.go b/op-deployer/pkg/deployer/pipeline/opchain.go index f44721dfd57..f038e464aaa 100644 --- a/op-deployer/pkg/deployer/pipeline/opchain.go +++ b/op-deployer/pkg/deployer/pipeline/opchain.go @@ -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, diff --git a/op-deployer/pkg/deployer/state/chain_intent.go b/op-deployer/pkg/deployer/state/chain_intent.go index 3ad1a3dea3b..727070fc146 100644 --- a/op-deployer/pkg/deployer/state/chain_intent.go +++ b/op-deployer/pkg/deployer/state/chain_intent.go @@ -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"` @@ -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") @@ -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 { diff --git a/op-deployer/pkg/deployer/state/deploy_config.go b/op-deployer/pkg/deployer/state/deploy_config.go index 05123b143e3..c43a218f449 100644 --- a/op-deployer/pkg/deployer/state/deploy_config.go +++ b/op-deployer/pkg/deployer/state/deploy_config.go @@ -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{ diff --git a/op-deployer/pkg/deployer/state/deploy_config_test.go b/op-deployer/pkg/deployer/state/deploy_config_test.go index 53d33d5874f..a91a90a8cbc 100644 --- a/op-deployer/pkg/deployer/state/deploy_config_test.go +++ b/op-deployer/pkg/deployer/state/deploy_config_test.go @@ -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" @@ -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"), diff --git a/op-deployer/pkg/deployer/state/intent.go b/op-deployer/pkg/deployer/state/intent.go index 410f0bd4369..8329dbfa023 100644 --- a/op-deployer/pkg/deployer/state/intent.go +++ b/op-deployer/pkg/deployer/state/intent.go @@ -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) } @@ -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 @@ -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, diff --git a/op-e2e/config/init.go b/op-e2e/config/init.go index 04aa0fd6209..1c8e93e0e07 100644 --- a/op-e2e/config/init.go +++ b/op-e2e/config/init.go @@ -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" @@ -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, diff --git a/op-e2e/e2eutils/intentbuilder/builder.go b/op-e2e/e2eutils/intentbuilder/builder.go index 88482bbc11a..448cb72e1c4 100644 --- a/op-e2e/e2eutils/intentbuilder/builder.go +++ b/op-e2e/e2eutils/intentbuilder/builder.go @@ -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) diff --git a/op-e2e/e2eutils/intentbuilder/builder_test.go b/op-e2e/e2eutils/intentbuilder/builder_test.go index eeffb15a14d..ecf7e19d307 100644 --- a/op-e2e/e2eutils/intentbuilder/builder_test.go +++ b/op-e2e/e2eutils/intentbuilder/builder_test.go @@ -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" @@ -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{