Skip to content

[PR #29] max_gas_gwei: u64 truncates sub-gwei priority fee — use wei #78

@obchain

Description

@obchain

PR: #29 (feat/04-toml-config-loader)
File: crates/charon-core/src/config.rs, line 38 (BotConfig.max_gas_gwei)

Gas ceiling in whole gwei. EIP-1559 priority fee on BSC often sub-gwei (0.1, 0.5). Gas oracle in PR #43 returns wei; comparison against max_gas_gwei * 1e9 loses precision. Operator cannot express "cap at 0.5 gwei."

Impact: Cannot tune bot for low-fee periods on BSC where tight gas caps are competitive advantage. Coarse truncation lowers hit rate.

Fix:

pub max_gas_wei: U256,

TOML via decimal string + custom serde deser (alloy already provides from_str on U256). Or keep gwei but switch to f64 — rejected per money-float rule. Preferred:

max_gas_wei = "3000000000"   # 3 gwei

with serde deserialize_with parsing decimal or hex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p1-coreCore MVP scope

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions