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
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.
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
env.budget()in tests to capture CPU and memory per entrypoint.threshold.
usually linear in a way that only shows up at scale.
numbers.
Acceptance criteria
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.