Remove substrate-in-the-browser (#9541)

* Comment out browser stuff

* Remove browser stuff

* Remove more wasm transport code

* Remove ExtTransport and rework how telemetry initialises.

* Change (most) wasm-timer using code to use std::time

* Rename CI-job

* Aura does not compile for wasm

* Remove testing in the browser on CI

* Update README

* Leave `StreamSink` be

* fmt
This commit is contained in:
David
2021-08-17 20:06:23 +02:00
committed by GitHub
parent 598c6676ae
commit 2de7e51c2a
61 changed files with 57 additions and 921 deletions
+3 -12
View File
@@ -27,10 +27,9 @@ use names::{Generator, Name};
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_service::{
config::{
BasePath, Configuration, DatabaseSource, ExtTransport, KeystoreConfig,
NetworkConfiguration, NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode,
Role, RpcMethods, TaskExecutor, TelemetryEndpoints, TransactionPoolOptions,
WasmExecutionMethod,
BasePath, Configuration, DatabaseSource, KeystoreConfig, NetworkConfiguration,
NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods,
TaskExecutor, TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod,
},
ChainSpec, KeepBlocks, TracingReceiver, TransactionStorageMode,
};
@@ -380,13 +379,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
Ok(chain_spec.telemetry_endpoints().clone())
}
/// Get the telemetry external transport
///
/// By default this is `None`.
fn telemetry_external_transport(&self) -> Result<Option<ExtTransport>> {
Ok(None)
}
/// Get the default value for heap pages
///
/// By default this is `None`.
@@ -526,7 +518,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
rpc_max_payload: self.rpc_max_payload()?,
prometheus_config: self.prometheus_config(DCV::prometheus_listen_port())?,
telemetry_endpoints,
telemetry_external_transport: self.telemetry_external_transport()?,
default_heap_pages: self.default_heap_pages()?,
offchain_worker: self.offchain_worker(&role)?,
force_authoring: self.force_authoring()?,
@@ -222,7 +222,6 @@ impl NetworkParams {
transport: TransportConfig::Normal {
enable_mdns: !is_dev && !self.no_mdns,
allow_private_ipv4,
wasm_external_transport: None,
},
max_parallel_downloads: self.max_parallel_downloads,
enable_dht_random_walk: !self.reserved_only,
@@ -29,7 +29,6 @@ sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" }
parking_lot = "0.11.1"
serde = { version = "1.0", features = ["derive"] }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.9.0" }
wasm-timer = "0.2.5"
async-trait = "0.1.42"
[dev-dependencies]
@@ -265,7 +265,7 @@ pub(crate) async fn import_single_block_metered<
r => return Ok(r), // Any other successful result means that the block is already imported.
}
let started = wasm_timer::Instant::now();
let started = std::time::Instant::now();
let mut import_block = BlockImportParams::new(block_origin, header);
import_block.body = block.body;
@@ -289,7 +289,7 @@ impl<B: BlockT> BlockImportWorker<B> {
number: NumberFor<B>,
justification: Justification,
) {
let started = wasm_timer::Instant::now();
let started = std::time::Instant::now();
let success = match self.justification_import.as_mut() {
Some(justification_import) => justification_import
@@ -45,7 +45,6 @@ prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../..
sc-block-builder = { version = "0.10.0-dev", path = "../block-builder" }
finality-grandpa = { version = "0.14.1", features = ["derive-codec"] }
async-trait = "0.1.50"
wasm-timer = "0.2"
[dev-dependencies]
assert_matches = "1.3.0"
@@ -101,9 +101,8 @@ use crate::{environment, CatchUp, CompactCommit, SignedMessage};
use std::{
collections::{HashMap, HashSet, VecDeque},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
const REBROADCAST_AFTER: Duration = Duration::from_secs(60 * 5);
const CATCH_UP_REQUEST_TIMEOUT: Duration = Duration::from_secs(45);
@@ -46,9 +46,8 @@ use std::{
pin::Pin,
sync::Arc,
task::{Context, Poll},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
const LOG_PENDING_INTERVAL: Duration = Duration::from_secs(15);
-1
View File
@@ -23,4 +23,3 @@ sc-network = { version = "0.10.0-dev", path = "../network" }
sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" }
sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime" }
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../transaction-pool/api" }
wasm-timer = "0.2"
+1 -1
View File
@@ -25,8 +25,8 @@ use sp_runtime::traits::{Block as BlockT, CheckedDiv, NumberFor, Saturating, Zer
use std::{
convert::{TryFrom, TryInto},
fmt,
time::Instant,
};
use wasm_timer::Instant;
/// State of the informant display system.
///
@@ -23,7 +23,6 @@ lru = "0.6.5"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.9.0", path = "../../utils/prometheus" }
sc-network = { version = "0.10.0-dev", path = "../network" }
sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime" }
wasm-timer = "0.2"
tracing = "0.1.25"
[dev-dependencies]
@@ -29,8 +29,8 @@ use std::{
iter,
sync::Arc,
time,
time::Instant,
};
use wasm_timer::Instant;
// FIXME: Add additional spam/DoS attack protection: https://github.com/paritytech/substrate/issues/1115
// NOTE: The current value is adjusted based on largest production network deployment (Kusama) and
-1
View File
@@ -63,7 +63,6 @@ unsigned-varint = { version = "0.6.0", features = [
"asynchronous_codec",
] }
void = "1.0.2"
wasm-timer = "0.2"
zeroize = "1.2.0"
[dependencies.libp2p]
+3 -15
View File
@@ -29,7 +29,7 @@ pub use crate::{
},
warp_request_handler::WarpSyncProvider,
};
pub use libp2p::{build_multiaddr, core::PublicKey, identity, wasm_ext::ExtTransport};
pub use libp2p::{build_multiaddr, core::PublicKey, identity};
// Note: this re-export shouldn't be part of the public API of the crate and will be removed in
// the future.
@@ -42,7 +42,7 @@ use core::{fmt, iter};
use futures::future;
use libp2p::{
identity::{ed25519, Keypair},
multiaddr, wasm_ext, Multiaddr, PeerId,
multiaddr, Multiaddr, PeerId,
};
use prometheus_endpoint::Registry;
use sc_consensus::ImportQueue;
@@ -490,11 +490,7 @@ impl NetworkConfiguration {
extra_sets: Vec::new(),
client_version: client_version.into(),
node_name: node_name.into(),
transport: TransportConfig::Normal {
enable_mdns: false,
allow_private_ipv4: true,
wasm_external_transport: None,
},
transport: TransportConfig::Normal { enable_mdns: false, allow_private_ipv4: true },
max_parallel_downloads: 5,
sync_mode: SyncMode::Full,
enable_dht_random_walk: true,
@@ -628,14 +624,6 @@ pub enum TransportConfig {
/// [RFC1918](https://tools.ietf.org/html/rfc1918)). Irrelevant for addresses that have
/// been passed in [`NetworkConfiguration::boot_nodes`].
allow_private_ipv4: bool,
/// Optional external implementation of a libp2p transport. Used in WASM contexts where we
/// need some binding between the networking provided by the operating system or
/// environment and libp2p.
///
/// This parameter exists whatever the target platform is, but it is expected to be set to
/// `Some` only when compiling for WASM.
wasm_external_transport: Option<wasm_ext::ExtTransport>,
},
/// Only allow connections within the same process.
+1 -2
View File
@@ -40,9 +40,8 @@ use std::{
error, io,
pin::Pin,
task::{Context, Poll},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
/// Time after we disconnect from a node before we purge its information from the cache.
const CACHE_EXPIRE: Duration = Duration::from_secs(10 * 60);
@@ -42,9 +42,8 @@ use std::{
str,
sync::Arc,
task::{Context, Poll},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
/// Network behaviour that handles opening substreams for custom protocols with other peers.
///
@@ -88,9 +88,8 @@ use std::{
str,
sync::Arc,
task::{Context, Poll},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
/// Number of pending notifications in asynchronous contexts.
/// See [`NotificationsSink::reserve_notification`] for context.
@@ -24,9 +24,8 @@ use sp_blockchain::Error as ClientError;
use sp_runtime::traits::{Block as BlockT, NumberFor, Zero};
use std::{
collections::{HashMap, HashSet, VecDeque},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
// Time to wait before trying to get the same extra data from the same peer.
const EXTRA_RETRY_WAIT: Duration = Duration::from_secs(10);
@@ -60,9 +60,8 @@ use std::{
io, iter,
pin::Pin,
task::{Context, Poll},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::Instant;
pub use libp2p::request_response::{InboundFailure, OutboundFailure, RequestId};
+3 -5
View File
@@ -291,10 +291,9 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
};
let (transport, bandwidth) = {
let (config_mem, config_wasm) = match params.network_config.transport {
TransportConfig::MemoryOnly => (true, None),
TransportConfig::Normal { wasm_external_transport, .. } =>
(false, wasm_external_transport),
let config_mem = match params.network_config.transport {
TransportConfig::MemoryOnly => true,
TransportConfig::Normal { .. } => false,
};
// The yamux buffer size limit is configured to be equal to the maximum frame size
@@ -337,7 +336,6 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
transport::build_transport(
local_identity,
config_mem,
config_wasm,
params.network_config.yamux_window_size,
yamux_maximum_buffer_size,
)
+4 -11
View File
@@ -25,7 +25,7 @@ use libp2p::{
transport::{Boxed, OptionalTransport},
upgrade,
},
identity, mplex, noise, wasm_ext, PeerId, Transport,
identity, mplex, noise, PeerId, Transport,
};
#[cfg(not(target_os = "unknown"))]
use libp2p::{dns, tcp, websocket};
@@ -51,18 +51,11 @@ pub use self::bandwidth::BandwidthSinks;
pub fn build_transport(
keypair: identity::Keypair,
memory_only: bool,
wasm_external_transport: Option<wasm_ext::ExtTransport>,
yamux_window_size: Option<u32>,
yamux_maximum_buffer_size: usize,
) -> (Boxed<(PeerId, StreamMuxerBox)>, Arc<BandwidthSinks>) {
// Build the base layer of the transport.
let transport = if let Some(t) = wasm_external_transport {
OptionalTransport::some(t)
} else {
OptionalTransport::none()
};
#[cfg(not(target_os = "unknown"))]
let transport = transport.or_transport(if !memory_only {
let transport = if !memory_only {
let desktop_trans = tcp::TcpConfig::new().nodelay(true);
let desktop_trans =
websocket::WsConfig::new(desktop_trans.clone()).or_transport(desktop_trans);
@@ -73,9 +66,9 @@ pub fn build_transport(
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Transport))
})
} else {
// For the in-memory case we set up the transport with an `.or_transport` below.
OptionalTransport::none()
});
};
let transport = transport.or_transport(if memory_only {
OptionalTransport::some(libp2p::core::transport::MemoryTransport::default())
} else {
+2 -2
View File
@@ -42,9 +42,9 @@ use std::{
collections::{HashMap, HashSet, VecDeque},
pin::Pin,
task::{Context, Poll},
time::Duration,
time::{Duration, Instant},
};
use wasm_timer::{Delay, Instant};
use wasm_timer::Delay;
pub use libp2p::PeerId;
+1 -1
View File
@@ -36,8 +36,8 @@ use std::{
hash_map::{Entry, OccupiedEntry},
HashMap, HashSet,
},
time::Instant,
};
use wasm_timer::Instant;
/// State storage behind the peerset.
///
-1
View File
@@ -30,7 +30,6 @@ rand = "0.7.3"
parking_lot = "0.11.1"
log = "0.4.11"
futures-timer = "3.0.1"
wasm-timer = "0.2"
exit-future = "0.2.0"
pin-project = "1.0.4"
hash-db = "0.15.2"
+1 -2
View File
@@ -62,8 +62,7 @@ use sp_runtime::{
BuildStorage,
};
use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender};
use std::{str::FromStr, sync::Arc};
use wasm_timer::SystemTime;
use std::{str::FromStr, sync::Arc, time::SystemTime};
/// A utility trait for building an RPC extension given a `DenyUnsafe` instance.
/// This is useful since at service definition time we don't know whether the
+1 -4
View File
@@ -23,7 +23,7 @@ pub use sc_client_db::{Database, DatabaseSource, KeepBlocks, PruningMode, Transa
pub use sc_executor::WasmExecutionMethod;
pub use sc_network::{
config::{
ExtTransport, IncomingRequest, MultiaddrWithPeerId, NetworkConfiguration, NodeKeyConfig,
IncomingRequest, MultiaddrWithPeerId, NetworkConfiguration, NodeKeyConfig,
NonDefaultSetConfig, OutgoingResponse, RequestResponseConfig, Role, SetConfig,
TransportConfig,
},
@@ -107,9 +107,6 @@ pub struct Configuration {
pub prometheus_config: Option<PrometheusConfig>,
/// Telemetry service URL. `None` if disabled.
pub telemetry_endpoints: Option<TelemetryEndpoints>,
/// External WASM transport for the telemetry. If `Some`, when connection to a telemetry
/// endpoint, this transport will be tried in priority before all others.
pub telemetry_external_transport: Option<ExtTransport>,
/// The default number of 64KB pages to allocate for Wasm execution
pub default_heap_pages: Option<u64>,
/// Should offchain workers be executed.
+4 -2
View File
@@ -28,8 +28,10 @@ use sc_transaction_pool_api::{MaintainedTransactionPool, PoolStatus};
use sp_api::ProvideRuntimeApi;
use sp_runtime::traits::{Block, NumberFor, SaturatedConversion, UniqueSaturatedInto};
use sp_utils::metrics::register_globals;
use std::{sync::Arc, time::Duration};
use wasm_timer::Instant;
use std::{
sync::Arc,
time::{Duration, Instant},
};
struct PrometheusMetrics {
// generic info
+2 -6
View File
@@ -221,11 +221,8 @@ fn node_config<
.collect(),
);
network_config.transport = TransportConfig::Normal {
enable_mdns: false,
allow_private_ipv4: true,
wasm_external_transport: None,
};
network_config.transport =
TransportConfig::Normal { enable_mdns: false, allow_private_ipv4: true };
Configuration {
impl_name: String::from("network-test-impl"),
@@ -256,7 +253,6 @@ fn node_config<
rpc_max_payload: None,
prometheus_config: None,
telemetry_endpoints: None,
telemetry_external_transport: None,
default_heap_pages: None,
offchain_worker: Default::default(),
force_authoring: false,
+1 -10
View File
@@ -46,7 +46,6 @@ use std::{
sync::{atomic, Arc},
};
pub use libp2p::wasm_ext::ExtTransport;
pub use log;
pub use serde_json;
@@ -124,15 +123,7 @@ impl TelemetryWorker {
///
/// Only one is needed per process.
pub fn new(buffer_size: usize) -> Result<Self> {
Self::with_transport(buffer_size, None)
}
/// Instantiate a new [`TelemetryWorker`] with the given [`ExtTransport`]
/// which can run in background.
///
/// Only one is needed per process.
pub fn with_transport(buffer_size: usize, transport: Option<ExtTransport>) -> Result<Self> {
let transport = initialize_transport(transport)?;
let transport = initialize_transport()?;
let (message_sender, message_receiver) = mpsc::channel(buffer_size);
let (register_sender, register_receiver) = mpsc::unbounded();
+4 -22
View File
@@ -22,30 +22,15 @@ use futures::{
ready,
task::{Context, Poll},
};
use libp2p::{
core::transport::{timeout::TransportTimeout, OptionalTransport},
wasm_ext, Transport,
};
use libp2p::{core::transport::timeout::TransportTimeout, Transport};
use std::{io, pin::Pin, time::Duration};
/// Timeout after which a connection attempt is considered failed. Includes the WebSocket HTTP
/// upgrading.
const CONNECT_TIMEOUT: Duration = Duration::from_secs(20);
pub(crate) fn initialize_transport(
wasm_external_transport: Option<wasm_ext::ExtTransport>,
) -> Result<WsTrans, io::Error> {
let transport = match wasm_external_transport.clone() {
Some(t) => OptionalTransport::some(t),
None => OptionalTransport::none(),
}
.map((|inner, _| StreamSink::from(inner)) as fn(_, _) -> _);
// The main transport is the `wasm_external_transport`, but if we're on desktop we add
// support for TCP+WebSocket+DNS as a fallback. In practice, you're not expected to pass
// an external transport on desktop and the fallback is used all the time.
#[cfg(not(target_os = "unknown"))]
let transport = transport.or_transport({
pub(crate) fn initialize_transport() -> Result<WsTrans, io::Error> {
let transport = {
let inner = block_on(libp2p::dns::DnsConfig::system(libp2p::tcp::TcpConfig::new()))?;
libp2p::websocket::framed::WsConfig::new(inner).and_then(|connec, _| {
let connec = connec
@@ -57,7 +42,7 @@ pub(crate) fn initialize_transport(
.map_ok(|data| data.into_bytes());
future::ready(Ok::<_, io::Error>(connec))
})
});
};
Ok(TransportTimeout::new(
transport.map(|out, _| {
@@ -86,9 +71,6 @@ pub(crate) type WsTrans = libp2p::core::transport::Boxed<
/// Wraps around an `AsyncWrite` and implements `Sink`. Guarantees that each item being sent maps
/// to one call of `write`.
///
/// For some context, we put this object around the `wasm_ext::ExtTransport` in order to make sure
/// that each telemetry message maps to one single call to `write` in the WASM FFI.
#[pin_project::pin_project]
pub(crate) struct StreamSink<T>(#[pin] T, Option<Vec<u8>>);
@@ -1,116 +0,0 @@
// This file is part of Substrate.
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// 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 crate::logging::event_format::{CustomFmtContext, EventFormat};
use std::fmt;
use tracing::{Event, Level, Subscriber};
use tracing_subscriber::{
fmt::{
time::{FormatTime, SystemTime},
FormatFields,
},
layer::Context,
registry::LookupSpan,
Layer,
};
use wasm_bindgen::prelude::*;
/// A `Layer` that display logs in the browser's console.
pub struct ConsoleLogLayer<S, N = tracing_subscriber::fmt::format::DefaultFields, T = SystemTime> {
event_format: EventFormat<T>,
fmt_fields: N,
_inner: std::marker::PhantomData<S>,
}
impl<S, T> ConsoleLogLayer<S, tracing_subscriber::fmt::format::DefaultFields, T> {
/// Create a new [`ConsoleLogLayer`] using the `EventFormat` provided in argument.
pub fn new(event_format: EventFormat<T>) -> Self {
Self { event_format, fmt_fields: Default::default(), _inner: std::marker::PhantomData }
}
}
// NOTE: the following code took inspiration from `EventFormat` (in this file)
impl<S, N, T: FormatTime> ConsoleLogLayer<S, N, T>
where
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'writer> FormatFields<'writer> + 'static,
{
fn format_event(
&self,
ctx: &Context<'_, S>,
writer: &mut dyn fmt::Write,
event: &Event,
) -> fmt::Result {
self.event_format.format_event_custom(
CustomFmtContext::ContextWithFormatFields(ctx, &self.fmt_fields),
writer,
event,
)
}
}
// NOTE: the following code took inspiration from tracing-subscriber
//
// https://github.com/tokio-rs/tracing/blob/2f59b32/tracing-subscriber/src/fmt/fmt_layer.rs#L717
impl<S, N, T> Layer<S> for ConsoleLogLayer<S, N, T>
where
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'writer> FormatFields<'writer> + 'static,
T: FormatTime + 'static,
{
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) {
thread_local! {
static BUF: std::cell::RefCell<String> = std::cell::RefCell::new(String::new());
}
BUF.with(|buf| {
let borrow = buf.try_borrow_mut();
let mut a;
let mut b;
let mut buf = match borrow {
Ok(buf) => {
a = buf;
&mut *a
},
_ => {
b = String::new();
&mut b
},
};
if self.format_event(&ctx, &mut buf, event).is_ok() {
if !buf.is_empty() {
let meta = event.metadata();
let level = meta.level();
// NOTE: the following code took inspiration from tracing-subscriber
//
// https://github.com/iamcodemaker/console_log/blob/f13b5d6755/src/lib.rs#L149
match *level {
Level::ERROR => web_sys::console::error_1(&JsValue::from(buf.as_str())),
Level::WARN => web_sys::console::warn_1(&JsValue::from(buf.as_str())),
Level::INFO => web_sys::console::info_1(&JsValue::from(buf.as_str())),
Level::DEBUG => web_sys::console::log_1(&JsValue::from(buf.as_str())),
Level::TRACE => web_sys::console::debug_1(&JsValue::from(buf.as_str())),
}
}
}
buf.clear();
});
}
}
@@ -16,10 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#[cfg(target_os = "unknown")]
mod console_log;
mod prefix_layer;
#[cfg(target_os = "unknown")]
pub use console_log::*;
pub use prefix_layer::*;
@@ -30,7 +30,6 @@ sp-transaction-pool = { version = "4.0.0-dev", path = "../../primitives/transact
sc-transaction-pool-api = { version = "4.0.0-dev", path = "./api" }
sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" }
sp-utils = { version = "4.0.0-dev", path = "../../primitives/utils" }
wasm-timer = "0.2"
serde = { version = "1.0.126", features = ["derive"] }
linked-hash-map = "0.5.4"
retain_mut = "0.1.3"
@@ -19,7 +19,6 @@ futures = "0.3.9"
log = "0.4.8"
parking_lot = "0.11.1"
serde = { version = "1.0.101", features = ["derive"] }
wasm-timer = "0.2"
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
sp-utils = { version = "4.0.0-dev", path = "../../../primitives/utils" }
sp-core = { version = "4.0.0-dev", path = "../../../primitives/core" }
@@ -24,7 +24,7 @@ use std::{
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::transaction_validity::TransactionTag as Tag;
use wasm_timer::Instant;
use std::time::Instant;
use super::base_pool::Transaction;
@@ -27,7 +27,7 @@ use sp_runtime::{
TransactionSource, TransactionTag as Tag, TransactionValidity, TransactionValidityError,
},
};
use wasm_timer::Instant;
use std::time::Instant;
use super::{
base_pool as base,
@@ -454,9 +454,11 @@ mod tests {
traits::Hash,
transaction_validity::{InvalidTransaction, TransactionSource, ValidTransaction},
};
use std::collections::{HashMap, HashSet};
use std::{
collections::{HashMap, HashSet},
time::Instant,
};
use substrate_test_runtime::{AccountId, Block, Extrinsic, Hashing, Transfer, H256};
use wasm_timer::Instant;
const INVALID_NONCE: u64 = 254;
const SOURCE: TransactionSource = TransactionSource::External;
@@ -22,8 +22,11 @@
//! Discarded extrinsics are banned so that they don't get re-imported again.
use parking_lot::RwLock;
use std::{collections::HashMap, hash, iter, time::Duration};
use wasm_timer::Instant;
use std::{
collections::HashMap,
hash, iter,
time::{Duration, Instant},
};
use super::base_pool::Transaction;
@@ -32,7 +32,7 @@ use sp_runtime::{
traits::{self, SaturatedConversion},
transaction_validity::{TransactionSource, TransactionTag as Tag, ValidTransaction},
};
use wasm_timer::Instant;
use std::time::Instant;
use super::{
base_pool::{self as base, PruneStatus},
+1 -1
View File
@@ -63,7 +63,7 @@ use sp_runtime::{
generic::BlockId,
traits::{AtLeast32Bit, Block as BlockT, Extrinsic, Header as HeaderT, NumberFor, Zero},
};
use wasm_timer::Instant;
use std::time::Instant;
use crate::metrics::MetricsLink as PrometheusMetrics;
use prometheus_endpoint::Registry as PrometheusRegistry;