Skip to content

feat: implement oracle data staleness and confidence interval validation#359

Open
Ekenesamuel8 wants to merge 10 commits intoPredictify-org:masterfrom
Ekenesamuel8:feature/oracle-staleness-confidence
Open

feat: implement oracle data staleness and confidence interval validation#359
Ekenesamuel8 wants to merge 10 commits intoPredictify-org:masterfrom
Ekenesamuel8:feature/oracle-staleness-confidence

Conversation

@Ekenesamuel8
Copy link

@Ekenesamuel8 Ekenesamuel8 commented Feb 23, 2026

Closes #311


Pull Request Description

📋 Basic Information

Type of Change

Please select the type of change this PR introduces:

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🧪 Test addition/update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🎨 UI/UX improvement
  • 🚀 Deployment/Infrastructure change

Related Issues

Closes #(issue number)
Fixes #(issue number)
Related to #(issue number)

Priority Level

  • 🔴 Critical (blocking other development)
  • 🟡 High (significant impact)
  • 🟢 Medium (moderate impact)
  • 🔵 Low (minor improvement)

📝 Detailed Description

What does this PR do?

Why is this change needed?

How was this tested?

Alternative Solutions Considered


🏗️ Smart Contract Specific

Contract Changes

Please check all that apply:

  • Core contract logic modified
  • Oracle integration changes (Pyth/Reflector)
  • New functions added
  • Existing functions modified
  • Storage structure changes
  • Events added/modified
  • Error handling improved
  • Gas optimization
  • Access control changes
  • Admin functions modified
  • Fee structure changes

Oracle Integration

  • Pyth oracle integration affected
  • Reflector oracle integration affected
  • Oracle configuration changes
  • Price feed handling modified
  • Oracle fallback mechanisms
  • Price validation logic

Market Resolution Logic

  • Hybrid resolution algorithm changed
  • Dispute mechanism modified
  • Fee structure updated
  • Voting mechanism changes
  • Community weight calculation
  • Oracle weight calculation

Security Considerations

  • Access control reviewed
  • Reentrancy protection
  • Input validation
  • Overflow/underflow protection
  • Oracle manipulation protection

🧪 Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • All tests passing locally
  • Manual testing completed
  • Oracle integration tested
  • Edge cases covered
  • Error conditions tested
  • Gas usage optimized
  • Cross-contract interactions tested

Test Results

# Paste test output here
cargo test
# Expected output: X tests passed, Y tests failed

Manual Testing Steps


📚 Documentation

Documentation Updates

  • README updated
  • Code comments added/updated
  • API documentation updated
  • Examples updated
  • Deployment instructions updated
  • Contributing guidelines updated
  • Architecture documentation updated

Breaking Changes

Breaking Changes:

Migration Guide:


🔍 Code Quality

Code Review Checklist

  • Code follows Rust/Soroban best practices
  • Self-review completed
  • No unnecessary code duplication
  • Error handling is appropriate
  • Logging/monitoring added where needed
  • Security considerations addressed
  • Performance implications considered
  • Code is readable and well-commented
  • Variable names are descriptive
  • Functions are focused and small

Performance Impact

  • Gas Usage:
  • Storage Impact:
  • Computational Complexity:

Security Review

  • No obvious security vulnerabilities
  • Access controls properly implemented
  • Input validation in place
  • Oracle data properly validated
  • No sensitive data exposed

🚀 Deployment & Integration

Deployment Notes

  • Network: Testnet/Mainnet
  • Contract Address:
  • Migration Required: Yes/No
  • Special Instructions:

Integration Points

  • Frontend integration considered
  • API changes documented
  • Backward compatibility maintained
  • Third-party integrations updated

📊 Impact Assessment

User Impact

  • End Users:
  • Developers:
  • Admins:

Business Impact

  • Revenue:
  • User Experience:
  • Technical Debt:

✅ Final Checklist

Pre-Submission

  • Code follows Rust/Soroban best practices
  • All CI checks passing
  • No breaking changes (or breaking changes are documented)
  • Ready for review
  • PR description is complete and accurate
  • All required sections filled out
  • Test results included
  • Documentation updated

Review Readiness

  • Self-review completed
  • Code is clean and well-formatted
  • Commit messages are clear and descriptive
  • Branch is up to date with main
  • No merge conflicts

📸 Screenshots (if applicable)

🔗 Additional Resources

  • Design Document:
  • Technical Spec:
  • Related Discussion:
  • External Documentation:

💬 Notes for Reviewers

Please pay special attention to:

Questions for reviewers:


Thank you for your contribution to Predictify! 🚀

@greatest0fallt1me
Copy link
Contributor

@Ekenesamuel8 Resolve the conflicts & fix the pipeline

- Add GlobalOracleValidationConfig and EventOracleValidationConfig structs
- Implement staleness validation (rejects data older than max age, default 60s)
- Implement confidence interval validation for Pyth (rejects if >5% by default)
- Add admin-only config setters: set_oracle_val_cfg_global, set_oracle_val_cfg_event
- Per-event config overrides global defaults
- Emit OracleValidationFailedEvent with detailed reason and parameters
- Integrate validation into OracleResolutionManager.try_fetch_from_config()
- Error handling with deterministic Error::OracleStale and Error::OracleConfidenceTooWide
- Comprehensive tests: staleness rejection, confidence rejection, success, per-event override, auth
- Tests achieve ≥95% coverage
- Security: admin-only, no bypass, deterministic errors
- Documentation: NatSpec comments, ORACLE_STALENESS_CONFIDENCE_FEATURE.md
- Clean up unused error variants to fix compilation
- Remove import of non-existent reentrancy_guard module
- Remove reentrancy check from handle_zero_stake_scenario
- Aligns with codebase-wide removal of reentrancy guard module
@Ekenesamuel8
Copy link
Author

this issue has be solved

@greatest0fallt1me
Copy link
Contributor

@Ekenesamuel8 can you resolve the conflicts?

@Ekenesamuel8
Copy link
Author

Ekenesamuel8 commented Feb 27, 2026 via email

@greatest0fallt1me
Copy link
Contributor

I don’t think I can else I try

On Fri, 27 Feb 2026 at 1:44 AM Gandhiji @.> wrote: greatest0fallt1me left a comment (Predictify-org/predictify-contracts#359) <#359 (comment)> @Ekenesamuel8 https://github.com/Ekenesamuel8 can you resolve the conflicts? — Reply to this email directly, view it on GitHub <#359 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAPUNA5B4LADYXPSBH7KZID4N6HQDAVCNFSM6AAAAACV4YIUGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSNZQGA3TOMRYGU . You are receiving this because you were mentioned.Message ID: @.>

Hey, please resolve any conflicts in your local code editor and then force push your changes.

@Ekenesamuel8
Copy link
Author

Ekenesamuel8 commented Feb 27, 2026 via email

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.

feat: implement oracle data staleness and confidence interval validation

2 participants