Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5f6bb70
grandpa: wire up basic RPC call
octol Apr 1, 2020
4ef39fa
grandpa: make it compile against GRANDPA with expose round state
andresilva Apr 1, 2020
eea294d
grandpa: use shared voter state to expose RPC endpoint
octol Apr 7, 2020
a8109a2
grandpa: restructure into nested structs
octol Apr 7, 2020
04fca7e
grandpa: return background rounds too
octol Apr 8, 2020
627c7a8
grandpa: return error when endpoint not ready
octol Apr 8, 2020
123e249
grandpa: collect grandpa rpc deps
octol Apr 8, 2020
10b3266
grandpa: decide to use concrete AuthorityId in finality-grandpa-rpc
octol Apr 17, 2020
eb5d87d
grandpa: remove unncessary type annotation
octol Apr 23, 2020
6edfa13
grandpa: move error code to const
octol Apr 23, 2020
bcb206d
grandpa: remove unnecessary WIP comment
octol Apr 23, 2020
4ca212d
grandpa: remove Id type parameter for SharedVoterState
octol Apr 23, 2020
b2af4f7
grandpa: update tests to add shared_voter_state in parameters
octol Apr 23, 2020
b04616f
grandpa: remove old deprecated test
octol Apr 23, 2020
c9bcbf8
grandpa: fix getting the correct set_id
octol Apr 24, 2020
fedfdcc
grandpa: make SharedVoterState a struct
octol Apr 24, 2020
4e75855
grandpa: wrap shared_voter_state in rpc_setup
octol Apr 24, 2020
f4140b6
grandpa: replace spaces with tabs
octol Apr 24, 2020
7586652
grandpa: limit RwLock write attempt to 1 sec
octol Apr 24, 2020
3d6f1c2
grandpa: add missing doc comments and remove some pub
octol Apr 27, 2020
4872fcb
Apply suggestions from code review
Demi-Marie Apr 28, 2020
75efc8e
grandpa: update function name call after change in finality-grandpa
octol Apr 29, 2020
26b0959
grandpa: group pub use and only export voter::report
octol Apr 29, 2020
9c55fa5
grandpa: add missing docs
octol Apr 29, 2020
d636c28
grandpa: extract out structs used for json serialization
octol Apr 29, 2020
e63c3be
grandpa: stick to u32 for fields intended for js
octol Apr 29, 2020
c02211c
grandpa: move Error type to its own file
octol Apr 29, 2020
fef11d3
grandpa: group pub use better
octol Apr 30, 2020
f1c2103
Apply code review suggestion
octol Apr 30, 2020
bc68092
Merge 'upstream/master' into jon/issue-4921-expose-grandpa-round-stat…
octol Apr 30, 2020
b809ee1
grandpa: use correct version of finality-granpda in rpc crate
octol Apr 30, 2020
988bbee
grandpa: add back basic rpc unit test
octol Apr 29, 2020
f9d9b1c
grandpa: replace SharedVoterState::new() with empty()
andresilva Apr 30, 2020
9eb5fa3
node: cleanup grandpa::SharedVoterState usage in macro
andresilva Apr 30, 2020
12004bc
grandpa: remove VoterState error variant
andresilva Apr 30, 2020
1ef01df
grandpa: enable missing futures compat feature
andresilva Apr 30, 2020
a97bb87
grandpa: fix typo in error variant
andresilva May 1, 2020
7aed9bb
grandpa: remove test_utils
andresilva May 1, 2020
65f8674
grandpa: allow mocking rpc handler components
andresilva May 1, 2020
a3e477d
grandpa: rename serialized to report in rpc module
andresilva May 1, 2020
23536a0
grandpa: add proper test for RPC
andresilva May 1, 2020
aabacb8
grandpa: update to finality-grandpa v0.12.1
andresilva May 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
grandpa: add missing docs
  • Loading branch information
octol committed Apr 29, 2020
commit 9c55fa5b13ecd6a8372d28e6b848d75a32deea5a
3 changes: 1 addition & 2 deletions client/finality-grandpa/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

//! RPC API for GRANDPA.
#![warn(missing_docs)]
#![warn(missing_docs)]

use finality_grandpa::BlockNumberOps;
use sc_finality_grandpa::{AuthorityId, SharedAuthoritySet, SharedVoterState, report};
Expand Down Expand Up @@ -52,7 +51,7 @@ impl From<Error> for jsonrpc_core::Error {
#[rpc]
pub trait GrandpaApi {
/// Returns the state of the current best round state as well as the
/// ongoining backgrounds rounds.
/// ongoing background rounds.
#[rpc(name = "grandpa_roundState")]
fn round_state(&self) -> FutureResult<ReportedRoundStates>;
}
Expand Down
6 changes: 6 additions & 0 deletions client/finality-grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
//! or prune any signaled changes based on whether the signaling block is
//! included in the newly-finalized chain.

#![warn(missing_docs)]

pub use finality_grandpa::voter::report;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bunch of pub use in L122, I think this should be moved there as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at the file and I noticed that things seems to be divided into two sections, before and after the afg_log macro

The ones on L122 seems to refer to entities in the current crate? while the ones at the top are related to other crates?

That's the rationale for me placing at the top, however I'm not sure here...


use futures::prelude::*;
Expand Down Expand Up @@ -213,6 +215,7 @@ pub struct SharedVoterState {
}

impl SharedVoterState {
/// Create a new `SharedVoterState` instance from the given `VoterState`.
pub fn new(voter_state: Option<Box<dyn voter::VoterState<AuthorityId> + Sync + Send>>) -> Self {
Self { inner: Arc::new(RwLock::new(voter_state)) }
}
Expand All @@ -228,6 +231,7 @@ impl SharedVoterState {
Ok(())
}

/// Get the inner `VoterState` instance.
pub fn voter_state(&self) -> Option<voter::report::VoterState<AuthorityId>> {
self.inner.read().as_ref().map(|vs| vs.get())
}
Expand Down Expand Up @@ -430,6 +434,7 @@ impl<H, N> fmt::Display for CommandOrError<H, N> {
}
}

/// Link between the block importer and the background voter.
pub struct LinkHalf<Block: BlockT, C, SC> {
client: Arc<C>,
select_chain: SC,
Expand All @@ -438,6 +443,7 @@ pub struct LinkHalf<Block: BlockT, C, SC> {
}

impl<Block: BlockT, C, SC> LinkHalf<Block, C, SC> {
/// Get the shared authority set.
pub fn shared_authority_set(&self) -> &SharedAuthoritySet<Block::Hash, NumberFor<Block>> {
&self.persistent_data.authority_set
}
Expand Down