Skip to content

[submit] Submitter returns anyhow::Error — pipeline cannot route Timeout vs RpcRejected vs ConnectionLost #195

@obchain

Description

@obchain

Refs #44

File: crates/charon-executor/src/submit.rs

Problem

submit() returns anyhow::Result. The pipeline must distinguish:

  • Timeout: resync nonce, drop opportunity, try next opportunity
  • RpcRejected (revert/bad nonce/bad signature): drop opportunity, do NOT resync
  • ConnectionLost: reinitialise submitter, retry next tick

With anyhow these collapse to a string. Same recurring issue as PR #41 finding 6 (#163), PR #43 finding 9 (#187).

Fix

Define structured error in submit.rs:

#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum SubmitError {
    #[error("submission timed out after {0:?}")]
    Timeout(std::time::Duration),
    #[error("rpc rejected: {0}")]
    RpcRejected(String),
    #[error("connection lost: {0}")]
    ConnectionLost(#[source] alloy::transports::TransportError),
    #[error("insecure scheme: {0}")]
    InsecureScheme(String),
}

Change submit() to return Result<TxHash, SubmitError>.

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