@@ -66,17 +66,26 @@ func action(ctx *cli.Context) error {
6666 registry := prometheus .DefaultRegisterer
6767 observability .Server (ctx , db )
6868
69- l1client , err := ethclient .Dial (cfg .L1Config .Endpoint )
69+ // Init L1 connection
70+ l1RpcClient , err := rpc .Dial (cfg .L1Config .Endpoint )
7071 if err != nil {
71- log .Crit ("failed to connect l1 geth " , "config file " , cfgFile , "error" , err )
72+ log .Crit ("failed to dial raw RPC client to L1 endpoint " , "endpoint " , cfg . L1Config . Endpoint , "error" , err )
7273 }
74+ l1client := ethclient .NewClient (l1RpcClient )
7375
74- l1watcher := watcher .NewL1WatcherClient (ctx .Context , l1client , cfg .L1Config .StartHeight , db , registry )
76+ // sanity check config
77+ if cfg .L1Config .RelayerConfig .GasOracleConfig .L1BaseFeeLimit == 0 || cfg .L1Config .RelayerConfig .GasOracleConfig .L1BlobBaseFeeLimit == 0 {
78+ log .Crit ("gas-oracle `l1_base_fee_limit` and `l1_blob_base_fee_limit` configs must be set" )
79+ }
80+
81+ // Init watcher and relayer
82+ l1watcher := watcher .NewL1WatcherClient (ctx .Context , l1RpcClient , cfg .L1Config .StartHeight , db , registry )
7583
7684 l1relayer , err := relayer .NewLayer1Relayer (ctx .Context , db , cfg .L1Config .RelayerConfig , relayer .ServiceTypeL1GasOracle , registry )
7785 if err != nil {
7886 log .Crit ("failed to create new l1 relayer" , "config file" , cfgFile , "error" , err )
7987 }
88+
8089 // Start l1 watcher process
8190 go utils .LoopWithContext (subCtx , 10 * time .Second , func (ctx context.Context ) {
8291 // Fetch the latest block number to decrease the delay when fetching gas prices
0 commit comments