Skip to content

Benchmark resource cost per entrypoint and fail CI on regression #76

Description

@joelpeace48-cell

Problem

Soroban meters CPU instructions and memory against a per-transaction budget.
Exceeding it makes an entrypoint permanently uncallable — for a deployed
contract, that is a bricked function with no fix short of an upgrade. Nothing
currently measures how close any entrypoint is to that ceiling.

What to do

  • Use env.budget() in tests to capture CPU and memory per entrypoint.
  • Commit a baseline and fail CI when a change exceeds it by more than a small
    threshold.
  • Measure at realistic input sizes, especially for batch operations — cost is
    usually linear in a way that only shows up at scale.
  • Publish the numbers in the README, alongside the WASM artifact sizes.
  • Track headroom explicitly: percentage of budget consumed, not just absolute
    numbers.

Acceptance criteria

  • Budget measured per entrypoint at realistic input sizes
  • Baseline committed; CI fails on regression beyond threshold
  • Headroom reported as a percentage of the limit
  • Numbers published

Notes

Do this before the contracts grow. Discovering an entrypoint is at 95% of
budget after deployment leaves no room to fix a bug in it.

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

    GrantFox OSSIssue tracked in GrantFox OSSThird CampaignCampaign: Third Campaignarea:workspaceWorkspace, build, releasedifficulty:mediumFamiliar patterns; touches a few files or conceptspriority:highNeeded for the next milestonetype:choreTooling, CI, dependencies

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions