Skip to content

fix: do not misreport a VM resource limit when debugging - #457

Merged
rkalis merged 2 commits into
nextfrom
fix/debug-resource-limit-errors
Sep 29, 2026
Merged

rkalis merged 2 commits into
nextfrom
fix/debug-resource-limit-errors

Conversation

@mr-zwets

Copy link
Copy Markdown
Member

On behalf of Mathieu G. (mr-zwets), drafted with Claude Opus 5.5.

Fixes #456. A VM resource limit such as the operation cost density limit is counted per operation, so a transaction can run out of budget on any instruction. debug() misreported that in two ways:

  • On the instruction a require statement ends in, it reported a FailedRequireError for that require, although its condition held. Resource-limit errors (operation cost, hashing, signature check count, operation count) now skip the require lookup.
  • On an instruction in a branch that is not taken, which still costs operations, the step was filtered out as not executed, so the error was lost and the reason became "Unsuccessful evaluation: completed with a non-truthy value". The step that raised the error is now kept.

Both are now reported as a FailedTransactionEvaluationError with libauth's reason. This uses a block-list of resource limits rather than an allow-list of verify-type errors, so timelock failures and other errors raised on a require's own opcode stay attributed to that require.

The new test scans the loop count and padding of a small hashing-loop contract so the budget runs out across the loop and the require statements after it. It asserts that every failure is a FailedTransactionEvaluationError carrying the operation-cost reason, and that the scan hits a require's instruction. It fails without the fix. SDK tests, lint and spellcheck pass.

A resource limit such as the operation cost density limit is counted per
operation, so it can be reached on any instruction. Debugging misreported
it in two ways:

- On the instruction a require statement ends in, it was attributed to
  that require, so the transaction was reported as a FailedRequireError
  for a require whose condition held. Resource limit errors now skip the
  require lookup.
- On an instruction in a branch that is not taken, which still costs
  operations, the step was filtered out as not executed. The error was
  lost and the reason became "Unsuccessful evaluation". The step that
  raised the error is now kept.

Both are reported as a FailedTransactionEvaluationError with the libauth
reason.

Closes #456

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cashscript Ready Ready Preview Sep 29, 2026 8:31am UTC

Request Review

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.35%. Comparing base (2a2e050) to head (6a914be).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next     #457      +/-   ##
==========================================
+ Coverage   89.34%   89.35%   +0.01%     
==========================================
  Files          61       61              
  Lines        5048     5053       +5     
  Branches      942      946       +4     
==========================================
+ Hits         4510     4515       +5     
  Misses        413      413              
  Partials      125      125              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Simplify the description of a VM resource limit bug fix in debugging.

This branch was successfully deployed

1 active deployment
Preview — 6a914be5 Deployed Sep 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants