Skip to content

[BREAKING] fix: allow vault to withdraw all collateral#991

Merged
gregdhill merged 2 commits intointerlay:masterfrom
gregdhill:fix/withdraw-all
Jul 20, 2023
Merged

[BREAKING] fix: allow vault to withdraw all collateral#991
gregdhill merged 2 commits intointerlay:masterfrom
gregdhill:fix/withdraw-all

Conversation

@gregdhill
Copy link
Member

Hacky fix to allow Vaults to withdraw all collateral since #974 unintentionally introduced a bug that prevents this. Specifically, due to a loss in precision the calculation in withdraw_stake (apply_slash) may produce a smaller amount than TotalCurrentStake which results in the InsufficientFunds error.

@sander2
Copy link
Member

sander2 commented Apr 12, 2023

please fix the ci

@gregdhill gregdhill force-pushed the fix/withdraw-all branch 4 times, most recently from 4ddf5fa to 2ee97b9 Compare June 15, 2023 15:42
@sander2
Copy link
Member

sander2 commented Jun 19, 2023

Can you add a test that fails on the current code, but succeeds on this branch?
Also would be good to have some assertions in that test that in such a case the vault is left with 0 stake and 0 locked tokens.

@gregdhill gregdhill requested a review from sander2 June 29, 2023 15:59
@sander2 sander2 changed the title fix: allow vault to withdraw all collateral [BREAKING] fix: allow vault to withdraw all collateral Jun 29, 2023
@gregdhill gregdhill force-pushed the fix/withdraw-all branch 4 times, most recently from 5750083 to d40fe09 Compare July 12, 2023 18:04
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
@gregdhill gregdhill merged commit e52f73d into interlay:master Jul 20, 2023
@gregdhill gregdhill deleted the fix/withdraw-all branch July 20, 2023 16:31
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.

2 participants