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

vault manager refactorings #5574

Merged
merged 3 commits into from
Jun 13, 2022
Merged

Conversation

turadg
Copy link
Member

@turadg turadg commented Jun 10, 2022

refs: #4415

Description

Code improvements that came up while working on bug fixes. Left out of those PRs since they're out of scope of fixing the bug and may require additional review.

Review by commit recommended.

Security Considerations

Take burnLosses power from vault. Gives vaultManager the vault object instead, but it already had the power to iterate over all unsettled vaults.

Documentation Considerations

Testing Considerations

@turadg turadg requested a review from dtribble as a code owner June 10, 2022 23:27
@@ -80,16 +76,13 @@ const liquidate = async (
const runToBurn = AmountMath.min(proceeds.RUN, debt);
// debt is fully settled, with runToBurn and shortfall
assert(AmountMath.isEqual(debt, AmountMath.add(runToBurn, shortfall)));
trace('before burn', { debt, proceeds, overage, shortfall, runToBurn });
// TODO why grant this power; we can burn it from the caller
burnLosses(runToBurn, vaultZcfSeat);
Copy link
Member Author

@turadg turadg Jun 10, 2022

Choose a reason for hiding this comment

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

Now vault is updated with liquidated before the losses are burned, which updates the consumer of the vault. If burnLosses fails now the vault will still be "liquidated" to the user.

As I think this through I realize this could allow a state in which a vault's phase is liquidated and thus settled, but it's still in the vaultManager. Though that possibility true of master, albeit with one fewer case (failure of burnLosses/burnDebt) that could manifest it. We don't have checked exceptions but maybe there's something to document about what failures must be handled? cc @dtribble

@turadg turadg merged commit ca09e9e into 5550-totalDebt-zero Jun 13, 2022
@turadg turadg deleted the ta/refactor-vaultManager branch June 13, 2022 19:04
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