foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.09k stars 1.67k forks source link

Native tracers support #4110

Open ValentinAndreevich opened 1 year ago

ValentinAndreevich commented 1 year ago

Component

Anvil

Describe the feature you would like

debug_traceCall is useful for getting an execution trace of eth_call, expecially when it comes to tx simulation. That will be very nice if you are able to add callTracer support as a tracing option.

Additional context

No response

algtm commented 1 year ago

+1

chibitanaka commented 1 year ago

+1, callTracer support would be nice

mattsse commented 1 year ago

this is being worked on separately on https://github.com/paradigmxyz/reth where these are already implemented, there will soon be some consolidation efforts to reduce duplicate code.

If someone wants to add this functionality via copy-paste to anvil until this is done, I'm happy to give pointers.

lljxx1 commented 1 year ago

+1

Billy1900 commented 1 year ago

One more requirement, I got the trace like this:

{
    "depth": 1,
    "gas": 29978936,
    "gasCost": 3,
    "op": "PUSH1",
    "pc": 0,
    "stack": []
},

however, when I use debug_traceTransaction, I got

{
    "depth": 0,
    "error": "",
    "gas": 39469,
    "gasCost": 3,
    "memory": [],
    "op": "PUSH1",
    "pc": 0,
    "stack": [],
    "storage": {}
},

can we add storage and memory part?

cesarhuret commented 11 months ago

this is being worked on separately on https://github.com/paradigmxyz/reth where these are already implemented, there will soon be some consolidation efforts to reduce duplicate code.

If someone wants to add this functionality via copy-paste to anvil until this is done, I'm happy to give pointers.

could you give me some pointers?

Billy1900 commented 11 months ago

this is being worked on separately on https://github.com/paradigmxyz/reth where these are already implemented, there will soon be some consolidation efforts to reduce duplicate code. If someone wants to add this functionality via copy-paste to anvil until this is done, I'm happy to give pointers.

could you give me some pointers?

what do you mean pointers, the storage and memory like

{
    "depth": 0,
    "error": "",
    "gas": 39469,
    "gasCost": 3,
    "memory": [],
    "op": "PUSH1",
    "pc": 0,
    "stack": [],
    "storage": {}
},
cesarhuret commented 11 months ago

this is being worked on separately on https://github.com/paradigmxyz/reth where these are already implemented, there will soon be some consolidation efforts to reduce duplicate code. If someone wants to add this functionality via copy-paste to anvil until this is done, I'm happy to give pointers.

could you give me some pointers?

what do you mean pointers, the storage and memory like

{
    "depth": 0,
    "error": "",
    "gas": 39469,
    "gasCost": 3,
    "memory": [],
    "op": "PUSH1",
    "pc": 0,
    "stack": [],
    "storage": {}
},

pointers meaning instructions/help on how to implement this into anvil

Billy1900 commented 11 months ago

this is being worked on separately on https://github.com/paradigmxyz/reth where these are already implemented, there will soon be some consolidation efforts to reduce duplicate code. If someone wants to add this functionality via copy-paste to anvil until this is done, I'm happy to give pointers.

could you give me some pointers?

what do you mean pointers, the storage and memory like

{
    "depth": 0,
    "error": "",
    "gas": 39469,
    "gasCost": 3,
    "memory": [],
    "op": "PUSH1",
    "pc": 0,
    "stack": [],
    "storage": {}
},

pointers meaning instructions/help on how to implement this into anvil

I do not dive deep into how we implement this. But I think you could refer to how debug_traceTransaction does. It won't be hard.