0xPolygonZero / erigon

Ethereum implementation on the efficiency frontier
GNU Lesser General Public License v3.0
0 stars 4 forks source link

Add 'witness' flag to zeroTracer config #7

Closed cffls closed 3 months ago

cffls commented 4 months ago

This flag will allow user to include or exclude witness in the result of zeroTracer. This PR also adds field txHash back to result output of zeroTracer. The purpose is to unify the output format of zeroTracer with the rest of tracers. Also, a minor change that sets witness version header from 1 to 0.

Usages

Include witness in tracer output:

curl http://127.0.0.1:8545   -X POST   -H "Content-Type: application/json"   --data '{"method":"debug_traceBlockByNumber","params":["0x58", {"tracer": "zeroTracer",  "tracerConfig": {"witness": true}}],"id":1,"jsonrpc":"2.0"}' 

Exclude witness in tracer output:

curl http://127.0.0.1:8545   -X POST   -H "Content-Type: application/json"   --data '{"method":"debug_traceBlockByNumber","params":["0x58", {"tracer": "zeroTracer",  "tracerConfig": {"witness": false}}],"id":1,"jsonrpc":"2.0"}' 

By default, witness flag is set to false. Hence, the query below will have the same output as the command above:

curl http://127.0.0.1:8545   -X POST   -H "Content-Type: application/json"   --data '{"method":"debug_traceBlockByNumber","params":["0x58", {"tracer": "zeroTracer"}],"id":1,"jsonrpc":"2.0"}'