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

refactor(run-protocol): store liquidation cohort before liquidating #4715

Merged
merged 6 commits into from
Mar 2, 2022

Conversation

turadg
Copy link
Member

@turadg turadg commented Mar 1, 2022

closes: #4571

Description

Populates a vaultsToLiquidate queue before beginning liquidation.

Separated in commits for easier review. I'll squash the whole PR for merge.

Security Considerations

Doesn't change API.

Documentation Considerations

Internal implementation.

Testing Considerations

No change in behavior. Eventually we'll want these stores to persist durably which will need testing, but that's down the road.

@turadg turadg requested review from dtribble and Chris-Hibbert March 1, 2022 23:20
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

This looks right, but I'd prefer to re-read it after the renamings I've suggested. The current names are confusing to me.

@@ -107,7 +108,10 @@ export const makeVaultManager = (
// definition of reschedulePriceCheck, which refers to sortedVaultKits
// XXX misleading mutability and confusing flow control; could be refactored with a listener
/** @type {ReturnType<typeof makePrioritizedVaults>=} */
let prioritizedVaults;
let illiquidVaults;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these are the same prioritizedVaults as before. 'illiquid' sounds to me like they have insufficient capitalization and should be liquidated. Would you mind renaming it back to prioritizedVaults, or something representing them as loans in good standing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's a poor name choice. I was looking for something that described how they're prioritized because vaultsToLiquidate are also ordered. But I'll leave that for #4415

@@ -129,30 +133,43 @@ export const makeVaultManager = (
);

/**
*
* @param {[key: string, vaultKit: InnerVault]} record
* @param {Iterable<[key: string, vaultKit: InnerVault]>} recordEntries
Copy link
Contributor

Choose a reason for hiding this comment

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

recordEntries is confusing to me. I alternate between reading record as a noun and a verb. Can they be vaultEntries or something like that?

@turadg turadg requested a review from Chris-Hibbert March 2, 2022 00:42
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

Looks good. I had one question/suggestion.


vaultsToLiquidate.delete(key);
} catch (e) {
// XXX should notify interested parties
Copy link
Contributor

Choose a reason for hiding this comment

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

If the vault is now in the liquidating state, should we try again to remove it from vaultsToLiquidate?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. My thought was it still needs to be liquidated. This way it'll keep retrying. I don't know of failure modes in which you wouldn't want to retry. I figure we'll come back to that when "notify interested parties" is addressed.

@turadg turadg added the automerge:squash Automatically squash merge label Mar 2, 2022
@mergify mergify bot merged commit 0a320ba into master Mar 2, 2022
@mergify mergify bot deleted the turadg/issue4571 branch March 2, 2022 18:09
turadg added a commit that referenced this pull request Mar 26, 2022
turadg added a commit that referenced this pull request Mar 30, 2022
mergify bot added a commit that referenced this pull request Mar 31, 2022
* Revert "refactor(run-protocol): store liquidation cohort before liquidating (#4715)"

This reverts commit 0a320ba.

* chained promise

* clarify parallel and serial behaviors

* Dean pairing

* fix tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Liquidation cohort is stored separately
2 participants