-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Using extcodehash instead of extcodesize for less gas #1802
Conversation
`extcodehash` uses less gas then `extcodesize`. You can tell which address is a contract by the hash (see EIP-1052).
Thank you @PhABC! We should add a comment explaining what 0x0 and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 mean: they are the codehashes for a new account, and an account with no code respectively. I assume 'new account' means an account that has not been targeted by any transaction, but I'm not entirely sure of this. Also, could you add a changelog entry for this improvement? Thanks! |
@nventuro Added comments! Not sure where to add a changelog entry however. |
Oh wow, it's super interesting that it returns two different values depending if the account has been used or not! I wonder if this distinction can be used for something? @PhABC The changelog entry should go in CHANGELOG.md, under a subsection "Improvements" for the last version. |
Hi all! |
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.
Added the changelog entry. Thank you @PhABC!
This References: |
Note: EIP-2929 affect pricing of these opcodes. Gas cost for both operations is the same:
|
extcodehash
uses less gas thenextcodesize
. You can tell which address is a contract by the hash (see EIP-1052).Fixes #