-
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
Use swapFeeManager as owner in mev hook #1305
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; very clean!
This pattern is starting to get used everywhere, so it makes sense to put it in SingletonAuthentication
.
@@ -16,6 +16,11 @@ import { Authentication } from "@balancer-labs/v3-solidity-utils/contracts/helpe | |||
abstract contract SingletonAuthentication is Authentication { | |||
IVault private immutable _vault; | |||
|
|||
modifier onlySwapFeeManagerOrAuthentication(address pool) { |
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.
Maybe onlySwapFeeManagerOrAuthenticate
/ onlySwapFeeManagerXorAuthenticate
sounds a bit better (xor is what we are actually doing, although the name doesn't sound great. Leaving that to @EndymionJkb :) )
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 we don't want to use exclusiveRole terminology, and have to make it swap-manager specific, maybe onlySwapFeeManagerOrGovernance
, or onlySwapFeeManagerIfDefined
?
I'd still prefer to have the _ensureAuthenticatedByExclusiveRole
function parameterized by the role, and then give the modifiers more specific names, and have them call the generic role authentication (identical to VaultAdmin). It would be most consistent across the whole codebase. Otherwise we're making up different patterns and naming conventions when there's already a suitable one there.
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.
Per comments on the other PR, I still suggest using a standard generic function _ensureAuthenticatedByExclusiveRole
in the base contract (maybe SingletonAuthentication; wherever it makes sense), and then have either local modifiers, or if they're really all going to be swapFeeManager, the modifier could go up there, too, but separate from the generic authentication logic that just takes a "roleAddress" - in case we have something else that uses a different role later.
@@ -16,6 +16,11 @@ import { Authentication } from "@balancer-labs/v3-solidity-utils/contracts/helpe | |||
abstract contract SingletonAuthentication is Authentication { | |||
IVault private immutable _vault; | |||
|
|||
modifier onlySwapFeeManagerOrAuthentication(address pool) { |
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 we don't want to use exclusiveRole terminology, and have to make it swap-manager specific, maybe onlySwapFeeManagerOrGovernance
, or onlySwapFeeManagerIfDefined
?
I'd still prefer to have the _ensureAuthenticatedByExclusiveRole
function parameterized by the role, and then give the modifiers more specific names, and have them call the generic role authentication (identical to VaultAdmin). It would be most consistent across the whole codebase. Otherwise we're making up different patterns and naming conventions when there's already a suitable one there.
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
This PR changes the authorization logic for mev hook: if swapFeeManager is set, use it as owner instead of governance.
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution
Closes #1300