Add methods param for RPC state_traceBlock (#9642)

* Add methods param for RPC state_traceBlock

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* rename event_values_filter arg

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Add some doc

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Add some doc

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix doc

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* format

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2021-08-30 19:52:26 +08:00
committed by GitHub
parent ac2468c47b
commit 847d264c33
6 changed files with 68 additions and 8 deletions
+45 -2
View File
@@ -222,17 +222,55 @@ pub trait StateApi<Hash> {
///
/// ### `curl` example
///
/// - Get tracing spans and events
/// ```text
/// curl \
/// -H "Content-Type: application/json" \
/// -d '{"id":1, "jsonrpc":"2.0", "method": "state_traceBlock", \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264"]}' \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264", "pallet,frame,state", "", ""]}' \
/// http://localhost:9933/
/// ```
///
/// - Get tracing events with all `storage_keys`
/// ```text
/// curl \
/// -H "Content-Type: application/json" \
/// -d '{"id":1, "jsonrpc":"2.0", "method": "state_traceBlock", \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264", "state", "", ""]}' \
/// http://localhost:9933/
/// ```
///
/// - Get tracing events with `storage_keys` ('f0c365c3cf59d671eb72da0e7a4113c4')
/// ```text
/// curl \
/// -H "Content-Type: application/json" \
/// -d '{"id":1, "jsonrpc":"2.0", "method": "state_traceBlock", \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264", "state", "f0c365c3cf59d671eb72da0e7a4113c4", ""]}' \
/// http://localhost:9933/
/// ```
///
/// - Get tracing events with `storage_keys` ('f0c365c3cf59d671eb72da0e7a4113c4') and method
/// ('Put')
/// ```text
/// curl \
/// -H "Content-Type: application/json" \
/// -d '{"id":1, "jsonrpc":"2.0", "method": "state_traceBlock", \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264", "state", "f0c365c3cf59d671eb72da0e7a4113c4", "Put"]}' \
/// http://localhost:9933/
/// ```
///
/// - Get tracing events with all `storage_keys` and method ('Put')
/// ```text
/// curl \
/// -H "Content-Type: application/json" \
/// -d '{"id":1, "jsonrpc":"2.0", "method": "state_traceBlock", \
/// "params": ["0xb246acf1adea1f801ce15c77a5fa7d8f2eb8fed466978bcee172cc02cf64e264", "state", "", "Put"]}' \
/// http://localhost:9933/
/// ```
///
/// ### Params
///
/// - `block_hash` (param index 0): Hash of the block to trace.
/// - `block` (param index 0): Hash of the block to trace.
/// - `targets` (param index 1): String of comma separated (no spaces) targets. Specified
/// targets match with trace targets by prefix (i.e if a target is in the beginning
/// of a trace target it is considered a match). If an empty string is specified no
@@ -251,6 +289,10 @@ pub trait StateApi<Hash> {
/// which is a map from `AccountId` to `AccountInfo`. The key filter for this would be
/// the storage prefix for the map:
/// `26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9`
/// - `methods` (param index 3): String of comma separated (no spaces) tracing event method.
/// If an empty string is specified no events will be filtered out. If anything other than
/// an empty string is specified, events will be filtered by method (so non-method events will
/// **not** show up).
///
/// Additionally you would want to track the extrinsic index, which is under the
/// `:extrinsic_index` key. The key for this would be the aforementioned string as bytes
@@ -277,5 +319,6 @@ pub trait StateApi<Hash> {
block: Hash,
targets: Option<String>,
storage_keys: Option<String>,
methods: Option<String>,
) -> FutureResult<sp_rpc::tracing::TraceBlockResponse>;
}