Skip to content

[executor] gas.rs and nonce.rs return anyhow::Result — violates repo thiserror convention #187

@obchain

Description

@obchain

Summary

Per the repo convention established in PRs #28, #40, and #41, all library-boundary error types must be thiserror enums so callers can match on specific variants to determine routing: drop opportunity, retry, or abort pipeline. anyhow::Result erases variant identity.

For gas.rs the variants needed are:

  • MissingBaseFee — retry on next block (transient, not fatal)
  • CeilingExceeded — skip this tx (not an error condition at all)
  • Provider(e) — retry with backoff
  • Overflow — abort pipeline (invariant violation)

For nonce.rs:

  • Provider(e) — retry

Without variant discrimination, the executor pipeline treats all gas oracle failures identically. A transient RPC error halts the bot; a ceiling-exceeded event surfaces as an error log instead of a skip metric.

Files

  • crates/charon-executor/src/gas.rs
  • crates/charon-executor/src/nonce.rs

Fix

#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum GasError {
    #[error("baseFeePerGas absent from block header")]
    MissingBaseFee,
    #[error("provider error: {0}")]
    Provider(#[from] alloy::transports::TransportError),
    #[error("arithmetic overflow in gas calculation")]
    Overflow,
}

#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum NonceError {
    #[error("provider error: {0}")]
    Provider(#[from] alloy::transports::TransportError),
}

Verify thiserror is in the workspace Cargo.toml [workspace.dependencies] (flagged as missing in PR #40 Finding 4).

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