Summary
GasOracle::fetch_params computes max_fee in wei (U256) then compares it against BotConfig.max_gas_gwei which is a u64 in gwei units. The field is named max_gas_gwei and holds a value of 10 in config/default.toml, meaning the ceiling is 10 gwei = 10,000,000,000 wei.
If the comparison is max_fee > config.bot.max_gas_gwei without unit normalisation, the comparison is between a wei-scale U256 (~3,000,000,000 wei at 3 gwei baseFee x 1.25) and a raw gwei integer (10). The result is either always-true (block all txs) or always-false (never enforce ceiling) depending on type coercion.
File
crates/charon-executor/src/gas.rs — fetch_params()
Risk
The gas-ceiling gate is an off-chain safety constraint listed in CLAUDE.md. A broken ceiling check either (a) blocks every liquidation opportunity (zero revenue) or (b) never enforces the ceiling, allowing unprofitable high-gas txs to broadcast.
Fix
Convert the ceiling to wei before comparison:
let max_gas_wei = U256::from(config.bot.max_gas_gwei) * U256::from(1_000_000_000u64);
if max_fee_per_gas > max_gas_wei {
return Ok(None);
}
Alternatively rename the config field to max_gas_wei: U256 and update config/default.toml and config.rs consistently. Either path must be reflected atomically in all three files.
Refs #43
Summary
GasOracle::fetch_paramscomputesmax_feein wei (U256) then compares it againstBotConfig.max_gas_gweiwhich is au64in gwei units. The field is namedmax_gas_gweiand holds a value of10inconfig/default.toml, meaning the ceiling is 10 gwei = 10,000,000,000 wei.If the comparison is
max_fee > config.bot.max_gas_gweiwithout unit normalisation, the comparison is between a wei-scale U256 (~3,000,000,000 wei at 3 gwei baseFee x 1.25) and a raw gwei integer (10). The result is either always-true (block all txs) or always-false (never enforce ceiling) depending on type coercion.File
crates/charon-executor/src/gas.rs—fetch_params()Risk
The gas-ceiling gate is an off-chain safety constraint listed in CLAUDE.md. A broken ceiling check either (a) blocks every liquidation opportunity (zero revenue) or (b) never enforces the ceiling, allowing unprofitable high-gas txs to broadcast.
Fix
Convert the ceiling to wei before comparison:
Alternatively rename the config field to
max_gas_wei: U256and updateconfig/default.tomlandconfig.rsconsistently. Either path must be reflected atomically in all three files.Refs #43