mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Remove more instances of futures01 (#4633)
* Start removing last few instances of futures01 * Use to_poll on wasm * Revert "Use to_poll on wasm" This reverts commit 1c61728f10d520df5f9b28c415a0db68e478b9c7. * Fix fg test * Upgrade network test futures * Update offchain hyper version * Update service test * bump tokio to 0.2.10 * Removed some unneeded tokios * fixes * fix run_until_all_full * Make service test debuggable * Update client/offchain/src/api/http.rs Co-Authored-By: Demi Obenour <48690212+DemiMarie-parity@users.noreply.github.com> * Add service_test to test-int output * nitpicking * Finally fix test * Give up and revert client/serviec/test * Revert gitlab ci too Co-authored-by: Demi Obenour <demi@parity.io>
This commit is contained in:
@@ -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" }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
@@ -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,
|
||||
@@ -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]
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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 {
|
||||
@@ -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,
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user