Commit 3c719a10 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

op-node: genesis generation (#11249)

Better logging in the genesis generation when creating L2 genesis.
Using the `startBlock()` method depends on the L1 contracts being
initialized.
parent 293c4d9b
...@@ -165,22 +165,23 @@ var Subcommands = cli.Commands{ ...@@ -165,22 +165,23 @@ var Subcommands = cli.Commands{
caller := batching.NewMultiCaller(client.Client(), batching.DefaultBatchSize) caller := batching.NewMultiCaller(client.Client(), batching.DefaultBatchSize)
sysCfg := NewSystemConfigContract(caller, config.SystemConfigProxy) sysCfg := NewSystemConfigContract(caller, config.SystemConfigProxy)
l1StartBlockNum, err := sysCfg.StartBlock(context.Background()) startBlock, err := sysCfg.StartBlock(context.Background())
if err != nil { if err != nil {
return fmt.Errorf("failed to fetch startBlock from SystemConfig: %w", err) return fmt.Errorf("failed to fetch startBlock from SystemConfig: %w", err)
} }
l1StartBlock, err := client.BlockByNumber(context.Background(), l1StartBlockNum)
log.Info("Using L1 Start Block", "number", startBlock)
l1StartBlock, err := client.BlockByNumber(context.Background(), startBlock)
if err != nil { if err != nil {
return fmt.Errorf("cannot fetch block by number: %w", err) return fmt.Errorf("cannot fetch block by number: %w", err)
} }
log.Info("Fetched L1 Start Block", "hash", l1StartBlock.Hash().Hex())
// Sanity check the config // Sanity check the config
if err := config.Check(); err != nil { if err := config.Check(); err != nil {
return err return err
} }
log.Info("Using L1 Start Block", "number", l1StartBlock.Number(), "hash", l1StartBlock.Hash().Hex())
// Build the L2 genesis block // Build the L2 genesis block
l2Genesis, err := genesis.BuildL2Genesis(config, l2Allocs, l1StartBlock) l2Genesis, err := genesis.BuildL2Genesis(config, l2Allocs, l1StartBlock)
if err != nil { if err != nil {
......
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