Skip to content

[executor] maxFeePerGas = base x 1.25 insufficient headroom — txs will get stuck on rising base fee #181

@obchain

Description

@obchain

Summary

fetch_params sets max_fee_per_gas = base_fee x 1.25. The EIP-1559 specification recommends:

maxFeePerGas = 2 x baseFee + maxPriorityFeePerGas

The 2x multiplier provides headroom for two consecutive max-upward base-fee adjustments (+12.5% per block). BSC's block time is ~3 seconds, so a base-fee surge during a liquidation-heavy event (large market drop triggering mass liquidations) can double in roughly 18 seconds — well within the realistic window between opportunity detection and tx inclusion.

With a 1.25x multiplier, a single block with target-exceeded gas usage causes the baseFee to rise by 12.5%, placing the new baseFee above max_fee_per_gas. The tx is then not includable in any subsequent block until baseFee falls back, which can take minutes. During that window, competing bots with correct headroom execute the liquidation.

File

crates/charon-executor/src/gas.rsfetch_params()

Risk

Liquidation transactions stuck in mempool during precisely the market-stress conditions where the most opportunities exist. Revenue loss.

Fix

let max_fee_per_gas = base_fee * U256::from(2) + priority_fee_wei;

The 2x base is the canonical recommendation and gives two blocks of margin. Ensure the ceiling check still applies after this change.

Refs #43

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p1-coreCore MVP scopestatus:readyScoped and ready to pick up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions