-
Notifications
You must be signed in to change notification settings - Fork 19
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
Round trip fee guardrail in Recovery Mode #1098
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.
LGTM!
This is super overkill, but I'm not against it. I'd love @danielmkm's thoughts on this one.
@@ -744,6 +744,14 @@ contract VaultExtension is IVaultExtension, VaultCommon, Proxy { | |||
return _isPoolInRecoveryMode(pool); | |||
} | |||
|
|||
// Needed to avoid stack-too-deep.apply |
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.
💀 dang
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 tried using a struct for the removeLiquidityRecovery
function itself first, as we have elsewhere, but it wasn't enough.
vault.manualEnableRecoveryMode(pool); | ||
// Set the fee, and flag to trigger collection of it. | ||
vault.manualSetStaticSwapFeePercentage(pool, BASE_MAX_SWAP_FEE); | ||
vault.manualSetAddLiquidityCalledFlag(pool, true); |
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.
You don't need this one actually. The whole test runs in the same tx.
Maybe just leave a comment, and / or assert that the flag is true?
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 did this, but it doesn't seem to be testing the content of the events properly. If that flag is set, it should be charging fees in the original test too, but the expected event doesn't have them, yet it passes. I manually clear the flag in the one that's not supposed to have the roundtrip fee, and that works too.
Testing the balances verifies that the two cases behave differently, but I wonder where else events aren't getting tested.
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.
LGTM!
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.
LGTM!
Description
Apply the same roundtrip fee guardrail on recovery mode that we do with regular proportional withdrawals. If there was a preceding add liquidity operation (which there wouldn't normally be in a recovery mode withdrawal), charge the pool's static swap fee.
To keep recovery mode as simple as possible, this fee is charged to the user (i.e., they receive fewer tokens for their BPT), but the tokens simply remain in the pool, accruing value to the other LPs.
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution
Resolves #1094