Commit 6c76ac76 authored by protolambda's avatar protolambda

op-node: set initial system config gaslimit, check initial values

parent e8ed2453
...@@ -109,6 +109,9 @@ var Subcommands = cli.Commands{ ...@@ -109,6 +109,9 @@ var Subcommands = cli.Commands{
if config.L1StartingBlockTag == nil { if config.L1StartingBlockTag == nil {
return errors.New("must specify a starting block tag in genesis") 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")) client, err := ethclient.Dial(ctx.String("l1-rpc"))
if err != nil { if err != nil {
...@@ -164,6 +167,9 @@ var Subcommands = cli.Commands{ ...@@ -164,6 +167,9 @@ var Subcommands = cli.Commands{
} }
rollupConfig := makeRollupConfig(config, l1StartBlock, l2Genesis, portalProxy.Address, sysCfgProxy.Address) 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 { if err := writeGenesisFile(ctx.String("outfile.l2"), l2Genesis); err != nil {
return err return err
......
...@@ -81,6 +81,18 @@ func (cfg *Config) Check() error { ...@@ -81,6 +81,18 @@ func (cfg *Config) Check() error {
if cfg.Genesis.L2Time == 0 { if cfg.Genesis.L2Time == 0 {
return errors.New("missing L2 genesis time") 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{}) { if cfg.P2PSequencerAddress == (common.Address{}) {
return errors.New("missing p2p sequencer 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