improve(liquidator): Send log when WDF is purposefully not activated#2432
improve(liquidator): Send log when WDF is purposefully not activated#2432nicholaspai merged 8 commits intomasterfrom
Conversation
…ated Signed-off-by: Nick Pai <npai.nyc@gmail.com>
chrismaree
left a comment
There was a problem hiding this comment.
Looks good! as discussed IRL we need to think about if we always want to be sending out these info messages. We really just need to know when the initial WDF liquidation is sent out and if the bot is running low on funds/cant extend a liquidation. The way this is set up is we'll see this info message every 5 mins, which I think is fine, but might be a bit noisy.
| parseFloat(defenseActivationPercent) | ||
| ) | ||
| return false; | ||
| if (!passedDefenseActivationPercent({ position, currentBlockTime })) return false; |
There was a problem hiding this comment.
can you not just return passedDefenseActivationPercent({ position, currentBlockTime }) at this point?
| ) { | ||
| this.logger.info({ | ||
| at: "Liquidator", | ||
| message: "Withdrawal liveness has not passed WDF activation threshold, skipping✋", |
There was a problem hiding this comment.
shall we use a new emoji? this one is used in other places.
There was a problem hiding this comment.
key comment, will do
daywiss
left a comment
There was a problem hiding this comment.
Looks great Nick, I like how you broke out the check into its own function. Approving assuming you will address @chrismaree concerns
| this.defenseActivationPercent && | ||
| !this.liquidationStrategy.utils.passedDefenseActivationPercent({ position, currentBlockTime }) | ||
| ) { | ||
| this.logger.info({ |
There was a problem hiding this comment.
will these logs cause pager duty to go off? I think id prefer not tripping PD on this since it could happen every time the bot runs
There was a problem hiding this comment.
INFO level logs should not set of PagerDuty
Good point, given the constraint that this bot runs serverlessly this is a bit tricky. Thoughts on changing this to a debug log vs keeping it as an info? I'm not sure what we'd prefer as a team, but I kind of like the idea of having more information than not. |
Co-authored-by: Chris Maree <christopher.maree@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
| liquidatorConfig, | ||
| liquidatorOverridePrice | ||
| liquidatorOverridePrice, | ||
| startingBlock, |
There was a problem hiding this comment.
as discussed on slack, you could consider putting these within the liquidatorConfig.
There was a problem hiding this comment.
I'm going to pack startingBlock and endingBlock into liquidatorConfig before creating the Liquidator.js object, but I still want to read those vars from the environment because the serverless hub sets them conveniently there
There was a problem hiding this comment.
See this commit for the proposed changes in response to your comment.
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
daywiss
left a comment
There was a problem hiding this comment.
Looks good to me, i just have questions about how starting and ending block gets set. Is this something that gets persisted in gcp somehow and set dynamically in cloud run or what?
chrismaree
left a comment
There was a problem hiding this comment.
This looks great! thanks for refining this & adding all the nits.
packages/liquidator/index.js
Outdated
| }; | ||
|
|
||
| // Add block window into `liquidatorConfig` | ||
| let overriddenLiquidatorConfig = { |
There was a problem hiding this comment.
nit: does this need to be a new variable? could you not just re-asign liquidatorConfig?
liquidatorConfig = {...liquidatorConfig, startingBlock, endingBlock };
The only reason I bring this up is that it is more consistent with how I was trying to override the liquidator config in the perpetual generalization.
There was a problem hiding this comment.
Good call, I originally had it set this way but ran into an error because I redeclared liquidatorConfig with a let statement.
Yep look at how the Hub sets the environment here |
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
| fromBlock: this.startingBlock, | ||
| toBlock: this.endingBlock | ||
| }); | ||
| if (blockWindowHasRequestedWithdraw) { |
There was a problem hiding this comment.
tiny nit: This could be done more cleanly using a simply ternary operator.
const logLevel = blockWindowHasRequestedWithdraw ? "info" : "debug";
Feel free to ignore as well, this is more personal preference.
Signed-off-by: Nick Pai npai.nyc@gmail.com
Motivation
Problem mentioned as part of #2419
Previously, this error log is being emitted even if the WDF is not being activated on purpose (i.e there is no error):

Summary
Liquidator queries
LiquidatorStrategyto determine if it should emit a specialized log about the WDF not being activated yet.