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