erigontech / erigon

Ethereum implementation on the efficiency frontier https://erigon.gitbook.io
GNU Lesser General Public License v3.0
3.09k stars 1.08k forks source link

streaming debug_traceCallMany returns invalid JSON object #8857

Open dallonby opened 9 months ago

dallonby commented 9 months ago

System information

Erigon version: erigon version 2.55.0-dev-fd6f529c

OS & Version: Linux

Commit hash: fd6f529c736b5e228cb6dbacda0d5d7816580607

Erigon Command (with flags/config): erigon --datadir=/data/erigon/datadir --authrpc.jwtsecret=/data/erigon/jwtsecret --http --http.addr=0.0.0.0 --http.port=8545 --http.vhosts=* --http.corsdomain=* --http.api=eth,admin,debug,net,trace,web3,erigon,ots --ws

Consensus Layer: Lighthouse

Consensus Layer Command (with flags/config): N/A

Chain/Network: ethereum / mainnet

Expected behaviour

Valid JSON object indicating error

Actual behaviour

Invalid JSON object returned {"jsonrpc":"2.0","id":1,"result":[[{"structLogs":[]},"resultHack":null,"error":{"code":-32000,"message":"tracing failed: fee cap less than block base fee: address 0xaddress, gasFeeCap: 10000000000 baseFee: 31605911202"}}

Steps to reproduce the behaviour

call debug_traceCallMany over websocket with a known bad tx. For example, a tx having gasFeeCap lower than current baseFee.

Suggested patch

diff --git a/turbo/transactions/tracing.go b/turbo/transactions/tracing.go
index 31c85f9c2..72d614997 100644
--- a/turbo/transactions/tracing.go
+++ b/turbo/transactions/tracing.go
@@ -204,6 +204,11 @@ func TraceTx(
                if streaming {
                        stream.WriteArrayEnd()
                        stream.WriteObjectEnd()
+                       stream.WriteArrayEnd()
+                       stream.WriteArrayEnd()
+                       stream.WriteMore()
+                       stream.WriteObjectField("failed")
+                       stream.WriteBool(true)
                        stream.WriteMore()
                        stream.WriteObjectField("resultHack") // higher-level func will assing it to NULL
                } else {
dallonby commented 9 months ago

Actually ignore patch, doesn't work. Bug remains an issue however.