Skip to content

feat(sdk): map contract errors to stable SDK codes and retryable flags - #409

Merged
karagozemin merged 2 commits into
Sub-Rosa-Issue:mainfrom
tomasbogado203-bit:feat/sdk-contract-error-mapping
Oct 1, 2026
Merged

karagozemin merged 2 commits into
Sub-Rosa-Issue:mainfrom
tomasbogado203-bit:feat/sdk-contract-error-mapping

Conversation

@tomasbogado203-bit

Copy link
Copy Markdown
Contributor

Summary

Closes #397

  • Implemented comprehensive contract error mappings in \packages/sdk/src/errors.ts\ (\ROUND_CONTRACT_ERRORS, \ROUND_CONTRACT_ERRORS_BY_NAME) covering all 27 contract errors from \contracts/round/src/error_paths.rs, \contracts/round/src/types.rs, and \contracts/round/ERRORS.md.
  • Classified each contract error with accurate
    etryable\ flag:
    • Transient/lifecycle failures (\CommitNotClosed, \RevealNotOpen, \RevealStillOpen, \NotCleared, \NotVoidable) are marked
      etryable: true.
    • Permanent failures (initialization, terminal round state, parameter validation, crypto/hash mismatches, etc.) are marked
      etryable: false.
    • Unknown / unmapped error codes/names default to non-retryable (\ alse).
  • Added lookup helpers (\getRoundContractError, \isRoundContractErrorRetryable, \diffContractErrorMapping) and integrated retryable resolution into \SubRosaPreflightError.
  • Added automated drift check in \scripts/check-round-errors.mjs\ comparing \ ypes.rs, \ERRORS.md, and \packages/sdk/src/errors.ts.
  • Added test suites in \packages/sdk/src/errors.test.ts\ and \scripts/check-round-errors.test.mjs\ ensuring:
    • Every documented contract error has an SDK code.
    • Adding a fixture error without a mapping fails the test.
    • Permanent contract failures are marked non-retryable.
    • Tests do not deploy a contract.

@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@tomasbogado203-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@karagozemin
karagozemin merged commit d5e3115 into Sub-Rosa-Issue:main Oct 1, 2026
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.

Map every contract error to one stable SDK code

2 participants