Skip to content

test: err.rs code stability test#807

Open
Gbotemi-ojo wants to merge 1 commit into
Predictify-org:masterfrom
Gbotemi-ojo:task/err-stability
Open

test: err.rs code stability test#807
Gbotemi-ojo wants to merge 1 commit into
Predictify-org:masterfrom
Gbotemi-ojo:task/err-stability

Conversation

@Gbotemi-ojo

Copy link
Copy Markdown
Contributor

Summary

Freezes all 93 client-facing error code discriminants in contracts/predictify-hybrid/src/err.rs with a dedicated stability test suite.

Changes

err_stability.rs (new test)

  • 6 test functions covering every error variant: user operations (100-112), oracle (200-214), validation (300-304), general/state (400-441), override replay (526), and circuit breaker (500-527).
  • total_variant_count() asserts exactly 93 variants exist, catching accidental insertions/deletions that would shift discriminants.
  • All numeric values are frozen — any reordering, deletion, or insertion without an explicit discriminant will fail CI.

err.rs (bug fixes)

  • Removed duplicate ReplayedOverride = 442 (conflicted with ReplayedOverride = 526).
  • Removed dead match arms referencing non-existent ForceResolveReplayed and ForceResolveReasonEmpty.
  • Fixed InsufficientStorageRentOperationWouldExceedBudget in description().
  • Added missing OperationWouldExceedBudget and ForceResolveAlreadyUsed to both description() and code().

Related fixes

  • storage.rs, market_creation_validation_tests.rs: InsufficientStorageRentInsufficientStorageRentBudget.

Verification

  • rustfmt clean on all touched files.
  • cargo test cannot run due to 245 pre-existing compilation errors in other modules (unrelated to this change).

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.

1 participant