Skip to content

fix: stop skipping Hyperp markets from liquidation scanning (H3)#86

Open
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/h3-hyperp-liquidation-skip
Open

fix: stop skipping Hyperp markets from liquidation scanning (H3)#86
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/h3-hyperp-liquidation-skip

Conversation

@0x-SquidSol
Copy link
Copy Markdown
Contributor

@0x-SquidSol 0x-SquidSol commented Apr 9, 2026

Summary

  • The liquidation scanner checked authorityPriceE6 === 0n inside the Hyperp branch and returned [], skipping the entire market
  • For Hyperp markets, price comes from lastEffectivePriceE6 (DEX pool mark price), NOT authorityPriceE6
  • authorityPriceE6 is legitimately zero for Hyperp markets — no authority pushes prices
  • This silently excluded all Hyperp markets with zero authority price from liquidation scanning
  • Undercollateralized positions in those markets were never flagged for liquidation

Fix

Remove the redundant authorityPriceE6 === 0n check (lines 207-213). The existing price === 0n guard on line 205 already correctly handles unbootstrapped markets since resolveMarketPrice() returns lastEffectivePriceE6 for Hyperp mode.

Test plan

  • All 133 existing tests pass
  • Crank service's true-Hyperp path (lines 438-557) has no such check and works correctly — confirms this check was unnecessary

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved market price resolution in the liquidation service for more accurate pricing.

The liquidation scanner checked authorityPriceE6 === 0n in the Hyperp
branch and returned early, skipping the entire market. But for Hyperp
markets, the price comes from lastEffectivePriceE6 (DEX pool mark
price), not authorityPriceE6. The authority field is legitimately zero
when no oracle authority has pushed a price.

The preceding check (price === 0n) already correctly guards against
unbootstrapped markets since resolveMarketPrice() returns
lastEffectivePriceE6 for Hyperp mode.

Remove the redundant authorityPriceE6 check that was silently
excluding all Hyperp markets with zero authority price from
liquidation scanning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8fb99850-51b2-4287-afe1-c3b1c92efbda

📥 Commits

Reviewing files that changed from the base of the PR and between 130dc6a and fa464f4.

📒 Files selected for processing (1)
  • src/services/liquidation.ts

📝 Walkthrough

Walkthrough

Removed the mark price sanity check from Hyperp oracle mode in LiquidationService.scanMarket that previously returned early when authorityPriceE6 was zero despite open interest existing. The code now relies solely on resolveMarketPrice and lastEffectivePriceE6 for pricing.

Changes

Cohort / File(s) Summary
Hyperp Oracle Pricing Simplification
src/services/liquidation.ts
Removed mark price sanity check that returned early when cfg.authorityPriceE6 === 0n with engine.totalOpenInterest > 0n. Now exclusively uses resolveMarketPrice/lastEffectivePriceE6 for pricing determination in Hyperp oracle mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 The oracle whispers, no need to double-check,
We trust the mark price path, what could go wrong, what the heck?
Authority's gone, but the resolve stands tall,
Simpler logic bounces—efficiency for all! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: stop skipping Hyperp markets from liquidation scanning (H3)' clearly and specifically describes the main change: removing a redundant check that was causing Hyperp markets to be skipped from liquidation scanning.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant