eth/tracers: use gencodec for native tracers (#25637)

The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec.

OBS! 
This PR changes the call tracer result slightly:

-  Order of type and value fields are changed (should not matter). 
-  Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty.
This commit is contained in:
Sina Mahmoodi
2022-09-26 18:35:44 +02:00
committed by GitHub
parent 3ec6fe6101
commit fc3e6d0162
5 changed files with 219 additions and 60 deletions
+4
View File
@@ -151,3 +151,7 @@ func (t *fourByteTracer) Stop(err error) {
t.reason = err
atomic.StoreUint32(&t.interrupt, 1)
}
func bytesToHex(s []byte) string {
return "0x" + common.Bytes2Hex(s)
}