fix: correct oracle account derivation in liquidate() (N1)#99
fix: correct oracle account derivation in liquidate() (N1)#990x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
Conversation
…e markets (N1) The liquidate() oracle account derivation only checked if indexFeedId was all-zeros, ignoring oracleAuthority entirely. For admin-oracle markets with a non-zero indexFeedId, it derived a Pyth PDA instead of using the slab address — causing the on-chain program to reject the transaction with OracleInvalid (0xc). Both crankMarket() and ADL scanMarket() correctly check oracleAuthority first and use slabAddress for admin-oracle markets. Use the existing detectOracleMode() helper (already in the same file and used by scanMarket()) to derive the oracle account consistently: - admin → slabAddress (regardless of indexFeedId) - hyperp → slabAddress - pyth-pinned → derivePythPushOraclePDA(feedHex) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 7 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
Summary
The
liquidate()oracle account derivation only checked ifindexFeedIdwas all-zeros, ignoringoracleAuthority. For admin-oracle markets with a non-zero indexFeedId, it derived a Pyth PDA instead of the slab address — causing the on-chain program to reject the transaction withOracleInvalid (0xc).This meant liquidations silently failed for these markets. Undercollateralized positions went unliquidated.
Both
crankMarket()and ADLscanMarket()correctly checkoracleAuthorityfirst.Fix
Use the existing
detectOracleMode()helper (already in the file, used byscanMarket()) to derive the oracle account:slabAddress(regardless of indexFeedId)slabAddressderivePythPushOraclePDA(feedHex)Test plan
🤖 Generated with Claude Code