Skip to content

Fix/sync ts contract error map - #459

Open
ayaoba24 wants to merge 2 commits into
TevaLabs:mainfrom
ayaoba24:fix/sync-ts-contract-error-map
Open

Fix/sync ts contract error map#459
ayaoba24 wants to merge 2 commits into
TevaLabs:mainfrom
ayaoba24:fix/sync-ts-contract-error-map

Conversation

@ayaoba24

Copy link
Copy Markdown

Summary

  • What changed and why?

Linked issues

Docs reference

Validation

  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cd bindings && npm ci && npm run build

Governance checklist

  • I reviewed CONTRIBUTING.md for workflow expectations
  • I reviewed the Contributor Task Matrix for domain-specific requirements
  • I checked CODEOWNERS impact for touched paths
  • I followed SUPPORT.md disclosure guidance for any security-sensitive change

Labels

  • I applied relevant labels (protocol, security, bug, enhancement, testing, blockchain, contract, Rust, priority: high/medium/low) as described in CONTRIBUTING.md

Smart-Contract Security Checklist

1. Authentication & Access Control

  • Every state-mutating method verifies caller authorization using require_auth() or appropriate admin/oracle checks.
  • Access control policies align with security specifications (e.g., admin-only vs oracle-only vs user-only).

2. Safe Arithmetic & Overflow Protection

  • Checked/safe math operations (checked_add, checked_sub, checked_mul, etc.) are used for all state changes.
  • Precision math operations use specialized safe helpers (e.g., payout_add / payout_mul) where applicable.

3. Lifecycle & State Transitions

  • Mutating actions are correctly gated by runtime mode checks (e.g., disabled during emergency modes, allowed during claims-only).
  • Invariants (like "exactly one active round") are preserved before/after execution.

4. Event Emission & Observability

  • Canonical events are emitted for all key state transitions (e.g., round created, bet placed, resolution, cancellation).
  • Forensic summary events are generated correctly with compact and stable metadata.

5. Tests & Verification

  • Unit tests cover both successful executions and expected failure/rejection paths.
  • Property/invariant tests or edge cases are added for new protocol changes.

Critical Path Changes

  • Does this PR modify contract payout, resolution, or claim paths?

    • No / Not Applicable
    • Yes (Provide an explicit note explaining the changes and the rationale below)

    If yes, note details:

    [Provide details here]

  • Are there any new failure modes introduced by these changes?

    • No / Not Applicable
    • Yes (Detail the new failure modes and how they are mitigated)

    If yes, note details:

    [Provide details here]

Snapshot policy

  • If snapshot files under contracts/test_snapshots/ changed, I reviewed the diff and confirmed every change is intentional
  • If snapshot drift was reported in CI, I either regenerated snapshots or marked the drift as expected in the PR description

ayaoba24 and others added 2 commits August 26, 2026 12:11
Add missing error variants (codes 55, 66–78) and update parity checker
to handle duplicate discriminants so error parity check passes cleanly.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Add 42 missing entries to the fromJSON block and 5 type definitions
(DeviationReferenceMode, PriceSample, GovProposal, OracleQuorumConfig,
OneSidedPolicy) so ABI parity check passes cleanly.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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.

Quality: sync TypeScript ContractError map with Rust enum

1 participant