rpc: debug_traceBlockByNumber endpoint (#555)

* Refactor traceTx

* add getTendermintBlock on backend

* keeper concurrency

* first version

* json rpc concurrency

* rever makefile change

* remove grpc traceblock

* create internal traceBlock function

* added types to evm module

* tendermintBlockByNumber rename

* added safe message check

* remove unnecesary line

* check error

* fix lint

* fix linter

* Update ethereum/rpc/namespaces/debug/api.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* Update ethereum/rpc/namespaces/debug/api.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* Update ethereum/rpc/backend/backend.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* improve traceBlock performance

* fix linter

* add extra line on function parameters

* changed index to uint 64

* fix lint

* proto gen

* update endpoints documentation

* update changelog

* Apply suggestions from code review

* Update ethereum/rpc/namespaces/eth/filters/filters.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
crypto-facs
2021-09-15 08:46:01 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent ec7d8a37fd
commit 3f1eeb30b6
11 changed files with 346 additions and 151 deletions
+17 -1
View File
@@ -124,7 +124,7 @@ Check the JSON-RPC methods supported on Ethermint. {synopsis}
| `debug_startGoTrace` | Debug | ✔ | | |
| `debug_stopCPUProfile` | Debug | ✔ | | |
| `debug_stopGoTrace` | Debug | ✔ | | |
| `debug_traceBlock` | Debug | | | |
| `debug_traceBlock`(#debug-traceblock) | Debug | | | |
| `debug_traceBlockByNumber` | Debug | | | |
| `debug_traceBlockByHash` | Debug | | | |
| `debug_traceBlockFromFile` | Debug | | | |
@@ -1007,6 +1007,22 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params"
["68410", "51470"]
```
### `debug_traceBlockByNumber`
The `traceBlockByNumber` endpoint accepts a block number and will replay the block that is already present in the database.
#### Parameters
- Trace Config
```json
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceBlockByNumber","params":["0xe", {"tracer": "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}"}],"id":1}' -H "Content-Type: application/json" http://localhost:8545
//Result
{"jsonrpc":"2.0","id":1,"result":[{"result":["68410", "51470"]}]}
```
## Miner Methods
+1 -1
View File
@@ -847,7 +847,7 @@ QueryTraceTxRequest defines TraceTx request
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `msg` | [MsgEthereumTx](#ethermint.evm.v1.MsgEthereumTx) | | msgEthereumTx for the requested transaction |
| `tx_index` | [uint32](#uint32) | | transaction index |
| `tx_index` | [uint64](#uint64) | | transaction index |
| `trace_config` | [TraceConfig](#ethermint.evm.v1.TraceConfig) | | TraceConfig holds extra parameters to trace functions. |