-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
cmd/evm: t8n support native tracers #28557
Conversation
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Interesting, I'll look into this. |
sorry for the late reply. Yes, I first use prestateTracer to dump the states(via debug_traceTransaction RPC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nitpicks, otherwise lgtm.
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Unfortunately, we cannot "unify"
So, when using |
@holiman Thanks, you are right. jsonl is json lines, while json is not. |
prevFile.Close() | ||
} | ||
traceFile, err := os.Create(path.Join(baseDir, fmt.Sprintf("trace-%d-%v.jsonl", txIndex, txHash.String()))) | ||
tracer, err := tracers.DefaultDirectory.New(ctx.String(TraceTracerFlag.Name), nil, config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you changed this to instantiate the tracer earlier, you made it so that every transaction uses the same tracer instance. I don't think that's how the lifecycle of a tracer works - all other tracer-usage instantiates a new tracer for each transaction. (correct me if I'm wrong, @s1na )
Please revert this change so the tracer is instantiated in getTracer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, let's instantiate inside the getTracer
, one tracer for each tx
Signed-off-by: jsvisa <delweng@gmail.com>
This reverts commit 931c814. Signed-off-by: jsvisa <delweng@gmail.com>
cmd/evm/internal/t8ntool/flags.go
Outdated
@@ -28,12 +28,15 @@ import ( | |||
var ( | |||
TraceFlag = &cli.BoolFlag{ | |||
Name: "trace", | |||
Usage: "Output full trace logs to files <txhash>.jsonl", | |||
Usage: "Output full trace logs to a file named: trace-<txIndex>-<txHash>.json or trace-<txIndex>-<txHash>.jsonl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage: "Output full trace logs to a file named: trace-<txIndex>-<txHash>.json or trace-<txIndex>-<txHash>.jsonl", | |
Usage: "Output json opcode traces to files (trace-<txIndex>-<txHash>.jsonl), |
IMO the --trace
configures the json tracer. For the other ones, it's implied. Why would you want to run a calltracer if it does not produce any output?
I'll push a fix
This change implements ability for the `evm t8n` tool to use custom tracers; either 'native' golang tracers or javascript tracers.
This change implements ability for the `evm t8n` tool to use custom tracers; either 'native' golang tracers or javascript tracers.
t8n is a useful tool to test state transition. Currently, we use t8n to analyze some exploit transactions, such as SaddleFinance Exploiter, a simple workflow as below:
alloc.json
;env.json
;txs.json
;./evm t8n --trace ...
;But currently t8n only supports JSONLogger traces, we want to extend it to support all traces under eth/tracers