-
Notifications
You must be signed in to change notification settings - Fork 232
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
Conversation
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
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.