fix(#382): assign unique contract error discriminants - #471
Open
iyanumajekodunmi756 wants to merge 2 commits into
Open
fix(#382): assign unique contract error discriminants#471iyanumajekodunmi756 wants to merge 2 commits into
iyanumajekodunmi756 wants to merge 2 commits into
Conversation
Keep pending-winnings expiry errors distinct from oracle timestamp errors and synchronize wallet-facing mappings and regression checks. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #382.
This PR removes the
ContractErrordiscriminant collision between oracle timestamp validation and pending-winnings expiry handling. It also synchronizes the wallet-facing TypeScript error map and documentation with the authoritative Rust enum, and adds a regression test so future duplicate discriminants are caught automatically.Changes
PendingWinningsNotExpiredthe unique stable code83.OracleTimestampOutsideWindowat code66.RotationDelayNotElapsed(55) mapping to TypeScript bindings.61to83.docs/WALLET_ERROR_GUIDE.mdwith every error code currently defined bycontracts/src/errors.rs.Compatibility / migration notes
Contract error codes are part of the client-facing ABI. Existing clients that decode code
61asPendingWinningsNotExpiredmust update to code83. Code66now unambiguously identifiesOracleTimestampOutsideWindow; clients should not use code66for pending-winnings expiry handling.No contract storage layout, event schema, method signature, or settlement behavior was changed.
Validation
Passed locally:
node scripts/check-doc-drift.jsnpm --prefix bindings run test:errorsnpm --prefix bindings run buildnpm --prefix bindings run lintgit diff --checkRust validation could not be run in the execution environment because
cargois not installed. The existing broader ABI parity command also reports pre-existing contract-method drift unrelated to this issue; the error enum parity portion passes.Review checklist
ContractErrorvariant has a uniqueu32discriminant.closes #382