Commit f9a51b90 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #3908 from ethereum-optimism/devnet-genesis-gaslimit-fix

op-node: set initial system config gaslimit, check initial values
parents 141982eb 3605d12a
......@@ -99,8 +99,8 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
OptimismL1FeeRecipient: predeploys.L1FeeVaultAddr,
L2CrossDomainMessengerOwner: common.Address{0: 0x52, 19: 0xf3}, // tbd
GasPriceOracleOwner: addresses.Alice, // tbd
GasPriceOracleOverhead: 0,
GasPriceOracleScalar: 0,
GasPriceOracleOverhead: 2100,
GasPriceOracleScalar: 1_000_000,
DeploymentWaitConfirmations: 1,
EIP1559Elasticity: 2,
......
......@@ -665,6 +665,7 @@ func TestL1InfoContract(t *testing.T) {
}
// calcGasFees determines the actual cost of the transaction given a specific basefee
// This does not include the L1 data fee charged from L2 transactions.
func calcGasFees(gasUsed uint64, gasTipCap *big.Int, gasFeeCap *big.Int, baseFee *big.Int) *big.Int {
x := new(big.Int).Add(gasTipCap, baseFee)
// If tip + basefee > gas fee cap, clamp it to the gas fee cap
......@@ -793,6 +794,7 @@ func TestWithdrawals(t *testing.T) {
// Take fee into account
diff = new(big.Int).Sub(startBalance, endBalance)
fees := calcGasFees(receipt.GasUsed, tx.GasTipCap(), tx.GasFeeCap(), header.BaseFee)
fees = fees.Add(fees, receipt.L1Fee)
diff = diff.Sub(diff, fees)
require.Equal(t, withdrawAmount, diff)
......
......@@ -109,6 +109,9 @@ var Subcommands = cli.Commands{
if config.L1StartingBlockTag == nil {
return errors.New("must specify a starting block tag in genesis")
}
if config.L2GenesisBlockGasLimit == 0 { // TODO: this is a hotfix, need to set default values in more clean way + sanity check the config
config.L2GenesisBlockGasLimit = 15_000_000
}
client, err := ethclient.Dial(ctx.String("l1-rpc"))
if err != nil {
......@@ -164,6 +167,9 @@ var Subcommands = cli.Commands{
}
rollupConfig := makeRollupConfig(config, l1StartBlock, l2Genesis, portalProxy.Address, sysCfgProxy.Address)
if err := rollupConfig.Check(); err != nil {
return fmt.Errorf("generated rollup config does not pass validation: %w", err)
}
if err := writeGenesisFile(ctx.String("outfile.l2"), l2Genesis); err != nil {
return err
......
......@@ -81,6 +81,18 @@ func (cfg *Config) Check() error {
if cfg.Genesis.L2Time == 0 {
return errors.New("missing L2 genesis time")
}
if cfg.Genesis.SystemConfig.BatcherAddr == (common.Address{}) {
return errors.New("missing genesis system config batcher address")
}
if cfg.Genesis.SystemConfig.Overhead == (eth.Bytes32{}) {
return errors.New("missing genesis system config overhead")
}
if cfg.Genesis.SystemConfig.Scalar == (eth.Bytes32{}) {
return errors.New("missing genesis system config scalar")
}
if cfg.Genesis.SystemConfig.GasLimit == 0 {
return errors.New("missing genesis system config gas limit")
}
if cfg.P2PSequencerAddress == (common.Address{}) {
return errors.New("missing p2p sequencer address")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment