Skip to content

[executor] wire batchExecute calldata through Simulator::simulate gate #298

@obchain

Description

@obchain

Tracking issue spun out of #208.

Context

Batcher::encode_calldata returns Bytes that are not self-validating. Per CLAUDE.md, every liquidation tx must pass an eth_call simulation gate before broadcast. The single-opportunity path is covered by TxBuilderSimulator::simulate; the batch path does not yet have an equivalent call site wired up in the CLI pipeline.

The Rustdoc on encode_calldata now documents this contract explicitly and requires callers to run the returned calldata through Simulator::simulate before broadcast.

Scope

  • Add a batch-aware simulation helper that takes a LiquidationBatch + Bytes and dispatches Simulator::simulate against the CharonLiquidator contract.
  • Wire it into the CLI pipeline once the batcher graduates from planner-only to a producer of submitted txs.
  • Add a fork test that broadcasts a batch after a successful simulate and asserts BatchExecuted emission, mirroring the existing single-opp test.

Acceptance

  • No code path outside tests calls encode_calldata without passing the result through Simulator::simulate first.
  • Fork test covers simulate-then-broadcast for batchExecute.
  • CLAUDE.md safety invariant (eth_call gate on every broadcast) remains unviolated for the batch path.

Refs #208.

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)priority:p1-coreCore MVP scopestatus:readyScoped and ready to pick uptype:choreMaintenance, config, tooling

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions