-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fee controller migration contracts #1299
Open
EndymionJkb
wants to merge
50
commits into
protocol-fee-controller-v3
Choose a base branch
from
fee-controller-script
base: protocol-fee-controller-v3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+361
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…on structure to simplify future migrations
…less error-prone)
EndymionJkb
commented
Feb 18, 2025
# Conflicts: # pkg/interfaces/contracts/vault/IProtocolFeeController.sol # pkg/vault/contracts/ProtocolFeeController.sol
# Conflicts: # pkg/pool-stable/test/foundry/E2eBatchSwap.t.sol # pkg/pool-stable/test/foundry/E2eErc4626Swaps.t.sol # pkg/pool-stable/test/foundry/E2eSwapRateProvider.t.sol # pkg/pool-weighted/test/foundry/E2ESwapRateProvider.t.sol
# Conflicts: # pkg/pool-weighted/test/foundry/E2eSwap.t.sol
# Conflicts: # pkg/interfaces/contracts/vault/IProtocolFeeController.sol # pkg/vault/contracts/ProtocolFeeController.sol # pkg/vault/test/foundry/ProtocolFeeController.t.sol
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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! We might not have thought this all the way through during the original design.
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 too.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.
One thing that needs to be cleaned up before merging is the current constructor / fee controller setter mechanism, which is only there because the fee controller is not yet deployed, so we have to deploy it in the fork test. After the v3 protocol fee controller is deployed, it will be accessible through the normal READ_ONLY task, and able to be passed in at deployment time.
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution