Skip to content

Conversation

@matchv
Copy link
Collaborator

@matchv matchv commented Oct 15, 2025

execute_liquidate_call, use math_utils::ceil_div() to count in dust debt
collateral accounting use regular div to round down collateral

…rsion

Apply directional rounding for conservative liquidation debt calculation.

Changes:
- Calculate user_reserve_debt_in_base_currency using ceil_div instead of normal division
- Modified: execute_liquidation_call function (L627-640)
- Keep collateral calculation with normal division (rounds down conservatively)

Rationale:
- Debt should never be underestimated during liquidation for protocol safety
- Conservative calculation prevents liquidation amount errors
- Ensures accurate liquidation bonus and collateral seizure calculations
- Aligns with Solidity Aave V3 implementation pattern

Impact:
- Liquidation calculations become more conservative
- Small debt amounts will not be rounded to zero (fixes potential dust debt issues)
- Better protection against debt underestimation in liquidation scenarios
- Consistent with generic_logic debt calculation approach
@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.70%. Comparing base (894edeb) to head (3cf38a0).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           mike/improve/supply-logic      #71   +/-   ##
==========================================================
  Coverage                      97.70%   97.70%           
==========================================================
  Files                             38       38           
  Lines                            785      785           
==========================================================
  Hits                             767      767           
  Misses                            18       18           
Flag Coverage Δ
move 97.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@matchv matchv closed this Oct 21, 2025
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.

3 participants