Skip to content

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

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

pcarranzav
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Jul 14, 2022

Codecov Report

Merging #624 (37d70a5) into pcv/571-n21-unused-imports (960cc04) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                     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           
Flag Coverage Δ
unittests 91.92% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
contracts/gateway/L1GraphTokenGateway.sol 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 960cc04...37d70a5. Read the comment docs.

Copy link
Contributor

@abarmat abarmat left a 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?

@pcarranzav
Copy link
Member Author

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 👍

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...

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?

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...

@pcarranzav pcarranzav force-pushed the pcv/571-n23-whitelist-check branch from b8d77aa to 3a6c3b5 Compare July 14, 2022 15:55
@pcarranzav
Copy link
Member Author

Amended to incorporate @abarmat's suggestion to revert rather than silently skip

abarmat
abarmat previously approved these changes Jul 26, 2022
@pcarranzav pcarranzav changed the base branch from pcv/571-n21-unused-imports to pcv/arb-full-deployment July 26, 2022 14:56
@pcarranzav pcarranzav dismissed abarmat’s stale review July 26, 2022 14:56

The base branch was changed.

@pcarranzav pcarranzav merged commit 37d70a5 into pcv/arb-full-deployment Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants