Skip to content

[ H4ck3r-netizen ] [ Crypto ] Fix PriceOracle missing staleness check and fallback mechanism#5196

Closed
H4ck3r-netizen wants to merge 2 commits into
UnsafeLabs:mainfrom
H4ck3r-netizen:fix-priceoracle-staleness-915-v2
Closed

[ H4ck3r-netizen ] [ Crypto ] Fix PriceOracle missing staleness check and fallback mechanism#5196
H4ck3r-netizen wants to merge 2 commits into
UnsafeLabs:mainfrom
H4ck3r-netizen:fix-priceoracle-staleness-915-v2

Conversation

@H4ck3r-netizen
Copy link
Copy Markdown

Summary

Add staleness check, price validation, and fallback oracle to PriceOracle contract.

Changes

  • Added round completeness validation: answeredInRound >= roundId
  • Added price validation: rejects zero or negative prices
  • Added staleness check: rejects prices older than MAX_STALENESS (3600 seconds)
  • Added fallback oracle that is queried when primary returns stale/invalid data
  • Emits StalePrice event when falling back to secondary oracle
  • Reverts if both oracles return invalid data
  • Constructor now accepts both primary and fallback feed addresses

Issue

Closes #915

Testing

  • Valid price returned from primary oracle
  • Stale primary price triggers fallback to secondary oracle
  • Zero/negative prices rejected with clear error
  • Incomplete rounds rejected
  • Both oracles stale triggers revert
  • MAX_STALENESS is configurable by owner

/bounty $200

@github-actions
Copy link
Copy Markdown
Contributor

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. See CONTRIBUTING.md for guidelines.

@github-actions github-actions Bot closed this May 26, 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.

[ Crypto ] Fix PriceOracle missing staleness check and fallback mechanism

1 participant