Skip to content

Fix double-emission of OracleResultEvent in resolution.rs fallback path #670

Description

@greatest0fallt1me

Description

When the primary oracle fails and the fallback succeeds, resolution.rs emits OracleResultEvent once for the failure and again for the success but with the same market_id and overlapping oracle_provider semantics, which causes downstream indexers to count the resolution twice. Disambiguate by adding attempt: u32 and is_final: bool to the event payload.

Requirements and Context

  • Mutate the event schema in events.rs
  • Update all emission sites in resolution.rs and oracles.rs
  • Update indexer-facing docs
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b bug/oracle-result-event-double-emit
  2. Implement changes
    • contracts/predictify-hybrid/src/events.rs
    • contracts/predictify-hybrid/src/resolution.rs
    • Update existing test asserting emission count
  3. Test and commit
    • cargo test -p predictify-hybrid oracle_result_event
    • Cover edge cases
    • Include test output and notes in the PR

Example commit message

fix: disambiguate primary/fallback OracleResultEvent emissions

Acceptance Criteria

  • Each emission carries unique (attempt, is_final) pair
  • Exactly one event with is_final=true per resolved market
  • Existing tests updated to assert new schema

Guidelines

  • No unwrap() in production paths
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programbugSomething isn't workingrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions