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 nuances of .codehash usage to the documentation #14794
Labels
documentation 📖
low effort
There is not much implementation work to be done. The task is very easy or tiny.
low impact
Changes are not very noticeable or potential benefits are limited.
Comments
Agree, should be addressed. The recent contest showed that there is a slight misunderstanding: https://code4rena.com/reports/2023-10-wildcat#h-02-codehash-check-in-factory-contracts-does-not-account-for-non-empty-addresses |
This issue has been marked as stale due to inactivity for the last 90 days. |
github-actions
bot
added
the
stale
The issue/PR was marked as stale because it has been open for too long.
label
Apr 21, 2024
The PR is waiting for an approval |
github-actions
bot
removed
the
stale
The issue/PR was marked as stale because it has been open for too long.
label
Apr 22, 2024
mehtavishwa30
added
low effort
There is not much implementation work to be done. The task is very easy or tiny.
low impact
Changes are not very noticeable or potential benefits are limited.
labels
Apr 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation 📖
low effort
There is not much implementation work to be done. The task is very easy or tiny.
low impact
Changes are not very noticeable or potential benefits are limited.
Page
https://docs.soliditylang.org/en/v0.8.23/types.html#members-of-addresses
Abstract
addr.codehash
output depends on theaddr
balance. It'll output 0 if the balance is 0 (andaddr
doesn't have any code, of course). Otherwise, if the balance is > 0, it'll outputkeccak256("")
.The issue might be considered a bug because the existing documentation treats
.codehash
as an equivalent ofkeccak256(addr.code)
, which, as you can see below in the PoC, has a different output.PoC:
The function's output:
Also, see this report: https://code4rena.com/reports/2023-10-wildcat#h-02-codehash-check-in-factory-contracts-does-not-account-for-non-empty-addresses
Pull request
#14793
The text was updated successfully, but these errors were encountered: