You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is the same as not adding it (and maybe the bytecode is unnecessarily larger? I don't know if the compiler is smart enough to detect this).
We could have a rule for detecting this. The rule should check if the fallback function has only one statement and if that statement is a call to revert.
The only potential issue I see is if you add a revert function to your contract and you want that function to be called in the fallback function. This would trigger a false positive. We could check if there's a function revert in the contract, but the function could be inherited from another contract. So I wouldn't bother: if someone is doing this, then they can just disable the rule.
Adding a fallback function that just reverts:
is the same as not adding it (and maybe the bytecode is unnecessarily larger? I don't know if the compiler is smart enough to detect this).
We could have a rule for detecting this. The rule should check if the fallback function has only one statement and if that statement is a call to revert.
The only potential issue I see is if you add a
revert
function to your contract and you want that function to be called in the fallback function. This would trigger a false positive. We could check if there's a functionrevert
in the contract, but the function could be inherited from another contract. So I wouldn't bother: if someone is doing this, then they can just disable the rule.Possible names:
no-redundant-fallback
no-unnecessary-fallback
dude-or-gal-check-the-docs-you-can-drop-that-code
cc @patitonar @fernandomg @pablofullana
The text was updated successfully, but these errors were encountered: