-
Notifications
You must be signed in to change notification settings - Fork 996
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
incorrect-equality: do not check addresses #1713
Conversation
i really don't think these errors have anything to do with my changes, can you please rerun the ci? |
798e8e3
to
9dc5167
Compare
should be good now? |
Comparing addresses strictly should not be flagged. | ||
""" | ||
addr = ElementaryType("address") | ||
return ir.variable_left.type != addr or ir.variable_right.type != addr |
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 something like Contract(address(0x0)) == Contract(address(0x0))
is used, is_not_comparing_addresses
won't filter it out. We would need to add something like isinstance(ir.variable_left.type, UserDefinedType) and isinstance(ir.variable_left.type.type, Contract)
. It'd be helpful to add a test case for both the address and contract case so that we can be sure of the modifications and prevent regressions in the future.
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.
alright, will do that
Casting my support of this PR. The wiki about this detector mentions a use case that should never be relevant for address checks. |
This commit adds a simple additional check to make sure no strict equality of addresses is flagged at all.