-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
eth/tracers: add txHash
field on txTraceResult
#27183
eth/tracers: add txHash
field on txTraceResult
#27183
Conversation
What @s1na wrote on that ticket was
Meaning, without putting the hash on the outer result-container, the inner tracer has access to the hash and can put it on the result, if desired. Is that not sufficient? |
eth/tracers/api.go
Outdated
@@ -200,6 +200,7 @@ type StdTraceConfig struct { | |||
|
|||
// txTraceResult is the result of a single transaction trace. | |||
type txTraceResult struct { | |||
TxHash common.Hash `json:"txHash,omitempty"` // transaction hash |
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.
Does omitEmpty
work as intended on the empty-hash?
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.
Thank you for the review. I realized that common.Hash is of type [32]byte, so it cannot have an empty value in a byte array. I will modify that.
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.
fixed it!
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.
In general, LGTM (if we want this feature)
How can the hash be inserted into the inner trace? It doesn't seem possible to retrieve the txHash when making a debug_traceBlock RPC call. |
So then it would be up to the tracer that is used -- and // Default tracer is the struct logger
tracer = logger.NewStructLogger(config.Config)
if config.Tracer != nil {
tracer, err = DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig)
if err != nil {
return nil, err
}
} However, the type ExecutionResult struct {
Gas uint64 `json:"gas"`
Failed bool `json:"failed"`
ReturnValue string `json:"returnValue"`
StructLogs []StructLogRes `json:"structLogs"`
} As it is, we can either fix it "everywhere" with the way this PR does it, or we can fix it only for the structlogger by modifying the constructor. |
Tracers are used in multiple contexts:
Because of this it might make sense to add this info directly to the result of |
I'm leaning towards accepting this PR as is, based on your comments above. (However:)
Do you mean he should obtain the traces, then afterwards load the block body and correlate? Sounds clunky. |
Can you please fix the failing tests? |
ae94780
to
000dcdc
Compare
txHash
field on txTraceResult
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.
LGTM
txHash
field on txTraceResulttxHash
field on txTraceResult
This PR modifies the interface for the results of `debug_traceBlock` and `debug_traceCall` by adding the `txHash`, allowing users to identify which transaction's trace result corresponds to. --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
This PR modifies the interface for the results of `debug_traceBlock` and `debug_traceCall` by adding the `txHash`, allowing users to identify which transaction's trace result corresponds to. --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
)" This reverts commit c2057f0.
)" This reverts commit c2057f0.
This update covers this PRs: - ethereum/go-ethereum#26414 - ethereum/go-ethereum#27183 - ethereum/go-ethereum#26291 - ethereum/go-ethereum#26048
This PR modifies the interface for the results of debug_traceBlock and debug_traceCall by adding the txHash, allowing users to identify which transaction's trace result corresponds to. This was previously discussed in issue #20629, but there has been no further discussion since then.