Unverified Commit ae6ff17b authored by Marcin S.'s avatar Marcin S.
Browse files

Merge branch 'master' into m-cat/remove-parity-util-mem

parents 7be1f356 2bde8c1a
Pipeline #230836 passed with stages
in 55 minutes and 8 seconds
......@@ -162,16 +162,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
[[package]]
name = "async-attributes"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "async-channel"
version = "1.6.1"
......@@ -250,67 +240,6 @@ dependencies = [
"event-listener",
]
[[package]]
name = "async-process"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c"
dependencies = [
"async-io",
"blocking",
"cfg-if",
"event-listener",
"futures-lite",
"libc",
"once_cell",
"signal-hook",
"winapi",
]
[[package]]
name = "async-std"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c"
dependencies = [
"async-attributes",
"async-channel",
"async-global-executor",
"async-io",
"async-lock",
"async-process",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
"futures-lite",
"gloo-timers",
"kv-log-macro",
"log",
"memchr",
"num_cpus",
"once_cell",
"pin-project-lite 0.2.6",
"pin-utils",
"slab",
"wasm-bindgen-futures",
]
[[package]]
name = "async-std-resolver"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723"
dependencies = [
"async-std",
"async-trait",
"futures-io",
"futures-util",
"pin-utils",
"socket2",
"trust-dns-resolver",
]
[[package]]
name = "async-stream"
version = "0.3.2"
......@@ -381,9 +310,9 @@ dependencies = [
[[package]]
name = "autocfg"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
......@@ -2754,19 +2683,6 @@ dependencies = [
"regex",
]
[[package]]
name = "gloo-timers"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f"
dependencies = [
"futures-channel",
"futures-core",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "group"
version = "0.12.0"
......@@ -3458,15 +3374,6 @@ dependencies = [
"substrate-wasm-builder",
]
[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
dependencies = [
"log",
]
[[package]]
name = "kvdb"
version = "0.13.0"
......@@ -3625,7 +3532,6 @@ version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720"
dependencies = [
"async-std-resolver",
"futures",
"libp2p-core",
"log",
......@@ -3689,7 +3595,6 @@ version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15"
dependencies = [
"async-io",
"data-encoding",
"dns-parser",
"futures",
......@@ -3700,6 +3605,7 @@ dependencies = [
"rand 0.8.5",
"smallvec",
"socket2",
"tokio",
"void",
]
......@@ -3828,7 +3734,6 @@ version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92"
dependencies = [
"async-io",
"futures",
"futures-timer",
"if-watch",
......@@ -3836,6 +3741,7 @@ dependencies = [
"libp2p-core",
"log",
"socket2",
"tokio",
]
[[package]]
......@@ -4034,7 +3940,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
"value-bag",
]
[[package]]
......@@ -4228,7 +4133,6 @@ dependencies = [
name = "mmr-gadget"
version = "4.0.0-dev"
dependencies = [
"async-std",
"beefy-primitives",
"futures",
"log",
......@@ -4546,7 +4450,6 @@ version = "3.0.0-dev"
dependencies = [
"array-bytes",
"assert_cmd",
"async-std",
"clap 4.0.11",
"clap_complete",
"criterion",
......@@ -4620,6 +4523,7 @@ dependencies = [
"substrate-rpc-client",
"tempfile",
"tokio",
"tokio-util",
"try-runtime-cli",
"wait-timeout",
]
......@@ -4736,6 +4640,7 @@ dependencies = [
"frame-benchmarking",
"frame-benchmarking-cli",
"frame-system",
"futures",
"jsonrpsee",
"node-template-runtime",
"pallet-transaction-payment",
......@@ -7781,6 +7686,7 @@ dependencies = [
"substrate-test-runtime-client",
"tempfile",
"thiserror",
"tokio",
]
[[package]]
......@@ -7829,6 +7735,7 @@ dependencies = [
"substrate-prometheus-endpoint",
"substrate-test-runtime-client",
"thiserror",
"tokio",
]
[[package]]
......@@ -8168,7 +8075,6 @@ version = "0.10.0-dev"
dependencies = [
"array-bytes",
"assert_matches",
"async-std",
"async-trait",
"asynchronous-codec",
"bitflags",
......@@ -8213,6 +8119,8 @@ dependencies = [
"substrate-test-runtime-client",
"tempfile",
"thiserror",
"tokio",
"tokio-util",
"unsigned-varint",
"zeroize",
]
......@@ -8273,7 +8181,6 @@ name = "sc-network-gossip"
version = "0.10.0-dev"
dependencies = [
"ahash",
"async-std",
"futures",
"futures-timer",
"libp2p",
......@@ -8285,6 +8192,7 @@ dependencies = [
"sp-runtime",
"substrate-prometheus-endpoint",
"substrate-test-runtime-client",
"tokio",
"tracing",
]
......@@ -8313,7 +8221,6 @@ name = "sc-network-sync"
version = "0.10.0-dev"
dependencies = [
"array-bytes",
"async-std",
"async-trait",
"fork-tree",
"futures",
......@@ -8342,13 +8249,13 @@ dependencies = [
"sp-tracing",
"substrate-test-runtime-client",
"thiserror",
"tokio",
]
[[package]]
name = "sc-network-test"
version = "0.8.0"
dependencies = [
"async-std",
"async-trait",
"futures",
"futures-timer",
......@@ -8372,6 +8279,7 @@ dependencies = [
"sp-tracing",
"substrate-test-runtime",
"substrate-test-runtime-client",
"tokio",
]
[[package]]
......@@ -8561,7 +8469,6 @@ dependencies = [
name = "sc-service"
version = "0.10.0-dev"
dependencies = [
"async-std",
"async-trait",
"directories",
"exit-future",
......@@ -9155,16 +9062,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d"
[[package]]
name = "signal-hook"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-registry"
version = "1.3.0"
......@@ -10718,16 +10615,16 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.17.0"
version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3"
dependencies = [
"autocfg",
"bytes",
"libc",
"memchr",
"mio",
"num_cpus",
"once_cell",
"parking_lot 0.12.1",
"pin-project-lite 0.2.6",
"signal-hook-registry",
......@@ -10784,9 +10681,9 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.7.1"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764"
checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
dependencies = [
"bytes",
"futures-core",
......@@ -10974,6 +10871,7 @@ dependencies = [
"smallvec",
"thiserror",
"tinyvec",
"tokio",
"tracing",
"url",
]
......@@ -10993,6 +10891,7 @@ dependencies = [
"resolv-conf",
"smallvec",
"thiserror",
"tokio",
"tracing",
"trust-dns-proto",
]
......@@ -11179,16 +11078,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "value-bag"
version = "1.0.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"
dependencies = [
"ctor",
"version_check",
]
[[package]]
name = "vcpkg"
version = "0.2.11"
......
......@@ -18,6 +18,7 @@ name = "node-template"
[dependencies]
clap = { version = "4.0.9", features = ["derive"] }
futures = { version = "0.3.21", features = ["thread-pool"]}
sc-cli = { version = "0.10.0-dev", path = "../../../client/cli" }
sp-core = { version = "7.0.0", path = "../../../primitives/core" }
......
......@@ -176,8 +176,7 @@ pub fn inherent_benchmark_data() -> Result<InherentData> {
let d = Duration::from_millis(0);
let timestamp = sp_timestamp::InherentDataProvider::new(d.into());
timestamp
.provide_inherent_data(&mut inherent_data)
futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data))
.map_err(|e| format!("creating inherent data: {:?}", e))?;
Ok(inherent_data)
}
......@@ -150,8 +150,10 @@ impl core::Benchmark for ConstructionBenchmark {
)
.expect("Proposer initialization failed");
let inherent_data = futures::executor::block_on(timestamp_provider.create_inherent_data())
.expect("Create inherent data failed");
let _block = futures::executor::block_on(proposer.propose(
timestamp_provider.create_inherent_data().expect("Create inherent data failed"),
inherent_data,
Default::default(),
std::time::Duration::from_secs(20),
None,
......
......@@ -117,10 +117,10 @@ nix = "0.23"
serde_json = "1.0"
regex = "1.6.0"
platforms = "2.0"
async-std = { version = "1.11.0", features = ["attributes"] }
soketto = "0.7.1"
criterion = { version = "0.3.5", features = ["async_tokio"] }
tokio = { version = "1.17.0", features = ["macros", "time", "parking_lot"] }
tokio = { version = "1.22.0", features = ["macros", "time", "parking_lot"] }
tokio-util = { version = "0.7.4", features = ["compat"] }
wait-timeout = "0.2"
substrate-rpc-client = { path = "../../../utils/frame/rpc/client" }
pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" }
......
......@@ -116,8 +116,7 @@ pub fn inherent_benchmark_data() -> Result<InherentData> {
let d = Duration::from_millis(0);
let timestamp = sp_timestamp::InherentDataProvider::new(d.into());
timestamp
.provide_inherent_data(&mut inherent_data)
futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data))
.map_err(|e| format!("creating inherent data: {:?}", e))?;
Ok(inherent_data)
}
......@@ -692,14 +692,16 @@ mod tests {
slot += 1;
};
let inherent_data = (
sp_timestamp::InherentDataProvider::new(
std::time::Duration::from_millis(SLOT_DURATION * slot).into(),
),
sp_consensus_babe::inherents::InherentDataProvider::new(slot.into()),
let inherent_data = futures::executor::block_on(
(
sp_timestamp::InherentDataProvider::new(
std::time::Duration::from_millis(SLOT_DURATION * slot).into(),
),
sp_consensus_babe::inherents::InherentDataProvider::new(slot.into()),
)
.create_inherent_data(),
)
.create_inherent_data()
.expect("Creates inherent data");
.expect("Creates inherent data");
digest.push(<DigestItem as CompatibleDigestItem>::babe_pre_digest(babe_pre_digest));
......
......@@ -26,7 +26,7 @@ use std::process;
pub mod common;
pub mod websocket_server;
#[async_std::test]
#[tokio::test]
async fn telemetry_works() {
let config = websocket_server::Config {
capacity: 1,
......@@ -38,7 +38,7 @@ async fn telemetry_works() {
let addr = server.local_addr().unwrap();
let server_task = async_std::task::spawn(async move {
let server_task = tokio::spawn(async move {
loop {
use websocket_server::Event;
match server.next_event().await {
......@@ -78,7 +78,7 @@ async fn telemetry_works() {
.spawn()
.unwrap();
server_task.await;
server_task.await.expect("server task panicked");
assert!(substrate.try_wait().unwrap().is_none(), "the process should still be running");
......
......@@ -16,11 +16,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use async_std::net::{TcpListener, TcpStream};
use core::pin::Pin;
use futures::prelude::*;
use soketto::handshake::{server::Response, Server};
use std::{io, net::SocketAddr};
use tokio::net::{TcpListener, TcpStream};
use tokio_util::compat::{Compat, TokioAsyncReadCompatExt};
/// Configuration for a [`WsServer`].
pub struct Config {
......@@ -71,8 +72,12 @@ pub struct WsServer {
negotiating: stream::FuturesUnordered<
Pin<
Box<
dyn Future<Output = Result<Server<'static, TcpStream>, Box<dyn std::error::Error>>>
+ Send,
dyn Future<
Output = Result<
Server<'static, Compat<TcpStream>>,
Box<dyn std::error::Error>,
>,
> + Send,
>,
>,
>,
......@@ -120,7 +125,7 @@ impl WsServer {
let pending_incoming = self.pending_incoming.take().expect("no pending socket");
self.negotiating.push(Box::pin(async move {
let mut server = Server::new(pending_incoming);
let mut server = Server::new(pending_incoming.compat());
let websocket_key = match server.receive_request().await {
Ok(req) => req.key(),
......
......@@ -312,9 +312,6 @@ try-runtime = [
"pallet-vesting/try-runtime",
"pallet-whitelist/try-runtime",
]
# Make contract callable functions marked as __unstable__ available. Do not enable
# on live chains as those are subject to change.
contracts-unstable-interface = ["pallet-contracts/unstable-interface"]
# Force `sp-sandbox` to call into the host resident executor. One still need to make sure
# that `sc-executor` gets the `wasmer-sandbox` feature which happens automatically when
# specified on the command line.
......
......@@ -32,7 +32,7 @@ use frame_support::{
pallet_prelude::Get,
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, Currency, EitherOfDiverse,
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU16, ConstU32, Currency, EitherOfDiverse,
EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter, KeyOwnerProofSystem,
LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote, WithdrawReasons,
},
......@@ -1191,6 +1191,7 @@ impl pallet_contracts::Config for Runtime {
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
type MaxCodeLen = ConstU32<{ 128 * 1024 }>;
type MaxStorageKeyLen = ConstU32<128>;
type UnsafeUnstableInterface = ConstBool<false>;
}
impl pallet_sudo::Config for Runtime {
......
......@@ -44,7 +44,7 @@ sp-runtime = { version = "7.0.0", path = "../../primitives/runtime" }
serde = "1.0.136"
strum = { version = "0.24.1", features = ["derive"] }
tempfile = "3.1.0"
tokio = "1.17.0"
tokio = "1.22.0"
sc-block-builder = { version = "0.10.0-dev", path = "../block-builder" }
sc-network-test = { version = "0.8.0", path = "../network/test" }
sp-finality-grandpa = { version = "4.0.0-dev", path = "../../primitives/finality-grandpa" }
......
......@@ -29,4 +29,4 @@ sc-rpc = { version = "4.0.0-dev", features = [
"test-helpers",
], path = "../../rpc" }
substrate-test-runtime-client = { version = "2.0.0", path = "../../../test-utils/runtime/client" }
tokio = { version = "1.17.0", features = ["macros"] }
tokio = { version = "1.22.0", features = ["macros"] }
......@@ -77,6 +77,7 @@ pub(crate) mod tests {
use super::*;
use crate::tests::BeefyTestNet;
use sc_network_test::TestNetFactory;
use tokio::runtime::Runtime;
// also used in tests.rs
pub fn verify_persisted_version<B: BlockT, BE: Backend<B>>(backend: &BE) -> bool {
......@@ -86,7 +87,8 @@ pub(crate) mod tests {
#[test]
fn should_load_persistent_sanity_checks() {
let mut net = BeefyTestNet::new(1);
let runtime = Runtime::new().unwrap();
let mut net = BeefyTestNet::new(runtime.handle().clone(), 1);
let backend = net.peer(0).client().as_backend();
// version not available in db -> None
......
......@@ -47,7 +47,7 @@ use sc_consensus::{
use sc_network::{config::RequestResponseConfig, ProtocolName};
use sc_network_test::{
Block, BlockImportAdapter, FullPeerConfig, PassThroughVerifier, Peer, PeersClient,
PeersFullClient, TestNetFactory,
PeersFullClient, TestNetFactory, WithRuntime,
};
use sc_utils::notification::NotificationReceiver;
use serde::{Deserialize, Serialize};
......@@ -64,7 +64,10 @@ use sp_runtime::{
};
use std::{collections::HashMap, marker::PhantomData, sync::Arc, task::Poll};
use substrate_test_runtime_client::{runtime::Header, ClientExt};
use tokio::{runtime::Runtime, time::Duration};
use tokio::{
runtime::{Handle, Runtime},
time::Duration,
};
const GENESIS_HASH: H256 = H256::zero();
fn beefy_gossip_proto_name() -> ProtocolName {
......@@ -103,14 +106,23 @@ pub(crate) struct PeerData {
Mutex<Option<BeefyJustifsRequestHandler<Block, PeersFullClient>>>,
}
#[derive(Default)]
pub(crate) struct BeefyTestNet {
rt_handle: Handle,
peers: Vec<BeefyPeer>,
}
impl WithRuntime for BeefyTestNet {
fn with_runtime(rt_handle: Handle) -> Self {
BeefyTestNet { rt_handle, peers: Vec::new() }
}
fn rt_handle(&self) -> &Handle {
&self.rt_handle
}
}
impl BeefyTestNet {
pub(crate) fn new(n_authority: usize) -> Self {
let mut net = BeefyTestNet { peers: Vec::with_capacity(n_authority) };
pub(crate) fn new(rt_handle: Handle, n_authority: usize) -> Self {
let mut net = BeefyTestNet::with_runtime(rt_handle);
for i in 0..n_authority {
let (rx, cfg) = on_demand_justifications_protocol_config(GENESIS_HASH, None);
......@@ -145,6 +157,7 @@ impl BeefyTestNet {
session_length: u64,
validator_set: &BeefyValidatorSet,
include_mmr_digest: bool,
runtime: &mut Runtime,
) {
self.peer(0).generate_blocks(count, BlockOrigin::File, |builder| {
let mut block = builder.build().unwrap().block;
......@@ -162,7 +175,7 @@ impl BeefyTestNet {
block
});
self.block_until_sync();
runtime.block_on(self.wait_until_sync());
}
}
......@@ -534,14 +547,14 @@ fn beefy_finalizing_blocks() {
let session_len = 10;