-
Notifications
You must be signed in to change notification settings - Fork 20.8k
eth/tracers: extend tracers for CREATE2
#17565
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
Conversation
👍 |
If we just merge this, it will have no effect, the |
You just need to do |
beb141a
to
f8d2fc1
Compare
@@ -85,7 +85,7 @@ | |||
case "EXTCODECOPY": case "EXTCODESIZE": case "BALANCE": | |||
this.lookupAccount(toAddress(log.stack.peek(0).toString(16)), db); | |||
break; | |||
case "CREATE": | |||
case "CREATE": case "CREATE2": |
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.
This is not correct. The code below uses toContract(from, db.getNonce(from))
to generate the contract address, but CREATE2 has a different contract address generation scheme. You'll need to implement a toContract2
similar to https://github.com/ethereum/go-ethereum/blob/master/eth/tracers/tracer.go#L354
f52a41c
to
f10bb14
Compare
Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
f10bb14
to
c49e754
Compare
@karalabe Updated, actually I know nothing about js and I implement PTAL if it is correct :) |
code := common.CopyBytes(makeSlice(ctx.GetBuffer(-1))) | ||
ctx.Pop3() | ||
|
||
contract := crypto.CreateAddress2(from, salt, code) |
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.
This is now wrong, CreateAddress2
now uses codeHash
, not code
.
@YaoZengzeng could you update it to use codehash instead? |
I am almost unfamiliar with the code base now. I will close this PR and maybe @holiman could make another PR to fix it. Sorry for that. |
ref: #17196