mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
Make tracers more robust by handling `nil` receipt as input. Also pass in a receipt with gas used in the state test runner. Closes https://github.com/ethereum/go-ethereum/issues/30117. --------- Co-authored-by: Martin HS <martin@swende.se> Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
This commit is contained in:
parent
1597be6879
commit
f5e76ea6df
3 changed files with 9 additions and 3 deletions
|
|
@ -274,7 +274,9 @@ func (t *jsTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.ctx["gasUsed"] = t.vm.ToValue(receipt.GasUsed)
|
if receipt != nil {
|
||||||
|
t.ctx["gasUsed"] = t.vm.ToValue(receipt.GasUsed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// onStart implements the Tracer interface to initialize the tracing operation.
|
// onStart implements the Tracer interface to initialize the tracing operation.
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,9 @@ func (l *StructLogger) OnTxEnd(receipt *types.Receipt, err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l.usedGas = receipt.GasUsed
|
if receipt != nil {
|
||||||
|
l.usedGas = receipt.GasUsed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StructLogs returns the captured log entries.
|
// StructLogs returns the captured log entries.
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,9 @@ func (t *callTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.callstack[0].GasUsed = receipt.GasUsed
|
if receipt != nil {
|
||||||
|
t.callstack[0].GasUsed = receipt.GasUsed
|
||||||
|
}
|
||||||
if t.config.WithLog {
|
if t.config.WithLog {
|
||||||
// Logs are not emitted when the call fails
|
// Logs are not emitted when the call fails
|
||||||
clearFailedLogs(&t.callstack[0], false)
|
clearFailedLogs(&t.callstack[0], false)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue