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 11 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b21d51c
Switch GrandPa to new futures
tomaka Aug 5, 2019
a25be8e
Merge remote-tracking branch 'upstream/master' into HEAD
tomaka Oct 24, 2019
513704d
Merge remote-tracking branch 'upstream/master' into HEAD
tomaka Oct 28, 2019
6007c2b
Work on making tests work
tomaka Oct 28, 2019
46f3728
until_imported tests working again
tomaka Oct 28, 2019
6f6849a
Work on switching tests to stable futures
tomaka Oct 28, 2019
7c4f79b
Merge remote-tracking branch 'parity/master' into HEAD
expenses Jan 10, 2020
c1dd9e5
Modifications
expenses Jan 13, 2020
6737632
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 13, 2020
46a6822
Re-add test as #[ignore]
expenses Jan 13, 2020
f05c301
Don't ignore
expenses Jan 13, 2020
53fb151
Add manual unpins
expenses Jan 13, 2020
6fdc0b8
Remove Header import
expenses Jan 14, 2020
a52f255
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 14, 2020
14d8afb
Return concrete Sink type
expenses Jan 15, 2020
b1264db
Switch to crates.io finality-grandpa version
expenses Jan 16, 2020
5afd086
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 16, 2020
ba62dd5
Remove use statement that slipped in
expenses Jan 16, 2020
daf41a3
Fix some nitpicks
expenses Jan 16, 2020
828af5e
Remove unpin from i
expenses Jan 16, 2020
c7d2b24
Fixed typo
expenses Jan 16, 2020
e1a89d7
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 17, 2020
7fcf87b
Move futures01 to dev-deps
expenses Jan 17, 2020
65724be
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 20, 2020
8589985
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 22, 2020
6053e88
Merge remote-tracking branch 'parity/master' into ashley-grandpa-futures
expenses Jan 23, 2020
a6097b3
Fix nitpicks
expenses Jan 23, 2020
6226ed4
Update client/finality-grandpa/src/communication/mod.rs
expenses Jan 23, 2020
d6b89c4
nitpicking
expenses Jan 23, 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
12 changes: 7 additions & 5 deletions Cargo.lock

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

7 changes: 5 additions & 2 deletions bin/node-template/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
is_authority,
};

use futures::prelude::*;

match (is_authority, disable_grandpa) {
(false, false) => {
// start the lightweight GRANDPA observer
Expand All @@ -163,7 +165,7 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
service.network(),
service.on_exit(),
service.spawn_task_handle(),
)?);
)?.unit_error().compat());
},
(true, false) => {
// start the full GRANDPA voter
Expand All @@ -180,7 +182,8 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon

// the GRANDPA voter task is considered infallible, i.e.
// if it fails we take down the service with it.
service.spawn_essential_task(grandpa::run_grandpa_voter(voter_config)?);
service.spawn_essential_task(grandpa::run_grandpa_voter(voter_config)?
.unit_error().compat());
},
(_, true) => {
grandpa::setup_disabled_grandpa(
Expand Down
5 changes: 3 additions & 2 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ macro_rules! new_full {
service.network(),
service.on_exit(),
service.spawn_task_handle(),
)?);
)?.unit_error().compat());
},
(true, false) => {
// start the full GRANDPA voter
Expand All @@ -239,7 +239,8 @@ macro_rules! new_full {
};
// the GRANDPA voter task is considered infallible, i.e.
// if it fails we take down the service with it.
service.spawn_essential_task(grandpa::run_grandpa_voter(grandpa_config)?);
service.spawn_essential_task(grandpa::run_grandpa_voter(grandpa_config)?
.map(|()| Ok::<(), ()>(())).compat());
},
(_, true) => {
grandpa::setup_disabled_grandpa(
Expand Down
9 changes: 5 additions & 4 deletions client/finality-grandpa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2018"

[dependencies]
fork-tree = { version = "2.0.0", path = "../../utils/fork-tree" }
futures = "0.1.29"
futures03 = { package = "futures", version = "0.3.1", features = ["compat"] }
futures = "0.3.1"
futures01 = { package = "futures", version = "0.1.29" }
futures-timer = "2.0.2"
log = "0.4.8"
parking_lot = "0.9.0"
Expand All @@ -27,10 +27,11 @@ sc-network = { version = "0.8", path = "../network" }
sc-network-gossip = { version = "2.0.0", path = "../network-gossip" }
sp-finality-tracker = { version = "2.0.0", path = "../../primitives/finality-tracker" }
sp-finality-grandpa = { version = "2.0.0", path = "../../primitives/finality-grandpa" }
finality-grandpa = { version = "0.10.1", features = ["derive-codec"] }
# See https://github.com/paritytech/finality-grandpa/pull/100
finality-grandpa = { git = "https://github.com/expenses/finality-grandpa", branch = "future", features = ["derive-codec"] }

[dev-dependencies]
finality-grandpa = { version = "0.10.1", features = ["derive-codec", "test-helpers"] }
finality-grandpa = { git = "https://github.com/expenses/finality-grandpa", branch = "future", features = ["derive-codec", "test-helpers"] }
sc-network = { version = "0.8", path = "../network" }
sc-network-test = { version = "2.0.0", path = "../network/test" }
sp-keyring = { version = "2.0.0", path = "../../primitives/keyring" }
Expand Down
25 changes: 11 additions & 14 deletions client/finality-grandpa/src/communication/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,18 @@ 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 futures::channel::mpsc;
use rand::seq::SliceRandom;

use crate::{environment, CatchUp, CompactCommit, SignedMessage};
use super::{cost, benefit, Round, SetId};

use std::collections::{HashMap, VecDeque, HashSet};
use std::time::{Duration, Instant};
use std::pin::Pin;
use std::task::{Poll, Context};

const REBROADCAST_AFTER: Duration = Duration::from_secs(60 * 5);
const CATCH_UP_REQUEST_TIMEOUT: Duration = Duration::from_secs(45);
Expand Down Expand Up @@ -1460,7 +1462,7 @@ 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
-> impl Future<Output=()> + Send + 'static + Unpin
where
B: BlockT,
{
Expand All @@ -1479,20 +1481,15 @@ struct ReportingTask<B: BlockT> {
}

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

fn poll(&mut self) -> Poll<(), ()> {
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> 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 }))) =>
match Stream::poll_next(Pin::new(&mut self.reports), cx) {
Poll::Ready(None) => return Poll::Ready(()),
Poll::Ready(Some(PeerReport { who, cost_benefit })) =>
self.net.report(who, cost_benefit),
Ok(Async::NotReady) => return Ok(Async::NotReady),
Poll::Pending => return Poll::Pending,
}
}
}
Expand Down
Loading