Skip to content

[GrantFox] Stabilize public error mapping (#1380) - #1439

Draft
s6pa1rta3n-lab wants to merge 1 commit into
Predictify-org:masterfrom
s6pa1rta3n-lab:fix-issue-1380
Draft

[GrantFox] Stabilize public error mapping (#1380)#1439
s6pa1rta3n-lab wants to merge 1 commit into
Predictify-org:masterfrom
s6pa1rta3n-lab:fix-issue-1380

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Closes #1380.

Stabilizes public error mapping across all contract variants, ensures non-colliding client code allocations, safe decoding for unknown error codes, and adds comprehensive golden vector integration test coverage.

Acceptance Criteria Checklist

  • Existing codes remain stable: All 116 existing client code mappings and discriminant values are preserved without modification.
  • New codes are unique and documented: All unmapped enum Error variants (16 new variants) have been assigned unique, non-colliding client codes in their respective domain bands and fully documented.
  • Unknown values decode safely: Error::decode_contract_code and Error::decode_client_code safely decode unknown/out-of-range integer values to PublicErrorMapping with is_known: false and fallback defaults ("UNKNOWN_ERROR").
  • Golden vectors cover public entrypoints: test_golden_vectors in error_code_tests.rs provides explicit coverage across Authentication, Market Lifecycle, Betting/Financial, Validation, Circuit Breaker, and Dispute resolution entrypoints.

Changes Included

  • contracts/predictify-hybrid/src/err.rs:
    • Defined PublicErrorMapping metadata structure.
    • Implemented exhaustive public_mapping(&self), from_contract_code, from_client_code, from_code_str, decode_contract_code, and decode_client_code functions covering all 132 Error variants.
  • contracts/predictify-hybrid/src/error_code_tests.rs:
    • Added unit test suite covering uniqueness, range validity, round-trip parsing, safe decoding of unknown values, and golden vector entrypoints.
  • contracts/predictify-hybrid/src/lib.rs:
    • Enabled mod error_code_tests; for test builds.
  • Upstream compilation repairs:
    • types.rs: Added Eq, PartialEq to BetStats.
    • admin.rs & validation.rs: Fixed ConfigValidator and OracleConfigValidator calls.
    • event_topic_compat_tests.rs: Added use alloc::format;.

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

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.

[GrantFox][Medium] Stabilize public error mapping

1 participant