Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

program: handle underflow in calculate_liability_transfer_to_cover_ma… #774

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

crispheaney
Copy link
Member

…rgin_shortage

@@ -68,7 +68,7 @@ pub fn calculate_liability_transfer_to_cover_margin_shortage(
if_liquidation_fee: u32,
) -> DriftResult<u128> {
// If unsettled pnl asset weight is 1 and quote asset is 1, this calculation breaks
if asset_weight == liability_weight && asset_weight >= liability_weight {
if asset_weight >= liability_weight {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Merging #774 (ae73705) into master (7a7d218) will increase coverage by 0.01%.
Report is 15 commits behind head on master.
The diff coverage is 94.11%.

❗ Current head ae73705 differs from pull request most recent head 00c984b. Consider uploading reports for the commit 00c984b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #774      +/-   ##
==========================================
+ Coverage   74.55%   74.57%   +0.01%     
==========================================
  Files         126      126              
  Lines       29469    29477       +8     
==========================================
+ Hits        21972    21983      +11     
+ Misses       7497     7494       -3     
Components Coverage Δ
drift 74.78% <94.11%> (+0.01%) ⬆️

@crispheaney crispheaney merged commit 337edac into master Dec 19, 2023
10 of 11 checks passed
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