Handle non-stale Pyth errors in multi feed oracle#235
Conversation
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 56 minutes and 49 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR implements selective Pyth error handling in ChangesSelector-based Pyth error handling
Possibly related issues
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates MultiPythOracleAdapter to treat Pyth “stale price” as a soft-failure while bubbling all other Pyth reverts unchanged, with accompanying test coverage.
Changes:
- Bubble non-stale Pyth errors while continuing to suppress
StalePriceas a(false, price)result. - Update stale-feed mocking to revert with
PythErrors.StalePrice. - Add a test ensuring non-stale Pyth reverts (e.g.,
PriceFeedNotFound) bubble throughlatestAnswer().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/src/concrete/oracle/MultiPythOracleAdapter.fuzz.t.sol | Updates stale mocking to use PythErrors and adds a revert-bubbling test. |
| src/concrete/oracle/MultiPythOracleAdapter.sol | Adds selective handling for StalePrice and bubbles other revert payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bytes4 selector; | ||
| assembly ("memory-safe") { | ||
| selector := mload(add(err, 0x20)) | ||
| } | ||
| if (selector == PythErrors.StalePrice.selector) { | ||
| return (false, price); | ||
| } |
| bytes4 selector; | ||
| assembly ("memory-safe") { | ||
| selector := mload(add(err, 0x20)) | ||
| } |
| abi.encodeWithSelector(PythErrors.PriceFeedNotFound.selector) | ||
| ); | ||
|
|
||
| vm.expectRevert(abi.encodeWithSelector(PythErrors.PriceFeedNotFound.selector)); |
7a69052 to
3f70805
Compare
|
Pushed follow-up commit
Revalidated:
|
Summary
PythErrors.StalePrice()revert as a stale-feed fallback inMultiPythOracleAdapter.PriceFeedNotFound(), preserving the operational signal instead of masking it asAllFeedsStale().Fixes #34.
Validation
forge fmt --check src/concrete/oracle/MultiPythOracleAdapter.sol test/src/concrete/oracle/MultiPythOracleAdapter.fuzz.t.solforge buildforge test --match-path test/src/concrete/oracle/MultiPythOracleAdapter.fuzz.t.sol -vvv-> 3 passedRPC_URL_BASE_FORK=https://mainnet.base.org forge test --match-path 'test/src/concrete/oracle/MultiPythOracleAdapter*.t.sol' -vv-> 38 passedRPC_URL_BASE_FORK=https://mainnet.base.org FORK_BLOCK_BASE=38996123 forge test --no-match-contract ProdForkTest-> 122 passedNote: full
forge testcurrently has unrelatedProdForkTestfailures against production fork assumptions; the suite above covers all non-production-fork tests plus the complete MultiPythOracleAdapter tests.Summary by CodeRabbit
Release Notes
Bug Fixes
Tests