Skip to content

Compiled artifact carries no compute-budget estimate; required commitment is discoverable only by node rejection #243

Description

@mw-pearson

Summary

Spending a compiled contract requires committing a computeBudget on the
input. The artifact JSON contains no estimate of what a contract's entry
will cost, and I could not find a documented way to obtain one, so the
working procedure on TN10 is: submit, read the rejection, commit the printed
number.

Environment: silverscript v1-rc1 (c7d17a1) · rustc/cargo 1.98.0 · TN10
node kaspad v2.0.1 · macOS (Apple Silicon).

Current behavior

Measured example (contract: one r0.succinct.verify call with a
222,668-byte seal, plus output-value and output-script introspection):

  • Commit 2,501 → rejected: script units exceeded the amount committed in the input: used=25446424, limit=25019999
  • Commit 2,543 → rejected: used=25446424, limit=25439999
  • Commit 2,544 → accepted (TN10 txid
    3b32c7bdcf22776c78bae81e4fd40fcfedeab994b94800997c60ddffc2cfde50, and
    boundary-tested again at
    e409473c97d470d0b87ac909cb24e923bad707f3d704127a89d6fca2301764a3).

Two measurements that may help scope a fix:

  • used was identical (25,446,424) across two different receipts of the
    same byte-length through the same script — the meter appears
    payload-invariant, so a static per-entry estimate looks feasible.
  • The compiler already does conservative per-entry sizing for the
    signature-script-limit check
    (compiler_rejects_entry_abis_that_cannot_fit_the_unlocking_stack), so
    machinery for per-entry static analysis exists.

Expected behavior

An estimated (or upper-bound) script-unit cost per entry in the artifact
JSON, or a silverc flag that prints one.

Impact

Tooling ergonomics. Trial-by-rejection works on a testnet; it is a poor fit
for anything unattended.

Acceptance criteria

  • A per-entry cost estimate is obtainable from the artifact or the CLI
    without submitting a transaction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions