-
Notifications
You must be signed in to change notification settings - Fork 157
fix: check before adding/removing whitelisted addresses [N-23] #624
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
fix: check before adding/removing whitelisted addresses [N-23] #624
Conversation
Codecov Report
@@ Coverage Diff @@
## pcv/571-n21-unused-imports #624 +/- ##
===========================================================
Coverage 91.91% 91.92%
===========================================================
Files 44 44
Lines 2078 2080 +2
Branches 354 356 +2
===========================================================
+ Hits 1910 1912 +2
Misses 168 168
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Just nitpicking a bit, this function might also have been something like:
function setCallhookWhitelist(address _target, bool _enabled) external onlyGovernor
But your version is more explicit, it's good 👍
In the spirit of failing loudly, I'd revert if the callhook is already whitelisted like:
require(callhookWhitelist[_newWhitelisted] == false, "WHITELIST_SET");
I try to avoid a transaction that is successful and doesn't do a state change.
What do you think?
Cool, yeah, I wasn't sure which way was better, I wonder if any of the options is a bit more gas-efficient, but in the end this won't be called very often so probably no big deal either way...
Good point, I wasn't sure what to do for this, since it's technically okay to try to set the whitelisted address twice, and I liked the function being idempotent, but in this case it might be safer to revert as it might be a sign that the user did something wrong... |
b8d77aa
to
3a6c3b5
Compare
Amended to incorporate @abarmat's suggestion to revert rather than silently skip |
No description provided.