Skip to content

[executor] build_tx missing max_fee >= max_priority_fee guard — invalid signed envelope reaches broadcast #160

@obchain

Description

@obchain

PR: #41 (feat/executor: transaction builder + eth_call simulator)
File: crates/charon-executor/src/builder.rs — build_tx()
Refs #41

Problem

EIP-1559 requires max_fee_per_gas >= max_priority_fee_per_gas. build_tx accepts both as u128 with no validation:

pub async fn build_tx<P>(
    &self,
    provider: &P,
    calldata: Bytes,
    max_fee_per_gas: u128,
    max_priority_fee_per_gas: u128,
    gas_limit: u64,
) -> Result<TransactionRequest>

If a caller passes inverted values, alloy encodes the TransactionRequest successfully and sign() produces a valid signed envelope. The envelope is rejected by every BSC node at submission with "max priority fee per gas higher than max fee per gas". The error surfaces only at broadcast, not at build or sign time, making it a silent failure from the executor's perspective.

Fix

Add a guard at the start of build_tx:

if max_priority_fee_per_gas > max_fee_per_gas {
    anyhow::bail!(
        "max_priority_fee_per_gas ({max_priority_fee_per_gas}) > max_fee_per_gas ({max_fee_per_gas})"
    );
}

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