-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Add a bool return to _grantRole and _revokeRole #4241
Add a bool return to _grantRole and _revokeRole #4241
Conversation
🦋 Changeset detectedLatest commit: 7dc7e62 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
No dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No dependency changes detected in pull request |
This would need to be rebased. However, I would also like us to consider the alternative of making the functions revert in the cases where they would return false, as an alternative to adding a return value. The argument so far has been that we want to allow no-ops, but we've seen how in this case it can actually lead to bugs when you override the function, and you very easily assume that there is an actual revoke ongoing. I think this is stronger for revoke than it is for grant. |
196ebe3
to
c41f431
Compare
This got lost, I think we should do it in 5.0 |
I'd like to consider this change for 5.0, but we didn't address @frangio's comments.
Sounds like a good idea but it'll require us to check how it behaves with AccessControl extensions. For example, imo we don't have time to check for those cases if we decide to do reverts. I'm more in favor of the current PR proposal. |
btw, should we add tests for the internal function return values? |
Added |
Co-authored-by: Ernesto García <[email protected]>
Following up on this question. Our current thinking is that if these functions reverted, it would be possible to frontrun a batch of If the concern is that We should write this in the contract. |
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 but we also discussed making TimelockController
return the proposalId
, I'd like to merge this and add that in another PR if it's not already out there.
In |
Similarly to
EnumerableSet
'sadd
andremove
, I believeAccessControl
's_grantRole
and_revokeRole
should return a boolean value. This would help overrides version handle no-ops.I believe the public versions should not return the boolean, but that is open to discussion.
PR Checklist
npx changeset add
)