-
Notifications
You must be signed in to change notification settings - Fork 52
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
Protocol Fee Controller migration contract #1299
Conversation
…on structure to simplify future migrations
…less error-prone)
# Conflicts: # pkg/interfaces/contracts/vault/IProtocolFeeController.sol # pkg/vault/contracts/ProtocolFeeController.sol # pkg/vault/test/foundry/ProtocolFeeController.t.sol
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 reasonable. I don't really have any comments; looking good!
I was thinking that if there are fees collected but not withdrawn in the old controller, probably the best way to get them is to just grant the permission to a multisig to pull them out. WDYT? We should probably include that detail in the notion docs as part of the 'user manual' for this migration.
I added a section on for post-migration considerations. The account that withdraws would already have permission on the old controller; could just leave it alone. The account could withdraw from both controllers if necessary. Nothing more can be collected post-migration, so the old controller would just be inert (to governance) after that. Pool creators could still withdraw forever, as they don't need permission. |
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
Based on #1307, this is the monorepo part of the ProtocolFeeController migration. It introduces a /governance-scripts package, and adds contracts used for the migration.
Turns out this is actually quite tricky! Essentially, there is no way to copy the "hidden" state that is set only on registration through the Vault or by pool creators. See #1307 for the ProtocolFeeController changes necessary to accomplish this (i.e., a
migratePool
function).We'd thought the problem was only pool creators, but it's actually worse. We cannot call the
updateProtocolSwap/YieldFeePercentage
functions to "copy" pool state, because those call into the Vault to update the aggregate percentage - and this function can only be called by the current fee controller: not one we're migrating to.So the final solution is to migrate to a new Protocol Fee Controller that has the ability to copy hidden state, with one twist. We needed to add new getters in order to copy the pool creator percentages, so these do not exist in the current (original) ProtocolFeeController. The first migration (very soon) has no pools with pool creators, so it's fine, but we need to tolerate failure so that the first migration works. (If any pool creators are missed, the pool creators can simply set the percentages again in the new fee controller, so it's not catastrophic. The fact that there is a pool creator cannot be lost, as that's stored in the Vault.)
So in the first migration, all the pool creator getter calls will fail (try... catch, so it doesn't revert), which is fine because they're all zero anyway. However, in future migrations they will work and correctly copy the pool creator fees.
This adds a new package, so if you see "hardhat not found" or something like that, run "yarn" at the top level to update the dependencies.
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution
Resolves #1290