Summary
GasOracle::fetch_params reads baseFeePerGas from the latest block header. BSC mainnet has emitted this field since the London-equivalent hard fork (Nov 2021, block ~13,082,000). However several failure modes produce a null value:
- Private or load-balanced RPC nodes that strip EIP-1559 fields from
eth_getBlockByNumber responses
- A BSC reorg that serves a block header before the executor has fully consumed it
- RPC libraries that deserialise missing optional fields as
None rather than propagating an error
If baseFeePerGas is None, the current implementation will propagate an error that stalls the gas oracle. Since the gas oracle is called before every liquidation, a single malformed block response causes all opportunities to be silently dropped until the next successful fetch. There is no fallback to eth_gasPrice (type-0 pricing) and no metric emitted.
File
crates/charon-executor/src/gas.rs — fetch_params()
Risk
Silent opportunity loss. A persistent RPC issue that omits EIP-1559 fields halts the bot with no clear error metric — only a log line.
Fix
Add a fallback:
let base_fee = block.header.base_fee_per_gas
.ok_or(GasError::MissingBaseFee)
.or_else(|_| {
warn!("baseFeePerGas absent from block, falling back to eth_gasPrice");
provider.get_gas_price().await.map_err(GasError::Provider)
})?;
Refs #43
Summary
GasOracle::fetch_paramsreadsbaseFeePerGasfrom the latest block header. BSC mainnet has emitted this field since the London-equivalent hard fork (Nov 2021, block ~13,082,000). However several failure modes produce a null value:eth_getBlockByNumberresponsesNonerather than propagating an errorIf
baseFeePerGasisNone, the current implementation will propagate an error that stalls the gas oracle. Since the gas oracle is called before every liquidation, a single malformed block response causes all opportunities to be silently dropped until the next successful fetch. There is no fallback toeth_gasPrice(type-0 pricing) and no metric emitted.File
crates/charon-executor/src/gas.rs—fetch_params()Risk
Silent opportunity loss. A persistent RPC issue that omits EIP-1559 fields halts the bot with no clear error metric — only a log line.
Fix
Add a fallback:
Refs #43