Skip to content

fix: make oracle fallback path panic-free and event-emitting#565

Merged
greatest0fallt1me merged 2 commits into
Predictify-org:masterfrom
Agbasimere:bug/harden-oracle-fallback
May 27, 2026
Merged

fix: make oracle fallback path panic-free and event-emitting#565
greatest0fallt1me merged 2 commits into
Predictify-org:masterfrom
Agbasimere:bug/harden-oracle-fallback

Conversation

@Agbasimere
Copy link
Copy Markdown
Contributor

Summary

Closes #544

This hardens the graceful degradation fallback path so oracle backup failures never panic mid-resolution.

What changed

  • made OracleBackup::get_price return typed contract errors when both primary and backup fail
  • removed panic-capable fallback behavior from the active graceful degradation path
  • emit degradation events for both primary and backup oracle failures
  • added persisted oracle degradation state tracking so timeout handling moves the oracle into a defined degraded state
  • updated handle_oracle_timeout to record degraded status and emit a degradation event
  • updated oracle health reporting so degraded status is surfaced explicitly

Why

The fallback path is the safety net when the primary oracle is unavailable. If that path panics or aborts, a market can get stuck during resolution. This change makes the path degrade gracefully instead:

  • both-oracles-down returns Error::FallbackOracleUnavailable
  • timeout handling records a defined degraded state
  • degradation is observable through emitted events

Files changed

  • contracts/predictify-hybrid/src/graceful_degradation.rs
  • contracts/predictify-hybrid/src/lib.rs

Tests

cargo test -p predictify-hybrid graceful_degradation -- --test-threads=1
cargo test -p predictify-hybrid -- oracle_fallback --test-threads=1
cargo test -p predictify-hybrid --lib -- --test-threads=1

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 26, 2026

@Agbasimere Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me greatest0fallt1me merged commit 2dedee5 into Predictify-org:master May 27, 2026
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.

Harden graceful_degradation::fallback_oracle_call and OracleBackup::get_price against panics on backup failure

2 participants