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
- Fork the repo and create a branch
git checkout -b bug/oracle-result-event-double-emit
- Implement changes
contracts/predictify-hybrid/src/events.rs
contracts/predictify-hybrid/src/resolution.rs
- Update existing test asserting emission count
- 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
Guidelines
- No
unwrap() in production paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
When the primary oracle fails and the fallback succeeds,
resolution.rsemitsOracleResultEventonce for the failure and again for the success but with the samemarket_idand overlappingoracle_providersemantics, which causes downstream indexers to count the resolution twice. Disambiguate by addingattempt: u32andis_final: boolto the event payload.Requirements and Context
events.rsresolution.rsandoracles.rsSuggested Execution
contracts/predictify-hybrid/src/events.rscontracts/predictify-hybrid/src/resolution.rscargo test -p predictify-hybrid oracle_result_eventExample commit message
Acceptance Criteria
(attempt, is_final)pairis_final=trueper resolved marketGuidelines
unwrap()in production paths