feat: implement oracle integration for automatic result verification #242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
π Basic Information
Type of Change
Please select the type of change this PR introduces:
Related Issues
Closes #200
Priority Level
π Detailed Description
What does this PR do?
Implements a secure, multi-source oracle integration that automatically fetches, validates, and finalizes event outcomes when events end. Adds a new
verify_result(event_id)entrypoint, oracle client module, validation and storage hooks, events for result verification, and admin functions for oracle management.Why is this change needed?
Automated, reliable event outcome resolution reduces manual intervention and the window for dispute. Integrating multiple oracle sources with validation and quorum/fallback logic improves resilience against single-source failures or manipulation.
How was this tested?
cargo testrun for the new test suite (example output below).Alternative Solutions Considered
ποΈ Smart Contract Specific
Contract Changes
Please check all that apply:
Oracle Integration
Market Resolution Logic
Security Considerations
π§ͺ Testing
Test Coverage
Manual Testing Steps
verify_result(event_id)(or run scheduler) and observeResultVerifiedorResultVerificationFailedevents.π Documentation
Documentation Updates
Breaking Changes
Breaking Changes:
Migration Guide:
π Code Quality
Code Review Checklist
Performance Impact
Security Review
π Deployment & Integration
Integration Points
β Final Checklist
Pre-Submission
Review Readiness
πΈ Screenshots (if applicable)
π¬ Notes for Reviewers
Please pay special attention to:
src/oracles.rsparsing and signature handlingsrc/validation.rsTTL, nonce, and schema validationsrc/lib.rs::verify_resultaggregation/quorum logic and edge handlingQuestions for reviewers:
Thank you for your contribution to Predictify! π