Skip to content

fix(scval): keep the error type of non-contract errors in scValToNative - #1918

Open
Ryang-21 wants to merge 2 commits into
mainfrom
fix/scval-error-type-1905
Open

Ryang-21 wants to merge 2 commits into
mainfrom
fix/scval-error-type-1905

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

scValToNative() adds an errorType field, such as "sceStorage", to the result for an scvError that is not a contract error. humanizeEvents() gets it too, since it calls scValToNative() on topics and data.

The type, code and value fields are unchanged, and a contract error is still { type: "contract", code }.

Why

Errors with the same code and different types gave the same result. Error(Storage, ExceededLimit) and Error(Budget, ExceededLimit) both became { type: "system", code: 5, value: "scecExceededLimit" }, so a caller could not tell why a transaction failed.

Fixes #1905

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Nov 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the change to preserve non-contract error types.

No open issues 🎉

What changed in this PR

Fixes #1905 by preserving non-contract error types in scValToNative() results, allowing SDK consumers to distinguish failures such as storage and budget errors through humanizeEvents().

Changes:

  • Adds errorType to system errors while preserving existing fields and the contract-error shape.
  • Adds regression tests for all nine non-contract error types and diagnostic event topics.
  • Documents the result shape and its effect on whole-object comparisons.
File Description
test/​unit/​base/​scval.test.ts Tests all non-contract error types and unchanged contract-error output.
test/​unit/​base/​events.test.ts Tests preservation of storage and budget error types in event topics.
src/​base/​scval.ts Returns and documents errorType for non-contract errors.
docs/​reference/​core-soroban-primitives.md Updates reference documentation and source links.
CHANGELOG.md Records the fix and compatibility considerations.

Review effort: Balanced

@Ryang-21
Ryang-21 requested a review from quietbits November 24, 2026 18:45

This branch has not been deployed

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

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

scValToNative / humanizeEvents drop the ScErrorType of every non-contract error

3 participants