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

Add native stateDiff tracer #470

Merged

Conversation

ziogaschr
Copy link
Member

@ziogaschr ziogaschr commented May 4, 2022

This PR converts the stateDiff tracer from a JS tracer to a native Go tracer.

eth/tracers/native: add native stateDiffTracer (draft)

core/vm,eth/tracers,eth/tracers/internal/tracetest: make it compile

eth/tracers/internal/tracetest/testdata/state_diff: add some tests

eth/tracers/internal/tracetest/testdata/state_diff,eth/tracers/native: stateDiff
this is useful for creating tests for stateDiff tracer
…h/tracers/js/internal/tracers,eth/tracers/js,eth/tracers/logger,eth/tracers/native: remove use of CapturePreEVM for JS legacy tracers
@ziogaschr ziogaschr changed the title Add native stateDiff tracer [WiP] Add native stateDiff tracer May 6, 2022
@ziogaschr ziogaschr requested a review from meowsbits May 6, 2022 17:26
// CaptureStart implements the EVMLogger interface to initialize the tracing operation.
func (t *prestateTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
t.env = env
t.create = create
t.to = to

t.lookupAccount(t.env.Context.Coinbase)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as it includes the miner's prestate for that block. Miner prestate is useful for creating stateDiff tests. We can remove this (comment out) and use it only when needed by me.
When I will create this PR to upstream geth, I am going to question this line.

@meowsbits
Copy link
Contributor

LGTM 🚀

@ziogaschr ziogaschr merged commit 416fefe into merge/foundation-release/1.10.17 Jun 7, 2022
@ziogaschr ziogaschr deleted the feat/native-stateDiff-tracer branch June 7, 2022 17:03
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

Successfully merging this pull request may close these issues.

2 participants