diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 5550265cf4..5347186c37 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -2124,7 +2124,7 @@ name = "node-template" version = "2.0.0" dependencies = [ "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3764,7 +3764,6 @@ name = "substrate" version = "2.0.0" dependencies = [ "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "node-cli 2.0.0", "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3806,8 +3805,8 @@ dependencies = [ "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3892,7 +3891,6 @@ name = "substrate-consensus-aura" version = "2.0.0" dependencies = [ "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3946,7 +3944,6 @@ name = "substrate-consensus-babe" version = "2.0.0" dependencies = [ "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "merlin 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3992,7 +3989,7 @@ name = "substrate-consensus-common" version = "2.0.0" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4010,7 +4007,7 @@ dependencies = [ name = "substrate-consensus-rhd" version = "2.0.0" dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4035,7 +4032,6 @@ dependencies = [ name = "substrate-consensus-slots" version = "2.0.0" dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4054,7 +4050,7 @@ version = "2.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4137,7 +4133,7 @@ dependencies = [ name = "substrate-keystore" version = "2.0.0" dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4151,8 +4147,8 @@ name = "substrate-network" version = "2.0.0" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fork-tree 2.0.0", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4182,7 +4178,6 @@ dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4290,7 +4285,7 @@ name = "substrate-rpc" version = "2.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4341,7 +4336,7 @@ dependencies = [ name = "substrate-service" version = "2.0.0" dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4487,8 +4482,8 @@ name = "substrate-transaction-graph" version = "2.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4503,7 +4498,7 @@ dependencies = [ name = "substrate-transaction-pool" version = "2.0.0" dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index f109d235af..3ccbb1c26d 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -10,7 +10,6 @@ build = "build.rs" edition = "2018" [dependencies] -error-chain = "0.12" cli = { package = "node-cli", path = "node/cli" } futures = "0.1" ctrlc = { version = "3.0", features = ["termination"] } diff --git a/substrate/core/cli/Cargo.toml b/substrate/core/cli/Cargo.toml index 2482323c80..54cde50d1a 100644 --- a/substrate/core/cli/Cargo.toml +++ b/substrate/core/cli/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" [dependencies] clap = "~2.32" +derive_more = "0.14.0" env_logger = "0.6" -error-chain = "0.12" log = "0.4" atty = "0.2" regex = "1" diff --git a/substrate/core/cli/src/error.rs b/substrate/core/cli/src/error.rs index 07d14eb479..b052a29710 100644 --- a/substrate/core/cli/src/error.rs +++ b/substrate/core/cli/src/error.rs @@ -16,26 +16,38 @@ //! Initialization errors. -// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting` -// https://github.com/paritytech/substrate/issues/1547 -#![allow(deprecated)] - use client; -use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed, - impl_extract_backtrace, impl_error_chain_kind}; -error_chain! { - foreign_links { - Io(::std::io::Error) #[doc="IO error"]; - Cli(::clap::Error) #[doc="CLI error"]; - Service(::service::Error) #[doc="Substrate service error"]; - Client(client::error::Error) #[doc="Client error"]; - } - errors { - /// Input error. - Input(m: String) { - description("Invalid input"), - display("{}", m), +/// Result type alias for the CLI. +pub type Result = std::result::Result; + +/// Error type for the CLI. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Io error + Io(std::io::Error), + /// Cli error + Cli(clap::Error), + /// Service error + Service(service::Error), + /// Client error + Client(client::error::Error), + /// Input error + Input(String), + /// Invalid listen multiaddress + #[display(fmt="Invalid listen multiaddress")] + InvalidListenMultiaddress +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Io(ref err) => Some(err), + Error::Cli(ref err) => Some(err), + Error::Service(ref err) => Some(err), + Error::Client(ref err) => Some(err), + Error::Input(_) => None, + Error::InvalidListenMultiaddress => None, } } } diff --git a/substrate/core/cli/src/lib.rs b/substrate/core/cli/src/lib.rs index 82ebf8ec05..e629788e80 100644 --- a/substrate/core/cli/src/lib.rs +++ b/substrate/core/cli/src/lib.rs @@ -55,7 +55,6 @@ use params::{ pub use params::{NoCustom, CoreParams}; pub use traits::{GetLogFilter, AugmentClap}; use app_dirs::{AppInfo, AppDataType}; -use error_chain::bail; use log::info; use lazy_static::lazy_static; @@ -145,10 +144,6 @@ fn base_path(cli: &SharedParams, version: &VersionInfo) -> PathBuf { ) } -fn input_err>(msg: T) -> error::Error { - error::ErrorKind::Input(msg.into()).into() -} - /// Check whether a node name is considered as valid fn is_node_name_valid(_name: &str) -> Result<(), &str> { let name = _name.to_string(); @@ -278,7 +273,7 @@ where /// Create an error caused by an invalid node key argument. fn invalid_node_key(e: impl std::fmt::Display) -> error::Error { - input_err(format!("Invalid node key: {}", e)) + error::Error::Input(format!("Invalid node key: {}", e)) } /// Parse a Secp256k1 secret key from a hex string into a `network::Secret`. @@ -334,7 +329,7 @@ fn fill_network_configuration( } for addr in cli.listen_addr.iter() { - let addr = addr.parse().map_err(|_| "Invalid listen multiaddress")?; + let addr = addr.parse().ok().ok_or(error::Error::InvalidListenMultiaddress)?; config.listen_addresses.push(addr); } @@ -392,14 +387,14 @@ where }; match is_node_name_valid(&config.name) { Ok(_) => (), - Err(msg) => bail!( - input_err( + Err(msg) => Err( + error::Error::Input( format!("Invalid node name '{}'. Reason: {}. If unsure, use none.", config.name, msg ) ) - ) + )? } let base_path = base_path(&cli.shared_params, version); @@ -417,7 +412,7 @@ where Some(ref s) if s == "archive" => PruningMode::ArchiveAll, None => PruningMode::default(), Some(s) => PruningMode::keep_blocks( - s.parse().map_err(|_| input_err("Invalid pruning mode specified"))? + s.parse().map_err(|_| error::Error::Input("Invalid pruning mode specified".to_string()))? ), }; @@ -851,7 +846,7 @@ mod tests { NodeKeyConfig::Ed25519(network::Secret::Input(ref ski)) if node_key_type == NodeKeyType::Ed25519 && &sk[..] == ski.as_ref() => Ok(()), - _ => Err(input_err("Unexpected node key config")) + _ => Err(error::Error::Input("Unexpected node key config".into())) }) }) } @@ -877,7 +872,7 @@ mod tests { if node_key_type == NodeKeyType::Secp256k1 && f == &file => Ok(()), NodeKeyConfig::Ed25519(network::Secret::File(ref f)) if node_key_type == NodeKeyType::Ed25519 && f == &file => Ok(()), - _ => Err(input_err("Unexpected node key config")) + _ => Err(error::Error::Input("Unexpected node key config".into())) }) }) } @@ -911,7 +906,7 @@ mod tests { if typ == NodeKeyType::Secp256k1 => Ok(()), NodeKeyConfig::Ed25519(network::Secret::New) if typ == NodeKeyType::Ed25519 => Ok(()), - _ => Err(input_err("Unexpected node key config")) + _ => Err(error::Error::Input("Unexpected node key config".into())) }) }) } @@ -928,7 +923,7 @@ mod tests { NodeKeyConfig::Ed25519(network::Secret::File(ref f)) if typ == NodeKeyType::Ed25519 && f == &dir.join(NODE_KEY_ED25519_FILE) => Ok(()), - _ => Err(input_err("Unexpected node key config")) + _ => Err(error::Error::Input("Unexpected node key config".into())) }) }) } diff --git a/substrate/core/client/db/src/cache/list_cache.rs b/substrate/core/client/db/src/cache/list_cache.rs index 3c74ac2d1f..4f343e93fd 100644 --- a/substrate/core/client/db/src/cache/list_cache.rs +++ b/substrate/core/client/db/src/cache/list_cache.rs @@ -45,7 +45,7 @@ use log::warn; use client::error::{Error as ClientError, Result as ClientResult}; use runtime_primitives::traits::{ - Block as BlockT, NumberFor, Zero, Bounded, SaturatedConversion, CheckedSub + Block as BlockT, NumberFor, Zero, Bounded, CheckedSub }; use crate::cache::{CacheItemT, ComplexBlockId, EntryType}; diff --git a/substrate/core/client/db/src/lib.rs b/substrate/core/client/db/src/lib.rs index 0e65e17f8d..8f54099a78 100644 --- a/substrate/core/client/db/src/lib.rs +++ b/substrate/core/client/db/src/lib.rs @@ -48,7 +48,7 @@ use primitives::storage::well_known_keys; use runtime_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay}; use runtime_primitives::traits::{ Block as BlockT, Header as HeaderT, NumberFor, Zero, One, Digest, DigestItem, - SaturatedConversion, UniqueSaturatedFrom, UniqueSaturatedInto + SaturatedConversion, }; use runtime_primitives::BuildStorage; use state_machine::backend::Backend as StateBackend; diff --git a/substrate/core/client/db/src/utils.rs b/substrate/core/client/db/src/utils.rs index eec476f40e..43c559b349 100644 --- a/substrate/core/client/db/src/utils.rs +++ b/substrate/core/client/db/src/utils.rs @@ -31,7 +31,7 @@ use trie::DBValue; use runtime_primitives::generic::BlockId; use runtime_primitives::traits::{ Block as BlockT, Header as HeaderT, Zero, UniqueSaturatedFrom, - UniqueSaturatedInto, SaturatedConversion, CheckedConversion + UniqueSaturatedInto, CheckedConversion }; use crate::DatabaseSettings; diff --git a/substrate/core/client/src/client.rs b/substrate/core/client/src/client.rs index 5b849e1352..c9f70039ea 100644 --- a/substrate/core/client/src/client.rs +++ b/substrate/core/client/src/client.rs @@ -29,7 +29,7 @@ use runtime_primitives::{ generic::{BlockId, SignedBlock}, }; use consensus::{ - Error as ConsensusError, ErrorKind as ConsensusErrorKind, ImportBlock, + Error as ConsensusError, ImportBlock, ImportResult, BlockOrigin, ForkChoiceStrategy, well_known_cache_keys::Id as CacheKeyId, SelectChain, self, @@ -1387,7 +1387,7 @@ impl consensus::BlockImport for Client ) -> Result { self.lock_import_and_run(|operation| { self.apply_block(operation, import_block, new_cache) - }).map_err(|e| ConsensusErrorKind::ClientImport(e.to_string()).into()) + }).map_err(|e| ConsensusError::ClientImport(e.to_string()).into()) } /// Check block preconditions. @@ -1397,7 +1397,7 @@ impl consensus::BlockImport for Client parent_hash: Block::Hash, ) -> Result { match self.block_status(&BlockId::Hash(parent_hash)) - .map_err(|e| ConsensusError::from(ConsensusErrorKind::ClientImport(e.to_string())))? + .map_err(|e| ConsensusError::ClientImport(e.to_string()))? { BlockStatus::InChainWithState | BlockStatus::Queued => {}, BlockStatus::Unknown | BlockStatus::InChainPruned => return Ok(ImportResult::UnknownParent), @@ -1405,7 +1405,7 @@ impl consensus::BlockImport for Client } match self.block_status(&BlockId::Hash(hash)) - .map_err(|e| ConsensusError::from(ConsensusErrorKind::ClientImport(e.to_string())))? + .map_err(|e| ConsensusError::ClientImport(e.to_string()))? { BlockStatus::InChainWithState | BlockStatus::Queued => return Ok(ImportResult::AlreadyInChain), BlockStatus::Unknown | BlockStatus::InChainPruned => {}, @@ -1641,14 +1641,14 @@ where fn leaves(&self) -> Result::Hash>, ConsensusError> { LongestChain::leaves(self) - .map_err(|e| ConsensusErrorKind::ChainLookup(e.to_string()).into()) + .map_err(|e| ConsensusError::ChainLookup(e.to_string()).into()) } fn best_chain(&self) -> Result<::Header, ConsensusError> { LongestChain::best_block_header(&self) - .map_err(|e| ConsensusErrorKind::ChainLookup(e.to_string()).into()) + .map_err(|e| ConsensusError::ChainLookup(e.to_string()).into()) } fn finality_target( @@ -1657,7 +1657,7 @@ where maybe_max_number: Option> ) -> Result, ConsensusError> { LongestChain::best_containing(self, target_hash, maybe_max_number) - .map_err(|e| ConsensusErrorKind::ChainLookup(e.to_string()).into()) + .map_err(|e| ConsensusError::ChainLookup(e.to_string()).into()) } } diff --git a/substrate/core/consensus/aura/Cargo.toml b/substrate/core/consensus/aura/Cargo.toml index 8a589aa126..6e489cf8a9 100644 --- a/substrate/core/consensus/aura/Cargo.toml +++ b/substrate/core/consensus/aura/Cargo.toml @@ -24,7 +24,6 @@ runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" } futures = "0.1.17" tokio = "0.1.7" parking_lot = "0.7.1" -error-chain = "0.12" log = "0.4" [dev-dependencies] diff --git a/substrate/core/consensus/aura/src/lib.rs b/substrate/core/consensus/aura/src/lib.rs index 429666585d..59483a5688 100644 --- a/substrate/core/consensus/aura/src/lib.rs +++ b/substrate/core/consensus/aura/src/lib.rs @@ -50,7 +50,7 @@ use runtime_primitives::traits::{ Block, Header, Digest, DigestItemFor, DigestItem, ProvideRuntimeApi, AuthorityIdFor, Zero, }; use primitives::Pair; -use inherents::{InherentDataProviders, InherentData, RuntimeString}; +use inherents::{InherentDataProviders, InherentData}; use authorities::AuthoritiesApi; use futures::{Future, IntoFuture, future, stream::Stream}; @@ -122,10 +122,6 @@ fn slot_author(slot_num: u64, authorities: &[AuthorityId

]) -> Option Some(current_author) } -fn inherent_to_common_error(err: RuntimeString) -> consensus_common::Error { - consensus_common::ErrorKind::InherentData(err.into()).into() -} - /// A digest item which is usable with aura consensus. pub trait CompatibleDigestItem: Sized { /// Construct a digest item which contains a slot number and a signature on the @@ -177,7 +173,8 @@ impl SlotCompatible for AuraSlotCompatible { ) -> Result<(TimestampInherent, AuraInherent), consensus_common::Error> { data.timestamp_inherent_data() .and_then(|t| data.aura_inherent_data().map(|a| (t, a))) - .map_err(inherent_to_common_error) + .map_err(Into::into) + .map_err(consensus_common::Error::InherentData) } } @@ -448,7 +445,7 @@ impl SlotWorker for AuraWorker(client: &C) -> Result<(), ConsensusError> return Ok(()); } - let map_err = |error| consensus_common::Error::from(consensus_common::ErrorKind::ClientImport( + let map_err = |error| consensus_common::Error::from(consensus_common::Error::ClientImport( format!( "Error initializing authorities cache: {}", error, @@ -766,7 +763,7 @@ fn authorities(client: &C, at: &BlockId) -> Result as CompatibleDigestItem>::aura_seal( slot_num, signature, @@ -1120,7 +1118,7 @@ mod tests { // Different slot is ok. assert!(check_header::<_, B, P>(&c, 5, header3, header3_hash, &authorities, false).is_ok()); - + // Here we trigger pruning and save header 4. assert!(check_header::<_, B, P>(&c, PRUNING_BOUND + 2, header4, header4_hash, &authorities, false).is_ok()); diff --git a/substrate/core/consensus/babe/Cargo.toml b/substrate/core/consensus/babe/Cargo.toml index 8ecfa05c4d..bc557ffb56 100644 --- a/substrate/core/consensus/babe/Cargo.toml +++ b/substrate/core/consensus/babe/Cargo.toml @@ -25,7 +25,6 @@ runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" } futures = "0.1.26" tokio = "0.1.18" parking_lot = "0.7.1" -error-chain = "0.12.0" log = "0.4.6" schnorrkel = "0.1.1" rand = "0.6.5" diff --git a/substrate/core/consensus/babe/src/lib.rs b/substrate/core/consensus/babe/src/lib.rs index c3d73b6e49..cccbc160c6 100644 --- a/substrate/core/consensus/babe/src/lib.rs +++ b/substrate/core/consensus/babe/src/lib.rs @@ -40,7 +40,7 @@ use primitives::{ sr25519::{Public, Signature, LocalizedSignature, self}, }; use merlin::Transcript; -use inherents::{InherentDataProviders, InherentData, RuntimeString}; +use inherents::{InherentDataProviders, InherentData}; use substrate_telemetry::{telemetry, CONSENSUS_TRACE, CONSENSUS_DEBUG, CONSENSUS_WARN, CONSENSUS_INFO}; use schnorrkel::{ keys::Keypair, @@ -191,10 +191,6 @@ impl Config { } } -fn inherent_to_common_error(err: RuntimeString) -> consensus_common::Error { - consensus_common::ErrorKind::InherentData(err.into()).into() -} - /// A digest item which is usable with BABE consensus. pub trait CompatibleDigestItem: Sized { /// Construct a digest item which contains a slot number and a signature @@ -243,7 +239,8 @@ impl SlotCompatible for BabeSlotCompatible { trace!(target: "babe", "extract timestamp"); data.timestamp_inherent_data() .and_then(|t| data.babe_inherent_data().map(|a| (t, a))) - .map_err(slots::inherent_to_common_error) + .map_err(Into::into) + .map_err(consensus_common::Error::InherentData) } } @@ -520,7 +517,7 @@ impl SlotWorker for BabeWorker whe }) .map_err(|e| { warn!("Client import failed: {:?}", e); - consensus_common::ErrorKind::ClientImport(format!("{:?}", e)).into() + consensus_common::Error::ClientImport(format!("{:?}", e)) }) ) } @@ -585,7 +582,7 @@ fn check_header( format!("VRF verification failed") })? }; - + if check(&inout, threshold) { match check_equivocation(&client, slot_now, slot_num, header.clone(), signer.clone()) { Ok(Some(equivocation_proof)) => { @@ -797,7 +794,7 @@ fn authorities(client: &C, at: &BlockId) -> Result< panic!("We don’t support deprecated code with new consensus algorithms, \ therefore this is unreachable; qed") } - }).ok_or_else(|| consensus_common::ErrorKind::InvalidAuthoritiesSet.into()) + }).ok_or(consensus_common::Error::InvalidAuthoritiesSet) } /// The BABE import queue type. @@ -812,7 +809,8 @@ fn register_babe_inherent_data_provider( if !inherent_data_providers.has_provider(&srml_babe::INHERENT_IDENTIFIER) { inherent_data_providers .register_provider(srml_babe::InherentDataProvider::new(slot_duration)) - .map_err(inherent_to_common_error) + .map_err(Into::into) + .map_err(consensus_common::Error::InherentData) } else { Ok(()) } @@ -1019,7 +1017,7 @@ mod tests { Default::default(), 0, ); - + let (inout, proof, _batchable_proof) = get_keypair(&pair).vrf_sign_n_check(transcript, |inout| check(inout, u64::MAX)).unwrap(); let pre_hash: H256 = header.hash(); let to_sign = (slot_num, pre_hash, proof.to_bytes()).encode(); diff --git a/substrate/core/consensus/common/Cargo.toml b/substrate/core/consensus/common/Cargo.toml index 4031830108..5e55d555dd 100644 --- a/substrate/core/consensus/common/Cargo.toml +++ b/substrate/core/consensus/common/Cargo.toml @@ -6,12 +6,12 @@ description = "Common utilities for substrate consensus" edition = "2018" [dependencies] +derive_more = "0.14.0" crossbeam-channel = "0.3.4" libp2p = { version = "0.8.1", default-features = false } log = "0.4" primitives = { package = "substrate-primitives", path= "../../primitives" } inherents = { package = "substrate-inherents", path = "../../inherents" } -error-chain = "0.12" futures = "0.1" rstd = { package = "sr-std", path = "../../sr-std" } runtime_version = { package = "sr-version", path = "../../sr-version" } diff --git a/substrate/core/consensus/common/src/error.rs b/substrate/core/consensus/common/src/error.rs index 71517c5440..a923c5f555 100644 --- a/substrate/core/consensus/common/src/error.rs +++ b/substrate/core/consensus/common/src/error.rs @@ -16,100 +16,69 @@ //! Error types in Consensus use runtime_version::RuntimeVersion; -use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed, - impl_extract_backtrace, impl_error_chain_kind}; use primitives::ed25519::{Public, Signature}; +use std::error; -error_chain! { - errors { - /// Missing state at block with given descriptor. - StateUnavailable(b: String) { - description("State missing at given block."), - display("State unavailable at block {}", b), - } +/// Result type alias. +pub type Result = std::result::Result; - /// I/O terminated unexpectedly - IoTerminated { - description("I/O terminated unexpectedly."), - display("I/O terminated unexpectedly."), - } +/// Error type. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Missing state at block with given descriptor. + #[display(fmt="State unavailable at block {}", _0)] + StateUnavailable(String), + /// I/O terminated unexpectedly + #[display(fmt="I/O terminated unexpectedly.")] + IoTerminated, + /// Unable to schedule wakeup. + #[display(fmt="Timer error: {}", _0)] + FaultyTimer(tokio_timer::Error), + /// Error while working with inherent data. + #[display(fmt="InherentData error: {}", _0)] + InherentData(String), + /// Unable to propose a block. + #[display(fmt="Unable to create block proposal.")] + CannotPropose, + /// Error checking signature + #[display(fmt="Message signature {:?} by {:?} is invalid.", _0, _1)] + InvalidSignature(Signature, Public), + /// Invalid authorities set received from the runtime. + #[display(fmt="Current state of blockchain has invalid authorities set")] + InvalidAuthoritiesSet, + /// Account is not an authority. + #[display(fmt="Message sender {:?} is not a valid authority.", _0)] + InvalidAuthority(Public), + /// Authoring interface does not match the runtime. + #[display(fmt="Authoring for current \ + runtime is not supported. Native ({}) cannot author for on-chain ({}).", native, on_chain)] + IncompatibleAuthoringRuntime { native: RuntimeVersion, on_chain: RuntimeVersion }, + /// Authoring interface does not match the runtime. + #[display(fmt="Authoring for current runtime is not supported since it has no version.")] + RuntimeVersionMissing, + /// Authoring interface does not match the runtime. + #[display(fmt="Authoring in current build is not supported since it has no runtime.")] + NativeRuntimeMissing, + /// Justification requirements not met. + #[display(fmt="Invalid justification.")] + InvalidJustification, + /// Some other error. + #[display(fmt="Other error: {}", _0)] + Other(Box), + /// Error from the client while importing + #[display(fmt="Import failed: {}", _0)] + ClientImport(String), + /// Error from the client while importing + #[display(fmt="Chain lookup failed: {}", _0)] + ChainLookup(String), +} - /// Unable to schedule wakeup. - FaultyTimer(e: ::tokio_timer::Error) { - description("Timer error"), - display("Timer error: {}", e), - } - - /// Error while working with inherent data. - InherentData(e: String) { - description("InherentData error"), - display("InherentData error: {}", e), - } - - /// Unable to propose a block. - CannotPropose { - description("Unable to create block proposal."), - display("Unable to create block proposal."), - } - - /// Error checking signature - InvalidSignature(s: Signature, a: Public) { - description("Message signature is invalid"), - display("Message signature {:?} by {:?} is invalid.", s, a), - } - - /// Invalid authorities set received from the runtime. - InvalidAuthoritiesSet { - description("authorities set is invalid"), - display("Current state of blockchain has invalid authorities set"), - } - - /// Account is not an authority. - InvalidAuthority(a: Public) { - description("Message sender is not a valid authority"), - display("Message sender {:?} is not a valid authority.", a), - } - - /// Authoring interface does not match the runtime. - IncompatibleAuthoringRuntime(native: RuntimeVersion, on_chain: RuntimeVersion) { - description("Authoring for current runtime is not supported"), - display("Authoring for current runtime is not supported. Native ({}) cannot author for on-chain ({}).", native, on_chain), - } - - /// Authoring interface does not match the runtime. - RuntimeVersionMissing { - description("Current runtime has no version"), - display("Authoring for current runtime is not supported since it has no version."), - } - - /// Authoring interface does not match the runtime. - NativeRuntimeMissing { - description("This build has no native runtime"), - display("Authoring in current build is not supported since it has no runtime."), - } - - /// Justification requirements not met. - InvalidJustification { - description("Invalid justification"), - display("Invalid justification."), - } - - /// Some other error. - Other(e: Box<::std::error::Error + Send>) { - description("Other error") - display("Other error: {}", e.description()) - } - - /// Error from the client while importing - ClientImport(reason: String) { - description("Import failed"), - display("Import failed: {}", reason), - } - - /// Error from the client while importing - ChainLookup(reason: String) { - description("Looking up chain failed"), - display("Chain lookup failed: {}", reason), +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self { + Error::FaultyTimer(ref err) => Some(err), + Error::Other(ref err) => Some(&**err), + _ => None, } } } diff --git a/substrate/core/consensus/common/src/evaluation.rs b/substrate/core/consensus/common/src/evaluation.rs index 7f1f527042..ed7515a419 100644 --- a/substrate/core/consensus/common/src/evaluation.rs +++ b/substrate/core/consensus/common/src/evaluation.rs @@ -20,37 +20,36 @@ use super::MAX_BLOCK_SIZE; use parity_codec::Encode; use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, One, CheckedConversion}; -use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed, - impl_extract_backtrace, impl_error_chain_kind, bail}; // This is just a best effort to encode the number. None indicated that it's too big to encode // in a u128. type BlockNumber = Option; -error_chain! { - errors { - BadProposalFormat { - description("Proposal provided not a block."), - display("Proposal provided not a block."), - } - WrongParentHash(expected: String, got: String) { - description("Proposal had wrong parent hash."), - display("Proposal had wrong parent hash. Expected {:?}, got {:?}", expected, got), - } - WrongNumber(expected: BlockNumber, got: BlockNumber) { - description("Proposal had wrong number."), - display("Proposal had wrong number. Expected {:?}, got {:?}", expected, got), - } - ProposalTooLarge(size: usize) { - description("Proposal exceeded the maximum size."), - display( - "Proposal exceeded the maximum size of {} by {} bytes.", - MAX_BLOCK_SIZE, size.saturating_sub(MAX_BLOCK_SIZE) - ), - } - } +/// Result type alias. +pub type Result = std::result::Result; + +/// Error type. +#[derive(Debug, derive_more::Display)] +pub enum Error { + /// Proposal provided not a block. + #[display(fmt="Proposal provided not a block.")] + BadProposalFormat, + /// Proposal had wrong parent hash. + #[display(fmt="Proposal had wrong parent hash. Expected {:?}, got {:?}", expected, got)] + WrongParentHash { expected: String, got: String }, + /// Proposal had wrong number. + #[display(fmt="Proposal had wrong number. Expected {:?}, got {:?}", expected, got)] + WrongNumber { expected: BlockNumber, got: BlockNumber }, + /// Proposal exceeded the maximum size. + #[display( + fmt="Proposal exceeded the maximum size of {} by {} bytes.", + "MAX_BLOCK_SIZE", "_0.saturating_sub(MAX_BLOCK_SIZE)" + )] + ProposalTooLarge(usize), } +impl std::error::Error for Error {} + /// Attempt to evaluate a substrate block as a node block, returning error /// upon any initial validity checks failing. pub fn evaluate_initial( @@ -61,24 +60,24 @@ pub fn evaluate_initial( let encoded = Encode::encode(proposal); let proposal = Block::decode(&mut &encoded[..]) - .ok_or_else(|| ErrorKind::BadProposalFormat)?; + .ok_or_else(|| Error::BadProposalFormat)?; if encoded.len() > MAX_BLOCK_SIZE { - bail!(ErrorKind::ProposalTooLarge(encoded.len())) + return Err(Error::ProposalTooLarge(encoded.len())) } if *parent_hash != *proposal.header().parent_hash() { - bail!(ErrorKind::WrongParentHash( - format!("{:?}", *parent_hash), - format!("{:?}", proposal.header().parent_hash()) - )); + return Err(Error::WrongParentHash { + expected: format!("{:?}", *parent_hash), + got: format!("{:?}", proposal.header().parent_hash()) + }); } if parent_number + One::one() != *proposal.header().number() { - bail!(ErrorKind::WrongNumber( - parent_number.checked_into::().map(|x| x + 1), - (*proposal.header().number()).checked_into::() - )); + return Err(Error::WrongNumber { + expected: parent_number.checked_into::().map(|x| x + 1), + got: (*proposal.header().number()).checked_into::(), + }); } Ok(()) diff --git a/substrate/core/consensus/common/src/lib.rs b/substrate/core/consensus/common/src/lib.rs index 5e308ba8fe..d28864a0cc 100644 --- a/substrate/core/consensus/common/src/lib.rs +++ b/substrate/core/consensus/common/src/lib.rs @@ -47,7 +47,7 @@ pub mod evaluation; // block size limit. const MAX_BLOCK_SIZE: usize = 4 * 1024 * 1024 + 512; -pub use self::error::{Error, ErrorKind}; +pub use self::error::Error; pub use block_import::{ BlockImport, BlockOrigin, ForkChoiceStrategy, ImportedAux, ImportBlock, ImportResult, JustificationImport, FinalityProofImport, FinalityProofRequestBuilder, diff --git a/substrate/core/consensus/rhd/Cargo.toml b/substrate/core/consensus/rhd/Cargo.toml index 8535f3f006..3f0a79a863 100644 --- a/substrate/core/consensus/rhd/Cargo.toml +++ b/substrate/core/consensus/rhd/Cargo.toml @@ -6,6 +6,7 @@ description = "Rhododendron Round-Based consensus-algorithm for substrate" edition = "2018" [dependencies] +derive_more = "0.14.0" futures = "0.1.17" codec = { package = "parity-codec", version = "3.2", features = ["derive"] } primitives = { package = "substrate-primitives", path = "../../primitives" } @@ -20,7 +21,6 @@ runtime_version = { package = "sr-version", path = "../../sr-version" } runtime_io = { package = "sr-io", path = "../../sr-io" } tokio = "0.1.7" parking_lot = "0.7.1" -error-chain = "0.12" log = "0.4" rhododendron = { version = "0.5.0", features = ["codec"] } exit-future = "0.1" diff --git a/substrate/core/consensus/rhd/src/error.rs b/substrate/core/consensus/rhd/src/error.rs index 3808110975..601cf1c963 100644 --- a/substrate/core/consensus/rhd/src/error.rs +++ b/substrate/core/consensus/rhd/src/error.rs @@ -15,45 +15,36 @@ // along with Substrate. If not, see . //! Error types in the rhododendron Consensus service. -use consensus::error::{Error as CommonError, ErrorKind as CommonErrorKind}; +use consensus::error::{Error as CommonError}; use primitives::AuthorityId; use client; -use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed, - impl_extract_backtrace, impl_error_chain_kind}; -error_chain! { - links { - Client(client::error::Error, client::error::ErrorKind); - Common(CommonError, CommonErrorKind); - } - errors { - NotValidator(id: AuthorityId) { - description("Local account ID not a validator at this block."), - display("Local account ID ({:?}) not a validator at this block.", id), - } - PrematureDestruction { - description("Proposer destroyed before finishing proposing or evaluating"), - display("Proposer destroyed before finishing proposing or evaluating"), - } - Timer(e: ::tokio::timer::Error) { - description("Failed to register or resolve async timer."), - display("Timer failed: {}", e), - } - Executor(e: ::futures::future::ExecuteErrorKind) { - description("Unable to dispatch agreement future"), - display("Unable to dispatch agreement future: {:?}", e), - } - } +/// A result alias. +pub type Result = std::result::Result; + +/// A RHD error type. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Client error. + Client(client::error::Error), + /// Consensus error. + Common(CommonError), + /// Local account ID not a validator at this block. + #[display(fmt="Local account ID ({:?}) not a validator at this block.", _0)] + NotValidator(AuthorityId), + /// Proposer destroyed before finishing proposing or evaluating + #[display(fmt="Proposer destroyed before finishing proposing or evaluating")] + PrematureDestruction, + /// Failed to register or resolve async timer. + #[display(fmt="Timer failed: {}", _0)] + Timer(tokio::timer::Error), + /// Unable to dispatch agreement future + #[display(fmt="Unable to dispatch agreement future: {:?}", _0)] + Executor(futures::future::ExecuteErrorKind), } impl From<::rhododendron::InputStreamConcluded> for Error { fn from(_: ::rhododendron::InputStreamConcluded) -> Self { - CommonErrorKind::IoTerminated.into() - } -} - -impl From for Error { - fn from(e: CommonErrorKind) -> Self { - CommonError::from(e).into() + CommonError::IoTerminated.into() } } diff --git a/substrate/core/consensus/slots/Cargo.toml b/substrate/core/consensus/slots/Cargo.toml index c02559185f..ee3571bcdc 100644 --- a/substrate/core/consensus/slots/Cargo.toml +++ b/substrate/core/consensus/slots/Cargo.toml @@ -15,5 +15,4 @@ inherents = { package = "substrate-inherents", path = "../../inherents" } futures = "0.1.17" tokio = "0.1.7" parking_lot = "0.7.1" -error-chain = "0.12" log = "0.4" diff --git a/substrate/core/consensus/slots/src/lib.rs b/substrate/core/consensus/slots/src/lib.rs index 4ae72fd92a..783cb018b9 100644 --- a/substrate/core/consensus/slots/src/lib.rs +++ b/substrate/core/consensus/slots/src/lib.rs @@ -65,11 +65,6 @@ pub trait SlotCompatible { ) -> Result<(u64, u64), consensus_common::Error>; } -/// Convert an inherent error to common error. -pub fn inherent_to_common_error(err: inherents::RuntimeString) -> consensus_common::Error { - consensus_common::ErrorKind::InherentData(err.into()).into() -} - /// Start a new slot worker in a separate thread. #[deprecated(since = "1.1", note = "Please spawn a thread manually")] pub fn start_slot_worker_thread( diff --git a/substrate/core/consensus/slots/src/slots.rs b/substrate/core/consensus/slots/src/slots.rs index df21ae9b83..964eeaff29 100644 --- a/substrate/core/consensus/slots/src/slots.rs +++ b/substrate/core/consensus/slots/src/slots.rs @@ -19,7 +19,7 @@ //! This is used instead of `tokio_timer::Interval` because it was unreliable. use super::SlotCompatible; -use consensus_common::{Error, ErrorKind}; +use consensus_common::Error; use futures::prelude::*; use futures::try_ready; use inherents::{InherentData, InherentDataProviders}; @@ -125,7 +125,7 @@ impl Stream for Slots { if let Some(ref mut inner_delay) = self.inner_delay { try_ready!(inner_delay .poll() - .map_err(|e| Error::from(ErrorKind::FaultyTimer(e)))); + .map_err(Error::FaultyTimer)); } // timeout has fired. @@ -133,7 +133,7 @@ impl Stream for Slots { let inherent_data = self .inherent_data_providers .create_inherent_data() - .map_err(crate::inherent_to_common_error)?; + .map_err(|s| consensus_common::Error::InherentData(s.into_owned()))?; let (timestamp, slot_num) = SC::extract_timestamp_and_slot(&inherent_data)?; // reschedule delay for next slot. diff --git a/substrate/core/executor/Cargo.toml b/substrate/core/executor/Cargo.toml index 0272ce2f47..8f39d35c79 100644 --- a/substrate/core/executor/Cargo.toml +++ b/substrate/core/executor/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -error-chain = "0.12" +derive_more = "0.14.0" parity-codec = "3.3" runtime_io = { package = "sr-io", path = "../sr-io" } primitives = { package = "substrate-primitives", path = "../primitives" } diff --git a/substrate/core/executor/src/error.rs b/substrate/core/executor/src/error.rs index b27ccf01bf..fdcb6cbc0e 100644 --- a/substrate/core/executor/src/error.rs +++ b/substrate/core/executor/src/error.rs @@ -16,72 +16,57 @@ //! Rust executor possible errors. -// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting` -// https://github.com/paritytech/substrate/issues/1547 -#![allow(deprecated)] - use state_machine; use serializer; use wasmi; -use error_chain::{ - error_chain, error_chain_processing, impl_error_chain_processed, - impl_extract_backtrace, impl_error_chain_kind -}; -error_chain! { - foreign_links { - InvalidData(serializer::Error) #[doc = "Unserializable Data"]; - Trap(wasmi::Trap) #[doc = "Trap occured during execution"]; - Wasmi(wasmi::Error) #[doc = "Wasmi loading/instantiating error"]; - } +/// Result type alias. +pub type Result = std::result::Result; - errors { - /// Method is not found - MethodNotFound(t: String) { - description("method not found"), - display("Method not found: '{}'", t), - } +/// Error type. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Unserializable Data + InvalidData(serializer::Error), + /// Trap occured during execution + Trap(wasmi::Trap), + /// Wasmi loading/instantiating error + Wasmi(wasmi::Error), + /// Error in the API. Parameter is an error message. + ApiError(String), + /// Method is not found + #[display(fmt="Method not found: '{}'", _0)] + MethodNotFound(String), + /// Code is invalid (expected single byte) + #[display(fmt="Invalid Code: {:?}", _0)] + InvalidCode(Vec), + /// Could not get runtime version. + #[display(fmt="On-chain runtime does not specify version")] + VersionInvalid, + /// Externalities have failed. + #[display(fmt="Externalities error")] + Externalities, + /// Invalid index. + #[display(fmt="Invalid index provided")] + InvalidIndex, + /// Invalid return type. + #[display(fmt="Invalid type returned (should be u64)")] + InvalidReturn, + /// Runtime failed. + #[display(fmt="Runtime error")] + Runtime, + /// Runtime failed. + #[display(fmt="Invalid memory reference")] + InvalidMemoryReference, +} - /// Code is invalid (expected single byte) - InvalidCode(c: Vec) { - description("invalid code"), - display("Invalid Code: {:?}", c), - } - - /// Could not get runtime version. - VersionInvalid { - description("Runtime version error"), - display("On-chain runtime does not specify version"), - } - - /// Externalities have failed. - Externalities { - description("externalities failure"), - display("Externalities error"), - } - - /// Invalid index. - InvalidIndex { - description("index given was not in range"), - display("Invalid index provided"), - } - - /// Invalid return type. - InvalidReturn { - description("u64 was not returned"), - display("Invalid type returned (should be u64)"), - } - - /// Runtime failed. - Runtime { - description("runtime failure"), - display("Runtime error"), - } - - /// Runtime failed. - InvalidMemoryReference { - description("invalid memory reference"), - display("Invalid memory reference"), +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::InvalidData(ref err) => Some(err), + Error::Trap(ref err) => Some(err), + Error::Wasmi(ref err) => Some(err), + _ => None, } } } diff --git a/substrate/core/executor/src/native_executor.rs b/substrate/core/executor/src/native_executor.rs index 0a702a5a1b..0a6f50d001 100644 --- a/substrate/core/executor/src/native_executor.rs +++ b/substrate/core/executor/src/native_executor.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use std::{borrow::BorrowMut, result, cell::{RefMut, RefCell}}; -use crate::error::{Error, ErrorKind, Result}; +use crate::error::{Error, Result}; use state_machine::{CodeExecutor, Externalities}; use crate::wasm_executor::WasmExecutor; use wasmi::{Module as WasmModule, ModuleRef as WasmModuleInstanceRef}; @@ -55,7 +55,7 @@ fn fetch_cached_runtime_version<'a, E: Externalities>( ) -> Result<(&'a WasmModuleInstanceRef, &'a Option)> { let code_hash = match ext.original_storage_hash(well_known_keys::CODE) { Some(code_hash) => code_hash, - None => return Err(ErrorKind::InvalidCode(vec![]).into()), + None => return Err(Error::InvalidCode(vec![])), }; let maybe_runtime_preproc = cache.borrow_mut().entry(code_hash.into()) @@ -69,7 +69,7 @@ fn fetch_cached_runtime_version<'a, E: Externalities>( .or(default_heap_pages) .unwrap_or(DEFAULT_HEAP_PAGES); match WasmModule::from_buffer(code) - .map_err(|_| ErrorKind::InvalidCode(vec![]).into()) + .map_err(|_| Error::InvalidCode(vec![])) .and_then(|module| wasm_executor.prepare_module(ext, heap_pages as usize, &module)) { Ok(module) => { @@ -88,7 +88,7 @@ fn fetch_cached_runtime_version<'a, E: Externalities>( match maybe_runtime_preproc { RuntimePreproc::InvalidCode => { let code = ext.original_storage(well_known_keys::CODE).unwrap_or(vec![]); - Err(ErrorKind::InvalidCode(code).into()) + Err(Error::InvalidCode(code)) }, RuntimePreproc::ValidCode(m, v) => { Ok((m, v)) @@ -101,7 +101,7 @@ fn safe_call(f: F) -> Result { // Substrate uses custom panic hook that terminates process on panic. Disable termination for the native call. let _guard = panic_handler::AbortGuard::new(false); - ::std::panic::catch_unwind(f).map_err(|_| ErrorKind::Runtime.into()) + ::std::panic::catch_unwind(f).map_err(|_| Error::Runtime) } /// Set up the externalities and safe calling environment to execute calls to a native runtime. @@ -248,7 +248,7 @@ impl CodeExecutor for NativeExecutor, method: &str, data: &[u8]) -> $crate::error::Result> { $crate::with_native_environment(ext, move || $dispatcher(method, data))? - .ok_or_else(|| $crate::error::ErrorKind::MethodNotFound(method.to_owned()).into()) + .ok_or_else(|| $crate::error::Error::MethodNotFound(method.to_owned())) } fn native_version() -> $crate::NativeVersion { diff --git a/substrate/core/executor/src/sandbox.rs b/substrate/core/executor/src/sandbox.rs index cc21d762be..24c8ad66ea 100644 --- a/substrate/core/executor/src/sandbox.rs +++ b/substrate/core/executor/src/sandbox.rs @@ -643,9 +643,8 @@ mod tests { let res = WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_exhaust_heap", &code); assert_eq!(res.is_err(), true); if let Err(err) = res { - let inner_err = err.iter().next().unwrap(); assert_eq!( - format!("{}", inner_err), + format!("{}", err), format!("{}", wasmi::Error::Trap(trap(allocator::OUT_OF_SPACE))) ); } diff --git a/substrate/core/executor/src/wasm_executor.rs b/substrate/core/executor/src/wasm_executor.rs index 3fe1a1c3cc..988b6ddcf3 100644 --- a/substrate/core/executor/src/wasm_executor.rs +++ b/substrate/core/executor/src/wasm_executor.rs @@ -26,7 +26,7 @@ use wasmi::{ use wasmi::RuntimeValue::{I32, I64, self}; use wasmi::memory_units::{Pages}; use state_machine::{Externalities, ChildStorageKey}; -use crate::error::{Error, ErrorKind, Result}; +use crate::error::{Error, Result}; use crate::wasm_utils::UserError; use primitives::{blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, Pair}; use primitives::hexdisplay::HexDisplay; @@ -769,9 +769,9 @@ impl WasmExecutor { fn get_mem_instance(module: &ModuleRef) -> Result { Ok(module .export_by_name("memory") - .ok_or_else(|| Error::from(ErrorKind::InvalidMemoryReference))? + .ok_or_else(|| Error::InvalidMemoryReference)? .as_memory() - .ok_or_else(|| Error::from(ErrorKind::InvalidMemoryReference))? + .ok_or_else(|| Error::InvalidMemoryReference)? .clone()) } @@ -795,7 +795,7 @@ impl WasmExecutor { if let Some(I64(r)) = res { let offset = r as u32; let length = (r as u64 >> 32) as usize; - memory.get(offset, length).map_err(|_| ErrorKind::Runtime.into()).map(Some) + memory.get(offset, length).map_err(|_| Error::Runtime).map(Some) } else { Ok(None) } @@ -828,7 +828,7 @@ impl WasmExecutor { let used_mem = memory.used_size(); let mut fec = FunctionExecutor::new(memory.clone(), table, ext)?; let parameters = create_parameters(&mut |data: &[u8]| { - let offset = fec.heap.allocate(data.len() as u32).map_err(|_| ErrorKind::Runtime)?; + let offset = fec.heap.allocate(data.len() as u32).map_err(|_| Error::Runtime)?; memory.set(offset, &data)?; Ok(offset) })?; @@ -841,7 +841,7 @@ impl WasmExecutor { let result = match result { Ok(val) => match filter_result(val, &memory)? { Some(val) => Ok(val), - None => Err(ErrorKind::InvalidReturn.into()), + None => Err(Error::InvalidReturn), }, Err(e) => { trace!(target: "wasm-executor", "Failed to execute code with {} pages", memory.current_size().0); @@ -877,7 +877,7 @@ impl WasmExecutor { // extract a reference to a linear memory, optional reference to a table // and then initialize FunctionExecutor. let memory = Self::get_mem_instance(intermediate_instance.not_started_instance())?; - memory.grow(Pages(heap_pages)).map_err(|_| Error::from(ErrorKind::Runtime))?; + memory.grow(Pages(heap_pages)).map_err(|_| Error::Runtime)?; let table: Option = intermediate_instance .not_started_instance() .export_by_name("__indirect_function_table") diff --git a/substrate/core/finality-grandpa/src/import.rs b/substrate/core/finality-grandpa/src/import.rs index cd5ca02a5b..1966913c72 100644 --- a/substrate/core/finality-grandpa/src/import.rs +++ b/substrate/core/finality-grandpa/src/import.rs @@ -26,7 +26,7 @@ use client::blockchain::HeaderBackend; use client::backend::Backend; use client::runtime_api::ApiExt; use consensus_common::{ - BlockImport, Error as ConsensusError, ErrorKind as ConsensusErrorKind, + BlockImport, Error as ConsensusError, ImportBlock, ImportResult, JustificationImport, well_known_cache_keys, SelectChain, }; @@ -187,11 +187,11 @@ where match maybe_change { Err(e) => match api.has_api_with::, _>(&at, |v| v >= 2) { - Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Err(e) => return Err(ConsensusError::ClientImport(e.to_string()).into()), Ok(true) => { // API version is high enough to support forced changes // but got error, so it is legitimate. - return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()) + return Err(ConsensusError::ClientImport(e.to_string()).into()) }, Ok(false) => { // API version isn't high enough to support forced changes @@ -216,7 +216,7 @@ where ); match maybe_change { - Err(e) => Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Err(e) => Err(ConsensusError::ClientImport(e.to_string()).into()), Ok(Some(change)) => Ok(Some(PendingChange { next_authorities: change.next_authorities, delay: change.delay, @@ -301,12 +301,12 @@ where guard.as_mut().add_pending_change( change, &is_descendent_of, - ).map_err(|e| ConsensusError::from(ConsensusErrorKind::ClientImport(e.to_string())))?; + ).map_err(|e| ConsensusError::from(ConsensusError::ClientImport(e.to_string())))?; } let applied_changes = { let forced_change_set = guard.as_mut().apply_forced_changes(hash, number, &is_descendent_of) - .map_err(|e| ConsensusErrorKind::ClientImport(e.to_string())) + .map_err(|e| ConsensusError::ClientImport(e.to_string())) .map_err(ConsensusError::from)?; if let Some((median_last_finalized_number, new_set)) = forced_change_set { @@ -318,14 +318,14 @@ where // with. we use the minimum between the median and the local // best finalized block. let best_finalized_number = self.inner.backend().blockchain().info() - .map_err(|e| ConsensusErrorKind::ClientImport(e.to_string()))? + .map_err(|e| ConsensusError::ClientImport(e.to_string()))? .finalized_number; let canon_number = best_finalized_number.min(median_last_finalized_number); let canon_hash = self.inner.backend().blockchain().header(BlockId::Number(canon_number)) - .map_err(|e| ConsensusErrorKind::ClientImport(e.to_string()))? + .map_err(|e| ConsensusError::ClientImport(e.to_string()))? .expect("the given block number is less or equal than the current best finalized number; \ current best finalized number must exist in chain; qed.") .hash(); @@ -343,7 +343,7 @@ where AppliedChanges::Forced(new_authorities) } else { let did_standard = guard.as_mut().enacts_standard_change(hash, number, &is_descendent_of) - .map_err(|e| ConsensusErrorKind::ClientImport(e.to_string())) + .map_err(|e| ConsensusError::ClientImport(e.to_string())) .map_err(ConsensusError::from)?; if let Some(root) = did_standard { @@ -399,7 +399,7 @@ impl, RA, PRA, SC> BlockImport match self.inner.backend().blockchain().status(BlockId::Hash(hash)) { Ok(blockchain::BlockStatus::InChain) => return Ok(ImportResult::AlreadyInChain), Ok(blockchain::BlockStatus::Unknown) => {}, - Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Err(e) => return Err(ConsensusError::ClientImport(e.to_string()).into()), } let pending_changes = self.make_authorities_changes(&mut block, hash)?; @@ -420,7 +420,7 @@ impl, RA, PRA, SC> BlockImport Err(e) => { debug!(target: "afg", "Restoring old authority set after block import error: {:?}", e); pending_changes.revert(); - return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()); + return Err(ConsensusError::ClientImport(e.to_string()).into()); }, } }; @@ -509,7 +509,7 @@ impl, RA, PRA, SC> BlockImport } } -impl, RA, PRA, SC> +impl, RA, PRA, SC> GrandpaBlockImport { pub(crate) fn new( @@ -559,7 +559,7 @@ where ); let justification = match justification { - Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Err(e) => return Err(ConsensusError::ClientImport(e.to_string()).into()), Ok(justification) => justification, }; @@ -579,17 +579,17 @@ where command {}, signaling voter.", number, command); if let Err(e) = self.send_voter_commands.unbounded_send(command) { - return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()); + return Err(ConsensusError::ClientImport(e.to_string()).into()); } }, Err(CommandOrError::Error(e)) => { return Err(match e { - Error::Grandpa(error) => ConsensusErrorKind::ClientImport(error.to_string()), - Error::Network(error) => ConsensusErrorKind::ClientImport(error), - Error::Blockchain(error) => ConsensusErrorKind::ClientImport(error), - Error::Client(error) => ConsensusErrorKind::ClientImport(error.to_string()), - Error::Safety(error) => ConsensusErrorKind::ClientImport(error), - Error::Timer(error) => ConsensusErrorKind::ClientImport(error.to_string()), + Error::Grandpa(error) => ConsensusError::ClientImport(error.to_string()), + Error::Network(error) => ConsensusError::ClientImport(error), + Error::Blockchain(error) => ConsensusError::ClientImport(error), + Error::Client(error) => ConsensusError::ClientImport(error.to_string()), + Error::Safety(error) => ConsensusError::ClientImport(error), + Error::Timer(error) => ConsensusError::ClientImport(error.to_string()), }.into()); }, Ok(_) => { diff --git a/substrate/core/finality-grandpa/src/lib.rs b/substrate/core/finality-grandpa/src/lib.rs index 53dd9d2a57..75aa4d85ce 100644 --- a/substrate/core/finality-grandpa/src/lib.rs +++ b/substrate/core/finality-grandpa/src/lib.rs @@ -441,7 +441,7 @@ fn register_finality_tracker_inherent_data_provider, RA> BlockImport block: ImportBlock, new_cache: HashMap>, ) -> Result { - do_import_block::<_, _, _, _, GrandpaJustification>(&*self.client, &mut *self.data.write(), block, new_cache) + do_import_block::<_, _, _, _, GrandpaJustification>( + &*self.client, &mut *self.data.write(), block, new_cache + ) } fn check_block( @@ -238,7 +240,7 @@ fn do_import_block, RA, J>( let mut imported_aux = match import_result { Ok(ImportResult::Imported(aux)) => aux, Ok(r) => return Ok(r), - Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()), + Err(e) => return Err(ConsensusError::ClientImport(e.to_string()).into()), }; match justification { @@ -294,12 +296,13 @@ fn do_import_finality_proof, RA, J>( authorities, authority_set_provider, finality_proof, - ).map_err(|e| ConsensusError::from(ConsensusErrorKind::ClientImport(e.to_string())))?; + ).map_err(|e| ConsensusError::ClientImport(e.to_string()))?; // try to import all new headers let block_origin = BlockOrigin::NetworkBroadcast; for header_to_import in finality_effects.headers_to_import { - let (block_to_import, new_authorities) = verifier.verify(block_origin, header_to_import, None, None)?; + let (block_to_import, new_authorities) = verifier.verify(block_origin, header_to_import, None, None) + .map_err(|e| ConsensusError::ClientImport(e))?; assert!(block_to_import.justification.is_none(), "We have passed None as justification to verifier.verify"); let mut cache = HashMap::new(); @@ -313,7 +316,7 @@ fn do_import_finality_proof, RA, J>( let finalized_block_hash = finality_effects.block; let finalized_block_number = client.backend().blockchain() .expect_block_number_from_id(&BlockId::Hash(finality_effects.block)) - .map_err(|e| ConsensusError::from(ConsensusErrorKind::ClientImport(e.to_string())))?; + .map_err(|e| ConsensusError::ClientImport(e.to_string()))?; do_finalize_block( client, data, @@ -383,7 +386,7 @@ fn do_import_justification, RA, J>( hash, ); - return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()); + return Err(ConsensusError::ClientImport(e.to_string()).into()); }, Ok(justification) => { trace!( @@ -417,7 +420,7 @@ fn do_finalize_block, RA>( // finalize the block client.finalize_block(BlockId::Hash(hash), Some(justification), true).map_err(|e| { warn!(target: "finality", "Error applying finality to block {:?}: {:?}", (hash, number), e); - ConsensusError::from(ConsensusErrorKind::ClientImport(e.to_string())) + ConsensusError::ClientImport(e.to_string()) })?; // forget obsoleted consensus changes @@ -513,7 +516,7 @@ fn require_insert_aux, RA>( fn on_post_finalization_error(error: ClientError, value_type: &str) -> ConsensusError { warn!(target: "finality", "Failed to write updated {} to disk. Bailing.", value_type); warn!(target: "finality", "Node is in a potentially inconsistent state."); - ConsensusError::from(ConsensusErrorKind::ClientImport(error.to_string())) + ConsensusError::ClientImport(error.to_string()) } #[cfg(test)] diff --git a/substrate/core/keystore/Cargo.toml b/substrate/core/keystore/Cargo.toml index 99f0ebedd2..1d4f146b7e 100644 --- a/substrate/core/keystore/Cargo.toml +++ b/substrate/core/keystore/Cargo.toml @@ -5,8 +5,8 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] +derive_more = "0.14.0" substrate-primitives = { path = "../primitives" } -error-chain = "0.12" hex = "0.3" rand = "0.6" serde_json = "1.0" diff --git a/substrate/core/keystore/src/lib.rs b/substrate/core/keystore/src/lib.rs index 9e6d4ec83c..67cf2c8d32 100644 --- a/substrate/core/keystore/src/lib.rs +++ b/substrate/core/keystore/src/lib.rs @@ -16,38 +16,42 @@ //! Keystore (and session key management) for ed25519 based chains like Polkadot. -// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting` -// https://github.com/paritytech/substrate/issues/1547 -#![allow(deprecated)] +#![warn(missing_docs)] use std::collections::HashMap; use std::path::PathBuf; use std::fs::{self, File}; use std::io::{self, Write}; -use error_chain::{bail, error_chain, error_chain_processing, impl_error_chain_processed, - impl_extract_backtrace, impl_error_chain_kind}; - use substrate_primitives::{ed25519::{Pair, Public}, Pair as PairT}; -error_chain! { - foreign_links { - Io(io::Error); - Json(serde_json::Error); - } +/// Keystore error. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// IO error. + Io(io::Error), + /// JSON error. + Json(serde_json::Error), + /// Invalid password. + #[display(fmt="Invalid password")] + InvalidPassword, + /// Invalid BIP39 phrase + #[display(fmt="Invalid recovery phrase (BIP39) data")] + InvalidPhrase, + /// Invalid seed + #[display(fmt="Invalid seed")] + InvalidSeed, +} - errors { - InvalidPassword { - description("Invalid password"), - display("Invalid password"), - } - InvalidPhrase { - description("Invalid recovery phrase (BIP39) data"), - display("Invalid recovery phrase (BIP39) data"), - } - InvalidSeed { - description("Invalid seed"), - display("Invalid seed"), +/// Keystore Result +pub type Result = std::result::Result; + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Io(ref err) => Some(err), + Error::Json(ref err) => Some(err), + _ => None, } } } @@ -77,7 +81,7 @@ impl Store { /// Create a new key from seed. Do not place it into the store. pub fn generate_from_seed(&mut self, seed: &str) -> Result { let pair = Pair::from_string(seed, None) - .map_err(|_| Error::from(ErrorKind::InvalidSeed))?; + .ok().ok_or(Error::InvalidSeed)?; self.additional.insert(pair.public(), pair.clone()); Ok(pair) } @@ -92,9 +96,9 @@ impl Store { let phrase: String = ::serde_json::from_reader(&file)?; let pair = Pair::from_phrase(&phrase, Some(password)) - .map_err(|_| Error::from(ErrorKind::InvalidPhrase))?; + .ok().ok_or(Error::InvalidPhrase)?; if &pair.public() != public { - bail!(ErrorKind::InvalidPassword); + return Err(Error::InvalidPassword); } Ok(pair) } diff --git a/substrate/core/network-libp2p/Cargo.toml b/substrate/core/network-libp2p/Cargo.toml index be631aa4b9..a2ea8660a2 100644 --- a/substrate/core/network-libp2p/Cargo.toml +++ b/substrate/core/network-libp2p/Cargo.toml @@ -10,7 +10,6 @@ edition = "2018" [dependencies] byteorder = "1.3" bytes = "0.4" -error-chain = { version = "0.12", default-features = false } fnv = "1.0" futures = "0.1" libp2p = { version = "0.8.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] } diff --git a/substrate/core/network/Cargo.toml b/substrate/core/network/Cargo.toml index c3184ab47d..d3b7a71f03 100644 --- a/substrate/core/network/Cargo.toml +++ b/substrate/core/network/Cargo.toml @@ -9,9 +9,9 @@ edition = "2018" [lib] [dependencies] +derive_more = "0.14.0" log = "0.4" parking_lot = "0.7.1" -error-chain = "0.12" bitflags = "1.0" futures = "0.1.17" linked-hash-map = "0.5" diff --git a/substrate/core/network/src/error.rs b/substrate/core/network/src/error.rs index 87b967765c..95a1dc5abe 100644 --- a/substrate/core/network/src/error.rs +++ b/substrate/core/network/src/error.rs @@ -14,22 +14,27 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Substrate service possible errors. +//! Substrate network possible errors. -// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting` -// https://github.com/paritytech/substrate/issues/1547 -#![allow(deprecated)] - -use error_chain::*; -use std::io::Error as IoError; use client; -error_chain! { - foreign_links { - Io(IoError) #[doc = "IO error."]; - Client(client::error::Error) #[doc="Client error"]; - } +/// Result type alias for the network. +pub type Result = std::result::Result; - errors { +/// Error type for the network. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Io error + Io(std::io::Error), + /// Client error + Client(client::error::Error), +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Io(ref err) => Some(err), + Error::Client(ref err) => Some(err), + } } } diff --git a/substrate/core/network/src/test/mod.rs b/substrate/core/network/src/test/mod.rs index 13d18a0d44..ac9e9a98eb 100644 --- a/substrate/core/network/src/test/mod.rs +++ b/substrate/core/network/src/test/mod.rs @@ -37,7 +37,7 @@ use consensus::import_queue::{ Link, SharedBlockImport, SharedJustificationImport, Verifier, SharedFinalityProofImport, SharedFinalityProofRequestBuilder, }; -use consensus::{Error as ConsensusError, ErrorKind as ConsensusErrorKind}; +use consensus::{Error as ConsensusError}; use consensus::{BlockOrigin, ForkChoiceStrategy, ImportBlock, JustificationImport}; use crate::consensus_gossip::{ConsensusGossip, MessageRecipient as GossipMessageRecipient, TopicNotification}; use futures::{prelude::*, sync::{mpsc, oneshot}}; @@ -1228,7 +1228,7 @@ impl JustificationImport for ForceFinalized { justification: Justification, ) -> Result<(), Self::Error> { self.0.finalize_block(BlockId::Hash(hash), Some(justification), true) - .map_err(|_| ConsensusErrorKind::InvalidJustification.into()) + .map_err(|_| ConsensusError::InvalidJustification.into()) } } diff --git a/substrate/core/rpc/Cargo.toml b/substrate/core/rpc/Cargo.toml index d0ead8224e..d69d7e17be 100644 --- a/substrate/core/rpc/Cargo.toml +++ b/substrate/core/rpc/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -error-chain = "0.12" +derive_more = "0.14.0" jsonrpc-core = "10.0.1" jsonrpc-pubsub = "10.0.1" jsonrpc-derive = "10.0.2" diff --git a/substrate/core/rpc/src/author/error.rs b/substrate/core/rpc/src/author/error.rs index 0084c4da8f..5955108249 100644 --- a/substrate/core/rpc/src/author/error.rs +++ b/substrate/core/rpc/src/author/error.rs @@ -16,35 +16,37 @@ //! Authoring RPC module errors. -use error_chain::*; use client; use transaction_pool::txpool; use crate::rpc; use crate::errors; -error_chain! { - foreign_links { - Client(client::error::Error) #[doc = "Client error"]; - } - links { - Pool(txpool::error::Error, txpool::error::ErrorKind) #[doc = "Pool error"]; - } - errors { - /// Not implemented yet - Unimplemented { - description("not yet implemented"), - display("Method Not Implemented"), - } - /// Incorrect extrinsic format. - BadFormat { - description("bad format"), - display("Invalid extrinsic format"), - } - /// Verification error - Verification(e: Box<::std::error::Error + Send>) { - description("extrinsic verification error"), - display("Extrinsic verification error: {}", e.description()), +/// Author RPC Result type. +pub type Result = std::result::Result; + +/// Author RPC errors. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Client error. + Client(client::error::Error), + /// Transaction pool error, + Pool(txpool::error::Error), + /// Verification error + #[display(fmt="Extrinsic verification error: {}", "_0.description()")] + Verification(Box<::std::error::Error + Send>), + /// Incorrect extrinsic format. + #[display(fmt="Invalid extrinsic format")] + BadFormat, +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Client(ref err) => Some(err), + Error::Pool(ref err) => Some(err), + Error::Verification(ref err) => Some(&**err), + _ => None, } } } @@ -73,49 +75,50 @@ const POOL_IMMEDIATELY_DROPPED: i64 = POOL_INVALID_TX + 6; impl From for rpc::Error { fn from(e: Error) -> Self { + use txpool::error::{Error as PoolError}; + match e { - Error(ErrorKind::Unimplemented, _) => errors::unimplemented(), - Error(ErrorKind::BadFormat, _) => rpc::Error { + Error::BadFormat => rpc::Error { code: rpc::ErrorCode::ServerError(BAD_FORMAT), message: "Extrinsic has invalid format.".into(), data: None, }, - Error(ErrorKind::Verification(e), _) => rpc::Error { + Error::Verification(e) => rpc::Error { code: rpc::ErrorCode::ServerError(VERIFICATION_ERROR), message: e.description().into(), data: Some(format!("{:?}", e).into()), }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::InvalidTransaction(code)), _) => rpc::Error { + Error::Pool(PoolError::InvalidTransaction(code)) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_INVALID_TX), message: "Invalid Transaction".into(), data: Some(code.into()), }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::UnknownTransactionValidity(code)), _) => rpc::Error { + Error::Pool(PoolError::UnknownTransactionValidity(code)) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_UNKNOWN_VALIDITY), message: "Unknown Transaction Validity".into(), data: Some(code.into()), }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::TemporarilyBanned), _) => rpc::Error { + Error::Pool(PoolError::TemporarilyBanned) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_TEMPORARILY_BANNED), message: "Transaction is temporarily banned".into(), data: None, }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::AlreadyImported(hash)), _) => rpc::Error { + Error::Pool(PoolError::AlreadyImported(hash)) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_ALREADY_IMPORTED), message: "Transaction Already Imported".into(), data: Some(format!("{:?}", hash).into()), }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::TooLowPriority(old, new)), _) => rpc::Error { + Error::Pool(PoolError::TooLowPriority { old, new }) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_TOO_LOW_PRIORITY), message: format!("Priority is too low: ({} vs {})", old, new), data: Some("The transaction has too low priority to replace another transaction already in the pool.".into()), }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::CycleDetected), _) => rpc::Error { + Error::Pool(PoolError::CycleDetected) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_CYCLE_DETECTED), message: "Cycle Detected".into(), data: None, }, - Error(ErrorKind::Pool(txpool::error::ErrorKind::ImmediatelyDropped), _) => rpc::Error { + Error::Pool(PoolError::ImmediatelyDropped) => rpc::Error { code: rpc::ErrorCode::ServerError(POOL_IMMEDIATELY_DROPPED), message: "Immediately Dropped" .into(), data: Some("The transaction couldn't enter the pool because of the limit".into()), diff --git a/substrate/core/rpc/src/author/mod.rs b/substrate/core/rpc/src/author/mod.rs index acd500ba0b..ae160f1d1a 100644 --- a/substrate/core/rpc/src/author/mod.rs +++ b/substrate/core/rpc/src/author/mod.rs @@ -104,13 +104,13 @@ impl AuthorApi, BlockHash

> for Author whe type Metadata = crate::metadata::Metadata; fn submit_extrinsic(&self, ext: Bytes) -> Result> { - let xt = Decode::decode(&mut &ext[..]).ok_or(error::Error::from(error::ErrorKind::BadFormat))?; + let xt = Decode::decode(&mut &ext[..]).ok_or(error::Error::BadFormat)?; let best_block_hash = self.client.info()?.chain.best_hash; self.pool .submit_one(&generic::BlockId::hash(best_block_hash), xt) .map_err(|e| e.into_pool_error() .map(Into::into) - .unwrap_or_else(|e| error::ErrorKind::Verification(Box::new(e)).into()) + .unwrap_or_else(|e| error::Error::Verification(Box::new(e)).into()) ) } @@ -121,12 +121,13 @@ impl AuthorApi, BlockHash

> for Author whe fn watch_extrinsic(&self, _metadata: Self::Metadata, subscriber: Subscriber, BlockHash

>>, xt: Bytes) { let submit = || -> Result<_> { let best_block_hash = self.client.info()?.chain.best_hash; - let dxt = <

::Block as traits::Block>::Extrinsic::decode(&mut &xt[..]).ok_or(error::Error::from(error::ErrorKind::BadFormat))?; + let dxt = <

::Block as traits::Block>::Extrinsic::decode(&mut &xt[..]) + .ok_or(error::Error::BadFormat)?; self.pool .submit_and_watch(&generic::BlockId::hash(best_block_hash), dxt) .map_err(|e| e.into_pool_error() .map(Into::into) - .unwrap_or_else(|e| error::ErrorKind::Verification(Box::new(e)).into()) + .unwrap_or_else(|e| error::Error::Verification(Box::new(e)).into()) ) }; diff --git a/substrate/core/rpc/src/chain/error.rs b/substrate/core/rpc/src/chain/error.rs index 723a21d773..ffd94f4649 100644 --- a/substrate/core/rpc/src/chain/error.rs +++ b/substrate/core/rpc/src/chain/error.rs @@ -14,33 +14,42 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use error_chain::*; use client; use crate::rpc; use crate::errors; -pub use internal_errors::*; -#[allow(deprecated)] -mod internal_errors { - use super::*; - error_chain! { - foreign_links { - Client(client::error::Error) #[doc = "Client error"]; - } - errors { - /// Not implemented yet - Unimplemented { - description("not yet implemented"), - display("Method Not Implemented"), - } +/// Chain RPC Result type. +pub type Result = std::result::Result; + +/// Chain RPC errors. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Client error. + Client(client::error::Error), + /// Other error type. + Other(String), +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Client(ref err) => Some(err), + _ => None, } } } +/// Base error code for all chain errors. +const BASE_ERROR: i64 = 3000; + impl From for rpc::Error { fn from(e: Error) -> Self { match e { - Error(ErrorKind::Unimplemented, _) => errors::unimplemented(), + Error::Other(message) => rpc::Error { + code: rpc::ErrorCode::ServerError(BASE_ERROR + 1), + message, + data: None, + }, e => errors::internal(e), } } diff --git a/substrate/core/rpc/src/chain/mod.rs b/substrate/core/rpc/src/chain/mod.rs index ab930d0076..9dd7ad84b8 100644 --- a/substrate/core/rpc/src/chain/mod.rs +++ b/substrate/core/rpc/src/chain/mod.rs @@ -145,7 +145,7 @@ impl Chain where let header = best_block_hash() .and_then(|hash| self.header(hash.into())) .and_then(|header| { - header.ok_or_else(|| self::error::ErrorKind::Unimplemented.into()) + header.ok_or_else(|| "Best header missing.".to_owned().into()) }) .map_err(Into::into); diff --git a/substrate/core/rpc/src/errors.rs b/substrate/core/rpc/src/errors.rs index a709013ad2..da910de762 100644 --- a/substrate/core/rpc/src/errors.rs +++ b/substrate/core/rpc/src/errors.rs @@ -17,14 +17,6 @@ use crate::rpc; use log::warn; -pub fn unimplemented() -> rpc::Error { - rpc::Error { - code: rpc::ErrorCode::ServerError(1), - message: "Not implemented yet".into(), - data: None, - } -} - pub fn internal(e: E) -> rpc::Error { warn!("Unknown error: {:?}", e); rpc::Error { diff --git a/substrate/core/rpc/src/state/error.rs b/substrate/core/rpc/src/state/error.rs index d4b3013abb..30b3315b7b 100644 --- a/substrate/core/rpc/src/state/error.rs +++ b/substrate/core/rpc/src/state/error.rs @@ -14,34 +14,47 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use error_chain::*; use client; use crate::rpc; use crate::errors; -error_chain! { - foreign_links { - Client(client::error::Error) #[doc = "Client error"]; - } +/// State RPC Result type. +pub type Result = std::result::Result; - errors { - /// Provided block range couldn't be resolved to a list of blocks. - InvalidBlockRange(from: String, to: String, details: String) { - description("Invalid block range"), - display("Cannot resolve a block range ['{:?}' ... '{:?}]. {}", from, to, details), - } - /// Not implemented yet - Unimplemented { - description("not implemented yet"), - display("Method Not Implemented"), +/// State RPC errors. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Client error. + Client(client::error::Error), + /// Provided block range couldn't be resolved to a list of blocks. + #[display(fmt = "Cannot resolve a block range ['{:?}' ... '{:?}]. {}", from, to, details)] + InvalidBlockRange { + from: String, + to: String, + details: String, + }, +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Client(ref err) => Some(err), + _ => None, } } } +/// Base code for all state errors. +const BASE_ERROR: i64 = 4000; + impl From for rpc::Error { fn from(e: Error) -> Self { match e { - Error(ErrorKind::Unimplemented, _) => errors::unimplemented(), + Error::InvalidBlockRange { .. } => rpc::Error { + code: rpc::ErrorCode::ServerError(BASE_ERROR + 1), + message: format!("{}", e), + data: None, + }, e => errors::internal(e), } } diff --git a/substrate/core/rpc/src/state/mod.rs b/substrate/core/rpc/src/state/mod.rs index 0f87faa7a7..98d62d678d 100644 --- a/substrate/core/rpc/src/state/mod.rs +++ b/substrate/core/rpc/src/state/mod.rs @@ -22,7 +22,6 @@ use std::{ sync::Arc, }; -use error_chain::bail; use log::{warn, trace}; use client::{self, Client, CallExecutor, BlockchainEvents, runtime_api::Metadata}; use jsonrpc_derive::rpc; @@ -148,11 +147,15 @@ pub trait StateApi { /// New storage subscription #[pubsub(subscription = "state_storage", subscribe, name = "state_subscribeStorage")] - fn subscribe_storage(&self, metadata: Self::Metadata, subscriber: Subscriber>, keys: Option>); + fn subscribe_storage( + &self, metadata: Self::Metadata, subscriber: Subscriber>, keys: Option> + ); /// Unsubscribe from storage subscription #[pubsub(subscription = "state_storage", unsubscribe, name = "state_unsubscribeStorage")] - fn unsubscribe_storage(&self, metadata: Option, id: SubscriptionId) -> RpcResult; + fn unsubscribe_storage( + &self, metadata: Option, id: SubscriptionId + ) -> RpcResult; } /// State API with subscriptions support. @@ -213,7 +216,7 @@ impl State where blocks.push(hdr.hash()); last = hdr; } else { - bail!(invalid_block_range( + return Err(invalid_block_range( Some(from), Some(to), format!("Parent of {} ({}) not found", last.number(), last.hash()), @@ -221,7 +224,7 @@ impl State where } } if last.hash() != from.hash() { - bail!(invalid_block_range( + return Err(invalid_block_range( Some(from), Some(to), format!("Expected to reach `from`, got {} ({})", last.number(), last.hash()), @@ -241,7 +244,7 @@ impl State where filtered_range, }) }, - (from, to) => bail!( + (from, to) => Err( invalid_block_range(from.as_ref(), to.as_ref(), "Invalid range or unknown block".into()) ), } @@ -483,7 +486,9 @@ impl StateApi for State where } fn subscribe_runtime_version(&self, _meta: Self::Metadata, subscriber: Subscriber) { - let stream = match self.client.storage_changes_notification_stream(Some(&[StorageKey(storage::well_known_keys::CODE.to_vec())])) { + let stream = match self.client.storage_changes_notification_stream( + Some(&[StorageKey(storage::well_known_keys::CODE.to_vec())]) + ) { Ok(stream) => stream, Err(err) => { let _ = subscriber.reject(error::Error::from(err).into()); @@ -551,11 +556,15 @@ pub(crate) fn split_range(size: usize, middle: Option) -> (Range, (range1, range2) } -fn invalid_block_range(from: Option<&H>, to: Option<&H>, reason: String) -> error::ErrorKind { +fn invalid_block_range(from: Option<&H>, to: Option<&H>, reason: String) -> error::Error { let to_string = |x: Option<&H>| match x { None => "unknown hash".into(), Some(h) => format!("{} ({})", h.number(), h.hash()), }; - error::ErrorKind::InvalidBlockRange(to_string(from), to_string(to), reason) + error::Error::InvalidBlockRange { + from: to_string(from), + to: to_string(to), + details: reason, + } } diff --git a/substrate/core/rpc/src/state/tests.rs b/substrate/core/rpc/src/state/tests.rs index 73a52fbc62..0ad983fc11 100644 --- a/substrate/core/rpc/src/state/tests.rs +++ b/substrate/core/rpc/src/state/tests.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use super::*; -use self::error::{Error, ErrorKind}; +use self::error::Error; use assert_matches::assert_matches; use consensus::BlockOrigin; @@ -80,7 +80,7 @@ fn should_call_contract() { assert_matches!( client.call("balanceOf".into(), Bytes(vec![1,2,3]), Some(genesis_hash).into()), - Err(Error(ErrorKind::Client(client::error::Error::Execution(_)), _)) + Err(Error::Client(client::error::Error::Execution(_))) ) } diff --git a/substrate/core/rpc/src/system/error.rs b/substrate/core/rpc/src/system/error.rs index d3c7e8b333..bdd4cbe667 100644 --- a/substrate/core/rpc/src/system/error.rs +++ b/substrate/core/rpc/src/system/error.rs @@ -16,40 +16,33 @@ //! System RPC module errors. -use error_chain::*; - use crate::rpc; -use crate::errors; use crate::system::helpers::Health; -error_chain! { - errors { - /// Node is not fully functional - NotHealthy(h: Health) { - description("node is not healthy"), - display("Node is not fully functional: {}", h) - } +/// System RPC Result type. +pub type Result = std::result::Result; - /// Not implemented yet - Unimplemented { - description("not yet implemented"), - display("Method Not Implemented"), - } - } +/// System RPC errors. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Provided block range couldn't be resolved to a list of blocks. + #[display(fmt = "Node is not fully functional: {}", _0)] + NotHealthy(Health), } -const ERROR: i64 = 2000; +impl std::error::Error for Error {} + +/// Base code for all system errors. +const BASE_ERROR: i64 = 2000; impl From for rpc::Error { fn from(e: Error) -> Self { match e { - Error(ErrorKind::Unimplemented, _) => errors::unimplemented(), - Error(ErrorKind::NotHealthy(h), _) => rpc::Error { - code: rpc::ErrorCode::ServerError(ERROR + 1), - message: "node is not healthy".into(), - data:serde_json::to_value(h).ok(), + Error::NotHealthy(ref h) => rpc::Error { + code: rpc::ErrorCode::ServerError(BASE_ERROR + 1), + message: format!("{}", e), + data: serde_json::to_value(h).ok(), }, - e => errors::internal(e), } } } diff --git a/substrate/core/service/Cargo.toml b/substrate/core/service/Cargo.toml index 89708683d0..e27c2d61b3 100644 --- a/substrate/core/service/Cargo.toml +++ b/substrate/core/service/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] +derive_more = "0.14.0" futures = "0.1.17" parking_lot = "0.7.1" -error-chain = "0.12" lazy_static = "1.0" log = "0.4" slog = {version = "^2", features = ["nested-values"]} diff --git a/substrate/core/service/src/components.rs b/substrate/core/service/src/components.rs index 2536d7c8f2..6e6503fc3d 100644 --- a/substrate/core/service/src/components.rs +++ b/substrate/core/service/src/components.rs @@ -522,7 +522,7 @@ impl Components for FullComponents { select_chain: Option, ) -> Result { let select_chain = select_chain - .ok_or_else(|| error::Error::from(error::ErrorKind::SelectChainRequired))?; + .ok_or(error::Error::SelectChainRequired)?; Factory::build_full_import_queue(config, client, select_chain) } diff --git a/substrate/core/service/src/error.rs b/substrate/core/service/src/error.rs index c5bcd61a3c..85a6892b26 100644 --- a/substrate/core/service/src/error.rs +++ b/substrate/core/service/src/error.rs @@ -16,32 +16,49 @@ //! Errors that can occur during the service operation. -// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting` -// https://github.com/paritytech/substrate/issues/1547 -#![allow(deprecated)] - use client; use network; use keystore; use consensus_common; -use error_chain::*; -error_chain! { - foreign_links { - Client(client::error::Error) #[doc="Client error"]; - Io(::std::io::Error) #[doc="IO error"]; +/// Service Result typedef. +pub type Result = std::result::Result; + +/// Service errors. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Client error. + Client(client::error::Error), + /// IO error. + Io(std::io::Error), + /// Consensus error. + Consensus(consensus_common::Error), + /// Network error. + Network(network::error::Error), + /// Keystore error. + Keystore(keystore::Error), + /// Best chain selection strategy is missing. + #[display(fmt="Best chain selection strategy (SelectChain) is not provided.")] + SelectChainRequired, + /// Other error. + Other(String), +} + +impl<'a> From<&'a str> for Error { + fn from(s: &'a str) -> Self { + Error::Other(s.into()) } +} - links { - Consensus(consensus_common::Error, consensus_common::ErrorKind) #[doc="Consensus error"]; - Network(network::error::Error, network::error::ErrorKind) #[doc="Network error"]; - Keystore(keystore::Error, keystore::ErrorKind) #[doc="Keystore error"]; - } - - errors { - SelectChainRequired { - description("Best chain selection strategy (SelectChain) must be provided when starting full node or authority."), - display("Best chain selection strategy (SelectChain) is not provided."), +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Client(ref err) => Some(err), + Error::Io(ref err) => Some(err), + Error::Consensus(ref err) => Some(err), + Error::Network(ref err) => Some(err), + Error::Keystore(ref err) => Some(err), + _ => None, } } } diff --git a/substrate/core/service/src/lib.rs b/substrate/core/service/src/lib.rs index 81e153b7ae..2a69dc83c7 100644 --- a/substrate/core/service/src/lib.rs +++ b/substrate/core/service/src/lib.rs @@ -44,7 +44,7 @@ use runtime_primitives::traits::{Header, SaturatedConversion}; use substrate_executor::NativeExecutor; use tel::{telemetry, SUBSTRATE_INFO}; -pub use self::error::{ErrorKind, Error}; +pub use self::error::Error; pub use config::{Configuration, Roles, PruningMode}; pub use chain_spec::{ChainSpec, Properties}; pub use transaction_pool::txpool::{ @@ -515,7 +515,7 @@ impl network::TransactionPool, ComponentBlock< match self.pool.submit_one(&best_block_id, uxt) { Ok(hash) => Some(hash), Err(e) => match e.into_pool_error() { - Ok(txpool::error::Error(txpool::error::ErrorKind::AlreadyImported(hash), _)) => { + Ok(txpool::error::Error::AlreadyImported(hash)) => { hash.downcast::>().ok() .map(|x| x.as_ref().clone()) }, diff --git a/substrate/core/test-runtime/wasm/Cargo.lock b/substrate/core/test-runtime/wasm/Cargo.lock index df89cba455..eaa9acbd45 100644 --- a/substrate/core/test-runtime/wasm/Cargo.lock +++ b/substrate/core/test-runtime/wasm/Cargo.lock @@ -119,11 +119,6 @@ dependencies = [ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "base-x" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "base58" version = "0.1.0" @@ -482,11 +477,6 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "dns-parser" version = "0.8.0" @@ -546,14 +536,6 @@ dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "failure" version = "0.1.5" @@ -886,41 +868,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libp2p" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core-derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-dns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-floodsub 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-kad 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mdns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mplex 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-noise 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-plaintext 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ratelimit 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-secio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-tcp 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ratelimit 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-wasm-ext 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -931,6 +914,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -941,21 +925,20 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "secp256k1 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -964,20 +947,19 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-floodsub" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -985,7 +967,7 @@ dependencies = [ "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -996,13 +978,13 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1010,14 +992,14 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-kad" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1027,7 +1009,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1037,20 +1019,20 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mdns" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1058,20 +1040,20 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mplex" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1081,14 +1063,16 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1099,41 +1083,42 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-plaintext" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1141,7 +1126,7 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1152,7 +1137,7 @@ dependencies = [ "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1170,14 +1155,14 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1185,23 +1170,36 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "libp2p-yamux" -version = "0.7.0" +name = "libp2p-wasm-ext" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-yamux" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1972,16 +1970,6 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "secp256k1" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "semver" version = "0.9.0" @@ -2304,50 +2292,6 @@ name = "static_slice" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "stdweb" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "stream-cipher" version = "0.3.0" @@ -2447,9 +2391,9 @@ name = "substrate-consensus-common" version = "2.0.0" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -2464,7 +2408,6 @@ dependencies = [ name = "substrate-consensus-slots" version = "2.0.0" dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2482,7 +2425,7 @@ name = "substrate-executor" version = "2.0.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3146,6 +3089,18 @@ dependencies = [ "weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasm-timer" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasmi" version = "0.4.3" @@ -3295,7 +3250,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" @@ -3341,7 +3295,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe9f11be34f800b3ecaaed0ec9ec2e015d1d0ba0c8644c1310f73d6e8994615" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" -"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" "checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac" @@ -3349,7 +3302,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" "checksum environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c7464757b80de8930c91c9afe77ddce501826bf9d134a87db2c67d9dc177e2c" "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" -"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" @@ -3394,23 +3346,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" -"checksum libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0231edab431064b30b7749484a39735eb36492cef4658c372c9059e58c3003aa" -"checksum libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1a3bad2ed26297112847678683dd221473a0d44297250b61f004e1b35e72493" -"checksum libp2p-core-derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f765f103b680cbed910b02bfdbdcfce5b1142899c93e51acb960bf59b6f81b1" -"checksum libp2p-dns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b129d20cc8cbb6ce5da8361045649c024659173e246c5dfbf20ae06071c046a" -"checksum libp2p-floodsub 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70d68816b8435d6788399416eb2f0a6974fb1d15c4be5c30141f87c8e81746df" -"checksum libp2p-identify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "718ca645a065fd70855ca6042a7df686c24cd21add750c37a82c811fbd1e5c43" -"checksum libp2p-kad 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbe27c623a6a720efd5d704347838972062f89149a9c3cd149748da60bdcd3e0" -"checksum libp2p-mdns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9bc1a5d85f4812cae6367b49a432763fe28997bac7c530dc55b70ec18a78aa7" -"checksum libp2p-mplex 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe5a858342a1cc89464474f7edc4bae1da649b9c823a3e04d9fb494493601746" -"checksum libp2p-noise 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc6b5185c50a52a12e7bbe2ee7799059e24de4e52ab25edbfd26c8ab8515d317" -"checksum libp2p-ping 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7905c1431ad115bee83405770629a27d6f17153ad02ec9670a7347998ef20e22" -"checksum libp2p-plaintext 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc17626763ded57da8fed73187c2d9f6ebb89d30838673c430315bf560c7e4db" -"checksum libp2p-ratelimit 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2409d08b809ab1a74269597f7da2829d117cc11b9ed3343af33fc20831619726" -"checksum libp2p-secio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258cdc6742945c8f6402997bbbf36733588e2db18e5a0014da6d46e3ccfb92cf" -"checksum libp2p-tcp 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b5691e2ba2720d42bd1e93d6b90239fa9235c1956ef6a5f1dd499a7ae2767be" -"checksum libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ab0b9ca050105fd94229c48911c0c84aef4d6b86a53d1b6df81d938354e47e" -"checksum libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6ff51a5b2056bacee1c9f2ed8455cdf3c5c619261ddb4efc783119130aaf52" +"checksum libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "141ab3f96adc87c8cb847b1cf790e0fbce0b03e3dabfdd3b72fe23d36fc005de" +"checksum libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1514593f2aced40b257565cf2edc63b4cc2f06241a2f3e5a4fe275e0c4d55e85" +"checksum libp2p-core-derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f6f5543deedf4d89931a74d3897b63be19a62d5cb675efaa4c669a4aa0ab12" +"checksum libp2p-dns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9db88ba58601f4528ef5e5e5414e142b19d5813bdaa685e683ef5a44ed23606b" +"checksum libp2p-floodsub 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "260689f26ab2161a1fde9617c53699f78e4ab25fd77c4b07a25b97fca74c5c6d" +"checksum libp2p-identify 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1281e58168ed62cf2e9bfe127908a0ec277cf48cbb3dec5b1a68b58ea6332171" +"checksum libp2p-kad 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd8ab542edc493fa7a9f9b7f93dc4ee0b384e1f9e2a3397ce0056ffe30a0ea21" +"checksum libp2p-mdns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f009594f78d952c57f452be237650025acd4ef17c5cc8eda4c6466ba196e5688" +"checksum libp2p-mplex 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ccfb9869daccfb9d3938eda8821146e85105a8c874f14393cdb57543afeceb38" +"checksum libp2p-noise 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d3dce2ec4fcb3a2cc748c02d61f7e76486df9c7b09e8ccb4d9f81befce207de" +"checksum libp2p-ping 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b3bb3328d206ad3061e863f179a211fc978d7bce05f90440ed6b8a6a9d17ced" +"checksum libp2p-plaintext 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b23a8ece138f448572c5ff781d62323a954f1f681c303e6553368026764b0ae" +"checksum libp2p-ratelimit 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "55918f058f118d72d83f9a976f12e02e54c8616ddfc795c779c4801a5042a44f" +"checksum libp2p-secio 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bff57806e0f71832cc02b5dea1010e5f1a9d16393fd104a4b64e4aaae40d885" +"checksum libp2p-tcp 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3629f9a667d9f5acb5876df59cf3b547250e340131c47587f9ace7c517f21327" +"checksum libp2p-uds 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d65c15f89c0607d4a334664d759e54e847e1856a73ea78e7bb6a75e6f4039010" +"checksum libp2p-wasm-ext 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dff6c81d0f46261a6327219349753aefd3a92021a1e6102185fa112cfcddca97" +"checksum libp2p-yamux 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5369165359bea84e7ebe73f37b6240f31f8d924ce6710be3d8e1fa678985c9b8" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" @@ -3496,7 +3449,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum schnorrkel 0.0.0 (git+https://github.com/w3f/schnorrkel)" = "" "checksum schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a700659388785588c75b197cecda0f23c7112a9281ef703e8ffc651061ce014c" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum secp256k1 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4070f3906e65249228094cf97b04a90799fba04468190bbbcfa812309cf86e32" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" @@ -3519,10 +3471,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" -"checksum stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a3edad410e603184d656e2abded5fd4d3d6e93d5763d21130dbaf99795db74eb" -"checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" -"checksum stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1635afd059cbfac7d5b1274f0c44cec110c1e013c48e8bbc22e07e52696cf887" -"checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" @@ -3579,6 +3527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum wasm-bindgen-macro-support 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9168c413491e4233db7b6884f09a43beb00c14d11d947ffd165242daa48a2385" "checksum wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "326c32126e1a157b6ced7400061a84ac5b11182b2cda6edad7314eb3ae9ac9fe" "checksum wasm-bindgen-webidl 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "613dbf4d7d3bf10aeb212b35de14a8ef07222c26526d4f931061a83fc9e2a851" +"checksum wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad9ac33c834103916e373d648adf65f58c83fb3d8a0f3e6b9a64bca7253a4dca" "checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" "checksum web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "24129e4be2281109b3e15a328d3d7f233ee232a5405f75ba1e9bb59a25ebc4d4" "checksum weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044" diff --git a/substrate/core/transaction-pool/Cargo.toml b/substrate/core/transaction-pool/Cargo.toml index c3f9dce5fe..5b2c2350af 100644 --- a/substrate/core/transaction-pool/Cargo.toml +++ b/substrate/core/transaction-pool/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -error-chain = "0.12" +derive_more = "0.14.0" futures = "0.1" log = "0.4" parity-codec = "3.3" diff --git a/substrate/core/transaction-pool/graph/Cargo.toml b/substrate/core/transaction-pool/graph/Cargo.toml index 29accf0eb8..0ebc74b7da 100644 --- a/substrate/core/transaction-pool/graph/Cargo.toml +++ b/substrate/core/transaction-pool/graph/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -error-chain = "0.12" +derive_more = "0.14.0" futures = "0.1" log = "0.4" parking_lot = "0.7.1" diff --git a/substrate/core/transaction-pool/graph/src/base_pool.rs b/substrate/core/transaction-pool/graph/src/base_pool.rs index 2b4b96839d..74e499674a 100644 --- a/substrate/core/transaction-pool/graph/src/base_pool.rs +++ b/substrate/core/transaction-pool/graph/src/base_pool.rs @@ -25,7 +25,6 @@ use std::{ sync::Arc, }; -use error_chain::bail; use log::{trace, debug, warn}; use serde::Serialize; use substrate_primitives::hexdisplay::HexDisplay; @@ -184,7 +183,7 @@ impl BasePool, ) -> error::Result> { if self.future.contains(&tx.hash) || self.ready.contains(&tx.hash) { - bail!(error::ErrorKind::AlreadyImported(Box::new(tx.hash.clone()))) + return Err(error::Error::AlreadyImported(Box::new(tx.hash.clone()))) } let tx = WaitingTransaction::new( @@ -259,7 +258,7 @@ impl BasePool) { - description("Transaction is already in the pool"), - display("[{:?}] Already imported", hash), - } - /// The transaction cannot be imported cause it's a replacement and has too low priority. - TooLowPriority(old: Priority, new: Priority) { - description("The priority is too low to replace transactions already in the pool."), - display("Too low priority ({} > {})", old, new) - } - /// Deps cycle detected and we couldn't import transaction. - CycleDetected { - description("Transaction was not imported because of detected cycle."), - display("Cycle Detected"), - } - /// Transaction was dropped immediately after it got inserted. - ImmediatelyDropped { - description("Transaction couldn't enter the pool because of the limit."), - display("Immediately Dropped"), - } - } +/// Transaction pool result. +pub type Result = std::result::Result; + +/// Transaction pool error type. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Transaction is not verifiable yet, but might be in the future. + #[display(fmt="Unkown Transaction Validity. Error code: {}", _0)] + UnknownTransactionValidity(i8), + /// Transaction is invalid. + #[display(fmt="Invalid Transaction. Error Code: {}", _0)] + InvalidTransaction(i8), + /// The transaction is temporarily banned. + #[display(fmt="Temporarily Banned")] + TemporarilyBanned, + /// The transaction is already in the pool. + #[display(fmt="[{:?}] Already imported", _0)] + AlreadyImported(Box), + /// The transaction cannot be imported cause it's a replacement and has too low priority. + #[display(fmt="Too low priority ({} > {})", old, new)] + TooLowPriority { + /// Transaction already in the pool. + old: Priority, + /// Transaction entering the pool. + new: Priority + }, + /// Deps cycle etected and we couldn't import transaction. + #[display(fmt="Cycle Detected")] + CycleDetected, + /// Transaction was dropped immediately after it got inserted. + #[display(fmt="Transaction couldn't enter the pool because of the limit.")] + ImmediatelyDropped, + /// Invalid block id. + InvalidBlockId(String), } +impl std::error::Error for Error {} + /// Transaction pool error conversion. pub trait IntoPoolError: ::std::error::Error + Send + Sized { /// Try to extract original `Error` diff --git a/substrate/core/transaction-pool/graph/src/pool.rs b/substrate/core/transaction-pool/graph/src/pool.rs index 78d06eabb5..a5b7a3d2aa 100644 --- a/substrate/core/transaction-pool/graph/src/pool.rs +++ b/substrate/core/transaction-pool/graph/src/pool.rs @@ -27,7 +27,6 @@ use crate::listener::Listener; use crate::rotator::PoolRotator; use crate::watcher::Watcher; use serde::Serialize; -use error_chain::bail; use log::debug; use futures::sync::mpsc; @@ -119,14 +118,14 @@ impl Pool { T: IntoIterator> { let block_number = self.api.block_id_to_number(at)? - .ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?; + .ok_or_else(|| error::Error::InvalidBlockId(format!("{:?}", at)).into())?; let results = xts .into_iter() .map(|xt| -> Result<_, B::Error> { let (hash, bytes) = self.api.hash_and_length(&xt); if self.rotator.is_banned(&hash) { - bail!(error::Error::from(error::ErrorKind::TemporarilyBanned)) + return Err(error::Error::TemporarilyBanned.into()) } match self.api.validate_transaction(at, xt.clone())? { @@ -144,11 +143,11 @@ impl Pool { }) }, TransactionValidity::Invalid(e) => { - bail!(error::Error::from(error::ErrorKind::InvalidTransaction(e))) + Err(error::Error::InvalidTransaction(e).into()) }, TransactionValidity::Unknown(e) => { self.listener.write().invalid(&hash); - bail!(error::Error::from(error::ErrorKind::UnknownTransactionValidity(e))) + Err(error::Error::UnknownTransactionValidity(e).into()) }, } }) @@ -168,7 +167,7 @@ impl Pool { let removed = self.enforce_limits(); Ok(results.into_iter().map(|res| match res { - Ok(ref hash) if removed.contains(hash) => Err(error::Error::from(error::ErrorKind::ImmediatelyDropped).into()), + Ok(ref hash) if removed.contains(hash) => Err(error::Error::ImmediatelyDropped.into()), other => other, }).collect()) } @@ -308,10 +307,7 @@ impl Pool { // Collect the hashes of transactions that now became invalid (meaning that they are succesfully pruned). let hashes = results.into_iter().enumerate().filter_map(|(idx, r)| match r.map_err(error::IntoPoolError::into_pool_error) { - Err(Ok(err)) => match err.kind() { - error::ErrorKind::InvalidTransaction(_) => Some(hashes[idx].clone()), - _ => None, - }, + Err(Ok(error::Error::InvalidTransaction(_))) => Some(hashes[idx].clone()), _ => None, }); // Fire `pruned` notifications for collected hashes and make sure to include @@ -319,7 +315,7 @@ impl Pool { let hashes = hashes.chain(known_imported_hashes.into_iter()); { let header_hash = self.api.block_id_to_hash(at)? - .ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?; + .ok_or_else(|| error::Error::InvalidBlockId(format!("{:?}", at)).into())?; let mut listener = self.listener.write(); for h in hashes { listener.pruned(header_hash, &h); @@ -338,7 +334,7 @@ impl Pool { /// See `prune_tags` if you want this. pub fn clear_stale(&self, at: &BlockId) -> Result<(), B::Error> { let block_number = self.api.block_id_to_number(at)? - .ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())? + .ok_or_else(|| error::Error::InvalidBlockId(format!("{:?}", at)).into())? .saturated_into::(); let now = time::Instant::now(); let to_remove = { @@ -569,7 +565,7 @@ mod tests { assert_eq!(pool.status().future, 0); // then - assert_matches!(res.unwrap_err().kind(), error::ErrorKind::TemporarilyBanned); + assert_matches!(res.unwrap_err(), error::Error::TemporarilyBanned); } #[test] diff --git a/substrate/core/transaction-pool/graph/src/ready.rs b/substrate/core/transaction-pool/graph/src/ready.rs index befb1b60cc..ca3d7322cc 100644 --- a/substrate/core/transaction-pool/graph/src/ready.rs +++ b/substrate/core/transaction-pool/graph/src/ready.rs @@ -23,7 +23,6 @@ use std::{ use serde::Serialize; use log::debug; -use error_chain::bail; use parking_lot::RwLock; use sr_primitives::traits::Member; use sr_primitives::transaction_validity::{ @@ -376,7 +375,7 @@ impl ReadyTransactions { // bail - the transaction has too low priority to replace the old ones if old_priority >= tx.priority { - bail!(error::ErrorKind::TooLowPriority(old_priority, tx.priority)) + return Err(error::Error::TooLowPriority { old: old_priority, new: tx.priority }) } replace_hashes.into_iter().cloned().collect::>() diff --git a/substrate/core/transaction-pool/src/error.rs b/substrate/core/transaction-pool/src/error.rs index d4cc0acee8..f3641aa8ec 100644 --- a/substrate/core/transaction-pool/src/error.rs +++ b/substrate/core/transaction-pool/src/error.rs @@ -16,29 +16,34 @@ //! Transaction pool error. -// Silence: `use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting` -// https://github.com/paritytech/substrate/issues/1547 -#![allow(deprecated)] - use client; use txpool; -use error_chain::{ - error_chain, error_chain_processing, impl_error_chain_processed, impl_extract_backtrace, impl_error_chain_kind -}; -error_chain! { - foreign_links { - Client(client::error::Error) #[doc = "Client error"]; - } - links { - Pool(txpool::error::Error, txpool::error::ErrorKind) #[doc = "Pool error"]; +/// Transaction pool result. +pub type Result = std::result::Result; + +/// Transaction pool error type. +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum Error { + /// Client error. + Client(client::error::Error), + /// Pool error. + Pool(txpool::error::Error), +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Client(ref err) => Some(err), + Error::Pool(ref err) => Some(err), + } } } impl txpool::IntoPoolError for Error { - fn into_pool_error(self) -> ::std::result::Result { + fn into_pool_error(self) -> std::result::Result { match self { - Error(ErrorKind::Pool(e), c) => Ok(txpool::error::Error(e, c)), + Error::Pool(e) => Ok(e), e => Err(e), } } diff --git a/substrate/node-template/Cargo.toml b/substrate/node-template/Cargo.toml index d0427ec80d..69f9c884cd 100644 --- a/substrate/node-template/Cargo.toml +++ b/substrate/node-template/Cargo.toml @@ -10,7 +10,7 @@ name = "node-template" path = "src/main.rs" [dependencies] -error-chain = "0.12" +derive_more = "0.14.0" futures = "0.1" ctrlc = { version = "3.0", features = ["termination"] } log = "0.4" diff --git a/substrate/node-template/runtime/wasm/Cargo.lock b/substrate/node-template/runtime/wasm/Cargo.lock index e458c165c0..5f46b360e4 100644 --- a/substrate/node-template/runtime/wasm/Cargo.lock +++ b/substrate/node-template/runtime/wasm/Cargo.lock @@ -119,11 +119,6 @@ dependencies = [ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "base-x" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "base58" version = "0.1.0" @@ -482,11 +477,6 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "dns-parser" version = "0.8.0" @@ -546,14 +536,6 @@ dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "failure" version = "0.1.5" @@ -886,41 +868,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libp2p" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core-derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-dns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-floodsub 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-kad 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mdns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mplex 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-noise 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-plaintext 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ratelimit 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-secio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-tcp 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ratelimit 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-wasm-ext 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -931,6 +914,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -941,21 +925,20 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "secp256k1 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -964,20 +947,19 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-floodsub" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -985,7 +967,7 @@ dependencies = [ "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -996,13 +978,13 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1010,14 +992,14 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-kad" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1027,7 +1009,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1037,20 +1019,20 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mdns" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1058,20 +1040,20 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mplex" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1081,14 +1063,16 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1099,41 +1083,42 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-plaintext" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1141,7 +1126,7 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1152,7 +1137,7 @@ dependencies = [ "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1170,14 +1155,14 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1185,23 +1170,36 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "libp2p-yamux" -version = "0.7.0" +name = "libp2p-wasm-ext" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-yamux" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2006,16 +2004,6 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "secp256k1" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "semver" version = "0.9.0" @@ -2457,50 +2445,6 @@ name = "static_slice" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "stdweb" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "stream-cipher" version = "0.3.0" @@ -2590,9 +2534,9 @@ name = "substrate-consensus-common" version = "2.0.0" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -2608,7 +2552,7 @@ name = "substrate-executor" version = "2.0.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3238,6 +3182,18 @@ dependencies = [ "weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasm-timer" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasmi" version = "0.4.3" @@ -3387,7 +3343,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" @@ -3433,7 +3388,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe9f11be34f800b3ecaaed0ec9ec2e015d1d0ba0c8644c1310f73d6e8994615" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" -"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" "checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac" @@ -3441,7 +3395,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" "checksum environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c7464757b80de8930c91c9afe77ddce501826bf9d134a87db2c67d9dc177e2c" "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" -"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" @@ -3486,23 +3439,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" -"checksum libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0231edab431064b30b7749484a39735eb36492cef4658c372c9059e58c3003aa" -"checksum libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1a3bad2ed26297112847678683dd221473a0d44297250b61f004e1b35e72493" -"checksum libp2p-core-derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f765f103b680cbed910b02bfdbdcfce5b1142899c93e51acb960bf59b6f81b1" -"checksum libp2p-dns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b129d20cc8cbb6ce5da8361045649c024659173e246c5dfbf20ae06071c046a" -"checksum libp2p-floodsub 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70d68816b8435d6788399416eb2f0a6974fb1d15c4be5c30141f87c8e81746df" -"checksum libp2p-identify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "718ca645a065fd70855ca6042a7df686c24cd21add750c37a82c811fbd1e5c43" -"checksum libp2p-kad 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbe27c623a6a720efd5d704347838972062f89149a9c3cd149748da60bdcd3e0" -"checksum libp2p-mdns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9bc1a5d85f4812cae6367b49a432763fe28997bac7c530dc55b70ec18a78aa7" -"checksum libp2p-mplex 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe5a858342a1cc89464474f7edc4bae1da649b9c823a3e04d9fb494493601746" -"checksum libp2p-noise 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc6b5185c50a52a12e7bbe2ee7799059e24de4e52ab25edbfd26c8ab8515d317" -"checksum libp2p-ping 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7905c1431ad115bee83405770629a27d6f17153ad02ec9670a7347998ef20e22" -"checksum libp2p-plaintext 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc17626763ded57da8fed73187c2d9f6ebb89d30838673c430315bf560c7e4db" -"checksum libp2p-ratelimit 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2409d08b809ab1a74269597f7da2829d117cc11b9ed3343af33fc20831619726" -"checksum libp2p-secio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258cdc6742945c8f6402997bbbf36733588e2db18e5a0014da6d46e3ccfb92cf" -"checksum libp2p-tcp 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b5691e2ba2720d42bd1e93d6b90239fa9235c1956ef6a5f1dd499a7ae2767be" -"checksum libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ab0b9ca050105fd94229c48911c0c84aef4d6b86a53d1b6df81d938354e47e" -"checksum libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6ff51a5b2056bacee1c9f2ed8455cdf3c5c619261ddb4efc783119130aaf52" +"checksum libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "141ab3f96adc87c8cb847b1cf790e0fbce0b03e3dabfdd3b72fe23d36fc005de" +"checksum libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1514593f2aced40b257565cf2edc63b4cc2f06241a2f3e5a4fe275e0c4d55e85" +"checksum libp2p-core-derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f6f5543deedf4d89931a74d3897b63be19a62d5cb675efaa4c669a4aa0ab12" +"checksum libp2p-dns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9db88ba58601f4528ef5e5e5414e142b19d5813bdaa685e683ef5a44ed23606b" +"checksum libp2p-floodsub 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "260689f26ab2161a1fde9617c53699f78e4ab25fd77c4b07a25b97fca74c5c6d" +"checksum libp2p-identify 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1281e58168ed62cf2e9bfe127908a0ec277cf48cbb3dec5b1a68b58ea6332171" +"checksum libp2p-kad 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd8ab542edc493fa7a9f9b7f93dc4ee0b384e1f9e2a3397ce0056ffe30a0ea21" +"checksum libp2p-mdns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f009594f78d952c57f452be237650025acd4ef17c5cc8eda4c6466ba196e5688" +"checksum libp2p-mplex 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ccfb9869daccfb9d3938eda8821146e85105a8c874f14393cdb57543afeceb38" +"checksum libp2p-noise 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d3dce2ec4fcb3a2cc748c02d61f7e76486df9c7b09e8ccb4d9f81befce207de" +"checksum libp2p-ping 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b3bb3328d206ad3061e863f179a211fc978d7bce05f90440ed6b8a6a9d17ced" +"checksum libp2p-plaintext 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b23a8ece138f448572c5ff781d62323a954f1f681c303e6553368026764b0ae" +"checksum libp2p-ratelimit 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "55918f058f118d72d83f9a976f12e02e54c8616ddfc795c779c4801a5042a44f" +"checksum libp2p-secio 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bff57806e0f71832cc02b5dea1010e5f1a9d16393fd104a4b64e4aaae40d885" +"checksum libp2p-tcp 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3629f9a667d9f5acb5876df59cf3b547250e340131c47587f9ace7c517f21327" +"checksum libp2p-uds 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d65c15f89c0607d4a334664d759e54e847e1856a73ea78e7bb6a75e6f4039010" +"checksum libp2p-wasm-ext 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dff6c81d0f46261a6327219349753aefd3a92021a1e6102185fa112cfcddca97" +"checksum libp2p-yamux 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5369165359bea84e7ebe73f37b6240f31f8d924ce6710be3d8e1fa678985c9b8" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" @@ -3588,7 +3542,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum schnorrkel 0.0.0 (git+https://github.com/w3f/schnorrkel)" = "" "checksum schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a700659388785588c75b197cecda0f23c7112a9281ef703e8ffc651061ce014c" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum secp256k1 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4070f3906e65249228094cf97b04a90799fba04468190bbbcfa812309cf86e32" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" @@ -3611,10 +3564,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" -"checksum stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a3edad410e603184d656e2abded5fd4d3d6e93d5763d21130dbaf99795db74eb" -"checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" -"checksum stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1635afd059cbfac7d5b1274f0c44cec110c1e013c48e8bbc22e07e52696cf887" -"checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" @@ -3671,6 +3620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum wasm-bindgen-macro-support 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9168c413491e4233db7b6884f09a43beb00c14d11d947ffd165242daa48a2385" "checksum wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "326c32126e1a157b6ced7400061a84ac5b11182b2cda6edad7314eb3ae9ac9fe" "checksum wasm-bindgen-webidl 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "613dbf4d7d3bf10aeb212b35de14a8ef07222c26526d4f931061a83fc9e2a851" +"checksum wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad9ac33c834103916e373d648adf65f58c83fb3d8a0f3e6b9a64bca7253a4dca" "checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" "checksum web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "24129e4be2281109b3e15a328d3d7f233ee232a5405f75ba1e9bb59a25ebc4d4" "checksum weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044" diff --git a/substrate/node-template/src/error.rs b/substrate/node-template/src/error.rs deleted file mode 100644 index a8aa94bf32..0000000000 --- a/substrate/node-template/src/error.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Initialization errors. - -use client; - -error_chain! { - foreign_links { - Io(::std::io::Error) #[doc="IO error"]; - Cli(::clap::Error) #[doc="CLI error"]; - } - links { - Client(client::error::Error, client::error::ErrorKind) #[doc="Client error"]; - } -} diff --git a/substrate/node-template/src/main.rs b/substrate/node-template/src/main.rs index 53845ddd08..5418453a02 100644 --- a/substrate/node-template/src/main.rs +++ b/substrate/node-template/src/main.rs @@ -9,7 +9,7 @@ mod cli; pub use substrate_cli::{VersionInfo, IntoExit, error}; -fn run() -> cli::error::Result<()> { +fn main() { let version = VersionInfo { name: "Substrate Node", commit: env!("VERGEN_SHA_SHORT"), @@ -19,7 +19,9 @@ fn run() -> cli::error::Result<()> { description: "Template Node", support_url: "support.anonymous.an", }; - cli::run(::std::env::args(), cli::Exit, version) -} -error_chain::quick_main!(run); + if let Err(e) = cli::run(::std::env::args(), cli::Exit, version) { + eprintln!("Error starting the node: {}\n\n{:?}", e, e); + std::process::exit(1) + } +} diff --git a/substrate/node-template/src/service.rs b/substrate/node-template/src/service.rs index 7a6a3f0c27..3725833e3d 100644 --- a/substrate/node-template/src/service.rs +++ b/substrate/node-template/src/service.rs @@ -10,7 +10,7 @@ use substrate_service::{ FactoryFullConfiguration, LightComponents, FullComponents, FullBackend, FullClient, LightClient, LightBackend, FullExecutor, LightExecutor, TaskExecutor, - error::{Error as ServiceError, ErrorKind as ServiceErrorKind}, + error::{Error as ServiceError}, }; use basic_authorship::ProposerFactory; use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra}; @@ -46,10 +46,18 @@ construct_service_factory! { RuntimeApi = RuntimeApi, NetworkProtocol = NodeProtocol { |config| Ok(NodeProtocol::new()) }, RuntimeDispatch = Executor, - FullTransactionPoolApi = transaction_pool::ChainApi, FullExecutor, Block, RuntimeApi>, Block> - { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) }, - LightTransactionPoolApi = transaction_pool::ChainApi, LightExecutor, Block, RuntimeApi>, Block> - { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) }, + FullTransactionPoolApi = transaction_pool::ChainApi< + client::Client, FullExecutor, Block, RuntimeApi>, + Block + > { + |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) + }, + LightTransactionPoolApi = transaction_pool::ChainApi< + client::Client, LightExecutor, Block, RuntimeApi>, + Block + > { + |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) + }, Genesis = GenesisConfig, Configuration = NodeConfig, FullService = FullComponents @@ -67,7 +75,7 @@ construct_service_factory! { }); let client = service.client(); let select_chain = service.select_chain() - .ok_or_else(|| ServiceError::from(ServiceErrorKind::SelectChainRequired))?; + .ok_or_else(|| ServiceError::SelectChainRequired)?; executor.spawn(start_aura( SlotDuration::get_or_compute(&*client)?, key.clone(), diff --git a/substrate/node/cli/src/error.rs b/substrate/node/cli/src/error.rs deleted file mode 100644 index dd5448ac8a..0000000000 --- a/substrate/node/cli/src/error.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2018-2019 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -//! Initialization errors. - -use client; -use error_chain::{ - error_chain, error_chain_processing, impl_error_chain_processed -}; - -error_chain! { - foreign_links { - Io(::std::io::Error) #[doc="IO error"]; - Cli(::clap::Error) #[doc="CLI error"]; - } - links { - Client(client::error::Error, client::error::ErrorKind) #[doc="Client error"]; - } -} diff --git a/substrate/node/cli/src/service.rs b/substrate/node/cli/src/service.rs index 90041b4cbb..a4ac1b0660 100644 --- a/substrate/node/cli/src/service.rs +++ b/substrate/node/cli/src/service.rs @@ -31,7 +31,7 @@ use node_runtime::{GenesisConfig, RuntimeApi}; use substrate_service::{ FactoryFullConfiguration, LightComponents, FullComponents, FullBackend, FullClient, LightClient, LightBackend, FullExecutor, LightExecutor, TaskExecutor, - error::{Error as ServiceError, ErrorKind as ServiceErrorKind}, + error::{Error as ServiceError}, }; use transaction_pool::{self, txpool::{Pool as TransactionPool}}; use inherents::InherentDataProviders; @@ -92,7 +92,7 @@ construct_service_factory! { let client = service.client(); let select_chain = service.select_chain() - .ok_or_else(|| ServiceError::from(ServiceErrorKind::SelectChainRequired))?; + .ok_or(ServiceError::SelectChainRequired)?; executor.spawn(start_aura( SlotDuration::get_or_compute(&*client)?, key.clone(), diff --git a/substrate/node/runtime/wasm/Cargo.lock b/substrate/node/runtime/wasm/Cargo.lock index 50037f709e..846857caa2 100644 --- a/substrate/node/runtime/wasm/Cargo.lock +++ b/substrate/node/runtime/wasm/Cargo.lock @@ -119,11 +119,6 @@ dependencies = [ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "base-x" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "base58" version = "0.1.0" @@ -482,11 +477,6 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "dns-parser" version = "0.8.0" @@ -546,14 +536,6 @@ dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "failure" version = "0.1.5" @@ -886,41 +868,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libp2p" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core-derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-dns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-floodsub 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-kad 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mdns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mplex 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-noise 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-plaintext 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ratelimit 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-secio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-tcp 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ratelimit 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-wasm-ext 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -931,6 +914,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -941,21 +925,20 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "secp256k1 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -964,20 +947,19 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-floodsub" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -985,7 +967,7 @@ dependencies = [ "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -996,13 +978,13 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1010,14 +992,14 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-kad" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1027,7 +1009,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1037,20 +1019,20 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mdns" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1058,20 +1040,20 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-mplex" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1081,14 +1063,16 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1099,41 +1083,42 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-plaintext" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1141,7 +1126,7 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1152,7 +1137,7 @@ dependencies = [ "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1170,14 +1155,14 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1185,23 +1170,36 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "libp2p-yamux" -version = "0.7.0" +name = "libp2p-wasm-ext" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-yamux" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2038,16 +2036,6 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "secp256k1" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "semver" version = "0.9.0" @@ -2592,50 +2580,6 @@ name = "static_slice" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "stdweb" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "stream-cipher" version = "0.3.0" @@ -2725,9 +2669,9 @@ name = "substrate-consensus-common" version = "2.0.0" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -2743,7 +2687,7 @@ name = "substrate-executor" version = "2.0.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3384,6 +3328,18 @@ dependencies = [ "weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasm-timer" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasmi" version = "0.4.3" @@ -3542,7 +3498,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" @@ -3588,7 +3543,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe9f11be34f800b3ecaaed0ec9ec2e015d1d0ba0c8644c1310f73d6e8994615" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" -"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" "checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac" @@ -3596,7 +3550,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" "checksum environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c7464757b80de8930c91c9afe77ddce501826bf9d134a87db2c67d9dc177e2c" "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" -"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" @@ -3641,23 +3594,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" -"checksum libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0231edab431064b30b7749484a39735eb36492cef4658c372c9059e58c3003aa" -"checksum libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1a3bad2ed26297112847678683dd221473a0d44297250b61f004e1b35e72493" -"checksum libp2p-core-derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f765f103b680cbed910b02bfdbdcfce5b1142899c93e51acb960bf59b6f81b1" -"checksum libp2p-dns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b129d20cc8cbb6ce5da8361045649c024659173e246c5dfbf20ae06071c046a" -"checksum libp2p-floodsub 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70d68816b8435d6788399416eb2f0a6974fb1d15c4be5c30141f87c8e81746df" -"checksum libp2p-identify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "718ca645a065fd70855ca6042a7df686c24cd21add750c37a82c811fbd1e5c43" -"checksum libp2p-kad 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbe27c623a6a720efd5d704347838972062f89149a9c3cd149748da60bdcd3e0" -"checksum libp2p-mdns 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9bc1a5d85f4812cae6367b49a432763fe28997bac7c530dc55b70ec18a78aa7" -"checksum libp2p-mplex 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe5a858342a1cc89464474f7edc4bae1da649b9c823a3e04d9fb494493601746" -"checksum libp2p-noise 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc6b5185c50a52a12e7bbe2ee7799059e24de4e52ab25edbfd26c8ab8515d317" -"checksum libp2p-ping 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7905c1431ad115bee83405770629a27d6f17153ad02ec9670a7347998ef20e22" -"checksum libp2p-plaintext 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc17626763ded57da8fed73187c2d9f6ebb89d30838673c430315bf560c7e4db" -"checksum libp2p-ratelimit 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2409d08b809ab1a74269597f7da2829d117cc11b9ed3343af33fc20831619726" -"checksum libp2p-secio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258cdc6742945c8f6402997bbbf36733588e2db18e5a0014da6d46e3ccfb92cf" -"checksum libp2p-tcp 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b5691e2ba2720d42bd1e93d6b90239fa9235c1956ef6a5f1dd499a7ae2767be" -"checksum libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ab0b9ca050105fd94229c48911c0c84aef4d6b86a53d1b6df81d938354e47e" -"checksum libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6ff51a5b2056bacee1c9f2ed8455cdf3c5c619261ddb4efc783119130aaf52" +"checksum libp2p 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "141ab3f96adc87c8cb847b1cf790e0fbce0b03e3dabfdd3b72fe23d36fc005de" +"checksum libp2p-core 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1514593f2aced40b257565cf2edc63b4cc2f06241a2f3e5a4fe275e0c4d55e85" +"checksum libp2p-core-derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f6f5543deedf4d89931a74d3897b63be19a62d5cb675efaa4c669a4aa0ab12" +"checksum libp2p-dns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9db88ba58601f4528ef5e5e5414e142b19d5813bdaa685e683ef5a44ed23606b" +"checksum libp2p-floodsub 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "260689f26ab2161a1fde9617c53699f78e4ab25fd77c4b07a25b97fca74c5c6d" +"checksum libp2p-identify 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1281e58168ed62cf2e9bfe127908a0ec277cf48cbb3dec5b1a68b58ea6332171" +"checksum libp2p-kad 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd8ab542edc493fa7a9f9b7f93dc4ee0b384e1f9e2a3397ce0056ffe30a0ea21" +"checksum libp2p-mdns 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f009594f78d952c57f452be237650025acd4ef17c5cc8eda4c6466ba196e5688" +"checksum libp2p-mplex 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ccfb9869daccfb9d3938eda8821146e85105a8c874f14393cdb57543afeceb38" +"checksum libp2p-noise 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d3dce2ec4fcb3a2cc748c02d61f7e76486df9c7b09e8ccb4d9f81befce207de" +"checksum libp2p-ping 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b3bb3328d206ad3061e863f179a211fc978d7bce05f90440ed6b8a6a9d17ced" +"checksum libp2p-plaintext 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b23a8ece138f448572c5ff781d62323a954f1f681c303e6553368026764b0ae" +"checksum libp2p-ratelimit 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "55918f058f118d72d83f9a976f12e02e54c8616ddfc795c779c4801a5042a44f" +"checksum libp2p-secio 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bff57806e0f71832cc02b5dea1010e5f1a9d16393fd104a4b64e4aaae40d885" +"checksum libp2p-tcp 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3629f9a667d9f5acb5876df59cf3b547250e340131c47587f9ace7c517f21327" +"checksum libp2p-uds 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d65c15f89c0607d4a334664d759e54e847e1856a73ea78e7bb6a75e6f4039010" +"checksum libp2p-wasm-ext 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dff6c81d0f46261a6327219349753aefd3a92021a1e6102185fa112cfcddca97" +"checksum libp2p-yamux 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5369165359bea84e7ebe73f37b6240f31f8d924ce6710be3d8e1fa678985c9b8" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" @@ -3744,7 +3698,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum schnorrkel 0.0.0 (git+https://github.com/w3f/schnorrkel)" = "" "checksum schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a700659388785588c75b197cecda0f23c7112a9281ef703e8ffc651061ce014c" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum secp256k1 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4070f3906e65249228094cf97b04a90799fba04468190bbbcfa812309cf86e32" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" @@ -3767,10 +3720,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" -"checksum stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a3edad410e603184d656e2abded5fd4d3d6e93d5763d21130dbaf99795db74eb" -"checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" -"checksum stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1635afd059cbfac7d5b1274f0c44cec110c1e013c48e8bbc22e07e52696cf887" -"checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" @@ -3827,6 +3776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum wasm-bindgen-macro-support 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9168c413491e4233db7b6884f09a43beb00c14d11d947ffd165242daa48a2385" "checksum wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "326c32126e1a157b6ced7400061a84ac5b11182b2cda6edad7314eb3ae9ac9fe" "checksum wasm-bindgen-webidl 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "613dbf4d7d3bf10aeb212b35de14a8ef07222c26526d4f931061a83fc9e2a851" +"checksum wasm-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad9ac33c834103916e373d648adf65f58c83fb3d8a0f3e6b9a64bca7253a4dca" "checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" "checksum wasmi-validation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab380192444b3e8522ae79c0a1976e42a82920916ccdfbce3def89f456ea33f3" "checksum web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "24129e4be2281109b3e15a328d3d7f233ee232a5405f75ba1e9bb59a25ebc4d4" diff --git a/substrate/node/src/main.rs b/substrate/node/src/main.rs index 5ff0d7ff3b..15b603e7a2 100644 --- a/substrate/node/src/main.rs +++ b/substrate/node/src/main.rs @@ -43,9 +43,7 @@ impl cli::IntoExit for Exit { } } -error_chain::quick_main!(run); - -fn run() -> cli::error::Result<()> { +fn main() { let version = VersionInfo { name: "Substrate Node", commit: env!("VERGEN_SHA_SHORT"), @@ -55,5 +53,9 @@ fn run() -> cli::error::Result<()> { description: "Generic substrate node", support_url: "https://github.com/paritytech/substrate/issues/new", }; - cli::run(::std::env::args(), Exit, version) + + if let Err(e) = cli::run(::std::env::args(), Exit, version) { + eprintln!("Error starting the node: {}\n\n{:?}", e, e); + std::process::exit(1) + } } diff --git a/substrate/scripts/gitlab/check_line_width.sh b/substrate/scripts/gitlab/check_line_width.sh index ad78b24e11..f382d630b1 100755 --- a/substrate/scripts/gitlab/check_line_width.sh +++ b/substrate/scripts/gitlab/check_line_width.sh @@ -11,7 +11,10 @@ GOOD_LINE_WIDTH="101" git diff --name-only ${BASE_BRANCH}...${CI_COMMIT_SHA} \*.rs | ( while read file do - if git diff ${BASE_BRANCH}...${CI_COMMIT_SHA} ${file} | grep -q "^+.\{${LINE_WIDTH}\}" + if [ ! -f ${file} ]; + then + echo "Skipping removed file." + elif git diff ${BASE_BRANCH}...${CI_COMMIT_SHA} ${file} | grep -q "^+.\{${LINE_WIDTH}\}" then if [ -z "${FAIL}" ] then