mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Upgrade tokio to 1.22.0 and replace async-std with tokio (#12646)
* Replace deprecated libp2p feature specs with correct ones * Bump tokio to 1.21.2 * Replace async-std libp2p primitives with tokio ones * minor: rustfmt * Fix TestNet to run initialization in the tokio context * Convert telemetry test from async-std to tokio * Convert notifications tests from async-std to tokio * Convert chain sync tests from async-std to tokio * Ditch async-std completely * Make executor mandatory * Bump tokio to 1.22.0 * minor: rustfmt * Explicitly use tokio runtime in tests * Move more tests to explicit tokio runtime * Explicitly set multithreaded runtime in tokio test * minor: rustfmt * minor: fix comment * Replace async-std with tokio in MMR tests
This commit is contained in:
@@ -84,7 +84,7 @@ parity-util-mem = { version = "0.12.0", default-features = false, features = [
|
||||
"primitive-types",
|
||||
] }
|
||||
async-trait = "0.1.57"
|
||||
tokio = { version = "1.17.0", features = ["time", "rt-multi-thread", "parking_lot"] }
|
||||
tokio = { version = "1.22.0", features = ["time", "rt-multi-thread", "parking_lot"] }
|
||||
tempfile = "3.1.0"
|
||||
directories = "4.0.1"
|
||||
static_init = "1.0.3"
|
||||
@@ -92,4 +92,3 @@ static_init = "1.0.3"
|
||||
[dev-dependencies]
|
||||
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }
|
||||
substrate-test-runtime = { version = "2.0.0", path = "../../test-utils/runtime/" }
|
||||
async-std = { version = "1.11.0", default-features = false }
|
||||
|
||||
@@ -876,9 +876,9 @@ where
|
||||
role: config.role.clone(),
|
||||
executor: {
|
||||
let spawn_handle = Clone::clone(&spawn_handle);
|
||||
Some(Box::new(move |fut| {
|
||||
Box::new(move |fut| {
|
||||
spawn_handle.spawn("libp2p-node", Some("networking"), fut);
|
||||
}))
|
||||
})
|
||||
},
|
||||
network_config: config.network.clone(),
|
||||
chain: client.clone(),
|
||||
|
||||
@@ -19,7 +19,7 @@ log = "0.4.17"
|
||||
parity-scale-codec = "3.0.0"
|
||||
parking_lot = "0.12.1"
|
||||
tempfile = "3.1.0"
|
||||
tokio = { version = "1.17.0", features = ["time"] }
|
||||
tokio = { version = "1.22.0", features = ["time"] }
|
||||
sc-block-builder = { version = "0.10.0-dev", path = "../../block-builder" }
|
||||
sc-client-api = { version = "4.0.0-dev", path = "../../api" }
|
||||
sc-client-db = { version = "0.10.0-dev", default-features = false, path = "../../db" }
|
||||
|
||||
@@ -302,48 +302,55 @@ where
|
||||
full: impl Iterator<Item = impl FnOnce(Configuration) -> Result<(F, U), Error>>,
|
||||
authorities: impl Iterator<Item = (String, impl FnOnce(Configuration) -> Result<(F, U), Error>)>,
|
||||
) {
|
||||
let handle = self.runtime.handle().clone();
|
||||
self.runtime.block_on(async {
|
||||
let handle = self.runtime.handle().clone();
|
||||
|
||||
for (key, authority) in authorities {
|
||||
let node_config = node_config(
|
||||
self.nodes,
|
||||
&self.chain_spec,
|
||||
Role::Authority,
|
||||
handle.clone(),
|
||||
Some(key),
|
||||
self.base_port,
|
||||
temp,
|
||||
);
|
||||
let addr = node_config.network.listen_addresses.first().unwrap().clone();
|
||||
let (service, user_data) =
|
||||
authority(node_config).expect("Error creating test node service");
|
||||
for (key, authority) in authorities {
|
||||
let node_config = node_config(
|
||||
self.nodes,
|
||||
&self.chain_spec,
|
||||
Role::Authority,
|
||||
handle.clone(),
|
||||
Some(key),
|
||||
self.base_port,
|
||||
temp,
|
||||
);
|
||||
let addr = node_config.network.listen_addresses.first().unwrap().clone();
|
||||
let (service, user_data) =
|
||||
authority(node_config).expect("Error creating test node service");
|
||||
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr =
|
||||
MultiaddrWithPeerId { multiaddr: addr, peer_id: service.network().local_peer_id() };
|
||||
self.authority_nodes.push((self.nodes, service, user_data, addr));
|
||||
self.nodes += 1;
|
||||
}
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr = MultiaddrWithPeerId {
|
||||
multiaddr: addr,
|
||||
peer_id: service.network().local_peer_id(),
|
||||
};
|
||||
self.authority_nodes.push((self.nodes, service, user_data, addr));
|
||||
self.nodes += 1;
|
||||
}
|
||||
|
||||
for full in full {
|
||||
let node_config = node_config(
|
||||
self.nodes,
|
||||
&self.chain_spec,
|
||||
Role::Full,
|
||||
handle.clone(),
|
||||
None,
|
||||
self.base_port,
|
||||
temp,
|
||||
);
|
||||
let addr = node_config.network.listen_addresses.first().unwrap().clone();
|
||||
let (service, user_data) = full(node_config).expect("Error creating test node service");
|
||||
for full in full {
|
||||
let node_config = node_config(
|
||||
self.nodes,
|
||||
&self.chain_spec,
|
||||
Role::Full,
|
||||
handle.clone(),
|
||||
None,
|
||||
self.base_port,
|
||||
temp,
|
||||
);
|
||||
let addr = node_config.network.listen_addresses.first().unwrap().clone();
|
||||
let (service, user_data) =
|
||||
full(node_config).expect("Error creating test node service");
|
||||
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr =
|
||||
MultiaddrWithPeerId { multiaddr: addr, peer_id: service.network().local_peer_id() };
|
||||
self.full_nodes.push((self.nodes, service, user_data, addr));
|
||||
self.nodes += 1;
|
||||
}
|
||||
handle.spawn(service.clone().map_err(|_| ()));
|
||||
let addr = MultiaddrWithPeerId {
|
||||
multiaddr: addr,
|
||||
peer_id: service.network().local_peer_id(),
|
||||
};
|
||||
self.full_nodes.push((self.nodes, service, user_data, addr));
|
||||
self.nodes += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user