Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove more instances of futures01 #4633

Merged
merged 30 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8da9a8a
Start removing last few instances of futures01
expenses Jan 15, 2020
1c61728
Use to_poll on wasm
expenses Jan 15, 2020
8f42407
Revert "Use to_poll on wasm"
expenses Jan 16, 2020
a80cc31
Fix fg test
expenses Jan 16, 2020
66f837a
Upgrade network test futures
expenses Jan 20, 2020
4e9e5c6
Update offchain hyper version
expenses Jan 20, 2020
7a429c6
Update service test
expenses Jan 21, 2020
738fff9
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 21, 2020
19c8b38
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 21, 2020
5d36bef
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 24, 2020
9a196df
bump tokio to 0.2.10
expenses Jan 24, 2020
29b70b8
Removed some unneeded tokios
expenses Jan 24, 2020
6aeecf7
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 27, 2020
c4fd68b
fixes
expenses Jan 27, 2020
553f9c1
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 27, 2020
8b28b97
fix run_until_all_full
expenses Jan 27, 2020
b692425
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 29, 2020
7c55e50
Make service test debuggable
expenses Jan 29, 2020
837aa0b
Update client/offchain/src/api/http.rs
expenses Jan 29, 2020
06ca442
Add service_test to test-int output
expenses Jan 29, 2020
25f1579
Merge branch 'ashley-more-futures' of github.com:paritytech/substrate…
expenses Jan 29, 2020
a0d4b37
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Jan 30, 2020
4270f7f
nitpicking
expenses Jan 30, 2020
b5e8f13
Merge remote-tracking branch 'parity/master' into HEAD
expenses Feb 6, 2020
64856fe
Finally fix test
expenses Feb 10, 2020
18fe65a
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Feb 10, 2020
6eb50f6
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Feb 27, 2020
bcc5b8b
Give up and revert client/serviec/test
expenses Feb 28, 2020
53c4ccf
Revert gitlab ci too
expenses Feb 28, 2020
143d62e
Merge remote-tracking branch 'parity/master' into ashley-more-futures
expenses Feb 28, 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
211 changes: 102 additions & 109 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,5 @@ sc-network = { version = "0.8.0-alpha.2", path = "../../network" }
sc-network-test = { version = "0.8.0-dev", path = "../../network/test" }
sc-service = { version = "0.8.0-alpha.2", path = "../../service" }
substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" }
tokio = "0.1.22"
env_logger = "0.7.0"
tempfile = "3.1.0"
futures01 = { package = "futures", version = "0.1" }
30 changes: 14 additions & 16 deletions client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,10 @@ mod tests {
use sp_runtime::traits::{Block as BlockT, DigestFor};
use sc_network::config::ProtocolConfig;
use parking_lot::Mutex;
use tokio::runtime::current_thread;
use sp_keyring::sr25519::Keyring;
use sc_client::BlockchainEvents;
use sp_consensus_aura::sr25519::AuthorityPair;
use std::task::Poll;

type Error = sp_blockchain::Error;

Expand Down Expand Up @@ -950,8 +950,8 @@ mod tests {

let net = Arc::new(Mutex::new(net));
let mut import_notifications = Vec::new();
let mut aura_futures = Vec::new();

let mut runtime = current_thread::Runtime::new().unwrap();
let mut keystore_paths = Vec::new();
for (peer_id, key) in peers {
let mut net = net.lock();
Expand Down Expand Up @@ -979,7 +979,7 @@ mod tests {
&inherent_data_providers, slot_duration.get()
).expect("Registers aura inherent data provider");

let aura = start_aura::<_, _, _, _, _, AuthorityPair, _, _, _>(
aura_futures.push(start_aura::<_, _, _, _, _, AuthorityPair, _, _, _>(
slot_duration,
client.clone(),
select_chain,
Expand All @@ -990,21 +990,19 @@ mod tests {
false,
keystore,
sp_consensus::AlwaysCanAuthor,
)
.expect("Starts aura")
.unit_error()
.compat();

runtime.spawn(aura);
).expect("Starts aura"));
}

runtime.spawn(futures01::future::poll_fn(move || {
net.lock().poll();
Ok::<_, ()>(futures01::Async::NotReady::<()>)
}));

runtime.block_on(future::join_all(import_notifications)
.unit_error().compat()).unwrap();
futures::executor::block_on(future::select(
future::poll_fn(move |cx| {
net.lock().poll(cx);
Poll::<()>::Pending
}),
future::select(
future::join_all(aura_futures),
future::join_all(import_notifications)
)
));
}

#[test]
Expand Down
2 changes: 0 additions & 2 deletions client/consensus/babe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ sc-network-test = { version = "0.8.0-dev", path = "../../network/test" }
sc-service = { version = "0.8.0-alpha.2", path = "../../service" }
substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../../test-utils/runtime/client" }
sc-block-builder = { version = "0.8.0-alpha.2", path = "../../block-builder" }
tokio = "0.1.22"
env_logger = "0.7.0"
tempfile = "3.1.0"
futures01 = { package = "futures", version = "0.1" }

[features]
test-helpers = []
2 changes: 1 addition & 1 deletion client/consensus/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub struct BabeParams<B: BlockT, C, E, I, SO, SC, CAW> {
pub can_author_with: CAW,
}

/// Start the babe worker. The returned future should be run in a tokio runtime.
/// Start the babe worker.
pub fn start_babe<B, C, SC, E, I, SO, CAW, Error>(BabeParams {
keystore,
client,
Expand Down
35 changes: 17 additions & 18 deletions client/consensus/babe/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ use sc_network_test::*;
use sc_network_test::{Block as TestBlock, PeersClient};
use sc_network::config::{BoxFinalityProofRequestBuilder, ProtocolConfig};
use sp_runtime::{generic::DigestItem, traits::{Block as BlockT, DigestFor}};
use tokio::runtime::current_thread;
use sc_client_api::{BlockchainEvents, backend::TransactionFor};
use log::debug;
use std::{time::Duration, cell::RefCell};
use std::{time::Duration, cell::RefCell, task::Poll};

type Item = DigestItem<Hash>;

Expand Down Expand Up @@ -354,7 +353,7 @@ fn run_one_test(

let net = Arc::new(Mutex::new(net));
let mut import_notifications = Vec::new();
let mut runtime = current_thread::Runtime::new().unwrap();
let mut babe_futures = Vec::new();
let mut keystore_paths = Vec::new();

for (peer_id, seed) in peers {
Expand Down Expand Up @@ -399,7 +398,7 @@ fn run_one_test(
);


runtime.spawn(start_babe(BabeParams {
babe_futures.push(start_babe(BabeParams {
block_import: data.block_import.lock().take().expect("import set up during init"),
select_chain,
client,
Expand All @@ -410,23 +409,23 @@ fn run_one_test(
babe_link: data.link.clone(),
keystore,
can_author_with: sp_consensus::AlwaysCanAuthor,
}).expect("Starts babe").unit_error().compat());
}).expect("Starts babe"));
}

runtime.spawn(futures01::future::poll_fn(move || {
let mut net = net.lock();
net.poll();
for p in net.peers() {
for (h, e) in p.failed_verifications() {
panic!("Verification failed for {:?}: {}", h, e);
futures::executor::block_on(future::select(
futures::future::poll_fn(move |cx| {
let mut net = net.lock();
net.poll(cx);
for p in net.peers() {
for (h, e) in p.failed_verifications() {
panic!("Verification failed for {:?}: {}", h, e);
}
}
}

Ok::<_, ()>(futures01::Async::NotReady::<()>)
}));

runtime.block_on(future::join_all(import_notifications)
.unit_error().compat()).unwrap();

Poll::<()>::Pending
}),
future::select(future::join_all(import_notifications), future::join_all(babe_futures))
));
}

#[test]
Expand Down
3 changes: 1 addition & 2 deletions client/finality-grandpa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-uti
sp-consensus-babe = { version = "0.8.0-alpha.2", path = "../../primitives/consensus/babe" }
sp-state-machine = { version = "0.8.0-alpha.2", path = "../../primitives/state-machine" }
env_logger = "0.7.0"
tokio = "0.1.22"
tokio = { version = "0.2", features = ["rt-core"] }
tempfile = "3.1.0"
sp-api = { version = "2.0.0-alpha.2", path = "../../primitives/api" }
futures01 = { package = "futures", version = "0.1.29" }
Loading