diff --git a/Cargo.lock b/Cargo.lock index c52e994004d93..371aa40d65141 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1786,7 +1786,6 @@ dependencies = [ "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", "sr-version 0.1.0", @@ -1803,6 +1802,7 @@ dependencies = [ "srml-timestamp 0.1.0", "srml-treasury 0.1.0", "srml-upgrade-key 0.1.0", + "substrate-client 0.1.0", "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", ] @@ -2566,16 +2566,6 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "sr-api" -version = "0.1.0" -dependencies = [ - "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0", - "sr-std 0.1.0", - "sr-version 0.1.0", -] - [[package]] name = "sr-io" version = "0.1.0" @@ -2789,6 +2779,8 @@ dependencies = [ "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-std 0.1.0", + "substrate-primitives 0.1.0", ] [[package]] @@ -3060,8 +3052,9 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 0.1.0", "sr-primitives 0.1.0", + "sr-std 0.1.0", + "sr-version 0.1.0", "substrate-consensus-common 0.1.0", "substrate-executor 0.1.0", "substrate-keyring 0.1.0", @@ -3455,6 +3448,7 @@ dependencies = [ "substrate-executor 0.1.0", "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", + "substrate-state-machine 0.1.0", "substrate-test-runtime 0.1.0", ] @@ -3468,12 +3462,12 @@ dependencies = [ "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 0.1.0", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", "sr-version 0.1.0", "srml-support 0.1.0", + "substrate-client 0.1.0", "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", ] diff --git a/Cargo.toml b/Cargo.toml index 03960300223ea..e38e3c3e23730 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ members = [ "core/primitives", "core/rpc", "core/rpc-servers", - "core/sr-api", "core/sr-io", "core/sr-sandbox", "core/sr-std", diff --git a/core/cli/src/informant.rs b/core/cli/src/informant.rs index 85d82132b4f3f..5912da81262cf 100644 --- a/core/cli/src/informant.rs +++ b/core/cli/src/informant.rs @@ -30,9 +30,8 @@ use runtime_primitives::traits::{Header, As}; const TIMER_INTERVAL_MS: u64 = 5000; /// Spawn informant on the event loop -pub fn start(service: &Service, exit: ::exit_future::Exit, handle: TaskExecutor) - where - C: Components, +pub fn start(service: &Service, exit: ::exit_future::Exit, handle: TaskExecutor) where + C: Components, { let interval = Interval::new(Instant::now(), Duration::from_millis(TIMER_INTERVAL_MS)); @@ -121,4 +120,3 @@ fn speed(best_number: u64, last_number: Option) -> String { format!(" {:4.1} bps", speed / 10.0) } } - diff --git a/core/client/Cargo.toml b/core/client/Cargo.toml index 5eeb75940d4b1..1ecf284dc191c 100644 --- a/core/client/Cargo.toml +++ b/core/client/Cargo.toml @@ -4,27 +4,55 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -error-chain = "0.12" -fnv = "1.0" -log = "0.4" -parking_lot = "0.4" -hex-literal = "0.1" -futures = "0.1.17" -slog = "^2" -heapsize = "0.4" -substrate-consensus-common = { path = "../consensus/common" } -parity-codec = "2.1" -substrate-executor = { path = "../executor" } -substrate-primitives = { path = "../primitives" } -sr-primitives = { path = "../sr-primitives" } -sr-api = { path = "../sr-api" } -substrate-state-machine = { path = "../state-machine" } -substrate-keyring = { path = "../keyring" } -substrate-trie = { path = "../trie" } -substrate-telemetry = { path = "../telemetry" } -hash-db = { git = "https://github.com/paritytech/trie" } -kvdb = "0.1" +error-chain = { version = "0.12", optional = true } +fnv = { version = "1.0", optional = true } +log = { version = "0.4", optional = true } +parking_lot = { version = "0.4", optional = true } +hex-literal = { version = "0.1", optional = true } +futures = { version = "0.1.17", optional = true } +slog = { version = "^2", optional = true } +heapsize = { version = "0.4", optional = true } +substrate-consensus-common = { path = "../consensus/common", optional = true } +substrate-executor = { path = "../executor", optional = true } +substrate-state-machine = { path = "../state-machine", optional = true } +substrate-keyring = { path = "../keyring", optional = true } +substrate-trie = { path = "../trie", optional = true } +substrate-telemetry = { path = "../telemetry", optional = true } +hash-db = { git = "https://github.com/paritytech/trie", optional = true } +kvdb = { version = "0.1", optional = true } + +parity-codec = { version = "2.1", default-features = false } +substrate-primitives = { path = "../primitives", default-features = false } +sr-primitives = { path = "../sr-primitives", default-features = false } +sr-version = { path = "../sr-version", default-features = false } +sr-std = { path = "../sr-std", default-features = false } [dev-dependencies] substrate-test-client = { path = "../test-client" } kvdb-memorydb = "0.1" + +[features] +default = ["std"] +std = [ + "parity-codec/std", + "substrate-consensus-common", + "substrate-primitives/std", + "parking_lot", + "error-chain", + "fnv", + "log", + "hex-literal", + "futures", + "slog", + "heapsize", + "substrate-executor", + "sr-primitives/std", + "sr-version/std", + "sr-std/std", + "substrate-state-machine", + "substrate-keyring", + "substrate-trie", + "substrate-telemetry", + "hash-db", + "kvdb" +] diff --git a/core/client/db/src/lib.rs b/core/client/db/src/lib.rs index 93a5352fd7b51..f485841fd897a 100644 --- a/core/client/db/src/lib.rs +++ b/core/client/db/src/lib.rs @@ -94,17 +94,17 @@ pub struct DatabaseSettings { } /// Create an instance of db-backed client. -pub fn new_client( +pub fn new_client( settings: DatabaseSettings, executor: E, genesis_storage: S, block_execution_strategy: ExecutionStrategy, api_execution_strategy: ExecutionStrategy, -) -> Result, client::LocalCallExecutor, E>, Block>, client::error::Error> -where - Block: BlockT, - E: CodeExecutor + RuntimeInfo, - S: BuildStorage, +) -> Result, client::LocalCallExecutor, E>, Block, RA>, client::error::Error> + where + Block: BlockT, + E: CodeExecutor + RuntimeInfo, + S: BuildStorage, { let backend = Arc::new(Backend::new(settings, CANONICALIZATION_DELAY)?); let executor = client::LocalCallExecutor::new(backend.clone(), executor); diff --git a/core/client/src/backend.rs b/core/client/src/backend.rs index e613c15534307..b953c9aedfdab 100644 --- a/core/client/src/backend.rs +++ b/core/client/src/backend.rs @@ -47,8 +47,7 @@ impl NewBlockState { } /// Block insertion operation. Keeps hold if the inserted block state and data. -pub trait BlockImportOperation -where +pub trait BlockImportOperation where Block: BlockT, H: Hasher, { @@ -85,11 +84,9 @@ where /// /// The same applies for live `BlockImportOperation`s: while an import operation building on a parent `P` /// is alive, the state for `P` should not be pruned. -pub trait Backend: Send + Sync -where +pub trait Backend: Send + Sync where Block: BlockT, H: Hasher, - { /// Associated block insertion operation type. type BlockImportOperation: BlockImportOperation; diff --git a/core/client/src/block_builder/api.rs b/core/client/src/block_builder/api.rs new file mode 100644 index 0000000000000..a5cbe7e554db4 --- /dev/null +++ b/core/client/src/block_builder/api.rs @@ -0,0 +1,40 @@ +// Copyright 2018 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 . + +//! The runtime api for building blocks. + +use runtime_primitives::{traits::Block as BlockT, ApplyResult}; +use rstd::vec::Vec; + +decl_runtime_apis! { + /// The `BlockBuilder` api trait that provides required functions for building a block for a runtime. + pub trait BlockBuilder { + /// The runtime api for building blocks./// Apply the given extrinsics. + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult; + /// Finish the current block. + fn finalise_block() -> ::Header; + /// Generate inherent extrinsics. + fn inherent_extrinsics( + inherent: InherentExtrinsic + ) -> Vec; + /// Check that the inherents are valid. + fn check_inherents( + block: Block, data: InherentData + ) -> Result<(), Error>; + /// Generate a random seed. + fn random_seed() -> ::Hash; + } +} diff --git a/core/client/src/block_builder.rs b/core/client/src/block_builder/block_builder.rs similarity index 59% rename from core/client/src/block_builder.rs rename to core/client/src/block_builder/block_builder.rs index d7365750a2caf..7d5b867e3a0ad 100644 --- a/core/client/src/block_builder.rs +++ b/core/client/src/block_builder/block_builder.rs @@ -14,60 +14,48 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Utility struct to build a block. - +use super::api::BlockBuilder as BlockBuilderApi; use std::vec::Vec; -use std::marker::PhantomData; use codec::Encode; -use state_machine; -use runtime_primitives::traits::{Header as HeaderT, Hash, Block as BlockT, One, HashFor}; +use blockchain::HeaderBackend; +use runtime_primitives::traits::{ + Header as HeaderT, Hash, Block as BlockT, One, HashFor, ProvideRuntimeApi, ApiRef +}; +use primitives::H256; use runtime_primitives::generic::BlockId; -use runtime_api::BlockBuilder as BlockBuilderAPI; -use {backend, error, Client, CallExecutor}; +use runtime_api::Core; +use error; use runtime_primitives::ApplyOutcome; -use primitives::{Blake2Hasher, H256}; -use hash_db::Hasher; /// Utility for building new (valid) blocks from a stream of extrinsics. -pub struct BlockBuilder<'a, B, E, Block, H> -where - B: backend::Backend + 'a, - E: CallExecutor + Clone + 'a, - Block: BlockT, - H: Hasher, - H::Out: Ord, - -{ +pub struct BlockBuilder<'a, Block, A: ProvideRuntimeApi> where Block: BlockT { header: ::Header, extrinsics: Vec<::Extrinsic>, - client: &'a Client, + api: ApiRef<'a, A::Api>, block_id: BlockId, - changes: state_machine::OverlayedChanges, - _marker: PhantomData, } -impl<'a, B, E, Block> BlockBuilder<'a, B, E, Block, Blake2Hasher> +impl<'a, Block, A> BlockBuilder<'a, Block, A> where - B: backend::Backend + 'a, - E: CallExecutor + Clone + 'a, Block: BlockT, + A: ProvideRuntimeApi + HeaderBackend + 'a, + A::Api: BlockBuilderApi, { /// Create a new instance of builder from the given client, building on the latest block. - pub fn new(client: &'a Client) -> error::Result { - client.info().and_then(|i| Self::at_block(&BlockId::Hash(i.chain.best_hash), client)) + pub fn new(api: &'a A) -> error::Result { + api.info().and_then(|i| Self::at_block(&BlockId::Hash(i.best_hash), api)) } /// Create a new instance of builder from the given client using a particular block's ID to /// build upon. - pub fn at_block(block_id: &BlockId, client: &'a Client) -> error::Result { - let number = client.block_number_from_id(block_id)? + pub fn at_block(block_id: &BlockId, api: &'a A) -> error::Result { + let number = api.block_number_from_id(block_id)? .ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{}", block_id)))? + One::one(); - let parent_hash = client.block_hash_from_id(block_id)? + let parent_hash = api.block_hash_from_id(block_id)? .ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{}", block_id)))?; - let mut changes = Default::default(); let header = <::Header as HeaderT>::new( number, Default::default(), @@ -76,16 +64,14 @@ where Default::default() ); - client.initialise_block(block_id, &mut changes, &header)?; - changes.commit_prospective(); + let api = api.runtime_api(); + api.initialise_block(block_id, &header)?; Ok(BlockBuilder { header, extrinsics: Vec::new(), - client, + api, block_id: *block_id, - changes, - _marker: Default::default(), }) } @@ -93,30 +79,32 @@ where /// can be validly executed (by executing it); if it is invalid, it'll be returned along with /// the error. Otherwise, it will return a mutable reference to self (in order to chain). pub fn push(&mut self, xt: ::Extrinsic) -> error::Result<()> { - match self.client.apply_extrinsic(&self.block_id, &mut self.changes, &xt) { - Ok(result) => { - match result { + fn impl_push<'a, T, Block: BlockT>( + api: &mut ApiRef<'a, T>, + block_id: &BlockId, + xt: Block::Extrinsic, + extrinsics: &mut Vec + ) -> error::Result<()> where T: BlockBuilderApi { + api.map_api_result(|api| { + match api.apply_extrinsic(block_id, &xt)? { Ok(ApplyOutcome::Success) | Ok(ApplyOutcome::Fail) => { - self.extrinsics.push(xt); - self.changes.commit_prospective(); + extrinsics.push(xt); Ok(()) } Err(e) => { - self.changes.discard_prospective(); Err(error::ErrorKind::ApplyExtrinsicFailed(e).into()) } } - } - Err(e) => { - self.changes.discard_prospective(); - Err(e) - } + }) } + + //FIXME: Please NLL, help me! + impl_push(&mut self.api, &self.block_id, xt, &mut self.extrinsics) } /// Consume the builder to return a valid `Block` containing all pushed extrinsics. pub fn bake(mut self) -> error::Result { - self.header = self.client.finalise_block(&self.block_id, &mut self.changes)?; + self.header = self.api.finalise_block(&self.block_id)?; debug_assert_eq!( self.header.extrinsics_root().clone(), diff --git a/core/client/src/block_builder/mod.rs b/core/client/src/block_builder/mod.rs new file mode 100644 index 0000000000000..f22f599ffdd9a --- /dev/null +++ b/core/client/src/block_builder/mod.rs @@ -0,0 +1,23 @@ +// Copyright 2018 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 . + +//! Utility struct to build a block. + +#[cfg(feature = "std")] +mod block_builder; +#[cfg(feature = "std")] +pub use self::block_builder::*; +pub mod api; diff --git a/core/client/src/blockchain.rs b/core/client/src/blockchain.rs index a2896ab7f366a..8c46e5ebe2121 100644 --- a/core/client/src/blockchain.rs +++ b/core/client/src/blockchain.rs @@ -40,6 +40,22 @@ pub trait HeaderBackend: Send + Sync { fn expect_header(&self, id: BlockId) -> Result { self.header(id)?.ok_or_else(|| ErrorKind::UnknownBlock(format!("{}", id)).into()) } + + /// Convert an arbitrary block ID into a block hash. + fn block_hash_from_id(&self, id: &BlockId) -> Result> { + match *id { + BlockId::Hash(h) => Ok(Some(h)), + BlockId::Number(n) => self.hash(n), + } + } + + /// Convert an arbitrary block ID into a block hash. + fn block_number_from_id(&self, id: &BlockId) -> Result>> { + match *id { + BlockId::Hash(_) => Ok(self.header(*id)?.map(|h| h.number().clone())), + BlockId::Number(n) => Ok(Some(n)), + } + } } /// Blockchain database backend. Does not perform any validation. diff --git a/core/client/src/client.rs b/core/client/src/client.rs index f1d1549185cd1..c008f0d15775e 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -16,8 +16,8 @@ //! Substrate Client -use std::sync::Arc; -use error::{Error, ErrorKind}; +use std::{marker::PhantomData, sync::Arc}; +use error::Error; use futures::sync::mpsc; use parking_lot::{Mutex, RwLock}; use primitives::AuthorityId; @@ -27,25 +27,29 @@ use runtime_primitives::{ transaction_validity::{TransactionValidity, TransactionTag}, }; use consensus::{ImportBlock, ImportResult, BlockOrigin}; -use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, As, NumberFor, CurrentHeight, BlockNumberToHash}; -use runtime_primitives::{ApplyResult, BuildStorage}; -use runtime_api as api; +use runtime_primitives::traits::{ + Block as BlockT, Header as HeaderT, Zero, As, NumberFor, CurrentHeight, BlockNumberToHash, + ApiRef, ProvideRuntimeApi +}; +use runtime_primitives::BuildStorage; +use runtime_api::{Core as CoreAPI, CallApiAt, TaggedTransactionQueue, ConstructRuntimeApi}; use primitives::{Blake2Hasher, H256, ChangesTrieConfiguration, convert_hash}; use primitives::storage::{StorageKey, StorageData}; use primitives::storage::well_known_keys; -use codec::{Encode, Decode}; +use codec::Decode; use state_machine::{ - Backend as StateBackend, CodeExecutor, - ExecutionStrategy, ExecutionManager, ChangesTrieAnchorBlockId, - prove_read, key_changes, key_changes_proof, OverlayedChanges + Backend as StateBackend, CodeExecutor, ChangesTrieAnchorBlockId, + ExecutionStrategy, ExecutionManager, prove_read, + key_changes, key_changes_proof, OverlayedChanges }; +use codec::Encode; use backend::{self, BlockImportOperation}; use blockchain::{self, Info as ChainInfo, Backend as ChainBackend, HeaderBackend as ChainHeaderBackend}; use call_executor::{CallExecutor, LocalCallExecutor}; use executor::{RuntimeVersion, RuntimeInfo}; use notifications::{StorageNotifications, StorageEventStream}; -use {cht, error, in_mem, block_builder, genesis, consensus}; +use {cht, error, in_mem, block_builder::{self, api::BlockBuilder as BlockBuilderAPI}, genesis, consensus}; /// Type that implements `futures::Stream` of block import events. pub type ImportNotifications = mpsc::UnboundedReceiver>; @@ -54,7 +58,7 @@ pub type ImportNotifications = mpsc::UnboundedReceiver = mpsc::UnboundedReceiver>; /// Substrate Client -pub struct Client where Block: BlockT { +pub struct Client where Block: BlockT { backend: Arc, executor: E, storage_notifications: Mutex>, @@ -65,6 +69,7 @@ pub struct Client where Block: BlockT { block_execution_strategy: ExecutionStrategy, api_execution_strategy: ExecutionStrategy, changes_trie_config: Option, + _phantom: PhantomData, } /// A source of blockchain events. @@ -180,36 +185,36 @@ impl PrePostHeader { } /// Create an instance of in-memory client. -pub fn new_in_mem( +pub fn new_in_mem( executor: E, genesis_storage: S, -) -> error::Result, LocalCallExecutor, E>, Block>> -where - E: CodeExecutor + RuntimeInfo, - S: BuildStorage, - Block: BlockT, +) -> error::Result, LocalCallExecutor, E>, Block, RA>> + where + E: CodeExecutor + RuntimeInfo, + S: BuildStorage, + Block: BlockT, { new_with_backend(Arc::new(in_mem::Backend::new()), executor, genesis_storage) } /// Create a client with the explicitely provided backend. /// This is useful for testing backend implementations. -pub fn new_with_backend( +pub fn new_with_backend( backend: Arc, executor: E, build_genesis_storage: S, -) -> error::Result, Block>> -where - E: CodeExecutor + RuntimeInfo, - S: BuildStorage, - Block: BlockT, - B: backend::LocalBackend +) -> error::Result, Block, RA>> + where + E: CodeExecutor + RuntimeInfo, + S: BuildStorage, + Block: BlockT, + B: backend::LocalBackend { let call_executor = LocalCallExecutor::new(backend.clone(), executor); Client::new(backend, call_executor, build_genesis_storage, ExecutionStrategy::NativeWhenPossible, ExecutionStrategy::NativeWhenPossible) } -impl Client where +impl Client where B: backend::Backend, E: CallExecutor, Block: BlockT, @@ -255,6 +260,7 @@ impl Client where block_execution_strategy, api_execution_strategy, changes_trie_config, + _phantom: Default::default(), }) } @@ -323,6 +329,36 @@ impl Client where self.header_proof_with_cht_size(id, cht::SIZE) } + pub(crate) fn call_at_state( + &self, + at: &BlockId, + function: &'static str, + args: Vec, + changes: &mut OverlayedChanges + ) -> error::Result> { + let state = self.state_at(at)?; + + let execution_manager = || match self.api_execution_strategy { + ExecutionStrategy::NativeWhenPossible => ExecutionManager::NativeWhenPossible, + ExecutionStrategy::AlwaysWasm => ExecutionManager::AlwaysWasm, + ExecutionStrategy::Both => ExecutionManager::Both(|wasm_result, native_result| { + warn!("Consensus error between wasm and native runtime execution at block {:?}", at); + warn!(" Function {:?}", function); + warn!(" Native result {:?}", native_result); + warn!(" Wasm result {:?}", wasm_result); + wasm_result + }), + }; + + self.executor.call_at_state(&state, changes, function, &args, execution_manager()) + .map(|res| res.0) + } + + /// Get block hash by number. + pub fn block_hash(&self, block_number: <::Header as HeaderT>::Number) -> error::Result> { + self.backend.blockchain().hash(block_number) + } + /// Reads given header and generates CHT-based header proof for CHT of given size. pub fn header_proof_with_cht_size(&self, id: &BlockId, cht_size: u64) -> error::Result<(Block::Header, Vec>)> { let proof_error = || error::ErrorKind::Backend(format!("Failed to generate header proof for {:?}", id)); @@ -402,88 +438,41 @@ impl Client where } /// Create a new block, built on the head of the chain. - pub fn new_block(&self) -> error::Result> - where E: Clone + pub fn new_block( + &self + ) -> error::Result> where + E: Clone + Send + Sync, + RA: BlockBuilderAPI { block_builder::BlockBuilder::new(self) } /// Create a new block, built on top of `parent`. - pub fn new_block_at(&self, parent: &BlockId) -> error::Result> - where E: Clone + pub fn new_block_at( + &self, parent: &BlockId + ) -> error::Result> where + E: Clone + Send + Sync, + RA: BlockBuilderAPI { block_builder::BlockBuilder::at_block(parent, &self) } - /// Set up the native execution environment to call into a native runtime code. - pub fn call_api(&self, function: &'static str, args: &A) -> error::Result - where A: Encode, R: Decode - { - self.call_api_at(&BlockId::Number(self.info()?.chain.best_number), function, args) - } - - /// Call a runtime function at given block. - pub fn call_api_at(&self, at: &BlockId, function: &'static str, args: &A) -> error::Result - where A: Encode, R: Decode - { - let parent = at; - let header = <::Header as HeaderT>::new( - self.block_number_from_id(&parent)? - .ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{:?}", parent)))? + As::sa(1), - Default::default(), - Default::default(), - self.block_hash_from_id(&parent)? - .ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{:?}", parent)))?, - Default::default() - ); - let mut overlay = Default::default(); - - self.call_at_state(at, "initialise_block", &header, &mut overlay)?; - self.call_at_state(at, function, args, &mut overlay) - } - - fn call_at_state( - &self, - at: &BlockId, - function: &'static str, - args: &A, - changes: &mut OverlayedChanges - ) -> error::Result { - let state = self.state_at(at)?; - - let execution_manager = || match self.api_execution_strategy { - ExecutionStrategy::NativeWhenPossible => ExecutionManager::NativeWhenPossible, - ExecutionStrategy::AlwaysWasm => ExecutionManager::AlwaysWasm, - ExecutionStrategy::Both => ExecutionManager::Both(|wasm_result, native_result| { - warn!("Consensus error between wasm and native runtime execution at block {:?}", at); - warn!(" Function {:?}", function); - warn!(" Native result {:?}", native_result); - warn!(" Wasm result {:?}", wasm_result); - wasm_result - }), - }; - - self.executor.call_at_state( - &state, - changes, - function, - &args.encode(), - execution_manager() - ).and_then(|res| - R::decode(&mut &res.0[..]) - .ok_or_else(|| Error::from(ErrorKind::CallResultDecode(function))) - ) - } - // TODO [ToDr] Optimize and re-use tags from the pool. - fn transaction_tags(&self, at: Block::Hash, body: &Option>) -> error::Result> { + fn transaction_tags( + &self, + at: Block::Hash, + body: &Option> + ) -> error::Result> where + RA: TaggedTransactionQueue, + E: CallExecutor + Send + Sync + Clone, + { let id = BlockId::Hash(at); Ok(match body { None => vec![], Some(ref extrinsics) => { let mut tags = vec![]; for tx in extrinsics { - let tx = api::TaggedTransactionQueue::validate_transaction(self, &id, &tx)?; + let tx = self.runtime_api().validate_transaction(&id, &tx)?; match tx { TransactionValidity::Valid { mut provides, .. } => { tags.append(&mut provides); @@ -508,7 +497,10 @@ impl Client where body: Option>, authorities: Option>, finalized: bool, - ) -> error::Result { + ) -> error::Result where + RA: TaggedTransactionQueue, + E: CallExecutor + Send + Sync + Clone, + { let parent_hash = import_headers.post().parent_hash().clone(); match self.backend.blockchain().status(BlockId::Hash(hash))? { blockchain::BlockStatus::InChain => return Ok(ImportResult::AlreadyInChain), @@ -737,30 +729,9 @@ impl Client where } } - /// Get block hash by number. - pub fn block_hash(&self, block_number: <::Header as HeaderT>::Number) -> error::Result> { - self.backend.blockchain().hash(block_number) - } - - /// Convert an arbitrary block ID into a block hash. - pub fn block_hash_from_id(&self, id: &BlockId) -> error::Result> { - match *id { - BlockId::Hash(h) => Ok(Some(h)), - BlockId::Number(n) => self.block_hash(n), - } - } - - /// Convert an arbitrary block ID into a block hash. - pub fn block_number_from_id(&self, id: &BlockId) -> error::Result>> { - match *id { - BlockId::Hash(_) => Ok(self.header(id)?.map(|h| h.number().clone())), - BlockId::Number(n) => Ok(Some(n)), - } - } - /// Convert an arbitrary block ID into a block hash, returning error if the block is unknown. fn require_block_number_from_id(&self, id: &BlockId) -> error::Result> { - self.block_number_from_id(id) + self.backend.blockchain().block_number_from_id(id) .and_then(|n| n.ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{}", id)).into())) } @@ -896,11 +867,87 @@ impl Client where } } +impl ChainHeaderBackend for Client where + B: backend::Backend, + E: CallExecutor + Send + Sync, + Block: BlockT, + RA: Send + Sync +{ + fn header(&self, id: BlockId) -> error::Result> { + self.backend.blockchain().header(id) + } + + fn info(&self) -> error::Result> { + self.backend.blockchain().info() + } + + fn status(&self, id: BlockId) -> error::Result { + self.backend.blockchain().status(id) + } + + fn number(&self, hash: Block::Hash) -> error::Result::Header as HeaderT>::Number>> { + self.backend.blockchain().number(hash) + } -impl consensus::BlockImport for Client where + fn hash(&self, number: NumberFor) -> error::Result> { + self.backend.blockchain().hash(number) + } +} + +impl ProvideRuntimeApi for Client where B: backend::Backend, - E: CallExecutor + Clone, + E: CallExecutor + Clone + Send + Sync, Block: BlockT, + RA: CoreAPI +{ + type Api = RA; + + fn runtime_api<'a>(&'a self) -> ApiRef<'a, Self::Api> { + Self::Api::construct_runtime_api(self) + } +} + +impl CallApiAt for Client where + B: backend::Backend, + E: CallExecutor + Clone + Send + Sync, + Block: BlockT, + RA: CoreAPI +{ + fn call_api_at( + &self, + at: &BlockId, + function: &'static str, + args: Vec, + changes: &mut OverlayedChanges, + initialised_block: &mut Option>, + ) -> error::Result> { + //TODO: Find a better way to prevent double block initialization + if function != "initialise_block" && initialised_block.map(|id| id != *at).unwrap_or(true) { + let parent = at; + let header = <::Header as HeaderT>::new( + self.block_number_from_id(parent)? + .ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{:?}", parent)))? + + As::sa(1), + Default::default(), + Default::default(), + self.block_hash_from_id(&parent)? + .ok_or_else(|| error::ErrorKind::UnknownBlock(format!("{:?}", parent)))?, + Default::default() + ); + self.call_at_state(at, "initialise_block", header.encode(), changes)?; + *initialised_block = Some(*at); + } + + self.call_at_state(at, function, args, changes) + } +} + + +impl consensus::BlockImport for Client where + B: backend::Backend, + E: CallExecutor + Clone + Send + Sync, + Block: BlockT, + RA: TaggedTransactionQueue { type Error = Error; @@ -963,7 +1010,7 @@ impl consensus::BlockImport for Client where } } -impl consensus::Authorities for Client where +impl consensus::Authorities for Client where B: backend::Backend, E: CallExecutor + Clone, Block: BlockT, @@ -974,7 +1021,7 @@ impl consensus::Authorities for Client where } } -impl CurrentHeight for Client where +impl CurrentHeight for Client where B: backend::Backend, E: CallExecutor + Clone, Block: BlockT, @@ -985,7 +1032,7 @@ impl CurrentHeight for Client where } } -impl BlockNumberToHash for Client where +impl BlockNumberToHash for Client where B: backend::Backend, E: CallExecutor + Clone, Block: BlockT, @@ -998,7 +1045,7 @@ impl BlockNumberToHash for Client where } -impl BlockchainEvents for Client +impl BlockchainEvents for Client where E: CallExecutor, Block: BlockT, @@ -1022,7 +1069,7 @@ where } } -impl ChainHead for Client +impl ChainHead for Client where B: backend::Backend, E: CallExecutor, @@ -1033,116 +1080,17 @@ where } } -impl BlockBody for Client where - B: backend::Backend, - E: CallExecutor, - Block: BlockT, +impl BlockBody for Client + where + B: backend::Backend, + E: CallExecutor, + Block: BlockT, { fn block_body(&self, id: &BlockId) -> error::Result::Extrinsic>>> { self.body(id) } } -impl api::Core for Client where - B: backend::Backend, - E: CallExecutor, - Block: BlockT, -{ - type Error = Error; - - fn version(&self, at: &BlockId) -> Result { - self.call_api_at(at, "version", &()) - } - - fn authorities(&self, at: &BlockId) -> Result, Self::Error> { - self.authorities_at(at) - } - - fn execute_block(&self, at: &BlockId, block: &Block) -> Result<(), Self::Error> { - self.call_api_at(at, "execute_block", &(block)) - } -} - -impl api::Metadata> for Client where - B: backend::Backend, - E: CallExecutor, - Block: BlockT, -{ - type Error = Error; - - fn metadata(&self, at: &BlockId) -> Result, Self::Error> { - self.executor.call(at, "metadata",&[]).map(|v| v.return_data) - } -} - -impl api::BlockBuilder for Client where - B: backend::Backend, - E: CallExecutor, - Block: BlockT, -{ - type Error = Error; - type OverlayedChanges = OverlayedChanges; - - fn initialise_block( - &self, - at: &BlockId, - changes: &mut OverlayedChanges, - header: &::Header - ) -> Result<(), Self::Error> { - self.call_at_state(at, "initialise_block", header, changes) - } - - fn apply_extrinsic( - &self, - at: &BlockId, - changes: &mut OverlayedChanges, - extrinsic: &::Extrinsic - ) -> Result { - self.call_at_state(at, "apply_extrinsic", extrinsic, changes) - } - - fn finalise_block( - &self, - at: &BlockId, - changes: &mut OverlayedChanges - ) -> Result<::Header, Self::Error> { - self.call_at_state(at, "finalise_block", &(), changes) - } - - fn inherent_extrinsics( - &self, at: &BlockId, inherent: &InherentExtrinsic - ) -> Result, Self::Error> { - self.call_api_at(at, "inherent_extrinsics", &(inherent)) - } - - fn check_inherents( - &self, - at: &BlockId, - block: &Block, - data: &InherentData - ) -> Result, Self::Error> { - self.call_api_at(at, "check_inherents", &(block, data)) - } - - fn random_seed(&self, at: &BlockId) -> Result<::Hash, Self::Error> { - self.call_api_at(at, "random_seed", &()) - } -} - -impl api::TaggedTransactionQueue for Client where - B: backend::Backend, - E: CallExecutor, - Block: BlockT, -{ - type Error = Error; - - fn validate_transaction( - &self, at: &BlockId, tx: &::Extrinsic - ) -> Result { - self.call_api_at(at, "validate_transaction", &(tx)) - } -} - #[cfg(test)] pub(crate) mod tests { use std::collections::HashMap; @@ -1155,14 +1103,14 @@ pub(crate) mod tests { use consensus::BlockOrigin; use test_client::client::backend::Backend as TestBackend; use test_client::BlockBuilderExt; - use test_client::runtime::{self, Block, Transfer}; + use test_client::runtime::{self, Block, Transfer, ClientWithApi, test_api::TestAPI}; /// Returns tuple, consisting of: /// 1) test client pre-filled with blocks changing balances; /// 2) roots of changes tries for these blocks /// 3) test cases in form (begin, end, key, vec![(block, extrinsic)]) that are required to pass pub fn prepare_client_with_key_changes() -> ( - test_client::client::Client, + test_client::client::Client, Vec, Vec<(u64, u64, Vec, Vec<(u64, u32)>)>, ) { @@ -1234,8 +1182,20 @@ pub(crate) mod tests { fn client_initialises_from_genesis_ok() { let client = test_client::new(); - assert_eq!(client.call_api::<_, u64>("balance_of", &Keyring::Alice.to_raw_public()).unwrap(), 1000); - assert_eq!(client.call_api::<_, u64>("balance_of", &Keyring::Ferdie.to_raw_public()).unwrap(), 0); + assert_eq!( + client.runtime_api().balance_of( + &BlockId::Number(client.info().unwrap().chain.best_number), + &Keyring::Alice.to_raw_public() + ).unwrap(), + 1000 + ); + assert_eq!( + client.runtime_api().balance_of( + &BlockId::Number(client.info().unwrap().chain.best_number), + &Keyring::Ferdie.to_raw_public() + ).unwrap(), + 0 + ); } #[test] @@ -1278,8 +1238,20 @@ pub(crate) mod tests { assert_eq!(client.info().unwrap().chain.best_number, 1); assert!(client.state_at(&BlockId::Number(1)).unwrap() != client.state_at(&BlockId::Number(0)).unwrap()); - assert_eq!(client.call_api::<_, u64>("balance_of", &Keyring::Alice.to_raw_public()).unwrap(), 958); - assert_eq!(client.call_api::<_, u64>("balance_of", &Keyring::Ferdie.to_raw_public()).unwrap(), 42); + assert_eq!( + client.runtime_api().balance_of( + &BlockId::Number(client.info().unwrap().chain.best_number), + &Keyring::Alice.to_raw_public() + ).unwrap(), + 958 + ); + assert_eq!( + client.runtime_api().balance_of( + &BlockId::Number(client.info().unwrap().chain.best_number), + &Keyring::Ferdie.to_raw_public() + ).unwrap(), + 42 + ); } #[test] diff --git a/core/client/src/lib.rs b/core/client/src/lib.rs index 255b0680159eb..58fced9687ff8 100644 --- a/core/client/src/lib.rs +++ b/core/client/src/lib.rs @@ -16,60 +16,101 @@ //! Substrate Client and associated logic. +#![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] #![recursion_limit="128"] +#[cfg(feature = "std")] extern crate substrate_trie as trie; extern crate parity_codec as codec; extern crate substrate_primitives as primitives; extern crate sr_primitives as runtime_primitives; +#[cfg(feature = "std")] extern crate substrate_state_machine as state_machine; +#[cfg(feature = "std")] extern crate substrate_consensus_common as consensus; -#[cfg(test)] extern crate substrate_keyring as keyring; -#[cfg(test)] extern crate substrate_test_client as test_client; -#[macro_use] extern crate substrate_telemetry; -#[macro_use] extern crate slog; // needed until we can reexport `slog_info` from `substrate_telemetry` +extern crate sr_version as runtime_version; +extern crate sr_std as rstd; +#[cfg(test)] +extern crate substrate_keyring as keyring; +#[cfg(test)] +extern crate substrate_test_client as test_client; +#[cfg(feature = "std")] +#[macro_use] +extern crate substrate_telemetry; +#[cfg(feature = "std")] +#[macro_use] +extern crate slog; // needed until we can reexport `slog_info` from `substrate_telemetry` +#[cfg(feature = "std")] extern crate fnv; +#[cfg(feature = "std")] extern crate futures; +#[cfg(feature = "std")] extern crate parking_lot; +#[cfg(feature = "std")] extern crate hash_db; +#[cfg(feature = "std")] extern crate heapsize; +#[cfg(feature = "std")] extern crate kvdb; -extern crate sr_api; -#[macro_use] extern crate error_chain; -#[macro_use] extern crate log; -#[cfg_attr(test, macro_use)] extern crate substrate_executor as executor; -#[cfg(test)] #[macro_use] extern crate hex_literal; -#[cfg(test)] extern crate kvdb_memorydb; +#[cfg(feature = "std")] +#[macro_use] +extern crate error_chain; +#[cfg(feature = "std")] +#[macro_use] +extern crate log; +#[cfg(feature = "std")] +#[cfg_attr(test, macro_use)] +extern crate substrate_executor as executor; +#[cfg(test)] +#[macro_use] +extern crate hex_literal; +#[cfg(feature = "std")] +#[cfg(test)] +extern crate kvdb_memorydb; +#[macro_use] +pub mod runtime_api; +#[cfg(feature = "std")] pub mod error; +#[cfg(feature = "std")] pub mod blockchain; +#[cfg(feature = "std")] pub mod backend; +#[cfg(feature = "std")] pub mod cht; +#[cfg(feature = "std")] pub mod in_mem; +#[cfg(feature = "std")] pub mod genesis; pub mod block_builder; +#[cfg(feature = "std")] pub mod light; +#[cfg(feature = "std")] mod leaves; +#[cfg(feature = "std")] mod call_executor; +#[cfg(feature = "std")] mod client; +#[cfg(feature = "std")] mod notifications; +#[cfg(feature = "std")] pub use blockchain::Info as ChainInfo; +#[cfg(feature = "std")] pub use call_executor::{CallResult, CallExecutor, LocalCallExecutor}; +#[cfg(feature = "std")] pub use client::{ new_with_backend, new_in_mem, BlockBody, BlockStatus, ImportNotifications, FinalityNotifications, BlockchainEvents, Client, ClientInfo, ChainHead, }; +#[cfg(feature = "std")] pub use notifications::{StorageEventStream, StorageChangeSet}; +#[cfg(feature = "std")] pub use state_machine::ExecutionStrategy; +#[cfg(feature = "std")] pub use leaves::LeafSet; - -/// Traits for interfacing with the runtime from the client. -pub mod runtime_api { - pub use sr_api::*; -} diff --git a/core/client/src/light/mod.rs b/core/client/src/light/mod.rs index 8791e2930fbad..29db81a0013be 100644 --- a/core/client/src/light/mod.rs +++ b/core/client/src/light/mod.rs @@ -48,11 +48,11 @@ pub fn new_light_backend, F: Fetcher>(bloc } /// Create an instance of light client. -pub fn new_light( +pub fn new_light( backend: Arc>, fetcher: Arc, genesis_storage: GS, -) -> ClientResult, RemoteCallExecutor, F, Blake2Hasher>, B>> +) -> ClientResult, RemoteCallExecutor, F, Blake2Hasher>, B, RA>> where B: BlockT, S: BlockchainStorage, diff --git a/core/client/src/runtime_api/core.rs b/core/client/src/runtime_api/core.rs new file mode 100644 index 0000000000000..20798422b7fad --- /dev/null +++ b/core/client/src/runtime_api/core.rs @@ -0,0 +1,62 @@ +// Copyright 2018 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 . + +#[cfg(feature = "std")] +use super::{ConstructRuntimeApi, ApiExt}; +use runtime_version::RuntimeVersion; +use runtime_primitives::traits::Block as BlockT; +#[cfg(feature = "std")] +use runtime_primitives::generic::BlockId; +use primitives::AuthorityId; +#[cfg(feature = "std")] +use error::Result; +use rstd::vec::Vec; + +/// The `Core` api trait that is mandantory for each runtime. +/// This is the side that should be implemented for the `RuntimeApi` that is used by the `Client`. +/// Any modifications at one of these two traits, needs to be done on the other one as well. +#[cfg(feature = "std")] +pub trait Core: 'static + Send + Sync + ConstructRuntimeApi + ApiExt { + /// Returns the version of the runtime. + fn version(&self, at: &BlockId) -> Result; + /// Returns the authorities. + fn authorities(&self, at: &BlockId) -> Result>; + /// Execute the given block. + fn execute_block(&self, at: &BlockId, block: &Block) -> Result<()>; + /// Initialise a block with the given header. + fn initialise_block( + &self, + at: &BlockId, + header: &::Header + ) -> Result<()>; +} + +pub mod runtime { + use super::*; + + /// The `Core` api trait that is mandantory for each runtime. + /// This is the side that should be implemented for the `Runtime`. + pub trait Core { + /// Returns the version of the runtime. + fn version() -> RuntimeVersion; + /// Returns the authorities. + fn authorities() -> Vec; + /// Execute the given block. + fn execute_block(block: Block); + /// Initialise a block with the given header. + fn initialise_block(header: ::Header); + } +} diff --git a/core/sr-api/src/lib.rs b/core/client/src/runtime_api/macros.rs similarity index 79% rename from core/sr-api/src/lib.rs rename to core/client/src/runtime_api/macros.rs index ee931f706ebc8..238314680bf49 100644 --- a/core/sr-api/src/lib.rs +++ b/core/client/src/runtime_api/macros.rs @@ -14,31 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! API's for interfacing with the runtime via native/wasm. - -#![cfg_attr(not(feature = "std"), no_std)] - -extern crate sr_std as rstd; -extern crate sr_primitives as primitives; -#[doc(hidden)] -pub extern crate parity_codec as codec; -extern crate sr_version as runtime_version; - -#[doc(hidden)] -pub use primitives::{traits::Block as BlockT, generic::BlockId, transaction_validity::TransactionValidity, ApplyResult}; -use runtime_version::{ApiId, RuntimeVersion}; -use rstd::vec::Vec; -#[doc(hidden)] -pub use rstd::slice; -#[doc(hidden)] -pub use codec::{Encode, Decode}; +//! Macros for declaring and implementing the runtime APIs. /// Declare the given API traits. /// /// # Example: /// /// ```nocompile -/// decl_apis!{ +/// decl_runtime_apis!{ /// pub trait Test ExtraClientSide { /// fn test(event: Event) -> AccountId; /// @@ -66,11 +49,11 @@ pub use codec::{Encode, Decode}; /// } /// ``` /// -/// The declarations generated in the `runtime` module will be used by `impl_apis!` for implementing +/// The declarations generated in the `runtime` module will be used by `impl_runtime_apis!` for implementing /// the traits for a runtime. The other declarations should be used for implementing the interface /// in the client. #[macro_export] -macro_rules! decl_apis { +macro_rules! decl_runtime_apis { ( $( $( #[$attr:meta] )* @@ -89,7 +72,7 @@ macro_rules! decl_apis { )* ) => { $( - decl_apis!( + decl_runtime_apis!( @ADD_BLOCK_GENERIC $( #[$attr] )* pub trait $name $(< $( $generic_param $( : $generic_bound )* ),* >)* { @@ -107,7 +90,7 @@ macro_rules! decl_apis { $( $( $generic_param $( : $generic_bound )* ),* )* ); )* - decl_apis! { + decl_runtime_apis! { @GENERATE_RUNTIME_TRAITS $( $( #[$attr] )* @@ -136,7 +119,7 @@ macro_rules! decl_apis { Block: BlockT $(, $generic_param_rest:ident $( : $generic_bound_rest:ident )* )* ) => { - decl_apis!( + decl_runtime_apis!( @ADD_BLOCK_GENERIC $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -149,7 +132,7 @@ macro_rules! decl_apis { )* }; Found; - $( $generic_param_parsed $( : $generic_bound_parsed )* , )* Block: $crate::BlockT; + $( $generic_param_parsed $( : $generic_bound_parsed )* , )* Block: $crate::runtime_api::BlockT; $( $generic_param_rest $( : $generic_bound_rest )* ),* ); }; @@ -169,7 +152,7 @@ macro_rules! decl_apis { $generic_param:ident $( : $generic_bound:ident )* $(, $generic_param_rest:ident $( : $generic_bound_rest:ident )* )* ) => { - decl_apis!( + decl_runtime_apis!( @ADD_BLOCK_GENERIC $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -200,7 +183,7 @@ macro_rules! decl_apis { Found; $( $generic_param_parsed:ident $( : $generic_bound_parsed:path )* ),*; ) => { - decl_apis!( + decl_runtime_apis!( @GENERATE_RETURN_TYPES $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -231,7 +214,7 @@ macro_rules! decl_apis { ; $( $generic_param_parsed:ident $( : $generic_bound_parsed:ident )* ),*; ) => { - decl_apis!( + decl_runtime_apis!( @GENERATE_RETURN_TYPES $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -244,7 +227,7 @@ macro_rules! decl_apis { )* }; // We need to add the required generic Block parameter - Block: $crate::BlockT $(, $generic_param_parsed $( : $generic_bound_parsed )* )*; + Block: $crate::runtime_api::BlockT $(, $generic_param_parsed $( : $generic_bound_parsed )* )*; {}; $( $( $return_ty )*; )* ); @@ -265,7 +248,7 @@ macro_rules! decl_apis { $return_ty_current:ty; $( $( $return_ty_rest:ty )*; )* ) => { - decl_apis!( + decl_runtime_apis!( @GENERATE_RETURN_TYPES $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -278,7 +261,7 @@ macro_rules! decl_apis { )* }; $( $generic_param_parsed $( : $generic_bound_parsed )* ),*; - { $( $result_return_ty; )* Result<$return_ty_current, Self::Error>; }; + { $( $result_return_ty; )* $crate::error::Result<$return_ty_current>; }; $( $( $return_ty_rest )*; )* ); }; @@ -298,7 +281,7 @@ macro_rules! decl_apis { ; $( $( $return_ty_rest:ty )*; )* ) => { - decl_apis!( + decl_runtime_apis!( @GENERATE_RETURN_TYPES $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -311,7 +294,7 @@ macro_rules! decl_apis { )* }; $( $generic_param_parsed $( : $generic_bound_parsed )* ),*; - { $( $result_return_ty; )* Result<(), Self::Error>; }; + { $( $result_return_ty; )* $crate::error::Result<()>; }; $( $( $return_ty_rest )*; )* ); }; @@ -329,7 +312,7 @@ macro_rules! decl_apis { $( $generic_param_parsed:ident $( : $generic_bound_parsed:path )* ),*; { $( $result_return_ty:ty; )* }; ) => { - decl_apis!( + decl_runtime_apis!( @GENERATE_CLIENT_TRAITS $( #[$attr] )* pub trait $name $(< $( $generic_param_orig $( : $generic_bound_orig )* ),* >)* { @@ -360,15 +343,14 @@ macro_rules! decl_apis { { $( $result_return_ty:ty; )* }; ) => { $( #[$attr] )* - pub trait $name < $( $generic_param_parsed $( : $generic_bound_parsed )* ),* > { - /// The Error type returned by this API. - type Error; + #[cfg(feature = "std")] + pub trait $name < $( $generic_param_parsed $( : $generic_bound_parsed )* ),* > : $crate::runtime_api::Core { $( type $client_generic_param $( : $client_generic_bound )*; )* $( $( #[$fn_attr] )* - fn $fn_name $( < $( $fn_generic: $crate::Encode + $crate::Decode ),* > )* ( - &self, at: &$crate::BlockId $(, $param_name: $param_type )* + fn $fn_name $( < $( $fn_generic: $crate::runtime_api::Encode + $crate::runtime_api::Decode ),* > )* ( + &self, at: &$crate::runtime_api::BlockId $(, $param_name: $param_type )* ) -> $result_return_ty; )* } @@ -386,7 +368,7 @@ macro_rules! decl_apis { }; )* ) => { - decl_apis! { + decl_runtime_apis! { @GENERATE_RUNTIME_TRAITS_WITH_JOINED_GENERICS $( $( #[$attr] )* @@ -427,57 +409,8 @@ macro_rules! decl_apis { }; } -/// The ApiIds for the various standard runtime APIs. -pub mod id { - use super::ApiId; - - /// ApiId for the BlockBuilder trait. - pub const BLOCK_BUILDER: ApiId = *b"blkbuild"; - - /// ApiId for the TaggedTransactionQueue trait. - pub const TAGGED_TRANSACTION_QUEUE: ApiId = *b"validatx"; - - /// ApiId for the Metadata trait. - pub const METADATA: ApiId = *b"metadata"; -} - -decl_apis! { - /// The `Core` api trait that is mandantory for each runtime. - pub trait Core { - fn version() -> RuntimeVersion; - fn authorities() -> Vec; - fn execute_block(block: Block); - } - - /// The `Metadata` api trait that returns metadata for the runtime. - pub trait Metadata { - fn metadata() -> Data; - } - - /// The `TaggedTransactionQueue` api trait for interfering with the new transaction queue. - pub trait TaggedTransactionQueue { - fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity; - } - - /// The `BlockBuilder` api trait that provides required functions for building a block for a runtime. - pub trait BlockBuilder ExtraClientSide { - /// Initialise a block with the given header. - fn initialise_block(header: ::Header) ExtraClientSide(changes: &mut Self::OverlayedChanges); - /// Apply the given extrinsics. - fn apply_extrinsic(extrinsic: ::Extrinsic) ExtraClientSide(changes: &mut Self::OverlayedChanges) -> ApplyResult; - /// Finish the current block. - fn finalise_block() ExtraClientSide(changes: &mut Self::OverlayedChanges) -> ::Header; - /// Generate inherent extrinsics. - fn inherent_extrinsics(inherent: InherentExtrinsic) -> Vec; - /// Check that the inherents are valid. - fn check_inherents(block: Block, data: InherentData) -> Result<(), Error>; - /// Generate a random seed. - fn random_seed() -> ::Hash; - } -} - /// Implement the given API's for the given runtime. -/// All desired API's need to be implemented in one `impl_apis!` call. +/// All desired API's need to be implemented in one `impl_runtime_apis!` call. /// Besides generating the implementation for the runtime, there will be also generated an /// auxiliary module named `api` that contains function for inferring with the API in native/wasm. /// It is important to use the traits from the `runtime` module with this macro. @@ -486,18 +419,17 @@ decl_apis! { /// /// ```nocompile /// #[macro_use] -/// extern crate sr_api as runtime_api; +/// extern crate substrate_client as client; /// -/// use runtime_api::runtime::{Core, TaggedTransactionQueue}; +/// use client::runtime_api::runtime::{Core, TaggedTransactionQueue}; /// -/// impl_apis! { -/// impl Core for Runtime { -/// fn version() -> RuntimeVersion { 1 } -/// fn authorities() -> Vec { vec![1] } +/// impl_runtime_apis! { +/// impl Core for Runtime { +/// fn version() -> RuntimeVersion { unimplemented!() } +/// fn authorities() -> Vec { unimplemented!() } /// fn execute_block(block: Block) { /// //comment -/// let block = call_arbitrary_code(block); -/// execute(block); +/// unimplemented!() /// } /// } /// @@ -511,7 +443,7 @@ decl_apis! { /// fn main() {} /// ``` #[macro_export] -macro_rules! impl_apis { +macro_rules! impl_runtime_apis { ( impl $trait_name:ident $( < $( $generic:ident ),* > )* for $runtime:ident { $( @@ -529,7 +461,7 @@ macro_rules! impl_apis { } )* } - impl_apis! { + impl_runtime_apis! { $runtime; $( $fn_name ( $( $arg_name: $arg_ty ),* ); )*; $( $rest )* @@ -554,7 +486,7 @@ macro_rules! impl_apis { } )* } - impl_apis! { + impl_runtime_apis! { $runtime; $( $fn_name_parsed ( $( $arg_name_parsed: $arg_ty_parsed ),* ); )* $( $fn_name ( $( $arg_name: $arg_ty ),* ); )*; @@ -573,7 +505,7 @@ macro_rules! impl_apis { match method { $( stringify!($fn_name) => { - Some({impl_apis! { + Some({impl_runtime_apis! { @GENERATE_IMPL_CALL $runtime; $fn_name; @@ -594,11 +526,11 @@ macro_rules! impl_apis { &[0u8; 0] } else { unsafe { - $crate::slice::from_raw_parts(input_data, input_len) + $crate::runtime_api::slice::from_raw_parts(input_data, input_len) } }; - let output = { impl_apis! { + let output = { impl_runtime_apis! { @GENERATE_IMPL_CALL $runtime; $fn_name; @@ -622,13 +554,13 @@ macro_rules! impl_apis { $arg_name:ident : $arg_ty:ty; $input:ident; ) => { - let $arg_name : $arg_ty = match $crate::codec::Decode::decode(&mut $input) { + let $arg_name : $arg_ty = match $crate::runtime_api::Decode::decode(&mut $input) { Some(input) => input, None => panic!("Bad input data provided to {}", stringify!($fn_name)), }; let output = $runtime::$fn_name($arg_name); - $crate::codec::Encode::encode(&output) + $crate::runtime_api::Encode::encode(&output) }; (@GENERATE_IMPL_CALL $runtime:ident; @@ -636,12 +568,12 @@ macro_rules! impl_apis { $( $arg_name:ident : $arg_ty:ty ),*; $input:ident; ) => { - let ( $( $arg_name ),* ) : ($( $arg_ty ),*) = match $crate::codec::Decode::decode(&mut $input) { + let ( $( $arg_name ),* ) : ($( $arg_ty ),*) = match $crate::runtime_api::Decode::decode(&mut $input) { Some(input) => input, None => panic!("Bad input data provided to {}", stringify!($fn_name)), }; let output = $runtime::$fn_name($( $arg_name ),*); - $crate::codec::Encode::encode(&output) + $crate::runtime_api::Encode::encode(&output) }; } diff --git a/core/client/src/runtime_api/mod.rs b/core/client/src/runtime_api/mod.rs new file mode 100644 index 0000000000000..62f0f0ca0362a --- /dev/null +++ b/core/client/src/runtime_api/mod.rs @@ -0,0 +1,99 @@ +// Copyright 2018 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 . + +//! All the functionality required for declaring and implementing runtime api's. +//! Core api's are also declared here. + +#[doc(hidden)] +#[cfg(feature = "std")] +pub use state_machine::OverlayedChanges; +#[doc(hidden)] +pub use runtime_primitives::{traits::Block as BlockT, generic::BlockId}; +#[cfg(feature = "std")] +use runtime_primitives::traits::ApiRef; +use runtime_version::ApiId; +#[doc(hidden)] +pub use rstd::slice; +#[cfg(feature = "std")] +use rstd::result; +#[doc(hidden)] +pub use codec::{Encode, Decode}; +#[cfg(feature = "std")] +use error; + +mod core; +#[macro_use] +mod macros; +mod traits; + +/// Something that can be constructed to a runtime api. +#[cfg(feature = "std")] +pub trait ConstructRuntimeApi: Sized { + /// Construct an instance of the runtime api. + fn construct_runtime_api<'a, T: CallApiAt>(call: &'a T) -> ApiRef<'a, Self>; +} + +/// An extension for the `RuntimeApi`. +#[cfg(feature = "std")] +pub trait ApiExt { + /// The given closure will be called with api instance. Inside the closure any api call is + /// allowed. After doing the api call, the closure is allowed to map the `Result` to a + /// different `Result` type. This can be important, as the internal data structure that keeps + /// track of modifications to the storage, discards changes when the `Result` is an `Err`. + /// On `Ok`, the structure commits the changes to an internal buffer. + fn map_api_result result::Result, R, E>( + &self, + map_call: F + ) -> result::Result; +} + +/// Something that can call the runtime api at a given block. +#[cfg(feature = "std")] +pub trait CallApiAt { + /// Calls the given api function with the given encoded arguments at the given block + /// and returns the encoded result. + fn call_api_at( + &self, + at: &BlockId, + function: &'static str, + args: Vec, + changes: &mut OverlayedChanges, + initialised_block: &mut Option>, + ) -> error::Result>; +} + +/// The ApiIds for the various standard runtime APIs. +pub mod id { + use super::ApiId; + + /// ApiId for the BlockBuilder trait. + pub const BLOCK_BUILDER: ApiId = *b"blkbuild"; + + /// ApiId for the TaggedTransactionQueue trait. + pub const TAGGED_TRANSACTION_QUEUE: ApiId = *b"validatx"; + + /// ApiId for the Metadata trait. + pub const METADATA: ApiId = *b"metadata"; +} + +pub use self::core::*; +pub use self::traits::*; + +/// The runtime apis that should be implemented for the `Runtime`. +pub mod runtime { + pub use super::core::runtime::Core; + pub use super::traits::runtime::*; +} diff --git a/core/client/src/runtime_api/traits.rs b/core/client/src/runtime_api/traits.rs new file mode 100644 index 0000000000000..4d237a09ef522 --- /dev/null +++ b/core/client/src/runtime_api/traits.rs @@ -0,0 +1,35 @@ +// Copyright 2018 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 . + +use primitives::OpaqueMetadata; +use runtime_primitives::{ + traits::{Block as BlockT}, + transaction_validity::TransactionValidity +}; + +decl_runtime_apis! { + /// The `Metadata` api trait that returns metadata for the runtime. + pub trait Metadata { + /// Returns the metadata of a runtime. + fn metadata() -> OpaqueMetadata; + } + + /// The `TaggedTransactionQueue` api trait for interfering with the new transaction queue. + pub trait TaggedTransactionQueue { + /// Validate the given transaction. + fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity; + } +} diff --git a/core/consensus/aura/src/lib.rs b/core/consensus/aura/src/lib.rs index 7355119074eba..e55756eacff7e 100644 --- a/core/consensus/aura/src/lib.rs +++ b/core/consensus/aura/src/lib.rs @@ -130,22 +130,7 @@ pub trait CompatibleDigestItem: Sized { fn as_aura_seal(&self) -> Option<(u64, &ed25519::Signature)>; } -impl CompatibleDigestItem for generic::DigestItem { - /// Construct a digest item which is a slot number and a signature on the - /// hash. - fn aura_seal(slot_number: u64, signature: ed25519::Signature) -> Self { - generic::DigestItem::Seal(slot_number, signature) - } - /// If this item is an Aura seal, return the slot number and signature. - fn as_aura_seal(&self) -> Option<(u64, &ed25519::Signature)> { - match self { - generic::DigestItem::Seal(slot, ref sign) => Some((*slot, sign)), - _ => None - } - } -} - -impl CompatibleDigestItem for generic::DigestItem { +impl CompatibleDigestItem for generic::DigestItem { /// Construct a digest item which is a slot number and a signature on the /// hash. fn aura_seal(slot_number: u64, signature: ed25519::Signature) -> Self { @@ -429,7 +414,7 @@ mod tests { type Error = client::error::Error; - type TestClient = client::Client; + type TestClient = client::Client; struct DummyFactory(Arc); struct DummyProposer(u64, Arc); diff --git a/core/finality-grandpa/src/lib.rs b/core/finality-grandpa/src/lib.rs index 97c93acfe334a..21f75f47f89e6 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/core/finality-grandpa/src/lib.rs @@ -41,7 +41,7 @@ extern crate substrate_keyring as keyring; use futures::prelude::*; use futures::stream::Fuse; use futures::sync::mpsc; -use client::{Client, ImportNotifications, backend::Backend, CallExecutor}; +use client::{Client, ImportNotifications, backend::Backend, CallExecutor, blockchain::HeaderBackend}; use codec::{Encode, Decode}; use runtime_primitives::traits::{As, NumberFor, Block as BlockT, Header as HeaderT}; use runtime_primitives::generic::BlockId; @@ -121,9 +121,10 @@ pub trait BlockStatus { fn block_number(&self, hash: Block::Hash) -> Result, Error>; } -impl> BlockStatus for Arc> where +impl, RA> BlockStatus for Arc> where B: Backend, - E: CallExecutor, + E: CallExecutor + Send + Sync, + RA: Send + Sync, NumberFor: As, { fn block_number(&self, hash: Block::Hash) -> Result, Error> { @@ -376,14 +377,14 @@ fn outgoing_messages( } /// The environment we run GRANDPA in. -pub struct Environment { - inner: Arc>, +pub struct Environment { + inner: Arc>, voters: HashMap, config: Config, network: N, } -impl, B, E, N> grandpa::Chain for Environment where +impl, B, E, N, RA> grandpa::Chain for Environment where Block: 'static, B: Backend + 'static, E: CallExecutor + 'static, @@ -434,12 +435,13 @@ impl, B, E, N> grandpa::Chain for Environm } } -impl, N> voter::Environment for Environment where +impl, N, RA> voter::Environment for Environment where Block: 'static, B: Backend + 'static, - E: CallExecutor + 'static, + E: CallExecutor + 'static + Send + Sync, N: Network + 'static, N::In: 'static, + RA: 'static + Send + Sync, NumberFor: As, { type Timer = Box>; @@ -543,9 +545,9 @@ impl, N> voter::Environment for Envi } /// Run a GRANDPA voter as a task. The returned future should be executed in a tokio runtime. -pub fn run_grandpa, N>( +pub fn run_grandpa, N, RA: Send + Sync + 'static>( config: Config, - client: Arc>, + client: Arc>, voters: HashMap, network: N, ) -> Result,client::error::Error> where diff --git a/core/network/src/chain.rs b/core/network/src/chain.rs index 6e4ec75cde6bc..32cb18f276661 100644 --- a/core/network/src/chain.rs +++ b/core/network/src/chain.rs @@ -68,52 +68,53 @@ pub trait Client: Send + Sync { ) -> Result<(NumberFor, Vec>), Error>; } -impl Client for SubstrateClient where +impl Client for SubstrateClient where B: client::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + 'static, Self: BlockImport, Block: BlockT, + RA: Send + Sync { fn import(&self, block: ImportBlock, new_authorities: Option>) -> Result { - (self as &SubstrateClient).import_block(block, new_authorities) + (self as &SubstrateClient).import_block(block, new_authorities) } fn info(&self) -> Result, Error> { - (self as &SubstrateClient).info() + (self as &SubstrateClient).info() } fn block_status(&self, id: &BlockId) -> Result { - (self as &SubstrateClient).block_status(id) + (self as &SubstrateClient).block_status(id) } fn block_hash(&self, block_number: ::Number) -> Result, Error> { - (self as &SubstrateClient).block_hash(block_number) + (self as &SubstrateClient).block_hash(block_number) } fn header(&self, id: &BlockId) -> Result, Error> { - (self as &SubstrateClient).header(id) + (self as &SubstrateClient).header(id) } fn body(&self, id: &BlockId) -> Result>, Error> { - (self as &SubstrateClient).body(id) + (self as &SubstrateClient).body(id) } fn justification(&self, id: &BlockId) -> Result, Error> { - (self as &SubstrateClient).justification(id) + (self as &SubstrateClient).justification(id) } fn header_proof(&self, block_number: ::Number) -> Result<(Block::Header, Vec>), Error> { - (self as &SubstrateClient).header_proof(&BlockId::Number(block_number)) + (self as &SubstrateClient).header_proof(&BlockId::Number(block_number)) } fn read_proof(&self, block: &Block::Hash, key: &[u8]) -> Result>, Error> { - (self as &SubstrateClient).read_proof(&BlockId::Hash(block.clone()), key) + (self as &SubstrateClient).read_proof(&BlockId::Hash(block.clone()), key) } fn execution_proof(&self, block: &Block::Hash, method: &str, data: &[u8]) -> Result<(Vec, Vec>), Error> { - (self as &SubstrateClient).execution_proof(&BlockId::Hash(block.clone()), method, data) + (self as &SubstrateClient).execution_proof(&BlockId::Hash(block.clone()), method, data) } fn key_changes_proof( @@ -123,6 +124,6 @@ impl Client for SubstrateClient where max: Block::Hash, key: &[u8] ) -> Result<(NumberFor, Vec>), Error> { - (self as &SubstrateClient).key_changes_proof(first, last, max, key) + (self as &SubstrateClient).key_changes_proof(first, last, max, key) } } diff --git a/core/network/src/import_queue.rs b/core/network/src/import_queue.rs index b31dee6310999..5a21393ae4081 100644 --- a/core/network/src/import_queue.rs +++ b/core/network/src/import_queue.rs @@ -677,7 +677,7 @@ pub mod tests { fn restart(&mut self) { self.restarts += 1; } } - fn prepare_good_block() -> (client::Client, Hash, u64, BlockData) { + fn prepare_good_block() -> (client::Client, Hash, u64, BlockData) { let client = test_client::new(); let block = client.new_block().unwrap().bake().unwrap(); client.justify_and_import(BlockOrigin::File, block).unwrap(); diff --git a/core/network/src/test/mod.rs b/core/network/src/test/mod.rs index 843ad836e0ba0..f5b70f2e9ad34 100644 --- a/core/network/src/test/mod.rs +++ b/core/network/src/test/mod.rs @@ -28,7 +28,6 @@ use client::block_builder::BlockBuilder; use runtime_primitives::generic::BlockId; use io::SyncIo; use protocol::{Context, Protocol, ProtocolContext}; -use primitives::{Blake2Hasher}; use config::ProtocolConfig; use service::TransactionPool; use network_libp2p::{NodeIndex, PeerId, Severity}; @@ -137,7 +136,7 @@ pub struct TestPacket { recipient: NodeIndex, } -pub type PeersClient = client::Client; +pub type PeersClient = client::Client; pub struct Peer> { client: Arc, @@ -230,7 +229,7 @@ impl> Peer { /// Add blocks to the peer -- edit the block before adding pub fn generate_blocks(&self, count: usize, origin: BlockOrigin, mut edit_block: F) - where F: FnMut(&mut BlockBuilder) + where F: FnMut(&mut BlockBuilder) { for _ in 0 .. count { let mut builder = self.client.new_block().unwrap(); @@ -305,7 +304,7 @@ pub trait TestNetFactory: Sized { fn mut_peers>>)>(&mut self, closure: F ); fn started(&self) -> bool; - fn set_started(&mut self, now: bool); + fn set_started(&mut self, now: bool); fn default_config() -> ProtocolConfig { ProtocolConfig::default() @@ -468,7 +467,7 @@ impl TestNetFactory for TestNet { started: false } } - + fn make_verifier(&self, _client: Arc, _config: &ProtocolConfig) -> Arc { diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 20f044a872725..1bbfaafb24138 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -129,7 +129,30 @@ impl From> for Bytes { fn from(s: Vec) -> Self { Bytes(s) } } +impl From for Bytes { + fn from(s: OpaqueMetadata) -> Self { Bytes(s.0) } +} + impl Deref for Bytes { type Target = [u8]; fn deref(&self) -> &[u8] { &self.0[..] } } + +/// Stores the encoded `RuntimeMetadata` for the native side as opaque type. +#[derive(Encode, Decode)] +pub struct OpaqueMetadata(Vec); + +impl OpaqueMetadata { + /// Creates a new instance with the given metadata blob. + pub fn new(metadata: Vec) -> Self { + OpaqueMetadata(metadata) + } +} + +impl rstd::ops::Deref for OpaqueMetadata { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/core/rpc/src/author/mod.rs b/core/rpc/src/author/mod.rs index 287b51dcc3a8d..9d3482f1eea94 100644 --- a/core/rpc/src/author/mod.rs +++ b/core/rpc/src/author/mod.rs @@ -71,23 +71,19 @@ build_rpc_trait! { } /// Authoring API -pub struct Author where - P: PoolChainApi + Sync + Send + 'static, -{ +pub struct Author where P: PoolChainApi + Sync + Send + 'static { /// Substrate client - client: Arc::Block>>, + client: Arc::Block, RA>>, /// Extrinsic pool pool: Arc>, /// Subscriptions manager subscriptions: Subscriptions, } -impl Author where - P: PoolChainApi + Sync + Send + 'static, -{ +impl Author where P: PoolChainApi + Sync + Send + 'static { /// Create new instance of Authoring API. pub fn new( - client: Arc::Block>>, + client: Arc::Block, RA>>, pool: Arc>, subscriptions: Subscriptions, ) -> Self { @@ -99,12 +95,13 @@ impl Author where } } -impl AuthorApi, BlockHash

> for Author where +impl AuthorApi, BlockHash

> for Author where B: client::backend::Backend<

::Block, Blake2Hasher> + Send + Sync + 'static, E: client::CallExecutor<

::Block, Blake2Hasher> + Send + Sync + 'static, P: PoolChainApi + Sync + Send + 'static, P::Block: traits::Block, P::Error: 'static, + RA: Send + Sync + 'static { type Metadata = ::metadata::Metadata; diff --git a/core/rpc/src/chain/mod.rs b/core/rpc/src/chain/mod.rs index 62b76ed2327da..e836857bc9c38 100644 --- a/core/rpc/src/chain/mod.rs +++ b/core/rpc/src/chain/mod.rs @@ -97,16 +97,16 @@ build_rpc_trait! { } /// Chain API with subscriptions support. -pub struct Chain { +pub struct Chain { /// Substrate client. - client: Arc>, + client: Arc>, /// Current subscriptions. subscriptions: Subscriptions, } -impl Chain { +impl Chain { /// Create new Chain API RPC handler. - pub fn new(client: Arc>, subscriptions: Subscriptions) -> Self { + pub fn new(client: Arc>, subscriptions: Subscriptions) -> Self { Self { client, subscriptions, @@ -114,10 +114,11 @@ impl Chain { } } -impl Chain where +impl Chain where Block: BlockT + 'static, B: client::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, + RA: Send + Sync + 'static { fn unwrap_or_best(&self, hash: Trailing) -> Result { Ok(match hash.into() { @@ -163,10 +164,11 @@ impl Chain where } } -impl ChainApi, SignedBlock> for Chain where +impl ChainApi, SignedBlock> for Chain where Block: BlockT + 'static, B: client::backend::Backend + Send + Sync + 'static, E: client::CallExecutor + Send + Sync + 'static, + RA: Send + Sync + 'static { type Metadata = ::metadata::Metadata; diff --git a/core/rpc/src/state/mod.rs b/core/rpc/src/state/mod.rs index d94b8f3deece4..f1ad6a67c2729 100644 --- a/core/rpc/src/state/mod.rs +++ b/core/rpc/src/state/mod.rs @@ -32,7 +32,7 @@ use primitives::{Blake2Hasher, Bytes}; use rpc::Result as RpcResult; use rpc::futures::{stream, Future, Sink, Stream}; use runtime_primitives::generic::BlockId; -use runtime_primitives::traits::{Block as BlockT, Header}; +use runtime_primitives::traits::{Block as BlockT, Header, ProvideRuntimeApi}; use subscriptions::Subscriptions; @@ -87,16 +87,16 @@ build_rpc_trait! { } /// State API with subscriptions support. -pub struct State { +pub struct State { /// Substrate client. - client: Arc>, + client: Arc>, /// Current subscriptions. subscriptions: Subscriptions, } -impl State { +impl State { /// Create new State API RPC handler. - pub fn new(client: Arc>, subscriptions: Subscriptions) -> Self { + pub fn new(client: Arc>, subscriptions: Subscriptions) -> Self { Self { client, subscriptions, @@ -104,7 +104,7 @@ impl State { } } -impl State where +impl State where Block: BlockT, B: client::backend::Backend, E: CallExecutor, @@ -114,10 +114,11 @@ impl State where } } -impl StateApi for State where +impl StateApi for State where Block: BlockT + 'static, B: client::backend::Backend + Send + Sync + 'static, - E: CallExecutor + Send + Sync + 'static, + E: CallExecutor + Send + Sync + 'static + Clone, + RA: Metadata { type Metadata = ::metadata::Metadata; @@ -151,7 +152,7 @@ impl StateApi for State where fn metadata(&self, block: Trailing) -> Result { let block = self.unwrap_or_best(block)?; - self.client.metadata(&BlockId::Hash(block)).map(Bytes).map_err(Into::into) + self.client.runtime_api().metadata(&BlockId::Hash(block)).map(Into::into).map_err(Into::into) } fn query_storage(&self, keys: Vec, from: Block::Hash, to: Trailing) -> Result>> { diff --git a/core/service/src/components.rs b/core/service/src/components.rs index a2b9225d3a357..cde3a5aecbcba 100644 --- a/core/service/src/components.rs +++ b/core/service/src/components.rs @@ -16,21 +16,20 @@ //! Substrate service components. -use std::sync::Arc; -use std::marker::PhantomData; -use std::ops::Deref; +use std::{sync::Arc, net::SocketAddr, marker::PhantomData, ops::Deref}; use serde::{Serialize, de::DeserializeOwned}; use tokio::runtime::TaskExecutor; -use chain_spec::ChainSpec; +use chain_spec::{ChainSpec, Properties}; use client_db; -use client::{self, Client}; -use {error, Service}; +use client::{self, Client, runtime_api::{TaggedTransactionQueue, Metadata}}; +use {error, Service, RpcConfig, maybe_start_server, TransactionPoolAdapter}; use network::{self, OnDemand, import_queue::ImportQueue}; use substrate_executor::{NativeExecutor, NativeExecutionDispatch}; use transaction_pool::txpool::{self, Options as TransactionPoolOptions, Pool as TransactionPool}; -use runtime_primitives::{traits::Block as BlockT, traits::Header as HeaderT, BuildStorage}; +use runtime_primitives::{traits::Block as BlockT, traits::Header as HeaderT, BuildStorage, generic::SignedBlock}; use config::Configuration; -use primitives::{H256, Blake2Hasher}; +use primitives::{Blake2Hasher, H256}; +use rpc; // Type aliases. // These exist mainly to avoid typing `::Foo` all over the code. @@ -70,10 +69,10 @@ pub type LightExecutor = client::light::call_executor::RemoteCallExecutor< >; /// Full client type for a factory. -pub type FullClient = Client, FullExecutor, ::Block>; +pub type FullClient = Client, FullExecutor, ::Block, ::RuntimeApi>; /// Light client type for a factory. -pub type LightClient = Client, LightExecutor, ::Block>; +pub type LightClient = Client, LightExecutor, ::Block, ::RuntimeApi>; /// `ChainSpec` specialization for a factory. pub type FactoryChainSpec = ChainSpec<::Genesis>; @@ -97,7 +96,8 @@ pub type FactoryFullConfiguration = Configuration<::Conf pub type ComponentClient = Client< ::Backend, ::Executor, - FactoryBlock<::Factory> + FactoryBlock<::Factory>, + ::RuntimeApi, >; /// Block type for `Components` @@ -116,10 +116,114 @@ pub type PoolApi = ::TransactionPoolApi; pub trait RuntimeGenesis: Serialize + DeserializeOwned + BuildStorage {} impl RuntimeGenesis for T {} +/// Something that can start the RPC service. +pub trait StartRPC { + fn start_rpc( + client: Arc, C::RuntimeApi>>, + chain_name: String, + impl_name: &'static str, + impl_version: &'static str, + rpc_http: Option, + rpc_ws: Option, + properties: Properties, + task_executor: TaskExecutor, + transaction_pool: Arc>, + ) -> Result<(Option, Option), error::Error>; +} + +impl StartRPC for T where + T::RuntimeApi: Metadata>, + for<'de> SignedBlock>: ::serde::Deserialize<'de>, +{ + fn start_rpc( + client: Arc, T::RuntimeApi>>, + chain_name: String, + impl_name: &'static str, + impl_version: &'static str, + rpc_http: Option, + rpc_ws: Option, + properties: Properties, + task_executor: TaskExecutor, + transaction_pool: Arc>, + ) -> Result<(Option, Option), error::Error> { + let rpc_config = RpcConfig { properties, chain_name, impl_name, impl_version }; + + let handler = || { + let client = client.clone(); + let subscriptions = rpc::apis::Subscriptions::new(task_executor.clone()); + let chain = rpc::apis::chain::Chain::new(client.clone(), subscriptions.clone()); + let state = rpc::apis::state::State::new(client.clone(), subscriptions.clone()); + let author = rpc::apis::author::Author::new( + client.clone(), transaction_pool.clone(), subscriptions + ); + rpc::rpc_handler::, ComponentExHash, _, _, _, _>( + state, + chain, + author, + rpc_config.clone(), + ) + }; + + Ok(( + maybe_start_server(rpc_http, |address| rpc::start_http(address, handler()))?, + maybe_start_server(rpc_ws, |address| rpc::start_ws(address, handler()))?, + )) + } +} + +/// Something that can create an instance of `network::Params`. +pub trait CreateNetworkParams { + fn create_network_params( + client: Arc, C::RuntimeApi>>, + roles: network::Roles, + network_config: network::NetworkConfiguration, + on_demand: Option, NetworkService>>>, + transaction_pool_adapter: TransactionPoolAdapter, + specialization: S, + ) -> network::Params, S, ComponentExHash>; +} + +impl CreateNetworkParams for T where + T::RuntimeApi: TaggedTransactionQueue> +{ + fn create_network_params( + client: Arc, T::RuntimeApi>>, + roles: network::Roles, + network_config: network::NetworkConfiguration, + on_demand: Option, NetworkService>>>, + transaction_pool_adapter: TransactionPoolAdapter, + specialization: S, + ) -> network::Params, S, ComponentExHash> { + network::Params { + config: network::ProtocolConfig { roles }, + network_config, + chain: client, + on_demand: on_demand.map(|d| d as Arc>>), + transaction_pool: Arc::new(transaction_pool_adapter), + specialization, + } + } +} + +/// The super trait that combines all required traits a `Service` needs to implement. +pub trait ServiceTrait: + Deref> + + Send + + Sync + + 'static + + StartRPC + + CreateNetworkParams +{} +impl ServiceTrait for T where + T: Deref> + Send + Sync + 'static + StartRPC + CreateNetworkParams +{} + /// A collection of types and methods to build a service on top of the substrate service. pub trait ServiceFactory: 'static + Sized { /// Block type. type Block: BlockT; + /// The type that implements the runtime API. + type RuntimeApi: Send + Sync; /// Network protocol extensions. type NetworkProtocol: network::specialization::Specialization; /// Chain runtime. @@ -133,9 +237,9 @@ pub trait ServiceFactory: 'static + Sized { /// Other configuration for service members. type Configuration: Default; /// Extended full service type. - type FullService: Deref>> + Send + Sync + 'static; + type FullService: ServiceTrait>; /// Extended light service type. - type LightService: Deref>> + Send + Sync + 'static; + type LightService: ServiceTrait>; /// ImportQueue for full client type FullImportQueue: network::import_queue::ImportQueue + 'static; /// ImportQueue for light clients @@ -192,7 +296,7 @@ pub trait ServiceFactory: 'static + Sized { } /// A collection of types and function to generalise over full / light client type. -pub trait Components: 'static { +pub trait Components: Sized + 'static { /// Associated service factory. type Factory: ServiceFactory; /// Client backend. @@ -204,6 +308,12 @@ pub trait Components: 'static { Hash = <::Block as BlockT>::Hash, Block = FactoryBlock >; + /// The type that implements the runtime API. + type RuntimeApi: Send + Sync; + /// A type that can start the RPC. + type RPC: StartRPC; + /// A type that can create the network params. + type CreateNetworkParams: CreateNetworkParams; /// Our Import Queue type ImportQueue: ImportQueue> + 'static; @@ -212,11 +322,13 @@ pub trait Components: 'static { fn build_client( config: &FactoryFullConfiguration, executor: CodeExecutor, - ) - -> Result<( + ) -> Result< + ( Arc>, Option, NetworkService>>> - ), error::Error>; + ), + error::Error + >; /// Create extrinsic pool. fn build_transaction_pool(config: TransactionPoolOptions, client: Arc>) @@ -232,6 +344,29 @@ pub trait Components: 'static { /// A struct that implement `Components` for the full client. pub struct FullComponents { _factory: PhantomData, + service: Service>, +} + +impl FullComponents { + pub fn new( + config: FactoryFullConfiguration, + task_executor: TaskExecutor + ) -> Result { + Ok( + Self { + _factory: Default::default(), + service: Service::new(config, task_executor)?, + } + ) + } +} + +impl Deref for FullComponents { + type Target = Service; + + fn deref(&self) -> &Self::Target { + &self.service + } } impl Components for FullComponents { @@ -240,6 +375,9 @@ impl Components for FullComponents { type Backend = FullBackend; type TransactionPoolApi = ::FullTransactionPoolApi; type ImportQueue = Factory::FullImportQueue; + type RuntimeApi = Factory::RuntimeApi; + type RPC = Factory::FullService; + type CreateNetworkParams = Factory::FullService; fn build_client( config: &FactoryFullConfiguration, @@ -281,6 +419,29 @@ impl Components for FullComponents { /// A struct that implement `Components` for the light client. pub struct LightComponents { _factory: PhantomData, + service: Service>, +} + +impl LightComponents { + pub fn new( + config: FactoryFullConfiguration, + task_executor: TaskExecutor + ) -> Result { + Ok( + Self { + _factory: Default::default(), + service: Service::new(config, task_executor)?, + } + ) + } +} + +impl Deref for LightComponents { + type Target = Service; + + fn deref(&self) -> &Self::Target { + &self.service + } } impl Components for LightComponents { @@ -289,16 +450,19 @@ impl Components for LightComponents { type Backend = LightBackend; type TransactionPoolApi = ::LightTransactionPoolApi; type ImportQueue = ::LightImportQueue; + type RuntimeApi = Factory::RuntimeApi; + type RPC = Factory::LightService; + type CreateNetworkParams = Factory::LightService; fn build_client( config: &FactoryFullConfiguration, executor: CodeExecutor, ) - -> Result<( - Arc>, - Option, - NetworkService>>> - ), error::Error> + -> Result< + ( + Arc>, + Option, NetworkService>>> + ), error::Error> { let db_settings = client_db::DatabaseSettings { cache_size: None, diff --git a/core/service/src/consensus.rs b/core/service/src/consensus.rs index c9a528dd2735a..338c1680cf28e 100644 --- a/core/service/src/consensus.rs +++ b/core/service/src/consensus.rs @@ -23,11 +23,11 @@ use std::time::{self, Duration, Instant}; use std; use client::{self, error, Client as SubstrateClient, CallExecutor}; -use client::runtime_api::{Core, BlockBuilder as BlockBuilderAPI, id::BLOCK_BUILDER}; +use client::{block_builder::api::BlockBuilder as BlockBuilderApi, runtime_api::{id::BLOCK_BUILDER, Core}}; use codec::{Decode, Encode}; use consensus_common::{self, InherentData, evaluation, offline_tracker::OfflineTracker}; use primitives::{H256, AuthorityId, ed25519, Blake2Hasher}; -use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT}; +use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi}; use runtime_primitives::generic::BlockId; use transaction_pool::txpool::{self, Pool as TransactionPool}; @@ -47,11 +47,8 @@ pub trait BlockBuilder { } /// Local client abstraction for the consensus. -pub trait AuthoringApi: - Send - + Sync - + BlockBuilderAPI<::Block, Error=::Error> - + Core<::Block, AuthorityId, Error=::Error> +pub trait AuthoringApi: Send + Sync + ProvideRuntimeApi where + ::Api: Core { /// The block used for this API type. type Block: BlockT; @@ -67,20 +64,22 @@ pub trait AuthoringApi: ) -> Result; } -impl<'a, B, E, Block> BlockBuilder for client::block_builder::BlockBuilder<'a, B, E, Block, Blake2Hasher> where - B: client::backend::Backend + Send + Sync + 'static, +impl<'a, B, E, Block, RA> BlockBuilder for client::block_builder::BlockBuilder<'a, Block, SubstrateClient> where + B: client::backend::Backend + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, + RA: BlockBuilderApi, { fn push_extrinsic(&mut self, extrinsic: ::Extrinsic) -> Result<(), error::Error> { client::block_builder::BlockBuilder::push(self, extrinsic).map_err(Into::into) } } -impl<'a, B, E, Block> AuthoringApi for SubstrateClient where +impl AuthoringApi for SubstrateClient where B: client::backend::Backend + Send + Sync + 'static, E: CallExecutor + Send + Sync + Clone + 'static, Block: BlockT, + RA: BlockBuilderApi, { type Block = Block; type Error = client::error::Error; @@ -95,7 +94,7 @@ impl<'a, B, E, Block> AuthoringApi for SubstrateClient where let mut block_builder = self.new_block_at(at)?; if runtime_version.has_api(BLOCK_BUILDER, 1) { - self.inherent_extrinsics(at, &inherent_data)? + self.runtime_api().inherent_extrinsics(at, &inherent_data)? .into_iter().try_for_each(|i| block_builder.push(i))?; } @@ -106,10 +105,7 @@ impl<'a, B, E, Block> AuthoringApi for SubstrateClient where } /// Proposer factory. -pub struct ProposerFactory where - C: AuthoringApi, - A: txpool::ChainApi, -{ +pub struct ProposerFactory where A: txpool::ChainApi { /// The client instance. pub client: Arc, /// The transaction pool. @@ -122,10 +118,11 @@ pub struct ProposerFactory where impl consensus_common::Environment<::Block> for ProposerFactory where C: AuthoringApi, + ::Api: BlockBuilderApi<::Block>, A: txpool::ChainApi::Block>, client::error::Error: From<::Error> { - type Proposer = Proposer; + type Proposer = Proposer<::Block, C, A>; type Error = error::Error; fn init( @@ -138,7 +135,7 @@ impl consensus_common::Environment<::Block> for Propose let id = BlockId::hash(parent_hash); - let authorities: Vec = self.client.authorities(&id)?; + let authorities: Vec = self.client.runtime_api().authorities(&id)?; self.offline.write().note_new_block(&authorities[..]); info!("Starting consensus session on top of parent {:?}", parent_hash); @@ -161,21 +158,23 @@ impl consensus_common::Environment<::Block> for Propose } /// The proposer logic. -pub struct Proposer { +pub struct Proposer { client: Arc, start: Instant, - parent_hash: <::Block as BlockT>::Hash, - parent_id: BlockId<::Block>, - parent_number: <<::Block as BlockT>::Header as HeaderT>::Number, + parent_hash: ::Hash, + parent_id: BlockId, + parent_number: <::Header as HeaderT>::Number, transaction_pool: Arc>, offline: SharedOfflineTracker, authorities: Vec, minimum_timestamp: u64, } -impl consensus_common::Proposer<::Block> for Proposer where - C: AuthoringApi, - A: txpool::ChainApi::Block>, +impl consensus_common::Proposer<::Block> for Proposer where + Block: BlockT, + C: AuthoringApi, + ::Api: BlockBuilderApi, + A: txpool::ChainApi, client::error::Error: From<::Error> { type Create = Result<::Block, error::Error>; diff --git a/core/service/src/lib.rs b/core/service/src/lib.rs index ec26826d83ed0..f64882bbe3460 100644 --- a/core/service/src/lib.rs +++ b/core/service/src/lib.rs @@ -67,7 +67,7 @@ use parking_lot::{Mutex, RwLock}; use keystore::Store as Keystore; use client::BlockchainEvents; use runtime_primitives::traits::{Header, As}; -use runtime_primitives::generic::{BlockId, SignedBlock}; +use runtime_primitives::generic::BlockId; use exit_future::Signal; #[doc(hidden)] pub use tokio::runtime::TaskExecutor; @@ -87,8 +87,11 @@ pub use components::{ServiceFactory, FullBackend, FullExecutor, LightBackend, ComponentBlock, FullClient, LightClient, FullComponents, LightComponents, CodeExecutor, NetworkService, FactoryChainSpec, FactoryBlock, FactoryFullConfiguration, RuntimeGenesis, FactoryGenesis, - ComponentExHash, ComponentExtrinsic, FactoryExtrinsic, + ComponentExHash, ComponentExtrinsic, FactoryExtrinsic }; +use components::{StartRPC, CreateNetworkParams}; +#[doc(hidden)] +pub use network::OnDemand; const DEFAULT_PROTOCOL_ID: &'static str = "sup"; @@ -122,7 +125,7 @@ impl Service where Components: components::Components, ::Executor: std::clone::Clone, - for<'de> SignedBlock>: ::serde::Deserialize<'de>, + // ::RuntimeApi: client::runtime_api::BlockBuilder<<::Factory as ServiceFactory>::Block, Error=client::error::Error, OverlayedChanges=client::runtime_api::OverlayedChanges> + Sync + Send + client::runtime_api::Core<<::Factory as components::ServiceFactory>::Block, primitives::AuthorityId, Error=client::error::Error, OverlayedChanges=client::runtime_api::OverlayedChanges> + client::runtime_api::ConstructRuntimeApi::Factory as ServiceFactory>::Block> + client::runtime_api::Metadata<<::Factory as components::ServiceFactory>::Block, Vec, Error=client::error::Error> + client::runtime_api::TaggedTransactionQueue<<::Factory as components::ServiceFactory>::Block, Error=client::error::Error>, { /// Creates a new service. pub fn new( @@ -173,17 +176,10 @@ impl Service client: client.clone(), }; - let network_params = network::Params { - config: network::ProtocolConfig { - roles: config.roles, - }, - network_config: config.network, - chain: client.clone(), - on_demand: on_demand.clone() - .map(|d| d as Arc>>), - transaction_pool: Arc::new(transaction_pool_adapter), - specialization: network_protocol, - }; + let network_params = Components::CreateNetworkParams::create_network_params( + client.clone(), config.roles, config.network, on_demand.clone(), + transaction_pool_adapter, network_protocol + ); let mut protocol_id = network::ProtocolId::default(); let protocol_id_full = config.chain_spec.protocol_id().unwrap_or(DEFAULT_PROTOCOL_ID).as_bytes(); @@ -232,33 +228,13 @@ impl Service task_executor.spawn(events); } - // RPC - let rpc_config = RpcConfig { - chain_name: config.chain_spec.name().to_string(), - properties: config.chain_spec.properties().clone(), - impl_name: config.impl_name, - impl_version: config.impl_version, - }; - let (rpc_http, rpc_ws) = { - let handler = || { - let client = client.clone(); - let subscriptions = rpc::apis::Subscriptions::new(task_executor.clone()); - let chain = rpc::apis::chain::Chain::new(client.clone(), subscriptions.clone()); - let state = rpc::apis::state::State::new(client.clone(), subscriptions.clone()); - let author = rpc::apis::author::Author::new(client.clone(), transaction_pool.clone(), subscriptions.clone()); - rpc::rpc_handler::, ComponentExHash, _, _, _, _>( - state, - chain, - author, - rpc_config.clone(), - ) - }; - ( - maybe_start_server(config.rpc_http, |address| rpc::start_http(address, handler()))?, - maybe_start_server(config.rpc_ws, |address| rpc::start_ws(address, handler()))?, - ) - }; + // RPC + let (rpc_http, rpc_ws) = Components::RPC::start_rpc( + client.clone(), config.chain_spec.name().to_string(), config.impl_name, + config.impl_version, config.rpc_http, config.rpc_ws, config.chain_spec.properties(), + task_executor.clone(), transaction_pool.clone() + )?; let proposer = Arc::new(ProposerFactory { client: client.clone(), @@ -309,9 +285,7 @@ impl Service } } -impl Service where - Components: components::Components, -{ +impl Service where Components: components::Components { /// Get shared client instance. pub fn client(&self) -> Arc> { self.client.clone() @@ -420,7 +394,7 @@ impl TransactionPoolAdapter { } } -impl network::TransactionPool, ComponentBlock> for TransactionPoolAdapter { +impl network::TransactionPool, ComponentBlock> for TransactionPoolAdapter where ::RuntimeApi: Send + Sync{ fn transactions(&self) -> Vec<(ComponentExHash, ComponentExtrinsic)> { self.pool.ready() .map(|t| { @@ -468,41 +442,6 @@ impl network::TransactionPool, ComponentBlock< } } -/// Creates a simple `Service` implementation. -/// This `Service` just holds an instance to a `service::Service` and implements `Deref`. -/// It also provides a `new` function that takes a `config` and a `TaskExecutor`. -#[macro_export] -macro_rules! construct_simple_service { - ( - $name: ident - ) => { - pub struct $name { - inner: $crate::Arc<$crate::Service>, - } - - impl $name { - fn new( - config: FactoryFullConfiguration, - executor: $crate::TaskExecutor - ) -> $crate::Result { - Ok( - Self { - inner: $crate::Arc::new($crate::Service::new(config, executor)?) - } - ) - } - } - - impl $crate::Deref for $name { - type Target = $crate::Service; - - fn deref(&self) -> &Self::Target { - &self.inner - } - } - } -} - /// Constructs a service factory with the given name that implements the `ServiceFactory` trait. /// The required parameters are required to be given in the exact order. Some parameters are followed /// by `{}` blocks. These blocks are required and used to initialize the given parameter. @@ -544,6 +483,7 @@ macro_rules! construct_service_factory { $(#[$attr:meta])* struct $name:ident { Block = $block:ty, + RuntimeApi = $runtime_api:ty, NetworkProtocol = $protocol:ty { $( $protocol_init:tt )* }, RuntimeDispatch = $dispatch:ty, FullTransactionPoolApi = $full_transaction:ty { $( $full_transaction_init:tt )* }, @@ -564,6 +504,7 @@ macro_rules! construct_service_factory { #[allow(unused_variables)] impl $crate::ServiceFactory for $name { type Block = $block; + type RuntimeApi = $runtime_api; type NetworkProtocol = $protocol; type RuntimeDispatch = $dispatch; type FullTransactionPoolApi = $full_transaction; diff --git a/core/service/test/src/lib.rs b/core/service/test/src/lib.rs index 0a967e3cd6c81..a155b18b37e40 100644 --- a/core/service/test/src/lib.rs +++ b/core/service/test/src/lib.rs @@ -179,7 +179,10 @@ impl TestNet { } } -pub fn connectivity(spec: FactoryChainSpec) { +pub fn connectivity(spec: FactoryChainSpec) where + ::RuntimeApi: + client::block_builder::api::BlockBuilder<::Block> +{ const NUM_NODES: u32 = 10; { let temp = TempDir::new("substrate-connectivity-test").expect("Error creating test dir"); @@ -219,6 +222,9 @@ where F: ServiceFactory, B: Fn(&F::FullService) -> ImportBlock, E: Fn(&F::FullService) -> FactoryExtrinsic, + ::RuntimeApi: + client::block_builder::api::BlockBuilder<::Block> + + client::runtime_api::TaggedTransactionQueue<::Block> { const NUM_NODES: u32 = 10; const NUM_BLOCKS: usize = 512; @@ -255,6 +261,8 @@ where pub fn consensus(spec: FactoryChainSpec, authorities: Vec) where F: ServiceFactory, + ::RuntimeApi: + client::block_builder::api::BlockBuilder<::Block> { const NUM_NODES: u32 = 20; const NUM_BLOCKS: u64 = 200; diff --git a/core/sr-api/Cargo.toml b/core/sr-api/Cargo.toml deleted file mode 100644 index 2877dfa919556..0000000000000 --- a/core/sr-api/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "sr-api" -version = "0.1.0" -authors = ["Parity Technologies "] - -[dependencies] -parity-codec = { version = "2.1", default-features = false } -sr-std = { path = "../sr-std", default-features = false } -sr-primitives = { path = "../sr-primitives", default-features = false } -sr-version = { path = "../sr-version", default-features = false } - -[features] -default = ["std"] -std = [ - "sr-std/std", - "parity-codec/std", - "sr-primitives/std", - "sr-version/std", -] diff --git a/core/sr-primitives/src/traits.rs b/core/sr-primitives/src/traits.rs index 28c7997a0f04f..fe1c6756e2266 100644 --- a/core/sr-primitives/src/traits.rs +++ b/core/sr-primitives/src/traits.rs @@ -27,8 +27,10 @@ use codec::{Codec, Encode, HasCompact}; pub use integer_sqrt::IntegerSquareRoot; pub use num_traits::{Zero, One, Bounded}; pub use num_traits::ops::checked::{CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}; -use rstd::ops::{Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign, - RemAssign, Shl, Shr}; +use rstd::ops::{ + Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign, + RemAssign, Shl, Shr +}; /// A lazy value. pub trait Lazy { @@ -597,3 +599,33 @@ pub trait ProvideInherent { block: &Block, data: Self::Inherent, extract_function: &F ) -> Result<(), Self::Error>; } + +/// Auxiliary wrapper that holds an api instance and binds it to the given lifetime. +pub struct ApiRef<'a, T>(T, rstd::marker::PhantomData<&'a ()>); + +impl<'a, T> From for ApiRef<'a, T> { + fn from(api: T) -> Self { + ApiRef(api, Default::default()) + } +} + +impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +/// Something that provides a runtime api. +pub trait ProvideRuntimeApi { + /// The concrete type that provides the api. + type Api; + + /// Returns the runtime api. + /// The returned instance will keep track of modifications to the storage. Any successful + /// call to an api function, will `commit` its changes to an internal buffer. Otherwise, + /// the modifications will be `discarded`. The modifications will not be applied to the + /// storage, even on a `commit`. + fn runtime_api<'a>(&'a self) -> ApiRef<'a, Self::Api>; +} diff --git a/core/test-client/Cargo.toml b/core/test-client/Cargo.toml index aa48f95211131..9f282f9db3f60 100644 --- a/core/test-client/Cargo.toml +++ b/core/test-client/Cargo.toml @@ -10,6 +10,6 @@ substrate-executor = { path = "../executor" } substrate-consensus-common = { path = "../consensus/common" } substrate-keyring = { path = "../../core/keyring" } substrate-primitives = { path = "../primitives" } +substrate-state-machine = { path = "../state-machine" } substrate-test-runtime = { path = "../test-runtime" } sr-primitives = { path = "../sr-primitives" } - diff --git a/core/test-client/src/block_builder_ext.rs b/core/test-client/src/block_builder_ext.rs index 11dd859c07d3e..3c334b07a1d58 100644 --- a/core/test-client/src/block_builder_ext.rs +++ b/core/test-client/src/block_builder_ext.rs @@ -20,8 +20,8 @@ use codec; use client; use keyring; use runtime; - -use primitives::{Blake2Hasher}; +use runtime_primitives::traits::ProvideRuntimeApi; +use client::block_builder::api::BlockBuilder; /// Extension trait for test block builder. pub trait BlockBuilderExt { @@ -29,10 +29,9 @@ pub trait BlockBuilderExt { fn push_transfer(&mut self, transfer: runtime::Transfer) -> Result<(), client::error::Error>; } -impl<'a, B, E> BlockBuilderExt for client::block_builder::BlockBuilder<'a, B, E, runtime::Block, Blake2Hasher> - where - B: client::backend::Backend, - E: client::CallExecutor + Clone, +impl<'a, A> BlockBuilderExt for client::block_builder::BlockBuilder<'a, runtime::Block, A> where + A: ProvideRuntimeApi + client::blockchain::HeaderBackend + 'a, + A::Api: BlockBuilder { fn push_transfer(&mut self, transfer: runtime::Transfer) -> Result<(), client::error::Error> { self.push(sign_tx(transfer)) diff --git a/core/test-client/src/client_ext.rs b/core/test-client/src/client_ext.rs index 61133c4d9da81..f16bfce40fdbc 100644 --- a/core/test-client/src/client_ext.rs +++ b/core/test-client/src/client_ext.rs @@ -35,11 +35,11 @@ pub trait TestClient: Sized { fn genesis_hash(&self) -> runtime::Hash; } -impl TestClient for Client +impl TestClient for Client where B: client::backend::Backend, E: client::CallExecutor, - Self: BlockImport + Self: BlockImport, { fn justify_and_import(&self, origin: BlockOrigin, block: runtime::Block) -> client::error::Result<()> diff --git a/core/test-client/src/lib.rs b/core/test-client/src/lib.rs index 6a92a3f692035..ce504bd0851ae 100644 --- a/core/test-client/src/lib.rs +++ b/core/test-client/src/lib.rs @@ -27,6 +27,7 @@ pub extern crate substrate_client as client; pub extern crate substrate_keyring as keyring; pub extern crate substrate_test_runtime as runtime; pub extern crate substrate_consensus_common as consensus; +extern crate substrate_state_machine as state_machine; pub mod client_ext; pub mod trait_tests; @@ -65,12 +66,12 @@ pub type Executor = client::LocalCallExecutor< >; /// Creates new client instance used for tests. -pub fn new() -> client::Client { +pub fn new() -> client::Client { new_with_backend(Arc::new(Backend::new()), false) } /// Creates new test client instance that suports changes trie creation. -pub fn new_with_changes_trie() -> client::Client { +pub fn new_with_changes_trie() -> client::Client { new_with_backend(Arc::new(Backend::new()), true) } @@ -79,7 +80,7 @@ pub fn new_with_changes_trie() -> client::Client( backend: Arc, support_changes_trie: bool -) -> client::Client>, runtime::Block> +) -> client::Client>, runtime::Block, runtime::ClientWithApi> where B: backend::LocalBackend, { diff --git a/core/test-runtime/Cargo.toml b/core/test-runtime/Cargo.toml index 6687c019f6886..42f4d1edd1c34 100644 --- a/core/test-runtime/Cargo.toml +++ b/core/test-runtime/Cargo.toml @@ -11,8 +11,8 @@ serde_derive = { version = "1.0", optional = true } parity-codec = { version = "2.1", default-features = false } parity-codec-derive = { version = "2.1", default-features = false } substrate-keyring = { path = "../keyring", optional = true } +substrate-client = { path = "../client", optional = true } substrate-primitives = { path = "../primitives", default-features = false } -sr-api = { path = "../sr-api", default-features = false } sr-std = { path = "../sr-std", default-features = false } sr-io = { path = "../sr-io", default-features = false } sr-primitives = { path = "../sr-primitives", default-features = false } @@ -26,9 +26,9 @@ std = [ "hex-literal", "serde", "serde_derive", + "substrate-client", "substrate-keyring", "parity-codec/std", - "sr-api/std", "sr-std/std", "sr-io/std", "srml-support/std", diff --git a/core/test-runtime/src/lib.rs b/core/test-runtime/src/lib.rs index 0a9c02d8df180..9fbdb1163878e 100644 --- a/core/test-runtime/src/lib.rs +++ b/core/test-runtime/src/lib.rs @@ -22,12 +22,13 @@ extern crate sr_std as rstd; extern crate parity_codec as codec; extern crate sr_primitives as runtime_primitives; +#[macro_use] +extern crate substrate_client as client; + #[macro_use] extern crate srml_support as runtime_support; #[macro_use] extern crate parity_codec_derive; -#[macro_use] -extern crate sr_api as runtime_api; extern crate sr_io as runtime_io; #[macro_use] extern crate sr_version as runtime_version; @@ -47,12 +48,20 @@ pub mod system; use rstd::prelude::*; use codec::{Encode, Decode}; -use runtime_api::runtime::*; +use client::{runtime_api::runtime::*, block_builder::api::runtime::*}; +#[cfg(feature = "std")] +use client::runtime_api::ApiExt; use runtime_primitives::traits::{BlindCheckable, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT}; +#[cfg(feature = "std")] +use runtime_primitives::traits::ApiRef; use runtime_primitives::{ApplyResult, Ed25519Signature, transaction_validity::TransactionValidity}; +#[cfg(feature = "std")] +use runtime_primitives::generic::BlockId; use runtime_version::RuntimeVersion; pub use primitives::hash::H256; use primitives::AuthorityId; +#[cfg(feature = "std")] +use primitives::OpaqueMetadata; #[cfg(any(feature = "std", test))] use runtime_version::NativeVersion; @@ -152,8 +161,8 @@ pub fn changes_trie_config() -> primitives::ChangesTrieConfiguration { } } -mod test_api { - decl_apis! { +pub mod test_api { + decl_runtime_apis! { pub trait TestAPI { fn balance_of(id: AccountId) -> u64; } @@ -162,10 +171,161 @@ mod test_api { use test_api::runtime::TestAPI; +#[cfg(feature = "std")] +pub struct ClientWithApi { + call: ::std::ptr::NonNull>, + commit_on_success: ::std::cell::RefCell, + initialised_block: ::std::cell::RefCell>>, + changes: ::std::cell::RefCell, +} + +#[cfg(feature = "std")] +unsafe impl Send for ClientWithApi {} +#[cfg(feature = "std")] +unsafe impl Sync for ClientWithApi {} + +#[cfg(feature = "std")] +impl ApiExt for ClientWithApi { + fn map_api_result Result, R, E>(&self, map_call: F) -> Result { + *self.commit_on_success.borrow_mut() = false; + let res = map_call(self); + *self.commit_on_success.borrow_mut() = true; + + self.commit_on_ok(&res); + + res + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::ConstructRuntimeApi for ClientWithApi { + fn construct_runtime_api<'a, T: client::runtime_api::CallApiAt>(call: &'a T) -> ApiRef<'a, Self> { + ClientWithApi { + call: unsafe { + ::std::ptr::NonNull::new_unchecked( + ::std::mem::transmute( + call as &client::runtime_api::CallApiAt + ) + ) + }, + commit_on_success: true.into(), + initialised_block: None.into(), + changes: Default::default(), + }.into() + } +} + +#[cfg(feature = "std")] +impl ClientWithApi { + fn call_api_at( + &self, + at: &BlockId, + function: &'static str, + args: &A + ) -> client::error::Result { + let res = unsafe { + self.call.as_ref().call_api_at( + at, + function, + args.encode(), + &mut *self.changes.borrow_mut(), + &mut *self.initialised_block.borrow_mut() + ).and_then(|r| + R::decode(&mut &r[..]) + .ok_or_else(|| + client::error::ErrorKind::CallResultDecode(function).into() + ) + ) + }; + + self.commit_on_ok(&res); + res + } + + fn commit_on_ok(&self, res: &Result) { + if *self.commit_on_success.borrow() { + if res.is_err() { + self.changes.borrow_mut().discard_prospective(); + } else { + self.changes.borrow_mut().commit_prospective(); + } + } + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::Core for ClientWithApi { + fn version(&self, at: &BlockId) -> Result { + self.call_api_at(at, "version", &()) + } + + fn authorities(&self, at: &BlockId) -> Result, client::error::Error> { + self.call_api_at(at, "authorities", &()) + } + + fn execute_block(&self, at: &BlockId, block: &Block) -> Result<(), client::error::Error> { + self.call_api_at(at, "execute_block", block) + } + + fn initialise_block(&self, at: &BlockId, header: &::Header) -> Result<(), client::error::Error> { + self.call_api_at(at, "initialise_block", header) + } +} + +#[cfg(feature = "std")] +impl client::block_builder::api::BlockBuilder for ClientWithApi { + fn apply_extrinsic(&self, at: &BlockId, extrinsic: &::Extrinsic) -> Result { + self.call_api_at(at, "apply_extrinsic", extrinsic) + } + + fn finalise_block(&self, at: &BlockId) -> Result<::Header, client::error::Error> { + self.call_api_at(at, "finalise_block", &()) + } + + fn inherent_extrinsics( + &self, at: &BlockId, inherent: &Inherent + ) -> Result, client::error::Error> { + self.call_api_at(at, "inherent_extrinsics", inherent) + } + + fn check_inherents(&self, at: &BlockId, block: &Block, inherent: &Inherent) -> Result, client::error::Error> { + self.call_api_at(at, "check_inherents", &(block, inherent)) + } + + fn random_seed(&self, at: &BlockId) -> Result<::Hash, client::error::Error> { + self.call_api_at(at, "random_seed", &()) + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::TaggedTransactionQueue for ClientWithApi { + fn validate_transaction( + &self, + at: &BlockId, + utx: &::Extrinsic + ) -> Result { + self.call_api_at(at, "validate_transaction", utx) + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::Metadata for ClientWithApi { + fn metadata(&self, at: &BlockId) -> Result { + self.call_api_at(at, "metadata", &()) + } +} + +#[cfg(feature = "std")] +impl test_api::TestAPI for ClientWithApi { + fn balance_of(&self, at: &BlockId, id: &AccountId) -> Result { + self.call_api_at(at, "balance_of", id) + } +} + struct Runtime; -impl_apis! { - impl Core for Runtime { +impl_runtime_apis! { + impl Core for Runtime { fn version() -> RuntimeVersion { version() } @@ -177,19 +337,19 @@ impl_apis! { fn execute_block(block: Block) { system::execute_block(block) } + + fn initialise_block(header: ::Header) { + system::initialise_block(header) + } } - impl TaggedTransactionQueue for Runtime { + impl TaggedTransactionQueue for Runtime { fn validate_transaction(utx: ::Extrinsic) -> TransactionValidity { system::validate_transaction(utx) } } impl BlockBuilder for Runtime { - fn initialise_block(header: ::Header) { - system::initialise_block(header) - } - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { system::execute_transaction(extrinsic) } diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index a0ececf55f075..f9c096414880e 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -6,6 +6,27 @@ dependencies = [ "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "backtrace" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "base58" version = "0.1.0" @@ -30,11 +51,35 @@ name = "byteorder" version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bytes" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -48,6 +93,11 @@ name = "constant_time_eq" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "crossbeam" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crossbeam-deque" version = "0.2.0" @@ -57,6 +107,15 @@ dependencies = [ "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-deque" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-epoch" version = "0.3.1" @@ -71,6 +130,19 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-epoch" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-utils" version = "0.2.2" @@ -79,6 +151,11 @@ dependencies = [ "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-utils" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crunchy" version = "0.1.6" @@ -102,6 +179,14 @@ name = "environmental" version = "1.0.0" source = "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.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fixed-hash" version = "0.3.0-beta.3" @@ -115,6 +200,24 @@ dependencies = [ "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -129,6 +232,11 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "gcc" version = "0.3.54" @@ -172,11 +280,58 @@ dependencies = [ "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "httparse" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "integer-sqrt" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kvdb" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "0.2.11" @@ -190,11 +345,25 @@ dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lazycell" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lock_api" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.3.9" @@ -229,6 +398,11 @@ dependencies = [ "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "memoffset" version = "0.2.1" @@ -248,16 +422,84 @@ name = "memory_units" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-extras" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nan-preserving-float" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "net2" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "num-integer" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-traits" version = "0.2.6" @@ -271,6 +513,30 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "openssl" +version = "0.10.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl-sys" +version = "0.9.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "owning_ref" version = "0.3.3" @@ -279,6 +545,11 @@ dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-bytes" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "parity-codec" version = "2.1.5" @@ -315,6 +586,15 @@ dependencies = [ "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.2.14" @@ -326,6 +606,28 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro-hack" version = "0.4.1" @@ -401,6 +703,11 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_syscall" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ring" version = "0.12.1" @@ -413,6 +720,11 @@ dependencies = [ "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-demangle" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc-hex" version = "2.0.1" @@ -426,6 +738,11 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ryu" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "0.3.3" @@ -460,21 +777,67 @@ dependencies = [ ] [[package]] -name = "smallvec" -version = "0.6.5" +name = "serde_json" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-api" -version = "0.1.0" +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slab" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slog" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slog-async" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0", - "sr-std 0.1.0", - "sr-version 0.1.0", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-json" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-scope" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -534,6 +897,8 @@ dependencies = [ "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-std 0.1.0", + "substrate-primitives 0.1.0", ] [[package]] @@ -561,6 +926,77 @@ name = "static_assertions" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "substrate-client" +version = "0.1.0" +dependencies = [ + "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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0", + "sr-std 0.1.0", + "sr-version 0.1.0", + "substrate-consensus-common 0.1.0", + "substrate-executor 0.1.0", + "substrate-keyring 0.1.0", + "substrate-primitives 0.1.0", + "substrate-state-machine 0.1.0", + "substrate-telemetry 0.3.0", + "substrate-trie 0.4.0", +] + +[[package]] +name = "substrate-consensus-common" +version = "0.1.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)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0", + "sr-version 0.1.0", + "substrate-primitives 0.1.0", + "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "substrate-executor" +version = "0.1.0" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 0.1.0", + "sr-version 0.1.0", + "substrate-primitives 0.1.0", + "substrate-serializer 0.1.0", + "substrate-state-machine 0.1.0", + "substrate-trie 0.4.0", + "wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "substrate-keyring" +version = "0.1.0" +dependencies = [ + "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-primitives 0.1.0", +] + [[package]] name = "substrate-primitives" version = "0.1.0" @@ -586,6 +1022,14 @@ dependencies = [ "wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "substrate-serializer" +version = "0.1.0" +dependencies = [ + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-state-machine" version = "0.1.0" @@ -602,6 +1046,20 @@ dependencies = [ "trie-root 0.9.0 (git+https://github.com/paritytech/trie)", ] +[[package]] +name = "substrate-telemetry" +version = "0.3.0" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-test-runtime" version = "0.1.0" @@ -610,12 +1068,12 @@ dependencies = [ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 0.1.0", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", "sr-version 0.1.0", "srml-support 0.1.0", + "substrate-client 0.1.0", "substrate-primitives 0.1.0", ] @@ -650,6 +1108,182 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-fs" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.5.0 (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.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.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.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (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.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "trie-db" version = "0.9.0" @@ -687,6 +1321,19 @@ dependencies = [ "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -705,6 +1352,21 @@ name = "untrusted" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vcpkg" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "version_check" version = "0.1.5" @@ -726,6 +1388,11 @@ dependencies = [ "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.6" @@ -735,6 +1402,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -745,52 +1417,115 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ws" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" +"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" +"checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" +"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" +"checksum crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3486aefc4c0487b9cb52372c97df0a48b8c249514af1ee99703bf70d2f2ceda1" "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" +"checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" +"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb" "checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" +"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum fixed-hash 0.3.0-beta.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e71c99c903a9fe54baed1bc701b43daba8c6dc6d4aec89a32f667ab6b3094c4" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" "checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" +"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea155abb3ba6f382a75f1418988c05fe82959ed9ce727de427f9cfd425b0c903" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72ae89206cea31c32014b39d5a454b96135894221610dbfd19cf4d2d044fa546" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum mashup 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d886e371548f5c66258a99df9ec03366bff02cc96ea3d3f8f346b5d2d6836de7" "checksum mashup-impl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8d426741e35fab52542d84dfee615f442c2b37247bee8b1ed5c25ca723487580" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum nan-preserving-float 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34d4f00fcc2f4c9efa8cc971db0da9e28290e28e97af47585e48691ef10ff31f" +"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" +"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" "checksum parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dca389ea5e1632c89b2ce54f7e2b4a8a8c9d278042222a91e0bf95451218cb4c" "checksum parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffa42c2cb493b60b12c75b26e8c94cb734af4df4d7f2cc229dc04c1953dac189" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" +"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" "checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901" @@ -800,29 +1535,62 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" "checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" +"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c" +"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "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 serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9" "checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe" +"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" +"checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" +"checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddd14b8df2df39378b3e933c79784350bf715b11444d99f903df0253bbe524e5" +"checksum slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "053344c94c0e2b22da6305efddb698d7c485809427cf40555dc936085f67a9df" "checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" "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 syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" "checksum syn 0.15.6 (registry+https://github.com/rust-lang/crates.io-index)" = "854b08a640fc8f54728fb95321e3ec485b365a97fe47609797c671addd1dde69" +"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" +"checksum tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6e93c78d23cc61aa245a8acd2c4a79c4d7fa7fb5c3ca90d5737029f043a84895" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f90fcd90952f0a496d438a976afba8e5c205fb12123f813d8ab3aa1c8436638c" +"checksum tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c117b6cf86bb730aab4834f10df96e4dd586eff2c3c27d3781348da49e255bde" +"checksum tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "60ae25f6b17d25116d2cba342083abe5255d3c2c79cb21ea11aa049c53bf7c75" +"checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21" +"checksum tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4b26fd37f1125738b2170c80b551f69ff6fecb277e6e5ca885e53eec2b005018" +"checksum tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad235e9dadd126b2d47f6736f65aa1fdcd6420e66ca63f44177bc78df89f912" +"checksum tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3929aee321c9220ed838ed6c3928be7f9b69986b0e3c22c972a66dbf8a298c68" +"checksum tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3a52f00c97fedb6d535d27f65cccb7181c8dd4c6edc3eda9ea93f6d45d05168e" +"checksum tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "da941144b816d0dcda4db3a1ba87596e4df5e860a72b70783fe435891f80601c" +"checksum tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df195376b43508f01570bacc73e13a1de0854dc59e79d1ec09913e8db6dd2a70" "checksum trie-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum trie-root 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum twox-hash 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f85be565a110ed72ed7048cf56570db04ce0a592c98aa59b7dacde3e5718750" "checksum uint 0.5.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4630460173a57c0af94b8306091e018025d988473f641a4af754b6cde980e1e3" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d184c4b7081f30316f74f8d73c197314dcb56ea7af9323522b42a2fa9cb19453" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/core/test-runtime/wasm/Cargo.toml b/core/test-runtime/wasm/Cargo.toml index f606a6b300a50..02b97a2c7e9b0 100644 --- a/core/test-runtime/wasm/Cargo.toml +++ b/core/test-runtime/wasm/Cargo.toml @@ -9,7 +9,7 @@ hex-literal = { version = "0.1.0", optional = true } parity-codec = { version = "2.1", default-features = false } parity-codec-derive = { version = "2.1", default-features = false } substrate-primitives = { path = "../../primitives", default-features = false } -sr-api = { path = "../../sr-api", default-features = false } +substrate-client = { path = "../../client", default-features = false } sr-std = { path = "../../sr-std", default-features = false } sr-io = { path = "../../sr-io", default-features = false } sr-version = { path = "../../sr-version", default-features = false } @@ -22,12 +22,12 @@ std = [ "log", "hex-literal", "parity-codec/std", - "sr-api/std", "sr-std/std", "sr-io/std", "srml-support/std", "sr-version/std", "substrate-primitives/std", + "substrate-client/std", "sr-primitives/std" ] diff --git a/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm b/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm index c526eacd1f6de..76ec888e142ae 100644 Binary files a/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm and b/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm differ diff --git a/core/transaction-pool/src/api.rs b/core/transaction-pool/src/api.rs index a8cb3ada50b50..a29010b50c8c1 100644 --- a/core/transaction-pool/src/api.rs +++ b/core/transaction-pool/src/api.rs @@ -18,8 +18,9 @@ use std::{ sync::Arc, + marker::PhantomData, }; -use client::{self, runtime_api::TaggedTransactionQueue}; +use client::{runtime_api::TaggedTransactionQueue, blockchain::HeaderBackend}; use parity_codec::Encode; use txpool; use substrate_primitives::{ @@ -36,30 +37,34 @@ use sr_primitives::{ use error; /// The transaction pool logic -pub struct ChainApi { - client: Arc>, +pub struct ChainApi { + client: Arc, + _marker: PhantomData, } -impl ChainApi { +impl ChainApi where + Block: traits::Block, + T: traits::ProvideRuntimeApi + HeaderBackend { /// Create new transaction pool logic. - pub fn new(client: Arc>) -> Self { + pub fn new(client: Arc) -> Self { ChainApi { client, + _marker: Default::default() } } } -impl txpool::ChainApi for ChainApi where +impl txpool::ChainApi for ChainApi where Block: traits::Block, - B: client::backend::Backend + Send + Sync + 'static, - E: client::CallExecutor + Send + Sync + Clone + 'static, + T: traits::ProvideRuntimeApi + HeaderBackend, + T::Api: TaggedTransactionQueue { type Block = Block; type Hash = H256; type Error = error::Error; fn validate_transaction(&self, at: &BlockId, uxt: &txpool::ExtrinsicFor) -> error::Result { - Ok(self.client.validate_transaction(at, uxt)?) + Ok(self.client.runtime_api().validate_transaction(at, uxt)?) } // TODO [toDr] Use proper lbock number type diff --git a/node/cli/src/lib.rs b/node/cli/src/lib.rs index 078ee5e143714..8a56e2edfa296 100644 --- a/node/cli/src/lib.rs +++ b/node/cli/src/lib.rs @@ -33,6 +33,7 @@ extern crate substrate_transaction_pool as transaction_pool; #[macro_use] extern crate substrate_network as network; extern crate substrate_consensus_aura as consensus; +extern crate substrate_client as client; extern crate node_primitives; #[macro_use] extern crate substrate_service; @@ -49,6 +50,7 @@ mod service; use tokio::runtime::Runtime; pub use cli::{VersionInfo, IntoExit}; use substrate_service::{ServiceFactory, Roles as ServiceRoles}; +use std::ops::Deref; /// The chain specification option. #[derive(Clone, Debug)] @@ -118,12 +120,13 @@ pub fn run(args: I, exit: E, version: cli::VersionInfo) -> error::Resul Ok(()) } -fn run_until_exit( +fn run_until_exit( runtime: &mut Runtime, - service: service::Service, + service: T, e: E, ) -> error::Result<()> where + T: Deref>, C: substrate_service::Components, E: IntoExit, { diff --git a/node/cli/src/service.rs b/node/cli/src/service.rs index d02ea48767b19..820c1dee26c8f 100644 --- a/node/cli/src/service.rs +++ b/node/cli/src/service.rs @@ -20,8 +20,8 @@ use std::sync::Arc; use transaction_pool::{self, txpool::{Pool as TransactionPool}}; +use node_runtime::{GenesisConfig, ClientWithApi}; use node_primitives::Block; -use node_runtime::GenesisConfig; use substrate_service::{ FactoryFullConfiguration, LightComponents, FullComponents, FullBackend, FullClient, LightClient, LightBackend, FullExecutor, LightExecutor, @@ -29,6 +29,7 @@ use substrate_service::{ }; use node_executor; use consensus::{import_queue, start_aura, Config as AuraConfig, AuraImportQueue}; +use client; const AURA_SLOT_DURATION: u64 = 6; @@ -37,23 +38,22 @@ construct_simple_protocol! { pub struct NodeProtocol where Block = Block { } } -construct_simple_service!(Service); - construct_service_factory! { struct Factory { Block = Block, + RuntimeApi = ClientWithApi, NetworkProtocol = NodeProtocol { |config| Ok(NodeProtocol::new()) }, RuntimeDispatch = node_executor::Executor, - FullTransactionPoolApi = transaction_pool::ChainApi, FullExecutor, Block> + FullTransactionPoolApi = transaction_pool::ChainApi, FullExecutor, Block, ClientWithApi>, Block> { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) }, - LightTransactionPoolApi = transaction_pool::ChainApi, LightExecutor, Block> + LightTransactionPoolApi = transaction_pool::ChainApi, LightExecutor, Block, ClientWithApi>, Block> { |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) }, Genesis = GenesisConfig, Configuration = (), - FullService = Service> + FullService = FullComponents { |config: FactoryFullConfiguration, executor: TaskExecutor| { let is_auth = config.roles == Roles::AUTHORITY; - Service::>::new(config, executor.clone()).map(move |service|{ + FullComponents::::new(config, executor.clone()).map(move |service|{ if is_auth { if let Ok(Some(Ok(key))) = service.keystore().contents() .map(|keys| keys.get(0).map(|k| service.keystore().load(k, ""))) @@ -77,18 +77,20 @@ construct_service_factory! { }) } }, - LightService = Service> - { |config, executor| Service::>::new(config, executor) }, + LightService = LightComponents + { |config, executor| >::new(config, executor) }, FullImportQueue = AuraImportQueue> { |config, client| Ok(import_queue(AuraConfig { local_key: None, slot_duration: 5 }, client)) }, LightImportQueue = AuraImportQueue> - { |config, client| Ok(import_queue(AuraConfig { - local_key: None, - slot_duration: 5 - }, client)) }, + { |config, client| Ok( + import_queue(AuraConfig { + local_key: None, + slot_duration: 5 + }, client)) + }, } } diff --git a/node/runtime/Cargo.toml b/node/runtime/Cargo.toml index 6c86355b255eb..1f6ccad0c31fa 100644 --- a/node/runtime/Cargo.toml +++ b/node/runtime/Cargo.toml @@ -11,10 +11,10 @@ serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default-features = false } parity-codec = "2.1" parity-codec-derive = "2.1" -sr-api = { path = "../../core/sr-api", default-features = false } sr-std = { path = "../../core/sr-std" } srml-support = { path = "../../srml/support" } substrate-primitives = { path = "../../core/primitives" } +substrate-client = { path = "../../core/client", optional = true } substrate-keyring = { path = "../../core/keyring" } srml-balances = { path = "../../srml/balances" } srml-consensus = { path = "../../srml/consensus" } @@ -37,7 +37,6 @@ default = ["std"] std = [ "parity-codec/std", "substrate-primitives/std", - "sr-api/std", "sr-std/std", "srml-support/std", "srml-balances/std", @@ -57,5 +56,6 @@ std = [ "node-primitives/std", "serde_derive", "serde/std", - "safe-mix/std" + "safe-mix/std", + "substrate-client", ] diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index 8a982b9ff8ddc..84ffbb4ab082c 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -20,9 +20,6 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit="256"] -#[macro_use] -extern crate sr_api as runtime_api; - #[macro_use] extern crate srml_support; @@ -35,9 +32,14 @@ extern crate serde_derive; extern crate substrate_primitives; +#[macro_use] +extern crate substrate_client as client; + #[macro_use] extern crate parity_codec_derive; +extern crate parity_codec as codec; + extern crate sr_std as rstd; extern crate srml_balances as balances; extern crate srml_consensus as consensus; @@ -55,23 +57,33 @@ extern crate srml_upgrade_key as upgrade_key; extern crate sr_version as version; extern crate node_primitives; +#[cfg(feature = "std")] +use codec::{Encode, Decode}; use rstd::prelude::*; use substrate_primitives::u32_trait::{_2, _4}; use node_primitives::{ - AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, - SessionKey, Signature + AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, SessionKey, Signature }; -use runtime_api::{runtime::*, id::*}; +#[cfg(feature = "std")] +use node_primitives::Block as GBlock; +use client::{block_builder::api::runtime::*, runtime_api::{runtime::*, id::*}}; +#[cfg(feature = "std")] +use client::runtime_api::ApiExt; use runtime_primitives::ApplyResult; use runtime_primitives::transaction_validity::TransactionValidity; use runtime_primitives::generic; use runtime_primitives::traits::{Convert, BlakeTwo256, Block as BlockT}; +#[cfg(feature = "std")] +use runtime_primitives::traits::ApiRef; +#[cfg(feature = "std")] +use substrate_primitives::AuthorityId; use version::RuntimeVersion; use council::{motions as council_motions, voting as council_voting}; #[cfg(feature = "std")] use council::seats as council_seats; #[cfg(any(feature = "std", test))] use version::NativeVersion; +use substrate_primitives::OpaqueMetadata; #[cfg(any(feature = "std", test))] pub use runtime_primitives::BuildStorage; @@ -236,8 +248,155 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = executive::Executive, Balances, AllModules>; -impl_apis! { - impl Core for Runtime { +#[cfg(feature = "std")] +pub struct ClientWithApi { + call: ::std::ptr::NonNull>, + commit_on_success: ::std::cell::RefCell, + initialised_block: ::std::cell::RefCell>, + changes: ::std::cell::RefCell, +} + +#[cfg(feature = "std")] +unsafe impl Send for ClientWithApi {} +#[cfg(feature = "std")] +unsafe impl Sync for ClientWithApi {} + +#[cfg(feature = "std")] +impl ApiExt for ClientWithApi { + fn map_api_result Result, R, E>(&self, map_call: F) -> Result { + *self.commit_on_success.borrow_mut() = false; + let res = map_call(self); + *self.commit_on_success.borrow_mut() = true; + + self.commit_on_ok(&res); + + res + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::ConstructRuntimeApi for ClientWithApi { + fn construct_runtime_api<'a, T: client::runtime_api::CallApiAt>(call: &'a T) -> ApiRef<'a, Self> { + ClientWithApi { + call: unsafe { + ::std::ptr::NonNull::new_unchecked( + ::std::mem::transmute( + call as &client::runtime_api::CallApiAt + ) + ) + }, + commit_on_success: true.into(), + initialised_block: None.into(), + changes: Default::default(), + }.into() + } +} + +#[cfg(feature = "std")] +impl ClientWithApi { + fn call_api_at( + &self, + at: &GBlockId, + function: &'static str, + args: &A + ) -> client::error::Result { + let res = unsafe { + self.call.as_ref().call_api_at( + at, + function, + args.encode(), + &mut *self.changes.borrow_mut(), + &mut *self.initialised_block.borrow_mut() + ).and_then(|r| + R::decode(&mut &r[..]) + .ok_or_else(|| + client::error::ErrorKind::CallResultDecode(function).into() + ) + ) + }; + + self.commit_on_ok(&res); + res + } + + fn commit_on_ok(&self, res: &Result) { + if *self.commit_on_success.borrow() { + if res.is_err() { + self.changes.borrow_mut().discard_prospective(); + } else { + self.changes.borrow_mut().commit_prospective(); + } + } + } +} + +#[cfg(feature = "std")] +type GBlockId = generic::BlockId; + +#[cfg(feature = "std")] +impl client::runtime_api::Core for ClientWithApi { + fn version(&self, at: &GBlockId) -> Result { + self.call_api_at(at, "version", &()) + } + + fn authorities(&self, at: &GBlockId) -> Result, client::error::Error> { + self.call_api_at(at, "authorities", &()) + } + + fn execute_block(&self, at: &GBlockId, block: &GBlock) -> Result<(), client::error::Error> { + self.call_api_at(at, "execute_block", block) + } + + fn initialise_block(&self, at: &GBlockId, header: &::Header) -> Result<(), client::error::Error> { + self.call_api_at(at, "initialise_block", header) + } +} + +#[cfg(feature = "std")] +impl client::block_builder::api::BlockBuilder for ClientWithApi { + fn apply_extrinsic(&self, at: &GBlockId, extrinsic: &::Extrinsic) -> Result { + self.call_api_at(at, "apply_extrinsic", extrinsic) + } + + fn finalise_block(&self, at: &GBlockId) -> Result<::Header, client::error::Error> { + self.call_api_at(at, "finalise_block", &()) + } + + fn inherent_extrinsics( + &self, at: &GBlockId, inherent: &Inherent + ) -> Result, client::error::Error> { + self.call_api_at(at, "inherent_extrinsics", inherent) + } + + fn check_inherents(&self, at: &GBlockId, block: &GBlock, inherent: &Inherent) -> Result, client::error::Error> { + self.call_api_at(at, "check_inherents", &(block, inherent)) + } + + fn random_seed(&self, at: &GBlockId) -> Result<::Hash, client::error::Error> { + self.call_api_at(at, "random_seed", &()) + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::TaggedTransactionQueue for ClientWithApi { + fn validate_transaction( + &self, + at: &GBlockId, + utx: &::Extrinsic + ) -> Result { + self.call_api_at(at, "validate_transaction", utx) + } +} + +#[cfg(feature = "std")] +impl client::runtime_api::Metadata for ClientWithApi { + fn metadata(&self, at: &GBlockId) -> Result { + self.call_api_at(at, "metadata", &()) + } +} + +impl_runtime_apis! { + impl Core for Runtime { fn version() -> RuntimeVersion { VERSION } @@ -249,19 +408,19 @@ impl_apis! { fn execute_block(block: Block) { Executive::execute_block(block) } - } - impl Metadata for Runtime { - fn metadata() -> RuntimeMetadata { - Runtime::metadata() + fn initialise_block(header: ::Header) { + Executive::initialise_block(&header) } } - impl BlockBuilder for Runtime { - fn initialise_block(header: ::Header) { - Executive::initialise_block(&header) + impl Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() } + } + impl BlockBuilder for Runtime { fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { Executive::apply_extrinsic(extrinsic) } @@ -283,7 +442,7 @@ impl_apis! { } } - impl TaggedTransactionQueue for Runtime { + impl TaggedTransactionQueue for Runtime { fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { Executive::validate_transaction(tx) } diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index 85a0109be8c1c..bb067bc400216 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -6,6 +6,27 @@ dependencies = [ "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "backtrace" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "base58" version = "0.1.0" @@ -30,11 +51,35 @@ name = "byteorder" version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bytes" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -48,6 +93,11 @@ name = "constant_time_eq" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "crossbeam" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crossbeam-deque" version = "0.2.0" @@ -57,6 +107,15 @@ dependencies = [ "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-deque" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-epoch" version = "0.3.1" @@ -71,6 +130,19 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-epoch" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-utils" version = "0.2.2" @@ -79,6 +151,11 @@ dependencies = [ "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-utils" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crunchy" version = "0.1.6" @@ -102,6 +179,14 @@ name = "environmental" version = "1.0.0" source = "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.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fixed-hash" version = "0.3.0-beta.3" @@ -115,6 +200,24 @@ dependencies = [ "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -129,6 +232,11 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "gcc" version = "0.3.54" @@ -172,11 +280,58 @@ dependencies = [ "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "httparse" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "integer-sqrt" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kvdb" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "0.2.11" @@ -190,11 +345,25 @@ dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lazycell" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lock_api" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.3.9" @@ -229,6 +398,11 @@ dependencies = [ "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "memoffset" version = "0.2.1" @@ -248,11 +422,71 @@ name = "memory_units" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-extras" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nan-preserving-float" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "net2" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "node-primitives" version = "0.1.0" @@ -275,7 +509,6 @@ dependencies = [ "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", "sr-version 0.1.0", @@ -292,6 +525,7 @@ dependencies = [ "srml-timestamp 0.1.0", "srml-treasury 0.1.0", "srml-upgrade-key 0.1.0", + "substrate-client 0.1.0", "substrate-primitives 0.1.0", ] @@ -300,6 +534,14 @@ name = "nodrop" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "num-integer" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-traits" version = "0.2.6" @@ -313,6 +555,30 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "openssl" +version = "0.10.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl-sys" +version = "0.9.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "owning_ref" version = "0.3.3" @@ -321,6 +587,11 @@ dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-bytes" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "parity-codec" version = "2.1.5" @@ -357,6 +628,15 @@ dependencies = [ "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.2.14" @@ -368,6 +648,28 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro-hack" version = "0.4.1" @@ -453,6 +755,11 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_syscall" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ring" version = "0.12.1" @@ -465,6 +772,11 @@ dependencies = [ "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc-demangle" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc-hex" version = "2.0.1" @@ -478,6 +790,11 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ryu" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "safe-mix" version = "1.0.0" @@ -520,21 +837,67 @@ dependencies = [ ] [[package]] -name = "smallvec" -version = "0.6.5" +name = "serde_json" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sr-api" -version = "0.1.0" +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slab" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slog" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slog-async" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0", - "sr-std 0.1.0", - "sr-version 0.1.0", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-json" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-scope" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -710,6 +1073,8 @@ dependencies = [ "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-std 0.1.0", + "substrate-primitives 0.1.0", ] [[package]] @@ -845,6 +1210,68 @@ name = "static_assertions" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "substrate-client" +version = "0.1.0" +dependencies = [ + "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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0", + "sr-std 0.1.0", + "sr-version 0.1.0", + "substrate-consensus-common 0.1.0", + "substrate-executor 0.1.0", + "substrate-keyring 0.1.0", + "substrate-primitives 0.1.0", + "substrate-state-machine 0.1.0", + "substrate-telemetry 0.3.0", + "substrate-trie 0.4.0", +] + +[[package]] +name = "substrate-consensus-common" +version = "0.1.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)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0", + "sr-version 0.1.0", + "substrate-primitives 0.1.0", + "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "substrate-executor" +version = "0.1.0" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 0.1.0", + "sr-version 0.1.0", + "substrate-primitives 0.1.0", + "substrate-serializer 0.1.0", + "substrate-state-machine 0.1.0", + "substrate-trie 0.4.0", + "wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-keyring" version = "0.1.0" @@ -879,6 +1306,14 @@ dependencies = [ "wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "substrate-serializer" +version = "0.1.0" +dependencies = [ + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-state-machine" version = "0.1.0" @@ -895,6 +1330,20 @@ dependencies = [ "trie-root 0.9.0 (git+https://github.com/paritytech/trie)", ] +[[package]] +name = "substrate-telemetry" +version = "0.3.0" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-trie" version = "0.4.0" @@ -926,6 +1375,182 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-fs" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.5.0 (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.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.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.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (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.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "trie-db" version = "0.9.0" @@ -963,6 +1588,19 @@ dependencies = [ "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -981,6 +1619,21 @@ name = "untrusted" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vcpkg" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "version_check" version = "0.1.5" @@ -1002,6 +1655,11 @@ dependencies = [ "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.6" @@ -1011,6 +1669,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1021,52 +1684,115 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ws" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" +"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" +"checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" +"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" +"checksum crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3486aefc4c0487b9cb52372c97df0a48b8c249514af1ee99703bf70d2f2ceda1" "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" +"checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" +"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb" "checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" +"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum fixed-hash 0.3.0-beta.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e71c99c903a9fe54baed1bc701b43daba8c6dc6d4aec89a32f667ab6b3094c4" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" "checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" +"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea155abb3ba6f382a75f1418988c05fe82959ed9ce727de427f9cfd425b0c903" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72ae89206cea31c32014b39d5a454b96135894221610dbfd19cf4d2d044fa546" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum mashup 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d886e371548f5c66258a99df9ec03366bff02cc96ea3d3f8f346b5d2d6836de7" "checksum mashup-impl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8d426741e35fab52542d84dfee615f442c2b37247bee8b1ed5c25ca723487580" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum nan-preserving-float 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34d4f00fcc2f4c9efa8cc971db0da9e28290e28e97af47585e48691ef10ff31f" +"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" +"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" "checksum parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dca389ea5e1632c89b2ce54f7e2b4a8a8c9d278042222a91e0bf95451218cb4c" "checksum parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffa42c2cb493b60b12c75b26e8c94cb734af4df4d7f2cc229dc04c1953dac189" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" +"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" "checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901" @@ -1077,30 +1803,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" "checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" +"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c" +"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" "checksum safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f7bf422d23a88c16d5090d455f182bc99c60af4df6a345c63428acf5129e347" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "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 serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9" "checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe" +"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" +"checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" +"checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddd14b8df2df39378b3e933c79784350bf715b11444d99f903df0253bbe524e5" +"checksum slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "053344c94c0e2b22da6305efddb698d7c485809427cf40555dc936085f67a9df" "checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" "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 syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" "checksum syn 0.15.6 (registry+https://github.com/rust-lang/crates.io-index)" = "854b08a640fc8f54728fb95321e3ec485b365a97fe47609797c671addd1dde69" +"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" +"checksum tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6e93c78d23cc61aa245a8acd2c4a79c4d7fa7fb5c3ca90d5737029f043a84895" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f90fcd90952f0a496d438a976afba8e5c205fb12123f813d8ab3aa1c8436638c" +"checksum tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c117b6cf86bb730aab4834f10df96e4dd586eff2c3c27d3781348da49e255bde" +"checksum tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "60ae25f6b17d25116d2cba342083abe5255d3c2c79cb21ea11aa049c53bf7c75" +"checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21" +"checksum tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4b26fd37f1125738b2170c80b551f69ff6fecb277e6e5ca885e53eec2b005018" +"checksum tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad235e9dadd126b2d47f6736f65aa1fdcd6420e66ca63f44177bc78df89f912" +"checksum tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3929aee321c9220ed838ed6c3928be7f9b69986b0e3c22c972a66dbf8a298c68" +"checksum tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3a52f00c97fedb6d535d27f65cccb7181c8dd4c6edc3eda9ea93f6d45d05168e" +"checksum tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "da941144b816d0dcda4db3a1ba87596e4df5e860a72b70783fe435891f80601c" +"checksum tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df195376b43508f01570bacc73e13a1de0854dc59e79d1ec09913e8db6dd2a70" "checksum trie-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum trie-root 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum twox-hash 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f85be565a110ed72ed7048cf56570db04ce0a592c98aa59b7dacde3e5718750" "checksum uint 0.5.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4630460173a57c0af94b8306091e018025d988473f641a4af754b6cde980e1e3" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d184c4b7081f30316f74f8d73c197314dcb56ea7af9323522b42a2fa9cb19453" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/node/runtime/wasm/Cargo.toml b/node/runtime/wasm/Cargo.toml index 17ae789bdfc64..9e74ff9d5d126 100644 --- a/node/runtime/wasm/Cargo.toml +++ b/node/runtime/wasm/Cargo.toml @@ -8,11 +8,11 @@ crate-type = ["cdylib"] [dependencies] integer-sqrt = { version = "0.1.2" } -safe-mix = { version = "1.0", default-features = false} +safe-mix = { version = "1.0", default-features = false } parity-codec-derive = { version = "2.1" } parity-codec = { version = "2.1", default-features = false } substrate-primitives = { path = "../../../core/primitives", default-features = false } -sr-api = { path = "../../../core/sr-api", default-features = false } +substrate-client = { path = "../../../core/client", default-features = false } sr-std = { path = "../../../core/sr-std", default-features = false } srml-support = { path = "../../../srml/support", default-features = false } srml-balances = { path = "../../../srml/balances", default-features = false } @@ -37,7 +37,7 @@ std = [ "safe-mix/std", "parity-codec/std", "substrate-primitives/std", - "sr-api/std", + "substrate-client/std", "sr-std/std", "srml-support/std", "srml-balances/std", diff --git a/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm b/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm index aafdeedceb1d9..766de4bda344e 100644 Binary files a/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm and b/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm differ diff --git a/srml/metadata/Cargo.toml b/srml/metadata/Cargo.toml index 24f0a21b33533..d442a5e225d11 100644 --- a/srml/metadata/Cargo.toml +++ b/srml/metadata/Cargo.toml @@ -8,12 +8,16 @@ parity-codec = { version = "2.1", default-features = false } parity-codec-derive = { version = "2.1", default-features = false } serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } +sr-std = { path = "../../core/sr-std", default-features = false } +substrate-primitives = { path = "../../core/primitives", default-features = false } [features] default = ["std"] std = [ "parity-codec/std", "parity-codec-derive/std", + "sr-std/std", + "substrate-primitives/std", "serde", "serde_derive" ] diff --git a/srml/metadata/src/lib.rs b/srml/metadata/src/lib.rs index ea722a705e476..0809531a9f8fe 100644 --- a/srml/metadata/src/lib.rs +++ b/srml/metadata/src/lib.rs @@ -21,14 +21,12 @@ //! codec-encoded metadata. #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(not(feature = "std"), feature(alloc))] - -#[cfg(not(feature = "std"))] -extern crate alloc; #[macro_use] extern crate parity_codec_derive; extern crate parity_codec as codec; +extern crate sr_std as rstd; +extern crate substrate_primitives as primitives; #[cfg(feature = "std")] extern crate serde; @@ -36,17 +34,10 @@ extern crate serde; #[macro_use] extern crate serde_derive; -#[cfg(feature = "std")] -pub mod alloc { - pub use std::vec; -} - use codec::{Encode, Output}; #[cfg(feature = "std")] use codec::{Decode, Input}; - -// Make Vec available on `std` and `no_std` -use alloc::vec::Vec; +use rstd::vec::Vec; #[cfg(feature = "std")] type StringBuf = String; @@ -294,3 +285,9 @@ pub struct RuntimeMetadata { pub modules: DecodeDifferentArray, pub outer_dispatch: OuterDispatchMetadata, } + +impl Into for RuntimeMetadata { + fn into(self) -> primitives::OpaqueMetadata { + primitives::OpaqueMetadata::new(self.encode()) + } +}