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

Implement prestateTracer #2624

Closed
mattsse opened this issue May 10, 2023 · 9 comments · Fixed by #3923
Closed

Implement prestateTracer #2624

mattsse opened this issue May 10, 2023 · 9 comments · Fixed by #3923
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented May 10, 2023

Describe the feature

See https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers

This is similar to #2110 but for the missing

GethDebugBuiltInTracerType::PreStateTracer => {
todo!()
}

variant

TODO

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled D-good-first-issue Nice and easy! A great choice to get started A-rpc Related to the RPC implementation and removed S-needs-triage This issue needs to be labelled labels May 10, 2023
@jerusan
Copy link

jerusan commented May 11, 2023

I am working on this.

@mattsse
Copy link
Collaborator Author

mattsse commented May 11, 2023

lmk if you have any questions,
I think we need to look closely at the geth reference impl.

@jerusan
Copy link

jerusan commented May 18, 2023

@mattsse I'm not sure if my method of obtaining the prestate is correct. I am thinking of making a copy of state_db before passing it to inspect(). In that way, db values can be accessed after passing it to inspect(). When inspect() returns post_state, I can iterate the post_state to get the addresses affected by the transaction then I will be able to use the db_copy to get the old account state.

@jerusan jerusan removed their assignment May 27, 2023
@0x366
Copy link

0x366 commented Jul 19, 2023

Any updates on prestate tracer? It's must-have to simulate a bundle

@mattsse
Copy link
Collaborator Author

mattsse commented Jul 19, 2023

I can bump prio for this,

@PlamenHristov
Copy link
Contributor

PlamenHristov commented Jul 24, 2023

@mattsse, mind I give it a try?

@0x366
Copy link

0x366 commented Jul 30, 2023

The prestateTracer is currently missing the "diffMode" option: nothing happens when

"tracerConfig": { "diffMode": true }

, that returns the differences between the transaction's pre and post-state (i.e. what changed because the transaction happened).
https://github.com/ethereum/go-ethereum/blob/8f2ae29b8f7743a14760e6f2b458ecddc8bb7d8f/eth/tracers/native/prestate.go#L254

@PlamenHristov
Copy link
Contributor

@0x366, there is a small bug, in how the config is parsed. Will push a fix EOD.

@PlamenHristov
Copy link
Contributor

PlamenHristov commented Jul 31, 2023

@0x366 here is the PR. Apologies for the bug. Otherwise, I tested the functionality on a live node and looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants