Skip to content

Commit 9be56ff

Browse files
committed
check invalid config
1 parent d4948d5 commit 9be56ff

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

rollup/cmd/gas_oracle/app/app.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,26 @@ func action(ctx *cli.Context) error {
6666
registry := prometheus.DefaultRegisterer
6767
observability.Server(ctx, db)
6868

69+
// Init L1 connection
6970
l1RpcClient, err := rpc.Dial(cfg.L1Config.Endpoint)
7071
if err != nil {
7172
log.Crit("failed to dial raw RPC client to L1 endpoint", "endpoint", cfg.L1Config.Endpoint, "error", err)
7273
}
7374
l1client := ethclient.NewClient(l1RpcClient)
7475

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
7582
l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1RpcClient, cfg.L1Config.StartHeight, db, registry)
7683

7784
l1relayer, err := relayer.NewLayer1Relayer(ctx.Context, db, cfg.L1Config.RelayerConfig, relayer.ServiceTypeL1GasOracle, registry)
7885
if err != nil {
7986
log.Crit("failed to create new l1 relayer", "config file", cfgFile, "error", err)
8087
}
88+
8189
// Start l1 watcher process
8290
go utils.LoopWithContext(subCtx, 10*time.Second, func(ctx context.Context) {
8391
// Fetch the latest block number to decrease the delay when fetching gas prices

rollup/internal/controller/relayer/l1_relayer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ func (r *Layer1Relayer) ProcessGasPriceOracle() {
174174
return
175175
}
176176
// Cap base fee update at the configured upper limit
177-
if limit := r.cfg.GasOracleConfig.L1BaseFeeLimit; limit > 0 && baseFee > limit {
177+
if limit := r.cfg.GasOracleConfig.L1BaseFeeLimit; baseFee > limit {
178178
log.Error("L1 base fee exceed max limit, set to max limit", "baseFee", baseFee, "maxLimit", limit)
179179
r.metrics.rollupL1RelayerGasPriceOracleFeeOverLimitTotal.Inc()
180180
baseFee = limit
181181
}
182182
// Cap blob base fee update at the configured upper limit
183-
if limit := r.cfg.GasOracleConfig.L1BlobBaseFeeLimit; limit > 0 && blobBaseFee > limit {
183+
if limit := r.cfg.GasOracleConfig.L1BlobBaseFeeLimit; blobBaseFee > limit {
184184
log.Error("L1 blob base fee exceed max limit, set to max limit", "blobBaseFee", blobBaseFee, "maxLimit", limit)
185185
r.metrics.rollupL1RelayerGasPriceOracleFeeOverLimitTotal.Inc()
186186
blobBaseFee = limit

0 commit comments

Comments
 (0)