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

Accomodate for Ganache negative transaction cost during debug_traceTransaction #64

Closed
argonavist opened this issue Jul 30, 2023 · 2 comments

Comments

@argonavist
Copy link

As per trufflesuite/ganache#277 and trufflesuite/ganache#578 a Ganache blockchain may report negative gas cost for a REVERT or RETURN EVM command.

The StructLog struct (module/debug/trace.go) for the result of the debug_traceTransaction RPC is using a uint to save the gas resulting in an error.

@argonavist argonavist changed the title Accomocate for Ganache negative transaction cost during debug_traceTransaction Accomodate for Ganache negative transaction cost during debug_traceTransaction Jul 30, 2023
@lmittmann
Copy link
Owner

The RPC-methods supported by this package are meant to support go-ethereum which can not report negative gas costs. Unfortunately the more advanced RPC-methods like tracing differ a lot between nodes and testing frameworks in their output format.

You can do two things:

  1. implement a custom debug_traceTransaction for Ganach. w3 is extendable with custom method bindings. You need to implement the w3types.Caller interface. See e.g. https://github.com/lmittmann/w3/blob/v0.13.0/module/eth/call.go#L98 as reference.
  2. play with the w3vm branch which will bring something like Ganache, but pure Go and super fast with state forking via RPC to w3. It allows tracing using any vm.EVMLogger implementation. However, this is still experimental and only "documented" here: https://pkg.go.dev/github.com/lmittmann/[email protected]/w3vm

@argonavist
Copy link
Author

Thank you very much for your very detailed reply.
That w3vm branch looks great and so does the ease in extending through w3types.Caller.

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