Expose GRANDPA round state through RPC (#5375)

* grandpa: wire up basic RPC call

* grandpa: make it compile against GRANDPA with expose round state

* grandpa: use shared voter state to expose RPC endpoint

* grandpa: restructure into nested structs

* grandpa: return background rounds too

* grandpa: return error when endpoint not ready

* grandpa: collect grandpa rpc deps

* grandpa: decide to use concrete AuthorityId in finality-grandpa-rpc

* grandpa: remove unncessary type annotation

* grandpa: move error code to const

* grandpa: remove unnecessary WIP comment

* grandpa: remove Id type parameter for SharedVoterState

* grandpa: update tests to add shared_voter_state in parameters

* grandpa: remove old deprecated test

* grandpa: fix getting the correct set_id

* grandpa: make SharedVoterState a struct

* grandpa: wrap shared_voter_state in rpc_setup

* grandpa: replace spaces with tabs

* grandpa: limit RwLock write attempt to 1 sec

* grandpa: add missing doc comments and remove some pub

* Apply suggestions from code review

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-Authored-By: Hernando Castano <HCastano@users.noreply.github.com>

* grandpa: update function name call after change in finality-grandpa

* grandpa: group pub use and only export voter::report

* grandpa: add missing docs

* grandpa: extract out structs used for json serialization

* grandpa: stick to u32 for fields intended for js

* grandpa: move Error type to its own file

* grandpa: group pub use better

* Apply code review suggestion

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* grandpa: use correct version of finality-granpda in rpc crate

* grandpa: add back basic rpc unit test

* grandpa: replace SharedVoterState::new() with empty()

* node: cleanup grandpa::SharedVoterState usage in macro

* grandpa: remove VoterState error variant

* grandpa: enable missing futures compat feature

* grandpa: fix typo in error variant

* grandpa: remove test_utils

* grandpa: allow mocking rpc handler components

* grandpa: rename serialized to report in rpc module

* grandpa: add proper test for RPC

* grandpa: update to finality-grandpa v0.12.1

Co-authored-by: André Silva <andre.beat@gmail.com>
Co-authored-by: Demi Obenour <demi@parity.io>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Jon Häggblad
2020-05-04 21:37:22 +02:00
committed by GitHub
parent 8df33e50af
commit 1f7f8abb33
15 changed files with 552 additions and 19 deletions
+23 -2
View File
@@ -1352,9 +1352,9 @@ dependencies = [
[[package]]
name = "finality-grandpa"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d7907cc24468e29b5d3ea2097e78104492b6650c55f96af1f14e7915dc155ad"
checksum = "5ab32971efbe776e46bfbc34d5b662d8e1de51fd14e26a2eba522c0f3470fc0f"
dependencies = [
"either",
"futures 0.3.4",
@@ -3447,6 +3447,7 @@ dependencies = [
"pallet-timestamp",
"pallet-transaction-payment",
"parity-scale-codec",
"parking_lot 0.10.2",
"platforms",
"rand 0.7.3",
"regex",
@@ -3565,6 +3566,8 @@ dependencies = [
"sc-consensus-babe",
"sc-consensus-babe-rpc",
"sc-consensus-epochs",
"sc-finality-grandpa",
"sc-finality-grandpa-rpc",
"sc-keystore",
"sp-api",
"sp-blockchain",
@@ -3660,6 +3663,7 @@ dependencies = [
"futures 0.3.4",
"log",
"node-template-runtime",
"parking_lot 0.10.2",
"sc-basic-authorship",
"sc-cli",
"sc-client-api",
@@ -6400,6 +6404,23 @@ dependencies = [
"tokio 0.2.18",
]
[[package]]
name = "sc-finality-grandpa-rpc"
version = "0.8.0-dev"
dependencies = [
"derive_more",
"finality-grandpa",
"futures 0.3.4",
"jsonrpc-core",
"jsonrpc-core-client",
"jsonrpc-derive",
"log",
"sc-finality-grandpa",
"serde",
"serde_json",
"sp-core",
]
[[package]]
name = "sc-informant"
version = "0.8.0-dev"