From a14df11cbe3226614d8e2b21a7319aaeddd51ebd Mon Sep 17 00:00:00 2001 From: Karim T Date: Wed, 7 Aug 2019 10:16:00 +0200 Subject: [PATCH] [PAN-2927] Add documentation for getSignerMetrics (#1723) --- docs/Reference/Pantheon-API-Methods.md | 119 +++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/docs/Reference/Pantheon-API-Methods.md b/docs/Reference/Pantheon-API-Methods.md index dbe4947ebd..3bc7690ba7 100644 --- a/docs/Reference/Pantheon-API-Methods.md +++ b/docs/Reference/Pantheon-API-Methods.md @@ -2738,6 +2738,65 @@ Lists [signers for the specified block](../Consensus-Protocols/Clique.md#adding- "result" : [ "0x42eb768f2244c8811c63729a21a3569731535f06", "0x7ffc57839b00206d1ad20c69a1981b489f772031", "0xb279182d99e65703f0076e4812653aab85fca0f0" ] } ``` + +### clique_getSignerMetrics + +Provides validator metrics for the specified range: + +- Number of blocks from each validator +- Block number of the last block proposed by each validator (if any proposed in the specified range) +- All validators present in the last block + +**Parameters** + +`fromBlockNumber` - Integer representing a block number or the string tag `earliest` as described in [Block Parameter](../Pantheon-API/Using-JSON-RPC-API.md#block-parameter) + +`toBlockNumber` - Integer representing a block number or one of the string tags `latest` or `pending`, as described in [Block Parameter](../Pantheon-API/Using-JSON-RPC-API.md#block-parameter) + +If no parameters are specified, metrics are provided for the last 100 blocks or all blocks if there are less than 100 blocks. + +If only the first parameter is specified, metrics are provided for all blocks from the block specified by the first +parameter to the latest block. + +**Returns** + +`result`: _object_ - List of validator objects + +!!! note + The proposer of the genesis block has address `0x0000000000000000000000000000000000000000`. + +!!! example + ```bash tab="curl HTTP" + curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSignerMetrics","params":["1", "100"], "id":1}' http://127.0.0.1:8545 + ``` + + ```bash tab="wscat WS" + {"jsonrpc":"2.0","method":"clique_getSignerMetrics","params":["1", "100"], "id":1} + ``` + + ```json tab="JSON result" + { + "jsonrpc": "2.0", + "id": 1, + "result": [ + { + "address": "0x7ffc57839b00206d1ad20c69a1981b489f772031", + "proposedBlockCount": "0x21", + "lastProposedBlockNumber": "0x61" + }, + { + "address": "0x42eb768f2244c8811c63729a21a3569731535f06", + "proposedBlockCount": "0x21", + "lastProposedBlockNumber": "0x63" + }, + { + "address": "0xb279182d99e65703f0076e4812653aab85fca0f0", + "proposedBlockCount": "0x21", + "lastProposedBlockNumber": "0x62" + } + ] + } + ``` ### clique_getSignersAtHash @@ -3452,6 +3511,66 @@ Proposes [adding or removing a validator](../Consensus-Protocols/IBFT.md#adding- } ``` +### ibft_getSignerMetrics + +Provides validator metrics for the specified range: + +- Number of blocks from each validator +- Block number of the last block proposed by each validator (if any proposed in the specified range) +- All validators present in the last block of the range + +**Parameters** + +`fromBlockNumber` - Integer representing a block number or the string tag `earliest` as described in [Block Parameter](../Pantheon-API/Using-JSON-RPC-API.md#block-parameter) + +`toBlockNumber` - Integer representing a block number or one of the string tags `latest` or `pending`, as described in [Block Parameter](../Pantheon-API/Using-JSON-RPC-API.md#block-parameter) + +If no parameters are specified, metrics are provided for the last 100 blocks or all blocks if there are less than 100 blocks. + +If only the first parameter is specified, metrics are provided for all blocks from the block specified by the first +parameter to the latest block. + +**Returns** + +`result`: _object_ - List of validator objects + +!!! note + The proposer of the genesis block has address `0x0000000000000000000000000000000000000000`. + +!!! example + ```bash tab="curl HTTP" + curl -X POST --data '{"jsonrpc":"2.0","method":"ibft_getSignerMetrics","params":["1", "100"], "id":1}' http://127.0.0.1:8545 + ``` + + ```bash tab="wscat WS" + {"jsonrpc":"2.0","method":"ibft_getSignerMetrics","params":["1", "100"], "id":1} + ``` + + ```json tab="JSON result" + { + "jsonrpc": "2.0", + "id": 1, + "result": [ + { + "address": "0x7ffc57839b00206d1ad20c69a1981b489f772031", + "proposedBlockCount": "0x21", + "lastProposedBlockNumber": "0x61" + }, + { + "address": "0x42eb768f2244c8811c63729a21a3569731535f06", + "proposedBlockCount": "0x21", + "lastProposedBlockNumber": "0x63" + }, + { + "address": "0xb279182d99e65703f0076e4812653aab85fca0f0", + "proposedBlockCount": "0x21", + "lastProposedBlockNumber": "0x62" + } + ] + } + ``` + + ## Permissioning Methods !!! note