Skip to content

[wave 3] core+deploy-server: fork-based simulate with gas estimates and predicted addresses #158

Description

@robercano

What

Today simulate() is validate+compile+ordering only: PlannedStep.address is always null and there are no costs. Add an optional fork-backed simulation mode that executes the plan against an ephemeral Anvil fork of the target network, returning predicted addresses (CREATE nonce-based / CREATE2), per-step gas estimates, and total cost at current gas prices.

Scope sketch

  • core: simulate(spec, { mode: "fork", rpcUrl, ... }) — spawn/attach to an Anvil fork, run the compiled plan, collect receipts; pure plan-only mode remains the default and dependency-free.
  • deploy-server: extend POST /api/simulate with the mode (network-aware via the existing selector); stream per-step results (address, gasUsed) over the existing SSE step events.
  • studio picks this up for free in the plan view (address/gas columns populate when present) — deeper UI polish can be a follow-up.

Acceptance

Fork simulate of the sample contracts returns non-null addresses and gas per step; a spec that reverts on-chain surfaces the failing step instead of a generic error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    module:core@redeploy/core deployment enginemodule:deploy-server@redeploy/deploy-serverplannedOwner-approved for the autonomous loop (assigned ONLY by the owner)type:featureFeature work scoped to one module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions