Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
40762b6
Refactor rebase master prometheus_v0.3
nodebreaker0-0 Nov 28, 2019
472aca1
Milestone1: Final Version of v0.3
nodebreaker0-0 Dec 10, 2019
1974f94
no-std or warm compatibility issues, grapana-data -source code refere…
nodebreaker0-0 Jan 2, 2020
62a873d
Cargo.lock paritytech/master rebase
nodebreaker0-0 Jan 2, 2020
97e37e4
prometheus networking.rs del, grafana-data-source networking.rs pub e…
nodebreaker0-0 Jan 3, 2020
f3e444e
chore: reflect various feedback
nodebreaker0-0 Jan 10, 2020
8145df7
Spaces to tabs.
gavofyork Jan 6, 2020
fca71be
Replace grafana and tidy
expenses Jan 10, 2020
855ceed
Add generics
expenses Jan 10, 2020
70c6bcc
Add photo back
expenses Jan 10, 2020
5941041
Re-fix spaces in primitives/consensus/babe/src/inherents.rs
expenses Jan 10, 2020
c93a0a3
custom weight function wrapper (#4158)
kianenigma Jan 14, 2020
b443dda
Take `genesis_storage` by ref (#4617)
bkchr Jan 14, 2020
012c5ef
Add trivial EnsureFounder verifier to society (#4615)
gavofyork Jan 14, 2020
410ce11
Update the service to std futures (#4447)
expenses Jan 14, 2020
45995b4
fixed panic on empty remote read request (#4619)
svyatonik Jan 14, 2020
8cb71bd
Add `pallet-society` and `pallet-recovery` to substrate node (#4622)
bkchr Jan 14, 2020
37be263
Make offchain worker calls more future proof. (#4618)
tomusdrw Jan 14, 2020
05ce617
network: add logging for extra requests (#4625)
andresilva Jan 15, 2020
5649259
Add more logging to the network (#4621)
tomaka Jan 15, 2020
33b3c23
Return early when fees/balances/values are zero (#4628)
shawntabrizi Jan 15, 2020
c2b0c0f
reset a couple of versions down from v2.0 (#4572)
rphmeier Jan 15, 2020
af1bc8c
fix some discrepancies in generic-asset (#4221)
kigawas Jan 15, 2020
1dafa60
Make Proposer instantiation potentially async. (#4630)
rphmeier Jan 15, 2020
f21eb1a
remove old test (#4637)
gui1117 Jan 16, 2020
4c4ee3d
use default in-memory for commands that don't use keystore (#4634)
NikVolf Jan 16, 2020
3fa5f09
Getting configuration from commands (#4643)
cecton Jan 16, 2020
47c36e6
Rename basic-authority to basic-authorship (#4640)
tomusdrw Jan 16, 2020
879e28a
Implement runtime version checks in `set_code` (#4548)
bkchr Jan 16, 2020
99430a5
grandpa: generic voting rule for backing off from best block (#4635)
andresilva Jan 16, 2020
1e0c679
Make the sync_cycle_from_offline_to_syncing_to_offline test non flaky…
tomaka Jan 16, 2020
f931588
Merge remote-tracking branch 'nodebreaker/prometheus_v0.3' into ashle…
expenses Jan 16, 2020
5796c85
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 16, 2020
8e98643
Allow updating configuration of changes tries (#3201)
svyatonik Jan 16, 2020
2a45de8
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 16, 2020
6a7137f
remove unused safe-mix dependency (#4656)
xlc Jan 17, 2020
394bcf4
Add typedefs for storage types (#4654)
stanislav-tkach Jan 17, 2020
7248ac2
add debug logs (#4657)
NikVolf Jan 17, 2020
188d59e
CODEOWNERS: Add myself to pow and EVM module (#4653)
sorpaas Jan 17, 2020
8bae73b
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 17, 2020
d4fbb89
client/finality-grandpa: Reintegrate periodic neighbor packet worker …
mxinden Jan 17, 2020
2d15616
grandpa: bump finality-grandpa crate to v0.10.3 (#4659)
andresilva Jan 17, 2020
10bebed
add missing bits (#4660)
NikVolf Jan 17, 2020
083ada5
Patch practical usability issues with Society (#4651)
shawntabrizi Jan 17, 2020
36a6de0
Expose proof generation and verifying api. (#4646)
montekki Jan 17, 2020
1caa0f1
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 17, 2020
ffb4746
Tidy
expenses Jan 17, 2020
e581e3c
Drive by fix of doc of `Value`. (#4658)
pepyakin Jan 17, 2020
f0c1852
client/finality-grandpa: Reintegrate gossip validator report stream (…
mxinden Jan 17, 2020
8a6e3c5
Use local registry
expenses Jan 17, 2020
8de5340
Society: Ensure all votes are removed after tally (#4666)
shawntabrizi Jan 17, 2020
0097939
make compute_fee public (#4669)
xlc Jan 18, 2020
a31ad6e
`sp-runtime-interface` add table about FFI types (#4668)
bkchr Jan 18, 2020
8131288
Add rules and unfounding to society. (#4671)
gavofyork Jan 18, 2020
6cf45f2
Make use of `cfg(doc)` in `sp-runtime-interface` (#4673)
bkchr Jan 19, 2020
3d1634b
Merge remote-tracking branch 'nodebreaker/prometheus_v0.3' into ashle…
expenses Jan 20, 2020
55ac4f8
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 20, 2020
3cfe43c
endpoint -> exporter
expenses Jan 20, 2020
0af2369
fix readme
expenses Jan 20, 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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pallet-transaction-payment = { version = "2.0.0", path = "../../../frame/transac
frame-support = { version = "2.0.0", default-features = false, path = "../../../frame/support" }
pallet-im-online = { version = "2.0.0", default-features = false, path = "../../../frame/im-online" }
pallet-authority-discovery = { version = "2.0.0", path = "../../../frame/authority-discovery" }
pallet-society = { version = "2.0.0", path = "../../../frame/society" }

# node-specific dependencies
node-runtime = { version = "2.0.0", path = "../runtime" }
Expand Down
64 changes: 8 additions & 56 deletions client/finality-grandpa/src/communication/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@
//! We only send polite messages to peers,

use sp_runtime::traits::{NumberFor, Block as BlockT, Zero};
use sc_network_gossip::{GossipEngine, MessageIntent, ValidatorContext};
use sc_network_gossip::{MessageIntent, ValidatorContext};
use sc_network::{config::Roles, PeerId, ReputationChange};
use parity_scale_codec::{Encode, Decode};
use sp_finality_grandpa::AuthorityId;

use sc_telemetry::{telemetry, CONSENSUS_DEBUG};
use log::{trace, debug, warn};
use log::{trace, debug};
use futures::prelude::*;
use futures::sync::mpsc;
use futures03::channel::mpsc;
use rand::seq::SliceRandom;

use crate::{environment, CatchUp, CompactCommit, SignedMessage};
Expand Down Expand Up @@ -1178,15 +1178,15 @@ impl<Block: BlockT> GossipValidator<Block> {
pub(super) fn new(
config: crate::Config,
set_state: environment::SharedVoterSetState<Block>,
) -> (GossipValidator<Block>, ReportStream) {
) -> (GossipValidator<Block>, mpsc::UnboundedReceiver<PeerReport>) {
let (tx, rx) = mpsc::unbounded();
let val = GossipValidator {
inner: parking_lot::RwLock::new(Inner::new(config)),
set_state,
report_sender: tx,
};

(val, ReportStream { reports: rx })
(val, rx)
}

/// Note a round in the current set has started.
Expand Down Expand Up @@ -1445,57 +1445,9 @@ impl<Block: BlockT> sc_network_gossip::Validator<Block> for GossipValidator<Bloc
}
}

struct PeerReport {
who: PeerId,
cost_benefit: ReputationChange,
}

// wrapper around a stream of reports.
#[must_use = "The report stream must be consumed"]
pub(super) struct ReportStream {
reports: mpsc::UnboundedReceiver<PeerReport>,
}

impl ReportStream {
/// Consume the report stream, converting it into a future that
/// handles all reports.
pub(super) fn consume<B>(self, net: GossipEngine<B>)
-> impl Future<Item=(),Error=()> + Send + 'static
where
B: BlockT,
{
ReportingTask {
reports: self.reports,
net,
}
}
}

/// A future for reporting peers.
#[must_use = "Futures do nothing unless polled"]
struct ReportingTask<B: BlockT> {
reports: mpsc::UnboundedReceiver<PeerReport>,
net: GossipEngine<B>,
}

impl<B: BlockT> Future for ReportingTask<B> {
type Item = ();
type Error = ();

fn poll(&mut self) -> Poll<(), ()> {
loop {
match self.reports.poll() {
Err(_) => {
warn!(target: "afg", "Report stream terminated unexpectedly");
return Ok(Async::Ready(()))
}
Ok(Async::Ready(None)) => return Ok(Async::Ready(())),
Ok(Async::Ready(Some(PeerReport { who, cost_benefit }))) =>
self.net.report(who, cost_benefit),
Ok(Async::NotReady) => return Ok(Async::NotReady),
}
}
}
pub(super) struct PeerReport {
pub who: PeerId,
pub cost_benefit: ReputationChange,
}

#[cfg(test)]
Expand Down
58 changes: 43 additions & 15 deletions client/finality-grandpa/src/communication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
//! In the future, there will be a fallback for allowing sending the same message
//! under certain conditions that are used to un-stick the protocol.

use futures::{prelude::*, future::Executor as _, sync::mpsc};
use futures::{prelude::*, sync::mpsc};
use futures03::{
channel::mpsc as mpsc03,
compat::Compat,
future::{Future as Future03},
stream::StreamExt,
future::{Future as Future03, FutureExt as _, TryFutureExt as _},
};
use log::{debug, trace};
use parking_lot::Mutex;
Expand All @@ -52,7 +53,12 @@ use crate::{
};
use crate::environment::HasVoted;
use gossip::{
GossipMessage, FullCatchUpMessage, FullCommitMessage, VoteMessage, GossipValidator
FullCatchUpMessage,
FullCommitMessage,
GossipMessage,
GossipValidator,
PeerReport,
VoteMessage,
};
use sp_finality_grandpa::{
AuthorityPair, AuthorityId, AuthoritySignature, SetId as SetIdNumber, RoundNumber,
Expand Down Expand Up @@ -148,9 +154,18 @@ pub(crate) struct NetworkBridge<B: BlockT, N: Network<B>> {

/// `NeighborPacketWorker` processing packets sent through the `NeighborPacketSender`.
//
// NetworkBridge is required to be clonable, thus one needs to be able to clone its children,
// thus one has to wrap neighor_packet_worker with an Arc Mutex.
// `NetworkBridge` is required to be clonable, thus one needs to be able to clone its children,
// thus one has to wrap neighor_packet_worker with an `Arc` `Mutex`.
neighbor_packet_worker: Arc<Mutex<periodic::NeighborPacketWorker<B>>>,

/// Receiver side of the peer report stream populated by the gossip validator, forwarded to the
/// gossip engine.
//
// `NetworkBridge` is required to be clonable, thus one needs to be able to clone its children,
// thus one has to wrap gossip_validator_report_stream with an `Arc` `Mutex`. Given that it is
// just an `UnboundedReceiver`, one could also switch to a multi-producer-*multi*-consumer
// channel implementation.
gossip_validator_report_stream: Arc<Mutex<mpsc03::UnboundedReceiver<PeerReport>>>,
}

impl<B: BlockT, N: Network<B>> Unpin for NetworkBridge<B, N> {}
Expand All @@ -165,7 +180,6 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
config: crate::Config,
set_state: crate::environment::SharedVoterSetState<B>,
executor: &impl futures03::task::Spawn,
on_exit: impl futures03::Future<Output = ()> + Clone + Send + Unpin + 'static,
) -> Self {
let (validator, report_stream) = GossipValidator::new(
config,
Expand Down Expand Up @@ -214,20 +228,16 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
}

let (neighbor_packet_worker, neighbor_packet_sender) = periodic::NeighborPacketWorker::new();
let reporting_job = report_stream.consume(gossip_engine.clone());

let bridge = NetworkBridge {
service,
gossip_engine,
validator,
neighbor_sender: neighbor_packet_sender,
neighbor_packet_worker: Arc::new(Mutex::new(neighbor_packet_worker)),
gossip_validator_report_stream: Arc::new(Mutex::new(report_stream)),
};

let executor = Compat::new(executor);
executor.execute(Box::new(reporting_job.select(on_exit.clone().map(Ok).compat()).then(|_| Ok(()))))
.expect("failed to spawn grandpa reporting job task");

bridge
}

Expand Down Expand Up @@ -418,13 +428,30 @@ impl<B: BlockT, N: Network<B>> Future03 for NetworkBridge<B, N> {

fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll03<Self::Output> {
loop {
match futures03::ready!((self.neighbor_packet_worker.lock()).poll_next_unpin(cx)) {
None => return Poll03::Ready(
Err(Error::Network("NeighborPacketWorker stream closed.".into()))
match self.neighbor_packet_worker.lock().poll_next_unpin(cx) {
Poll03::Ready(Some((to, packet))) => {
self.gossip_engine.send_message(to, packet.encode());
},
Poll03::Ready(None) => return Poll03::Ready(
Err(Error::Network("Neighbor packet worker stream closed.".into()))
),
Some((to, packet)) => self.gossip_engine.send_message(to, packet.encode()),
Poll03::Pending => break,
}
}

loop {
match self.gossip_validator_report_stream.lock().poll_next_unpin(cx) {
Poll03::Ready(Some(PeerReport { who, cost_benefit })) => {
self.gossip_engine.report(who, cost_benefit);
},
Poll03::Ready(None) => return Poll03::Ready(
Err(Error::Network("Gossip validator report stream closed.".into()))
),
Poll03::Pending => break,
}
}

Poll03::Pending
}
}

Expand Down Expand Up @@ -568,6 +595,7 @@ impl<B: BlockT, N: Network<B>> Clone for NetworkBridge<B, N> {
validator: Arc::clone(&self.validator),
neighbor_sender: self.neighbor_sender.clone(),
neighbor_packet_worker: self.neighbor_packet_worker.clone(),
gossip_validator_report_stream: self.gossip_validator_report_stream.clone(),
}
}
}
Expand Down
1 change: 0 additions & 1 deletion client/finality-grandpa/src/communication/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ fn make_test_network(executor: &impl futures03::task::Spawn) -> (
config(),
voter_set_state(),
executor,
Exit,
);

(
Expand Down
1 change: 0 additions & 1 deletion client/finality-grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ pub fn run_grandpa_voter<B, E, Block: BlockT, N, RA, SC, VR, X, Sp>(
config.clone(),
persistent_data.set_state.clone(),
&executor,
on_exit.clone(),
);

register_finality_tracker_inherent_data_provider(client.clone(), &inherent_data_providers)?;
Expand Down
1 change: 0 additions & 1 deletion client/finality-grandpa/src/observer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ pub fn run_grandpa_observer<B, E, Block: BlockT, N, RA, SC, Sp>(
config.clone(),
persistent_data.set_state.clone(),
&executor,
on_exit.clone(),
);

let observer_work = ObserverWork::new(
Expand Down
4 changes: 1 addition & 3 deletions client/finality-grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sc_network_test::{
use sc_network::config::{ProtocolConfig, Roles, BoxFinalityProofRequestBuilder};
use parking_lot::Mutex;
use futures_timer::Delay;
use futures03::{StreamExt as _, TryStreamExt as _};
use futures03::TryStreamExt as _;
use tokio::runtime::current_thread;
use sp_keyring::Ed25519Keyring;
use sc_client::LongestChain;
Expand Down Expand Up @@ -1270,7 +1270,6 @@ fn voter_persists_its_votes() {
config.clone(),
set_state,
&threads_pool,
Exit,
);

let (round_rx, round_tx) = network.round_communication(
Expand Down Expand Up @@ -1675,7 +1674,6 @@ fn grandpa_environment_respects_voting_rules() {
config.clone(),
set_state.clone(),
&threads_pool,
Exit,
);

Environment {
Expand Down
2 changes: 1 addition & 1 deletion frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ decl_module! {
}

/// Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact
/// the proposal; otherwise it is a vote to keep the status quo.
/// the proposal; otherwise it is a vote to keep the status quo.
///
/// # <weight>
/// - O(1).
Expand Down
Loading