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

bug(anvil): unable to use debug_traceTransaction structLogs tracer on forked network #8262

Closed
2 tasks done
Tracked by #8269
antazoey opened this issue Jun 26, 2024 · 2 comments
Closed
2 tasks done
Tracked by #8269
Assignees
Labels
C-anvil Command: anvil T-bug Type: bug T-to-investigate Type: to investigate
Milestone

Comments

@antazoey
Copy link

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (7bef9ca 2024-06-26T00:21:14.969821000Z)

What command(s) is the bug in?

anvil

Operating System

macOS (Intel)

Describe the bug

I am able to use debug_traceTransaction w/o specifying the tracer-value for any local transaction, and it works great.
However, when I use a forked network (such as Ethereum mainnet, forked with Anvil), and I use an old transaction hash, such as '0x0537316f37627655b7fe5e50e23f71cd835b377d1cde4226443c94723d036e32`, I get errors that I don't get when the transaction originated during local / testing (not a historical tx picked up from the fork).

the first error I get is like:

Fork Error: Transport(HttpError(HttpError { status: 400, body: "{\"jsonrpc\":\"2.0\",\"id\":41,\"error\":{\"code\":-32602,\"message\":\"invalid 2nd argument: options object was missing 'tracer' element\"}}" }))

Because my parameters are {"stepsTracing": true, "enableMemory": true} which work great for local anvil nodes when tracing, but I guess forked-mode expects something else?

So I tried messing around with parameters. I tried passing "tracer": "structLogs" which is valid in Geth but that does not seem to be valid tracer in revm or something. I tried excluding all of it together but i get the first error again.

I know before this used to work, so I am not sure what has happened.

Interestingly, Hardhat seems to also suddenly issues similar to this: NomicFoundation/edr#533
And I think they are also using revm now.
Perhaps the real issues lie there?

@antazoey antazoey added the T-bug Type: bug label Jun 26, 2024
@zerosnacks zerosnacks added the C-anvil Command: anvil label Jun 27, 2024
@zerosnacks zerosnacks changed the title Unable to use debug_traceTransaction structLogs tracer on forked network bug(anvil): unable to use debug_traceTransaction structLogs tracer on forked network Jul 16, 2024
@zerosnacks zerosnacks added the T-to-investigate Type: to investigate label Jul 16, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@grandizzy
Copy link
Collaborator

@antazoey I think this depends on the capabilities your provider offers, I tried your sample by forking mainnet using alchemy provider and indeed it reproduce the error you posted

curl -H "Content-Type: application/json" --data '{"method":"debug_traceTransaction","params":["0x0537316f37627655b7fe5e50e23f71cd835b377d1cde4226443c94723d036e32", {"stepsTracing": true, "enableMemory": true}], "id":1,"jsonrpc":"2.0"}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Fork Error: Transport(HttpError(HttpError { status: 400, body: \"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":35,\\\"error\\\":{\\\"code\\\":-32602,\\\"message\\\":\\\"invalid 2nd argument: options object was missing 'tracer' element\\\"}}\" }))"}}

However doing the same query against provider directly shows the same issue

curl https://eth-mainnet.g.alchemy.com/v2/KEY -X POST -H "Content-Type: application/json" -d '{"method":"debug_traceTransaction","params":["0x0537316f37627655b7fe5e50e23f71cd835b377d1cde4226443c94723d036e32", {"stepsTracing": true, "enableMemory": true}],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid 2nd argument: options object was missing 'tracer' element"}}

But if starting anvil with linea fork, querying a tx works without issue:

curl -H "Content-Type: application/json" --data '{"method":"debug_traceTransaction","params":["0x5d3faa9b9605a8fb04d989a79bfe6d3b708bdcfc66048d2fe18ed2dda4a8297c", {"stepsTracing": true, "enableMemory": true}], "id":1,"jsonrpc":"2.0"}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"result":{"failed":false,"gas":21000,"returnValue":"","structLogs":[]}}

Querying directly the provider works too

curl https://linea-mainnet.g.alchemy.com/v2/KEY -X POST -H "Content-Type: application/json" -d '{"method":"debug_traceTransaction","params":["0x5d3faa9b9605a8fb04d989a79bfe6d3b708bdcfc66048d2fe18ed2dda4a8297c", {"stepsTracing": true, "enableMemory": true}],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}

Lmk if this makes sense and if good to close this. thank you

@github-project-automation github-project-automation bot moved this to Todo in Foundry Sep 30, 2024
@grandizzy grandizzy moved this from Todo to Blocked in Foundry Sep 30, 2024
@grandizzy grandizzy assigned grandizzy and unassigned yash-atreya Sep 30, 2024
@grandizzy
Copy link
Collaborator

@antazoey going to close this for now, please check comment above and reopen if still an issue. thank you!

@grandizzy grandizzy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@github-project-automation github-project-automation bot moved this from Blocked to Done in Foundry Oct 1, 2024
@grandizzy grandizzy moved this from Done to Completed in Foundry Oct 7, 2024
@grandizzy grandizzy removed this from Foundry Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug T-to-investigate Type: to investigate
Projects
None yet
Development

No branches or pull requests

4 participants