-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement three trace APIs: - trace_block - trace_filter - trace_transaction Plus tests and docs * Fix for PR comment regarding trace_filter pagination - Moved pagination earlier in the code to avoid unnecessary traces - I've taken a procedural approach here with use of a loop label, but I'm open to switching to iterators * Removed some redundant code and comments * Fix for trace_transaction return type and test
- Loading branch information
Showing
6 changed files
with
564 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Title | ||
|
||
trace_block | ||
|
||
# Keywords | ||
|
||
block,trace,parity | ||
|
||
# Description | ||
|
||
Returns traces created at given block. The traces are returned in transaction index order. | ||
|
||
# Curl | ||
|
||
```shell | ||
curl -d '{ | ||
"id": "1", | ||
"jsonrpc": "2.0", | ||
"method": "trace_block", | ||
"params": ["0x2ed119"] | ||
}' -H "Content-Type: application/json" -X POST "{{ _api_url }}" | ||
``` | ||
|
||
# Response | ||
|
||
```json | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": [ | ||
{ | ||
"output": "0x", | ||
"stateDiff": null, | ||
"trace": [{ | ||
"action": { | ||
"from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750", | ||
"gas": "0x0", | ||
"value": "0x1", | ||
"callType": "call", | ||
"to": "0x2910543af39aba0cd09dbb2d50200b3e800a63d2" | ||
}, | ||
"result": { | ||
"gasUsed": "0x0", | ||
"output": "0x" | ||
}, | ||
"subtraces": 0, | ||
"traceAddress": [], | ||
"type": "call" | ||
}], | ||
"vmTrace": null | ||
} | ||
] | ||
} | ||
``` | ||
|
||
# Arguments | ||
|
||
| Parameter | Type | Required | Description | | ||
|-----------|--------|----------|---------------------------------| | ||
| `id` | string | Required | `"1"` | | ||
| `jsonrpc` | string | Required | `"2.0"` | | ||
| `method` | string | Required | `"trace_block"` | | ||
| `params` | array | Required | `[blockNumber]` Block number or tag | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Title | ||
|
||
trace_filter | ||
|
||
# Keywords | ||
|
||
trace,filter,parity | ||
|
||
# Description | ||
|
||
Returns traces matching given filter. The traces are returned in transaction index order. | ||
|
||
# Curl | ||
|
||
```shell | ||
curl -d '{ | ||
"id": "1", | ||
"jsonrpc": "2.0", | ||
"method": "trace_filter", | ||
"params": [{ | ||
"fromBlock": "0x2ed119", | ||
"toBlock": "0x2ed119", | ||
"fromAddress": ["0x1c39ba39e4735cb65978d4db400ddd70a72dc750"], | ||
"toAddress": ["0x2910543af39aba0cd09dbb2d50200b3e800a63d2"], | ||
"after": 0, | ||
"count": 100 | ||
}] | ||
}' -H "Content-Type: application/json" -X POST "{{ _api_url }}" | ||
``` | ||
|
||
# Response | ||
|
||
```json | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": [ | ||
{ | ||
"output": "0x", | ||
"stateDiff": null, | ||
"trace": [{ | ||
"action": { | ||
"from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750", | ||
"gas": "0x0", | ||
"value": "0x1", | ||
"callType": "call", | ||
"to": "0x2910543af39aba0cd09dbb2d50200b3e800a63d2" | ||
}, | ||
"result": { | ||
"gasUsed": "0x0", | ||
"output": "0x" | ||
}, | ||
"subtraces": 0, | ||
"traceAddress": [], | ||
"type": "call" | ||
}], | ||
"vmTrace": null | ||
} | ||
] | ||
} | ||
``` | ||
|
||
# Arguments | ||
|
||
| Parameter | Type | Required | Description | | ||
|-----------|--------|----------|------------------------------------------------------| | ||
| `id` | string | Required | `"1"` | | ||
| `jsonrpc` | string | Required | `"2.0"` | | ||
| `method` | string | Required | `"trace_filter"` | | ||
| `params` | array | Required | `[filterOptions]` Object containing filter options: | | ||
|
||
Filter Options: | ||
|
||
- `fromBlock`: `BlockNumber` - (optional) From this block | ||
- `toBlock`: `BlockNumber` - (optional) To this block | ||
- `fromAddress`: `[Address]` - (optional) Sent from these addresses | ||
- `toAddress`: `[Address]` - (optional) Sent to these addresses | ||
- `after`: `Integer` - (optional) The offset trace number | ||
- `count`: `Integer` - (optional) Integer number of traces to display in a batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Title | ||
|
||
trace_transaction | ||
|
||
# Keywords | ||
|
||
transaction,trace,parity | ||
|
||
# Description | ||
|
||
Returns all traces of given transaction. The traces are returned in transaction index order and each trace object has the following format. | ||
|
||
# Curl | ||
|
||
```shell | ||
curl -d '{ | ||
"id": "1", | ||
"jsonrpc": "2.0", | ||
"method": "trace_transaction", | ||
"params": ["0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3"] | ||
}' -H "Content-Type: application/json" -X POST "{{ _api_url }}" | ||
``` | ||
|
||
# Response | ||
|
||
```json | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": { | ||
"output": "0x", | ||
"stateDiff": { | ||
"0x00...01": { | ||
"balance": { | ||
"*": { | ||
"from": "0x100", | ||
"to": "0x110" | ||
} | ||
}, | ||
"code": "=", | ||
"nonce": "=", | ||
"storage": {} | ||
} | ||
}, | ||
"trace": { | ||
"action": { | ||
"from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", | ||
"gas": "0x1dcd12a0", | ||
"value": "0x0", | ||
"callType": "call", | ||
"input": "0x", | ||
"to": "0xf12b5dd4ead5f743c6baa640b0216200e89b60da" | ||
}, | ||
"result": { | ||
"gasUsed": "0x0", | ||
"output": "0x" | ||
}, | ||
"subtraces": 0, | ||
"traceAddress": [], | ||
"type": "call" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
# Arguments | ||
|
||
| Parameter | Type | Required | Description | | ||
|-----------|--------|----------|----------------------------------------| | ||
| `id` | string | Required | `"1"` | | ||
| `jsonrpc` | string | Required | `"2.0"` | | ||
| `method` | string | Required | `"trace_transaction"` | | ||
| `params` | array | Required | `[transactionHash]` Transaction hash | |
Oops, something went wrong.