Skip to content
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

debug_traceTransaction returns wrong gasCost on CALL opcode #19019

Closed
jangko opened this issue Feb 8, 2019 · 3 comments
Closed

debug_traceTransaction returns wrong gasCost on CALL opcode #19019

jangko opened this issue Feb 8, 2019 · 3 comments

Comments

@jangko
Copy link

jangko commented Feb 8, 2019

System information

Geth
Version: 1.8.18-unstable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.3
Operating System: windows
GOPATH=C:\Users\Jangko\go
GOROOT=E:\go\
Geth
Version: 1.8.22-stable
Git Commit: 7fa3509e2eaf1a4ebc12344590e5699406690f15
Architecture: 386
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.11.5
Operating System: windows
GOPATH=C:\Users\Jangko\go
GOROOT=E:\go\

Expected behaviour

{"pc":423,"op":"DUP4","gas":317741,"gasCost":3,"depth":1},
{"pc":424,"op":"CALL","gas":317738,"gasCost":6740,"depth":1}, // <-- should be 6740
{"pc":425,"op":"POP","gas":310998,"gasCost":2,"depth":1}

Actual behaviour

{"pc":423,"op":"DUP4","gas":317741,"gasCost":3,"depth":1},
{"pc":424,"op":"CALL","gas":317738,"gasCost":9040,"depth":1}, // <-- wrong
{"pc":425,"op":"POP","gas":310998,"gasCost":2,"depth":1} // <-- funny, the next gas is correct

Steps to reproduce the behaviour

curl localhost:8545 -H "Content-Type:application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"debug_traceTransaction\",\"params\":[\"0x22591c7aadb705df30a13e97f73496b529f208573a231c7eb389766d29b421d1\", {\"disableStorage\":true, \"disableMemory\":true, \"disableStack\":true}],\"id\":1}"

we are developing EVM debugging tools that depend on geth's debugging caps, but turn out we also found bug in geth debug_traceTransaction.

@holiman
Copy link
Contributor

holiman commented Feb 8, 2019

This is a transaction from a very early block, this was fixed in #18503. It's not in the 1.8-branch, IIRC, but it is fixed on master and will appear in the 1.9 release.
I don't believe it's scheduled for backporting into 1.8, but if it's very important to you we can consider it.... (?)

@holiman holiman closed this as completed Feb 8, 2019
@holiman
Copy link
Contributor

holiman commented Feb 8, 2019

Addiionally, I'd recommed you to use the functionality introduced in #17914. The output is

  • less quirky (always get the opcode integer, not only textual representation)
  • less memory intense, since it flushes every op instead of saving up to a gigantic json response.

@jangko
Copy link
Author

jangko commented Feb 22, 2019

Thanks for the reply.
I already download and compile master branch of upcoming 1.9.x.
I observed this issue is not addressed yet.

bugfix #18503 only touch the fork choice problem.
I believe #17914 enhancement also infected by this issue because the problem lies in the EVM, not in the tracer.

in opcode CALL, CALLCODE, STATICCALL, DELEGATECALL, and CREATE, the tracer seems ignoring returnGas and only take into account gasCost before opcode execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants