Summary
All three unit tests in gas.rs test pure functions (gas_cost_usd_cents, edge-case arithmetic, overflow saturation). No test calls fetch_params against a live or fork BSC provider to verify:
baseFeePerGas is non-null in a real BSC block response from the configured RPC endpoints
- The computed
max_fee_per_gas is within a sane range (e.g. 1-100 gwei)
- The
priority_fee_gwei conversion produces the correct wei value in the returned GasParams
Given that the null-baseFee failure mode (Issue 2 in this review) exists and causes a complete gas oracle halt, the absence of a live test means the guard is unverified against the actual BSC RPC infrastructure the bot will use in production.
File
crates/charon-executor/src/gas.rs
Fix
Add an #[ignore] integration test, skipped in standard CI but runnable manually and in the BSC fork environment:
#[tokio::test]
#[ignore = "requires live BNB_HTTP_URL env var"]
async fn fetch_params_returns_sane_values_on_bsc() {
let url = std::env::var("BNB_HTTP_URL")
.expect("BNB_HTTP_URL must be set to run this test");
let provider = ProviderBuilder::new().on_http(url.parse().unwrap());
let cfg = /* minimal config with max_gas_gwei = 100 */;
let oracle = GasOracle::new(&cfg);
let result = oracle.fetch_params(&provider, 0).await.unwrap();
let GasDecision::Proceed(params) = result else {
panic!("ceiling hit unexpectedly with gwei ceiling = 100");
};
assert!(params.max_fee_per_gas >= U256::from(1_000_000_000u64), "max_fee below 1 gwei");
assert!(params.max_fee_per_gas <= U256::from(100_000_000_000u64), "max_fee above 100 gwei");
assert!(params.max_priority_fee >= U256::from(1_000_000_000u64), "priority fee below 1 gwei");
}
Refs #43
Summary
All three unit tests in
gas.rstest pure functions (gas_cost_usd_cents, edge-case arithmetic, overflow saturation). No test callsfetch_paramsagainst a live or fork BSC provider to verify:baseFeePerGasis non-null in a real BSC block response from the configured RPC endpointsmax_fee_per_gasis within a sane range (e.g. 1-100 gwei)priority_fee_gweiconversion produces the correct wei value in the returnedGasParamsGiven that the null-baseFee failure mode (Issue 2 in this review) exists and causes a complete gas oracle halt, the absence of a live test means the guard is unverified against the actual BSC RPC infrastructure the bot will use in production.
File
crates/charon-executor/src/gas.rsFix
Add an
#[ignore]integration test, skipped in standard CI but runnable manually and in the BSC fork environment:Refs #43