From 0c1674b0831b64944b9fe5386ca15233ce4c8fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 24 Apr 2019 11:05:22 +0200 Subject: [PATCH 001/229] Forward port blake2 storage support (#2360) * move storage maps to blake2_128 (#2268) * remove default hash, introduce twox_128 and blake2 * use blake2_128 & create ext_blake2_128 * refactor code * add benchmark * factorize generator * fix * parameterizable hasher * some fix * fix * fix * fix * metadata * fix * remove debug print * map -> blake2_256 * fix test * fix test * Apply suggestions from code review Co-Authored-By: thiolliere * impl twox 128 concat (#2353) * impl twox_128_concat * comment addressed * fix * impl twox_128->64_concat * fix test * Fix compilation and cleanup some docs * Apply suggestions from code review Co-Authored-By: bkchr --- core/client/src/client.rs | 14 +- core/client/src/light/fetcher.rs | 6 +- core/executor/src/wasm_executor.rs | 55 ++- core/executor/wasm/src/lib.rs | 3 +- core/primitives/Cargo.toml | 6 +- core/primitives/benches/benches.rs | 60 +++ core/primitives/src/hashing.rs | 17 + core/primitives/src/lib.rs | 2 +- core/rpc/src/state/tests.rs | 6 +- core/sr-io/with_std.rs | 4 +- core/sr-io/without_std.rs | 20 + core/sr-primitives/src/lib.rs | 8 - core/test-runtime/src/genesismap.rs | 4 +- core/test-runtime/src/system.rs | 24 +- core/test-runtime/wasm/Cargo.lock | 6 +- node-template/runtime/wasm/Cargo.lock | 1 + node/executor/src/lib.rs | 26 +- node/runtime/src/lib.rs | 2 +- node/runtime/wasm/Cargo.lock | 1 + srml/executive/src/lib.rs | 2 +- srml/indices/src/lib.rs | 15 +- srml/metadata/src/lib.rs | 21 +- srml/support/Cargo.toml | 4 +- srml/support/procedural/src/storage/impls.rs | 138 ++++--- srml/support/procedural/src/storage/mod.rs | 76 +++- .../procedural/src/storage/transformation.rs | 93 ++--- srml/support/procedural/tools/src/syn_ext.rs | 2 +- srml/support/src/event.rs | 39 +- srml/support/src/hashable.rs | 15 +- srml/support/src/lib.rs | 24 +- srml/support/src/metadata.rs | 14 +- srml/support/src/storage/child.rs | 0 srml/support/src/storage/hashed/generator.rs | 285 +++++++++++++++ srml/support/src/storage/hashed/mod.rs | 223 ++++++++++++ srml/support/src/storage/mod.rs | 251 ++----------- .../{generator.rs => storage_items.rs} | 341 ++++-------------- .../support/src/storage/unhashed/generator.rs | 23 +- srml/support/src/storage/unhashed/mod.rs | 2 +- 38 files changed, 1101 insertions(+), 732 deletions(-) create mode 100644 core/primitives/benches/benches.rs create mode 100644 srml/support/src/storage/child.rs create mode 100644 srml/support/src/storage/hashed/generator.rs create mode 100644 srml/support/src/storage/hashed/mod.rs rename srml/support/src/storage/{generator.rs => storage_items.rs} (72%) diff --git a/core/client/src/client.rs b/core/client/src/client.rs index 099255bdf5..2b4465f19c 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -1536,7 +1536,7 @@ impl backend::AuxStore for Client pub(crate) mod tests { use std::collections::HashMap; use super::*; - use primitives::twox_128; + use primitives::blake2_256; use runtime_primitives::traits::DigestItem as DigestItemT; use runtime_primitives::generic::DigestItem; use test_client::{self, TestClient, AccountKeyring}; @@ -1586,12 +1586,12 @@ pub(crate) mod tests { } // prepare test cases - let alice = twox_128(&runtime::system::balance_of_key(AccountKeyring::Alice.into())).to_vec(); - let bob = twox_128(&runtime::system::balance_of_key(AccountKeyring::Bob.into())).to_vec(); - let charlie = twox_128(&runtime::system::balance_of_key(AccountKeyring::Charlie.into())).to_vec(); - let dave = twox_128(&runtime::system::balance_of_key(AccountKeyring::Dave.into())).to_vec(); - let eve = twox_128(&runtime::system::balance_of_key(AccountKeyring::Eve.into())).to_vec(); - let ferdie = twox_128(&runtime::system::balance_of_key(AccountKeyring::Ferdie.into())).to_vec(); + let alice = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into())).to_vec(); + let bob = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Bob.into())).to_vec(); + let charlie = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Charlie.into())).to_vec(); + let dave = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Dave.into())).to_vec(); + let eve = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Eve.into())).to_vec(); + let ferdie = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Ferdie.into())).to_vec(); let test_cases = vec![ (1, 4, alice.clone(), vec![(4, 0), (1, 0)]), (1, 3, alice.clone(), vec![(1, 0)]), diff --git a/core/client/src/light/fetcher.rs b/core/client/src/light/fetcher.rs index 3f724c31c4..28df2f8bff 100644 --- a/core/client/src/light/fetcher.rs +++ b/core/client/src/light/fetcher.rs @@ -404,7 +404,7 @@ pub mod tests { use crate::light::fetcher::{Fetcher, FetchChecker, LightDataChecker, RemoteCallRequest, RemoteHeaderRequest}; use crate::light::blockchain::tests::{DummyStorage, DummyBlockchain}; - use primitives::{twox_128, Blake2Hasher}; + use primitives::{blake2_256, Blake2Hasher}; use primitives::storage::{StorageKey, well_known_keys}; use runtime_primitives::generic::BlockId; use state_machine::Backend; @@ -587,7 +587,7 @@ pub mod tests { // we're testing this test case here: // (1, 4, dave.clone(), vec![(4, 0), (1, 1), (1, 0)]), let (remote_client, remote_roots, _) = prepare_client_with_key_changes(); - let dave = twox_128(&runtime::system::balance_of_key(AccountKeyring::Dave.into())).to_vec(); + let dave = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Dave.into())).to_vec(); let dave = StorageKey(dave); // 'fetch' changes proof from remote node: @@ -699,7 +699,7 @@ pub mod tests { let (remote_client, remote_roots, _) = prepare_client_with_key_changes(); let local_cht_root = cht::compute_root::( 4, 0, remote_roots.iter().cloned().map(|ct| Ok(Some(ct)))).unwrap(); - let dave = twox_128(&runtime::system::balance_of_key(AccountKeyring::Dave.into())).to_vec(); + let dave = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Dave.into())).to_vec(); let dave = StorageKey(dave); // 'fetch' changes proof from remote node: diff --git a/core/executor/src/wasm_executor.rs b/core/executor/src/wasm_executor.rs index ce41d86a18..cc355f6bba 100644 --- a/core/executor/src/wasm_executor.rs +++ b/core/executor/src/wasm_executor.rs @@ -28,7 +28,7 @@ use wasmi::memory_units::{Pages}; use state_machine::{Externalities, ChildStorageKey}; use crate::error::{Error, ErrorKind, Result}; use crate::wasm_utils::UserError; -use primitives::{blake2_256, twox_128, twox_256, ed25519, sr25519, Pair}; +use primitives::{blake2_128, blake2_256, twox_64, twox_128, twox_256, ed25519, sr25519, Pair}; use primitives::hexdisplay::HexDisplay; use primitives::sandbox as sandbox_primitives; use primitives::{H256, Blake2Hasher}; @@ -448,6 +448,30 @@ impl_function_executor!(this: FunctionExecutor<'e, E>, ext_chain_id() -> u64 => { Ok(this.ext.chain_id()) }, + ext_twox_64(data: *const u8, len: u32, out: *mut u8) => { + let result: [u8; 8] = if len == 0 { + let hashed = twox_64(&[0u8; 0]); + debug_trace!(target: "xxhash", "XXhash: '' -> {}", HexDisplay::from(&hashed)); + this.hash_lookup.insert(hashed.to_vec(), vec![]); + hashed + } else { + let key = this.memory.get(data, len as usize).map_err(|_| UserError("Invalid attempt to get key in ext_twox_64"))?; + let hashed_key = twox_64(&key); + debug_trace!(target: "xxhash", "XXhash: {} -> {}", + if let Ok(_skey) = ::std::str::from_utf8(&key) { + _skey + } else { + &format!("{}", HexDisplay::from(&key)) + }, + HexDisplay::from(&hashed_key) + ); + this.hash_lookup.insert(hashed_key.to_vec(), key); + hashed_key + }; + + this.memory.set(out, &result).map_err(|_| UserError("Invalid attempt to set result in ext_twox_64"))?; + Ok(()) + }, ext_twox_128(data: *const u8, len: u32, out: *mut u8) => { let result: [u8; 16] = if len == 0 { let hashed = twox_128(&[0u8; 0]); @@ -481,6 +505,21 @@ impl_function_executor!(this: FunctionExecutor<'e, E>, this.memory.set(out, &result).map_err(|_| UserError("Invalid attempt to set result in ext_twox_256"))?; Ok(()) }, + ext_blake2_128(data: *const u8, len: u32, out: *mut u8) => { + let result: [u8; 16] = if len == 0 { + let hashed = blake2_128(&[0u8; 0]); + this.hash_lookup.insert(hashed.to_vec(), vec![]); + hashed + } else { + let key = this.memory.get(data, len as usize).map_err(|_| UserError("Invalid attempt to get key in ext_blake2_128"))?; + let hashed_key = blake2_128(&key); + this.hash_lookup.insert(hashed_key.to_vec(), key); + hashed_key + }; + + this.memory.set(out, &result).map_err(|_| UserError("Invalid attempt to set result in ext_blake2_128"))?; + Ok(()) + }, ext_blake2_256(data: *const u8, len: u32, out: *mut u8) => { let result: [u8; 32] = if len == 0 { blake2_256(&[0u8; 0]) @@ -940,6 +979,20 @@ mod tests { ); } + #[test] + fn blake2_128_should_work() { + let mut ext = TestExternalities::default(); + let test_code = include_bytes!("../wasm/target/wasm32-unknown-unknown/release/runtime_test.compact.wasm"); + assert_eq!( + WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_blake2_128", &[]).unwrap(), + blake2_128(&b""[..]).encode() + ); + assert_eq!( + WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_blake2_128", b"Hello world!").unwrap(), + blake2_128(&b"Hello world!"[..]).encode() + ); + } + #[test] fn twox_256_should_work() { let mut ext = TestExternalities::default(); diff --git a/core/executor/wasm/src/lib.rs b/core/executor/wasm/src/lib.rs index dda9c61733..294c21d146 100644 --- a/core/executor/wasm/src/lib.rs +++ b/core/executor/wasm/src/lib.rs @@ -7,7 +7,7 @@ use alloc::vec::Vec; use alloc::slice; use runtime_io::{ - set_storage, storage, clear_prefix, print, blake2_256, + set_storage, storage, clear_prefix, print, blake2_128, blake2_256, twox_128, twox_256, ed25519_verify, sr25519_verify, enumerated_trie_root }; @@ -68,6 +68,7 @@ impl_stubs!( input.to_vec() }, test_blake2_256 => |input| blake2_256(input).to_vec(), + test_blake2_128 => |input| blake2_128(input).to_vec(), test_twox_256 => |input| twox_256(input).to_vec(), test_twox_128 => |input| twox_128(input).to_vec(), test_ed25519_verify => |input: &[u8]| { diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 5a8468b436..02133e0655 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -31,8 +31,10 @@ regex = {version = "1.1", optional = true } [dev-dependencies] substrate-serializer = { path = "../serializer" } -pretty_assertions = "0.6.1" -heapsize = "0.4.2" +pretty_assertions = "0.6" +heapsize = "0.4" +hex-literal = "0.1" +rand = "0.6" [features] default = ["std"] diff --git a/core/primitives/benches/benches.rs b/core/primitives/benches/benches.rs new file mode 100644 index 0000000000..b81ef9dc42 --- /dev/null +++ b/core/primitives/benches/benches.rs @@ -0,0 +1,60 @@ +// Copyright 2019 Parity Technologies +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// TODO: Move benchmark to criterion #2354 +#![feature(test)] + +extern crate test; +use hex_literal::{hex, hex_impl}; +use substrate_primitives::hashing::{twox_128, blake2_128}; + + +const MAX_KEY_SIZE: u32 = 32; + +fn data_set() -> Vec> { + use rand::SeedableRng; + use rand::Rng; + + let rnd: [u8; 32] = rand::rngs::StdRng::seed_from_u64(12).gen(); + let mut rnd = rnd.iter().cycle(); + let mut res = Vec::new(); + for size in 1..=MAX_KEY_SIZE { + for _ in 0..1_000 { + let value = (0..size) + .map(|_| rnd.next().unwrap().clone()) + .collect(); + res.push(value); + } + } + res +} + +fn bench_hash_128(b: &mut test::Bencher, f: &Fn(&[u8]) -> [u8; 16]) { + let data_set = data_set(); + b.iter(|| { + for data in &data_set { + let _a = f(data); + } + }); +} + +#[bench] +fn bench_blake2_128(b: &mut test::Bencher) { + bench_hash_128(b, &blake2_128); +} + +#[bench] +fn bench_twox_128(b: &mut test::Bencher) { + bench_hash_128(b, &twox_128); +} diff --git a/core/primitives/src/hashing.rs b/core/primitives/src/hashing.rs index 814048fea8..87312ce6e4 100644 --- a/core/primitives/src/hashing.rs +++ b/core/primitives/src/hashing.rs @@ -55,6 +55,23 @@ pub fn blake2_128(data: &[u8]) -> [u8; 16] { r } +/// Do a XX 64-bit hash and place result in `dest`. +pub fn twox_64_into(data: &[u8], dest: &mut [u8; 8]) { + use ::core::hash::Hasher; + let mut h0 = twox_hash::XxHash::with_seed(0); + h0.write(data); + let r0 = h0.finish(); + use byteorder::{ByteOrder, LittleEndian}; + LittleEndian::write_u64(&mut dest[0..8], r0); +} + +/// Do a XX 64-bit hash and return result. +pub fn twox_64(data: &[u8]) -> [u8; 8] { + let mut r: [u8; 8] = [0; 8]; + twox_64_into(data, &mut r); + r +} + /// Do a XX 128-bit hash and place result in `dest`. pub fn twox_128_into(data: &[u8], dest: &mut [u8; 16]) { use ::core::hash::Hasher; diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index eb309c04a3..97f5480743 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -46,7 +46,7 @@ pub use impl_serde::serialize as bytes; #[cfg(feature = "std")] pub mod hashing; #[cfg(feature = "std")] -pub use hashing::{blake2_256, twox_128, twox_256}; +pub use hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256}; #[cfg(feature = "std")] pub mod hexdisplay; pub mod crypto; diff --git a/core/rpc/src/state/tests.rs b/core/rpc/src/state/tests.rs index 09ef303a64..5cf83921ad 100644 --- a/core/rpc/src/state/tests.rs +++ b/core/rpc/src/state/tests.rs @@ -17,7 +17,7 @@ use super::*; use self::error::{Error, ErrorKind}; -use sr_io::twox_128; +use sr_io::blake2_256; use assert_matches::assert_matches; use consensus::BlockOrigin; use test_client::{self, runtime, AccountKeyring, TestClient, BlockBuilderExt}; @@ -88,7 +88,7 @@ fn should_send_initial_storage_changes_and_notifications() { { let api = State::new(Arc::new(test_client::new()), Subscriptions::new(remote)); - let alice_balance_key = twox_128(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into())); + let alice_balance_key = blake2_256(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into())); api.subscribe_storage(Default::default(), subscriber, Some(vec![ StorageKey(alice_balance_key.to_vec()), @@ -147,7 +147,7 @@ fn should_query_storage() { let block2_hash = add_block(1); let genesis_hash = client.genesis_hash(); - let alice_balance_key = twox_128(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into())); + let alice_balance_key = blake2_256(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into())); let mut expected = vec![ StorageChangeSet { diff --git a/core/sr-io/with_std.rs b/core/sr-io/with_std.rs index bf7147babb..3148cf2842 100644 --- a/core/sr-io/with_std.rs +++ b/core/sr-io/with_std.rs @@ -18,8 +18,8 @@ pub use parity_codec as codec; // re-export hashing functions. pub use primitives::{ - blake2_256, twox_128, twox_256, ed25519, Blake2Hasher, sr25519, - Pair + blake2_128, blake2_256, twox_128, twox_256, twox_64, ed25519, Blake2Hasher, + sr25519, Pair }; pub use tiny_keccak::keccak256 as keccak_256; // Switch to this after PoC-3 diff --git a/core/sr-io/without_std.rs b/core/sr-io/without_std.rs index f4b3c91154..66ad5541df 100644 --- a/core/sr-io/without_std.rs +++ b/core/sr-io/without_std.rs @@ -273,7 +273,9 @@ extern_functions! { /// Hash calculation and verification fn ext_blake2_256_enumerated_trie_root(values_data: *const u8, lens_data: *const u32, lens_len: u32, result: *mut u8); + fn ext_blake2_128(data: *const u8, len: u32, out: *mut u8); fn ext_blake2_256(data: *const u8, len: u32, out: *mut u8); + fn ext_twox_64(data: *const u8, len: u32, out: *mut u8); fn ext_twox_128(data: *const u8, len: u32, out: *mut u8); fn ext_twox_256(data: *const u8, len: u32, out: *mut u8); fn ext_keccak_256(data: *const u8, len: u32, out: *mut u8); @@ -544,6 +546,15 @@ pub fn blake2_256(data: &[u8]) -> [u8; 32] { result } +/// Conduct a 128-bit Blake2 hash. +pub fn blake2_128(data: &[u8]) -> [u8; 16] { + let mut result: [u8; 16] = Default::default(); + unsafe { + ext_blake2_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result +} + /// Conduct a 256-bit Keccak hash. pub fn keccak_256(data: &[u8]) -> [u8; 32] { let mut result: [u8; 32] = Default::default(); @@ -571,6 +582,15 @@ pub fn twox_128(data: &[u8]) -> [u8; 16] { result } +/// Conduct two XX hashes to give a 64-bit result. +pub fn twox_64(data: &[u8]) -> [u8; 8] { + let mut result: [u8; 8] = Default::default(); + unsafe { + ext_twox_64.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result +} + /// Verify a ed25519 signature. pub fn ed25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { unsafe { diff --git a/core/sr-primitives/src/lib.rs b/core/sr-primitives/src/lib.rs index 32d59b6b5a..e1ec698a4a 100644 --- a/core/sr-primitives/src/lib.rs +++ b/core/sr-primitives/src/lib.rs @@ -88,14 +88,6 @@ pub use serde::{Serialize, Deserialize, de::DeserializeOwned}; /// Complex storage builder stuff. #[cfg(feature = "std")] pub trait BuildStorage: Sized { - /// Hash given slice. - /// - /// Default to xx128 hashing. - fn hash(data: &[u8]) -> [u8; 16] { - let r = runtime_io::twox_128(data); - log::trace!(target: "build_storage", "{} <= {}", substrate_primitives::hexdisplay::HexDisplay::from(&r), ascii_format(data)); - r - } /// Build the storage out of this builder. fn build_storage(self) -> Result<(StorageOverlay, ChildrenStorageOverlay), String> { let mut storage = Default::default(); diff --git a/core/test-runtime/src/genesismap.rs b/core/test-runtime/src/genesismap.rs index 13e9e5ec9a..be1c784a52 100644 --- a/core/test-runtime/src/genesismap.rs +++ b/core/test-runtime/src/genesismap.rs @@ -17,7 +17,7 @@ //! Tool for creating the genesis block. use std::collections::HashMap; -use runtime_io::twox_128; +use runtime_io::{blake2_256, twox_128}; use super::AccountId; use parity_codec::{Encode, KeyedVec, Joiner}; use primitives::{ChangesTrieConfiguration, map, storage::well_known_keys}; @@ -47,7 +47,7 @@ impl GenesisConfig { let wasm_runtime = include_bytes!("../wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm").to_vec(); let mut map: HashMap, Vec> = self.balances.iter() .map(|&(ref account, balance)| (account.to_keyed_vec(b"balance:"), vec![].and(&balance))) - .map(|(k, v)| (twox_128(&k[..])[..].to_vec(), v.to_vec())) + .map(|(k, v)| (blake2_256(&k[..])[..].to_vec(), v.to_vec())) .chain(vec![ (well_known_keys::CODE.into(), wasm_runtime), (well_known_keys::HEAP_PAGES.into(), vec![].and(&(16 as u64))), diff --git a/core/test-runtime/src/system.rs b/core/test-runtime/src/system.rs index 266b7130d4..51f12966dc 100644 --- a/core/test-runtime/src/system.rs +++ b/core/test-runtime/src/system.rs @@ -18,7 +18,7 @@ //! and depositing logs. use rstd::prelude::*; -use runtime_io::{storage_root, enumerated_trie_root, storage_changes_root, twox_128}; +use runtime_io::{storage_root, enumerated_trie_root, storage_changes_root, twox_128, blake2_256}; use runtime_support::storage::{self, StorageValue, StorageMap}; use runtime_support::storage_items; use runtime_primitives::traits::{Hash as HashT, BlakeTwo256, Digest as DigestT}; @@ -45,11 +45,11 @@ pub fn balance_of_key(who: AccountId) -> Vec { } pub fn balance_of(who: AccountId) -> u64 { - storage::get_or(&balance_of_key(who), 0) + storage::hashed::get_or(&blake2_256, &balance_of_key(who), 0) } pub fn nonce_of(who: AccountId) -> u64 { - storage::get_or(&who.to_keyed_vec(NONCE_OF), 0) + storage::hashed::get_or(&blake2_256, &who.to_keyed_vec(NONCE_OF), 0) } /// Get authorities at given block. @@ -152,7 +152,7 @@ pub fn validate_transaction(utx: Extrinsic) -> TransactionValidity { let tx = utx.transfer(); let nonce_key = tx.from.to_keyed_vec(NONCE_OF); - let expected_nonce: u64 = storage::get_or(&nonce_key, 0); + let expected_nonce: u64 = storage::hashed::get_or(&blake2_256, &nonce_key, 0); if tx.nonce < expected_nonce { return TransactionValidity::Invalid(ApplyError::Stale as i8); } @@ -241,26 +241,26 @@ fn execute_transaction_backend(utx: &Extrinsic) -> ApplyResult { fn execute_transfer_backend(tx: &Transfer) -> ApplyResult { // check nonce let nonce_key = tx.from.to_keyed_vec(NONCE_OF); - let expected_nonce: u64 = storage::get_or(&nonce_key, 0); + let expected_nonce: u64 = storage::hashed::get_or(&blake2_256, &nonce_key, 0); if !(tx.nonce == expected_nonce) { return Err(ApplyError::Stale) } // increment nonce in storage - storage::put(&nonce_key, &(expected_nonce + 1)); + storage::hashed::put(&blake2_256, &nonce_key, &(expected_nonce + 1)); // check sender balance let from_balance_key = tx.from.to_keyed_vec(BALANCE_OF); - let from_balance: u64 = storage::get_or(&from_balance_key, 0); + let from_balance: u64 = storage::hashed::get_or(&blake2_256, &from_balance_key, 0); // enact transfer if !(tx.amount <= from_balance) { return Err(ApplyError::CantPay) } let to_balance_key = tx.to.to_keyed_vec(BALANCE_OF); - let to_balance: u64 = storage::get_or(&to_balance_key, 0); - storage::put(&from_balance_key, &(from_balance - tx.amount)); - storage::put(&to_balance_key, &(to_balance + tx.amount)); + let to_balance: u64 = storage::hashed::get_or(&blake2_256, &to_balance_key, 0); + storage::hashed::put(&blake2_256, &from_balance_key, &(from_balance - tx.amount)); + storage::hashed::put(&blake2_256, &to_balance_key, &(to_balance + tx.amount)); Ok(ApplyOutcome::Success) } @@ -295,7 +295,7 @@ fn info_expect_equal_hash(given: &Hash, expected: &Hash) { mod tests { use super::*; - use runtime_io::{with_externalities, twox_128, TestExternalities}; + use runtime_io::{with_externalities, twox_128, blake2_256, TestExternalities}; use parity_codec::{Joiner, KeyedVec}; use substrate_test_client::{AuthorityKeyring, AccountKeyring}; use crate::{Header, Transfer}; @@ -313,7 +313,7 @@ mod tests { twox_128(&0u32.to_keyed_vec(well_known_keys::AUTHORITY_PREFIX)).to_vec() => AuthorityKeyring::Alice.to_raw_public().to_vec(), twox_128(&1u32.to_keyed_vec(well_known_keys::AUTHORITY_PREFIX)).to_vec() => AuthorityKeyring::Bob.to_raw_public().to_vec(), twox_128(&2u32.to_keyed_vec(well_known_keys::AUTHORITY_PREFIX)).to_vec() => AuthorityKeyring::Charlie.to_raw_public().to_vec(), - twox_128(&AccountKeyring::Alice.to_raw_public().to_keyed_vec(b"balance:")).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0] + blake2_256(&AccountKeyring::Alice.to_raw_public().to_keyed_vec(b"balance:")).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0] ]) } diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index bff3e79986..b637940459 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -2223,7 +2223,6 @@ version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", "substrate-primitives 1.0.0", ] @@ -2238,7 +2237,6 @@ dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -2577,7 +2575,7 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "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.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2595,7 +2593,6 @@ dependencies = [ "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -2628,6 +2625,7 @@ dependencies = [ "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", + "substrate-primitives 1.0.0", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/node-template/runtime/wasm/Cargo.lock b/node-template/runtime/wasm/Cargo.lock index 54d7822c75..c430e34fb8 100644 --- a/node-template/runtime/wasm/Cargo.lock +++ b/node-template/runtime/wasm/Cargo.lock @@ -2751,6 +2751,7 @@ dependencies = [ "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", + "substrate-primitives 1.0.0", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/node/executor/src/lib.rs b/node/executor/src/lib.rs index c855a4e6f0..d1a8e0cda3 100644 --- a/node/executor/src/lib.rs +++ b/node/executor/src/lib.rs @@ -34,7 +34,7 @@ mod tests { use keyring::{AuthorityKeyring, AccountKeyring}; use runtime_support::{Hashable, StorageValue, StorageMap, traits::Currency}; use state_machine::{CodeExecutor, Externalities, TestExternalities}; - use primitives::{twox_128, Blake2Hasher, ChangesTrieConfiguration, NeverNativeValue, + use primitives::{twox_128, blake2_256, Blake2Hasher, ChangesTrieConfiguration, NeverNativeValue, NativeOrEncoded}; use node_primitives::{Hash, BlockNumber, AccountId}; use runtime_primitives::traits::{Header as HeaderT, Hash as HashT}; @@ -119,13 +119,13 @@ mod tests { #[test] fn panic_execution_with_foreign_code_gives_error() { let mut t = TestExternalities::::new_with_code(BLOATY_CODE, map![ - twox_128(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + blake2_256(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], - twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32], + blake2_256(&>::key_for(0)).to_vec() => vec![0u8; 32], twox_128(>::key()).to_vec() => vec![70u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16] ]); @@ -152,13 +152,13 @@ mod tests { #[test] fn bad_extrinsic_with_native_equivalent_code_gives_error() { let mut t = TestExternalities::::new_with_code(COMPACT_CODE, map![ - twox_128(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + blake2_256(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], - twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32], + blake2_256(&>::key_for(0)).to_vec() => vec![0u8; 32], twox_128(>::key()).to_vec() => vec![70u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16] ]); @@ -185,13 +185,13 @@ mod tests { #[test] fn successful_execution_with_native_equivalent_code_gives_ok() { let mut t = TestExternalities::::new_with_code(COMPACT_CODE, map![ - twox_128(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + blake2_256(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], - twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32], + blake2_256(&>::key_for(0)).to_vec() => vec![0u8; 32], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16] ]); @@ -222,13 +222,13 @@ mod tests { #[test] fn successful_execution_with_foreign_code_gives_ok() { let mut t = TestExternalities::::new_with_code(BLOATY_CODE, map![ - twox_128(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + blake2_256(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], - twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32], + blake2_256(&>::key_for(0)).to_vec() => vec![0u8; 32], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16] ]); @@ -796,13 +796,13 @@ mod tests { fn panic_execution_gives_error() { let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.wasm"); let mut t = TestExternalities::::new_with_code(foreign_code, map![ - twox_128(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + blake2_256(&>::key_for(alice())).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], - twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32], + blake2_256(&>::key_for(0)).to_vec() => vec![0u8; 32], twox_128(>::key()).to_vec() => vec![70u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16] ]); @@ -818,13 +818,13 @@ mod tests { fn successful_execution_gives_ok() { let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm"); let mut t = TestExternalities::::new_with_code(foreign_code, map![ - twox_128(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + blake2_256(&>::key_for(alice())).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16], - twox_128(&>::key_for(0)).to_vec() => vec![0u8; 32], + blake2_256(&>::key_for(0)).to_vec() => vec![0u8; 32], twox_128(>::key()).to_vec() => vec![0u8; 16], twox_128(>::key()).to_vec() => vec![0u8; 16] ]); diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index a09d8b31f6..340220160e 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -59,7 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("node"), impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, - spec_version: 64, + spec_version: 65, impl_version: 65, apis: RUNTIME_API_VERSIONS, }; diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index 93d79d7dba..b14c919bb3 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -2901,6 +2901,7 @@ dependencies = [ "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", + "substrate-primitives 1.0.0", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/srml/executive/src/lib.rs b/srml/executive/src/lib.rs index 69db7e5ff0..271d7156ac 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -443,7 +443,7 @@ mod tests { header: Header { parent_hash: [69u8; 32].into(), number: 1, - state_root: hex!("49cd58a254ccf6abc4a023d9a22dcfc421e385527a250faec69f8ad0d8ed3e48").into(), + state_root: hex!("4c10fddf15e63c91ff2aa13ab3a9b7f6b19938d533829489e72ba40278a08fac").into(), extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(), digest: Digest { logs: vec![], }, }, diff --git a/srml/indices/src/lib.rs b/srml/indices/src/lib.rs index 76261796c8..4a6010f800 100644 --- a/srml/indices/src/lib.rs +++ b/srml/indices/src/lib.rs @@ -96,16 +96,17 @@ decl_storage! { }): T::AccountIndex; /// The enumeration sets. - pub EnumSet get(enum_set): map T::AccountIndex => Vec; + pub EnumSet get(enum_set) build(|config: &GenesisConfig| { + (0..(config.ids.len() + ENUM_SET_SIZE - 1) / ENUM_SET_SIZE) + .map(|i| ( + T::AccountIndex::sa(i), + config.ids[i * ENUM_SET_SIZE..config.ids.len().min((i + 1) * ENUM_SET_SIZE)].to_owned(), + )) + .collect::>() + }): map T::AccountIndex => Vec; } add_extra_genesis { config(ids): Vec; - build(|storage: &mut primitives::StorageOverlay, _: &mut primitives::ChildrenStorageOverlay, config: &GenesisConfig| { - for i in 0..(config.ids.len() + ENUM_SET_SIZE - 1) / ENUM_SET_SIZE { - storage.insert(GenesisConfig::::hash(&>::key_for(T::AccountIndex::sa(i))).to_vec(), - config.ids[i * ENUM_SET_SIZE..config.ids.len().min((i + 1) * ENUM_SET_SIZE)].to_owned().encode()); - } - }); } } diff --git a/srml/metadata/src/lib.rs b/srml/metadata/src/lib.rs index 254e72cb11..5f8b57206b 100644 --- a/srml/metadata/src/lib.rs +++ b/srml/metadata/src/lib.rs @@ -253,17 +253,30 @@ impl std::fmt::Debug for DefaultByteGetter { } } +/// Hasher used by storage maps +#[derive(Clone, PartialEq, Eq, Encode)] +#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))] +pub enum StorageHasher { + Blake2_128, + Blake2_256, + Twox128, + Twox256, + Twox64Concat, +} + /// A storage function type. #[derive(Clone, PartialEq, Eq, Encode)] #[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))] pub enum StorageFunctionType { Plain(DecodeDifferentStr), Map { + hasher: StorageHasher, key: DecodeDifferentStr, value: DecodeDifferentStr, is_linked: bool, }, DoubleMap { + hasher: StorageHasher, key1: DecodeDifferentStr, key2: DecodeDifferentStr, value: DecodeDifferentStr, @@ -312,8 +325,10 @@ pub enum RuntimeMetadata { V1(RuntimeMetadataDeprecated), /// Version 2 for runtime metadata. No longer used. V2(RuntimeMetadataDeprecated), - /// Version 3 for runtime metadata. - V3(RuntimeMetadataV3), + /// Version 3 for runtime metadata. No longer used. + V3(RuntimeMetadataDeprecated), + /// Version 4 for runtime metadata. + V4(RuntimeMetadataV4), } /// Enum that should fail. @@ -336,7 +351,7 @@ impl Decode for RuntimeMetadataDeprecated { /// The metadata of a runtime. #[derive(Eq, Encode, PartialEq)] #[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))] -pub struct RuntimeMetadataV3 { +pub struct RuntimeMetadataV4 { pub modules: DecodeDifferentArray, } diff --git a/srml/support/Cargo.toml b/srml/support/Cargo.toml index 5a6dc3d9eb..ab16e98ee9 100644 --- a/srml/support/Cargo.toml +++ b/srml/support/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] hex-literal = { version = "0.1.0", optional = true } serde = { version = "1.0", optional = true, features = ["derive"] } -parity-codec = { version = "3.5.1", default-features = false, features = ["derive"] } +codec = { package = "parity-codec", version = "3.5.1", default-features = false, features = ["derive"] } srml-metadata = { path = "../metadata", default-features = false } sr-std = { path = "../../core/sr-std", default-features = false } runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false } @@ -30,7 +30,7 @@ std = [ "bitmask/std", "serde", "runtime_io/std", - "parity-codec/std", + "codec/std", "sr-std/std", "sr-primitives/std", "srml-metadata/std", diff --git a/srml/support/procedural/src/storage/impls.rs b/srml/support/procedural/src/storage/impls.rs index 5a8f7f65d5..2708fdb213 100644 --- a/srml/support/procedural/src/storage/impls.rs +++ b/srml/support/procedural/src/storage/impls.rs @@ -67,13 +67,13 @@ impl<'a, I: Iterator> Impls<'a, I> { let mutate_impl = if !is_option { quote!{ - >::put(&val, storage) + >::put(&val, storage) } } else { quote!{ match val { - Some(ref val) => >::put(&val, storage), - None => >::kill(storage), + Some(ref val) => >::put(&val, storage), + None => >::kill(storage), } } }; @@ -96,9 +96,12 @@ impl<'a, I: Iterator> Impls<'a, I> { // generator for value quote!{ #( #[ #attrs ] )* - #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance>(#scrate::storage::generator::PhantomData<(#traitinstance #comma_instance)>); + #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance> + (#scrate::rstd::marker::PhantomData<(#traitinstance #comma_instance)>); - impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::storage::generator::StorageValue<#typ> for #name<#traitinstance, #instance> { + impl<#traitinstance: #traittype, #instance #bound_instantiable> + #scrate::storage::hashed::generator::StorageValue<#typ> for #name<#traitinstance, #instance> + { type Query = #value_type; /// Get the storage key. @@ -107,20 +110,20 @@ impl<'a, I: Iterator> Impls<'a, I> { } /// Load the value from the provided storage instance. - fn get(storage: &S) -> Self::Query { - storage.get(>::key()) + fn get>(storage: &S) -> Self::Query { + storage.get(>::key()) .#option_simple_1(|| #fielddefault) } /// Take a value from storage, removing it afterwards. - fn take(storage: &S) -> Self::Query { - storage.take(>::key()) + fn take>(storage: &S) -> Self::Query { + storage.take(>::key()) .#option_simple_1(|| #fielddefault) } /// Mutate the value under a key. - fn mutate R, S: #scrate::GenericStorage>(f: F, storage: &S) -> R { - let mut val = >::get(storage); + fn mutate R, S: #scrate::HashedStorage<#scrate::Twox128>>(f: F, storage: &S) -> R { + let mut val = >::get(storage); let ret = f(&mut val); #mutate_impl ; @@ -130,7 +133,7 @@ impl<'a, I: Iterator> Impls<'a, I> { } } - pub fn map(self, kty: &syn::Type) -> TokenStream2 { + pub fn map(self, hasher: TokenStream2, kty: &syn::Type) -> TokenStream2 { let Self { scrate, visibility, @@ -147,15 +150,17 @@ impl<'a, I: Iterator> Impls<'a, I> { let DeclStorageTypeInfos { typ, value_type, is_option, .. } = type_infos; let option_simple_1 = option_unwrap(is_option); + let as_map = quote!{ > }; + let mutate_impl = if !is_option { quote!{ - >::insert(key, &val, storage) + #as_map::insert(key, &val, storage) } } else { quote!{ match val { - Some(ref val) => >::insert(key, &val, storage), - None => >::remove(key, storage), + Some(ref val) => #as_map::insert(key, &val, storage), + None => #as_map::remove(key, storage), } } }; @@ -178,11 +183,16 @@ impl<'a, I: Iterator> Impls<'a, I> { // generator for map quote!{ #( #[ #attrs ] )* - #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance>(#scrate::storage::generator::PhantomData<(#traitinstance #comma_instance)>); + #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance> + (#scrate::rstd::marker::PhantomData<(#traitinstance #comma_instance)>); - impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::storage::generator::StorageMap<#kty, #typ> for #name<#traitinstance, #instance> { + impl<#traitinstance: #traittype, #instance #bound_instantiable> + #scrate::storage::hashed::generator::StorageMap<#kty, #typ> for #name<#traitinstance, #instance> + { type Query = #value_type; + type Hasher = #scrate::#hasher; + /// Get the prefix key in storage. fn prefix() -> &'static [u8] { #final_prefix @@ -190,26 +200,26 @@ impl<'a, I: Iterator> Impls<'a, I> { /// Get the storage key used to fetch a value corresponding to a specific key. fn key_for(x: &#kty) -> #scrate::rstd::vec::Vec { - let mut key = >::prefix().to_vec(); + let mut key = #as_map::prefix().to_vec(); #scrate::codec::Encode::encode_to(x, &mut key); key } /// Load the value associated with the given key from the map. - fn get(key: &#kty, storage: &S) -> Self::Query { - let key = >::key_for(key); + fn get>(key: &#kty, storage: &S) -> Self::Query { + let key = #as_map::key_for(key); storage.get(&key[..]).#option_simple_1(|| #fielddefault) } /// Take the value, reading and removing it. - fn take(key: &#kty, storage: &S) -> Self::Query { - let key = >::key_for(key); + fn take>(key: &#kty, storage: &S) -> Self::Query { + let key = #as_map::key_for(key); storage.take(&key[..]).#option_simple_1(|| #fielddefault) } /// Mutate the value under a key - fn mutate R, S: #scrate::GenericStorage>(key: &#kty, f: F, storage: &S) -> R { - let mut val = >::get(key, storage); + fn mutate R, S: #scrate::HashedStorage<#scrate::#hasher>>(key: &#kty, f: F, storage: &S) -> R { + let mut val = #as_map::get(key, storage); let ret = f(&mut val); #mutate_impl ; @@ -220,7 +230,7 @@ impl<'a, I: Iterator> Impls<'a, I> { } } - pub fn linked_map(self, kty: &syn::Type) -> TokenStream2 { + pub fn linked_map(self, hasher: TokenStream2, kty: &syn::Type) -> TokenStream2 { let Self { scrate, visibility, @@ -264,8 +274,8 @@ impl<'a, I: Iterator> Impls<'a, I> { let name_lowercase = name.to_string().to_lowercase(); let inner_module = syn::Ident::new(&format!("__linked_map_details_for_{}_do_not_use", name_lowercase), name.span()); let linkage = syn::Ident::new(&format!("__LinkageFor{}DoNotUse", name), name.span()); - let phantom_data = quote! { #scrate::storage::generator::PhantomData }; - let as_map = quote!{ > }; + let phantom_data = quote! { #scrate::rstd::marker::PhantomData }; + let as_map = quote!{ > }; let put_or_insert = quote! { match linkage { Some(linkage) => storage.put(key_for, &(val, linkage)), @@ -316,14 +326,17 @@ impl<'a, I: Iterator> Impls<'a, I> { pub _data: #phantom_data, } - impl<'a, S: #scrate::GenericStorage, #traitinstance: #traittype, #instance #bound_instantiable> Iterator for Enumerator<'a, S, #kty, (#typ, #traitinstance, #instance)> + impl<'a, S: #scrate::HashedStorage<#scrate::#hasher>, #traitinstance: #traittype, #instance #bound_instantiable> + Iterator for Enumerator<'a, S, #kty, (#typ, #traitinstance, #instance)> where #traitinstance: 'a { type Item = (#kty, #typ); fn next(&mut self) -> Option { let next = self.next.take()?; - let key_for = as #scrate::storage::generator::StorageMap<#kty, #typ>>::key_for(&next); + let key_for = + as #scrate::storage::hashed::generator::StorageMap<#kty, #typ>>::key_for(&next); + let (val, linkage): (#typ, Linkage<#kty>) = self.storage.get(&*key_for) .expect("previous/next only contain existing entires; we enumerate using next; entry exists; qed"); self.next = linkage.next; @@ -336,26 +349,26 @@ impl<'a, I: Iterator> Impls<'a, I> { /// /// Takes care of updating previous and next elements points /// as well as updates head if the element is first or last. - fn remove_linkage(linkage: Linkage<#kty>, storage: &S); + fn remove_linkage>(linkage: Linkage<#kty>, storage: &S); /// Read the contained data and it's linkage. - fn read_with_linkage(storage: &S, key: &[u8]) -> Option<(#value_type, Linkage<#kty>)>; + fn read_with_linkage>(storage: &S, key: &[u8]) -> Option<(#value_type, Linkage<#kty>)>; /// Generate linkage for newly inserted element. /// /// Takes care of updating head and previous head's pointer. - fn new_head_linkage( + fn new_head_linkage>( storage: &S, key: &#kty, ) -> Linkage<#kty>; /// Read current head pointer. - fn read_head(storage: &S) -> Option<#kty>; + fn read_head>(storage: &S) -> Option<#kty>; /// Overwrite current head pointer. /// /// If `None` is given head is removed from storage. - fn write_head(storage: &S, head: Option<&#kty>); + fn write_head>(storage: &S, head: Option<&#kty>); } } }; @@ -365,7 +378,7 @@ impl<'a, I: Iterator> Impls<'a, I> { #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance>(#phantom_data<(#traitinstance #comma_instance)>); impl<#traitinstance: #traittype, #instance #bound_instantiable> self::#inner_module::Utils<#traitinstance, #instance> for #name<#traitinstance, #instance> { - fn remove_linkage( + fn remove_linkage>( linkage: self::#inner_module::Linkage<#kty>, storage: &S, ) { @@ -394,14 +407,14 @@ impl<'a, I: Iterator> Impls<'a, I> { } } - fn read_with_linkage( + fn read_with_linkage>( storage: &S, key: &[u8], ) -> Option<(#value_type, self::#inner_module::Linkage<#kty>)> { storage.get(key) } - fn new_head_linkage( + fn new_head_linkage>( storage: &S, key: &#kty, ) -> self::#inner_module::Linkage<#kty> { @@ -433,11 +446,11 @@ impl<'a, I: Iterator> Impls<'a, I> { } } - fn read_head(storage: &S) -> Option<#kty> { + fn read_head>(storage: &S) -> Option<#kty> { storage.get(#final_head_key) } - fn write_head(storage: &S, head: Option<&#kty>) { + fn write_head>(storage: &S, head: Option<&#kty>) { match head { Some(head) => storage.put(#final_head_key, head), None => storage.kill(#final_head_key), @@ -451,9 +464,13 @@ impl<'a, I: Iterator> Impls<'a, I> { #structure - impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::storage::generator::StorageMap<#kty, #typ> for #name<#traitinstance, #instance> { + impl<#traitinstance: #traittype, #instance #bound_instantiable> + #scrate::storage::hashed::generator::StorageMap<#kty, #typ> for #name<#traitinstance, #instance> + { type Query = #value_type; + type Hasher = #scrate::#hasher; + /// Get the prefix key in storage. fn prefix() -> &'static [u8] { #final_prefix @@ -467,12 +484,12 @@ impl<'a, I: Iterator> Impls<'a, I> { } /// Load the value associated with the given key from the map. - fn get(key: &#kty, storage: &S) -> Self::Query { + fn get>(key: &#kty, storage: &S) -> Self::Query { storage.get(&*#as_map::key_for(key)).#option_simple_1(|| #fielddefault) } /// Take the value, reading and removing it. - fn take(key: &#kty, storage: &S) -> Self::Query { + fn take>(key: &#kty, storage: &S) -> Self::Query { use self::#inner_module::Utils; let res: Option<(#value_type, self::#inner_module::Linkage<#kty>)> = storage.take(&*#as_map::key_for(key)); @@ -486,12 +503,12 @@ impl<'a, I: Iterator> Impls<'a, I> { } /// Remove the value under a key. - fn remove(key: &#kty, storage: &S) { + fn remove>(key: &#kty, storage: &S) { #as_map::take(key, storage); } /// Store a value to be associated with the given key from the map. - fn insert(key: &#kty, val: &#typ, storage: &S) { + fn insert>(key: &#kty, val: &#typ, storage: &S) { use self::#inner_module::Utils; let key_for = &*#as_map::key_for(key); @@ -505,7 +522,7 @@ impl<'a, I: Iterator> Impls<'a, I> { } /// Mutate the value under a key - fn mutate R, S: #scrate::GenericStorage>(key: &#kty, f: F, storage: &S) -> R { + fn mutate R, S: #scrate::HashedStorage<#scrate::#hasher>>(key: &#kty, f: F, storage: &S) -> R { use self::#inner_module::Utils; let key_for = &*#as_map::key_for(key); @@ -519,20 +536,22 @@ impl<'a, I: Iterator> Impls<'a, I> { } } - impl<#traitinstance: 'static + #traittype, #instance #bound_instantiable> #scrate::storage::generator::EnumerableStorageMap<#kty, #typ> for #name<#traitinstance, #instance> { - fn head(storage: &S) -> Option<#kty> { + impl<#traitinstance: 'static + #traittype, #instance #bound_instantiable> + #scrate::storage::hashed::generator::EnumerableStorageMap<#kty, #typ> for #name<#traitinstance, #instance> + { + fn head>(storage: &S) -> Option<#kty> { use self::#inner_module::Utils; Self::read_head(storage) } - fn enumerate<'a, S: #scrate::GenericStorage>(storage: &'a S) -> #scrate::storage::generator::Box + 'a> where + fn enumerate<'a, S: #scrate::HashedStorage<#scrate::#hasher>>(storage: &'a S) -> #scrate::rstd::boxed::Box + 'a> where #kty: 'a, #typ: 'a, { use self::#inner_module::{Utils, Enumerator}; - #scrate::storage::generator::Box::new(Enumerator { + #scrate::rstd::boxed::Box::new(Enumerator { next: Self::read_head(storage), storage, _data: #phantom_data::<(#typ, #traitinstance, #instance)>::default(), @@ -542,7 +561,7 @@ impl<'a, I: Iterator> Impls<'a, I> { } } - pub fn double_map(self, k1ty: &syn::Type, k2ty: &syn::Type, k2_hasher: TokenStream2) -> TokenStream2 { + pub fn double_map(self, hasher: TokenStream2, k1ty: &syn::Type, k2ty: &syn::Type, k2_hasher: TokenStream2) -> TokenStream2 { let Self { scrate, visibility, @@ -593,11 +612,20 @@ impl<'a, I: Iterator> Impls<'a, I> { // generator for double map quote!{ #( #[ #attrs ] )* - #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance>(#scrate::storage::generator::PhantomData<(#traitinstance #comma_instance)>); + #visibility struct #name<#traitinstance: #traittype, #instance #bound_instantiable #equal_default_instance> + (#scrate::rstd::marker::PhantomData<(#traitinstance #comma_instance)>); - impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::storage::unhashed::generator::StorageDoubleMap<#k1ty, #k2ty, #typ> for #name<#traitinstance, #instance> { + impl<#traitinstance: #traittype, #instance #bound_instantiable> + #scrate::storage::unhashed::generator::StorageDoubleMap<#k1ty, #k2ty, #typ> for #name<#traitinstance, #instance> + { type Query = #value_type; + fn prefix_for(k1: &#k1ty) -> Vec { + let mut key = #as_double_map::prefix().to_vec(); + #scrate::codec::Encode::encode_to(k1, &mut key); + #scrate::Hashable::#hasher(&key).to_vec() + } + fn prefix() -> &'static [u8] { #final_prefix } @@ -608,17 +636,17 @@ impl<'a, I: Iterator> Impls<'a, I> { key } - fn get(key1: &#k1ty, key2: &#k2ty, storage: &S) -> Self::Query { + fn get(key1: &#k1ty, key2: &#k2ty, storage: &S) -> Self::Query { let key = #as_double_map::key_for(key1, key2); storage.get(&key).#option_simple_1(|| #fielddefault) } - fn take(key1: &#k1ty, key2: &#k2ty, storage: &S) -> Self::Query { + fn take(key1: &#k1ty, key2: &#k2ty, storage: &S) -> Self::Query { let key = #as_double_map::key_for(key1, key2); storage.take(&key).#option_simple_1(|| #fielddefault) } - fn mutate R, S: #scrate::GenericUnhashedStorage>(key1: &#k1ty, key2: &#k2ty, f: F, storage: &S) -> R { + fn mutate R, S: #scrate::UnhashedStorage>(key1: &#k1ty, key2: &#k2ty, f: F, storage: &S) -> R { let mut val = #as_double_map::get(key1, key2, storage); let ret = f(&mut val); diff --git a/srml/support/procedural/src/storage/mod.rs b/srml/support/procedural/src/storage/mod.rs index 82290e0de4..649a48a181 100644 --- a/srml/support/procedural/src/storage/mod.rs +++ b/srml/support/procedural/src/storage/mod.rs @@ -23,6 +23,8 @@ use srml_support_procedural_tools::{ToTokens, Parse, custom_keyword, custom_keyw use syn::{Ident, Token}; use syn::token::CustomKeyword; +use proc_macro2::TokenStream as TokenStream2; +use quote::quote; mod impls; @@ -138,6 +140,7 @@ enum DeclStorageType { #[derive(Parse, ToTokens, Debug)] struct DeclStorageMap { pub map_keyword: ext::CustomToken, + pub hasher: Option, pub key: syn::Type, pub ass_keyword: Token![=>], pub value: syn::Type, @@ -146,6 +149,7 @@ struct DeclStorageMap { #[derive(Parse, ToTokens, Debug)] struct DeclStorageLinkedMap { pub map_keyword: ext::CustomToken, + pub hasher: Option, pub key: syn::Type, pub ass_keyword: Token![=>], pub value: syn::Type, @@ -154,19 +158,22 @@ struct DeclStorageLinkedMap { #[derive(Parse, ToTokens, Debug)] struct DeclStorageDoubleMap { pub map_keyword: ext::CustomToken, + pub hasher: Option, pub key1: syn::Type, pub comma_keyword: Token![,], - pub key2_hasher: DeclStorageDoubleMapHasher, + pub key2_hasher: Hasher, pub key2: ext::Parens, pub ass_keyword: Token![=>], pub value: syn::Type, } #[derive(Parse, ToTokens, Debug)] -enum DeclStorageDoubleMapHasher { +enum Hasher { Blake2_256(ext::CustomToken), + Blake2_128(ext::CustomToken), Twox256(ext::CustomToken), Twox128(ext::CustomToken), + Twox64Concat(ext::CustomToken), } #[derive(Parse, ToTokens, Debug)] @@ -175,6 +182,64 @@ struct DeclStorageDefault { pub expr: syn::Expr, } +#[derive(Parse, ToTokens, Debug)] +struct SetHasher { + pub hasher_keyword: ext::CustomToken, + pub inner: ext::Parens, +} + +#[derive(Debug, Clone)] +enum HasherKind { + Blake2_256, + Blake2_128, + Twox256, + Twox128, + Twox64Concat, +} + +impl From<&SetHasher> for HasherKind { + fn from(set_hasher: &SetHasher) -> Self { + match set_hasher.inner.content { + Hasher::Blake2_256(_) => HasherKind::Blake2_256, + Hasher::Blake2_128(_) => HasherKind::Blake2_128, + Hasher::Twox256(_) => HasherKind::Twox256, + Hasher::Twox128(_) => HasherKind::Twox128, + Hasher::Twox64Concat(_) => HasherKind::Twox64Concat, + } + } +} +impl HasherKind { + fn into_storage_hasher_struct(&self) -> TokenStream2 { + match self { + HasherKind::Blake2_256 => quote!( Blake2_256 ), + HasherKind::Blake2_128 => quote!( Blake2_128 ), + HasherKind::Twox256 => quote!( Twox256 ), + HasherKind::Twox128 => quote!( Twox128 ), + HasherKind::Twox64Concat => quote!( Twox64Concat ), + } + } + + fn into_hashable_fn(&self) -> TokenStream2 { + match self { + HasherKind::Blake2_256 => quote!( blake2_256 ), + HasherKind::Blake2_128 => quote!( blake2_128 ), + HasherKind::Twox256 => quote!( twox_256 ), + HasherKind::Twox128 => quote!( twox_128 ), + HasherKind::Twox64Concat => quote!( twox_64_concat), + } + } + + fn into_metadata(&self) -> TokenStream2 { + match self { + HasherKind::Blake2_256 => quote!( StorageHasher::Blake2_256 ), + HasherKind::Blake2_128 => quote!( StorageHasher::Blake2_128 ), + HasherKind::Twox256 => quote!( StorageHasher::Twox256 ), + HasherKind::Twox128 => quote!( StorageHasher::Twox128 ), + HasherKind::Twox64Concat => quote!( StorageHasher::Twox64Concat ), + } + } +} + custom_keyword_impl!(SpecificHiddenCrate, "hiddencrate", "hiddencrate as keyword"); custom_keyword_impl!(DeclStorageConfig, "config", "build as keyword"); custom_keyword!(ConfigKeyword, "config", "config as keyword"); @@ -186,6 +251,9 @@ custom_keyword!(MapKeyword, "map", "map as keyword"); custom_keyword!(LinkedMapKeyword, "linked_map", "linked_map as keyword"); custom_keyword!(DoubleMapKeyword, "double_map", "double_map as keyword"); custom_keyword!(Blake2_256Keyword, "blake2_256", "Blake2_256 as keyword"); -custom_keyword!(Twox256Keyword, "twox_256", "Twox_256 as keyword"); -custom_keyword!(Twox128Keyword, "twox_128", "Twox_128 as keyword"); +custom_keyword!(Blake2_128Keyword, "blake2_128", "Blake2_128 as keyword"); +custom_keyword!(Twox256Keyword, "twox_256", "Twox256 as keyword"); +custom_keyword!(Twox128Keyword, "twox_128", "Twox128 as keyword"); +custom_keyword!(Twox64ConcatKeyword, "twox_64_concat", "Twox64Concat as keyword"); custom_keyword_impl!(ExtraGenesisSkipPhantomDataField, "extra_genesis_skip_phantom_data_field", "extra_genesis_skip_phantom_data_field as keyword"); +custom_keyword_impl!(SetHasher, "hasher", "storage hasher"); diff --git a/srml/support/procedural/src/storage/transformation.rs b/srml/support/procedural/src/storage/transformation.rs index f00b5e8309..205fccdea5 100644 --- a/srml/support/procedural/src/storage/transformation.rs +++ b/srml/support/procedural/src/storage/transformation.rs @@ -156,13 +156,13 @@ pub fn decl_storage_impl(input: TokenStream) -> TokenStream { impl<#traitinstance: 'static + #traittype, #instance #bound_instantiable> #module_ident<#traitinstance, #instance> { #impl_store_fns #[doc(hidden)] - pub fn store_metadata() -> #scrate::storage::generator::StorageMetadata { - #scrate::storage::generator::StorageMetadata { - functions: #scrate::storage::generator::DecodeDifferent::Encode(#store_functions_to_metadata) , + pub fn store_metadata() -> #scrate::metadata::StorageMetadata { + #scrate::metadata::StorageMetadata { + functions: #scrate::metadata::DecodeDifferent::Encode(#store_functions_to_metadata) , } } #[doc(hidden)] - pub fn store_metadata_functions() -> &'static [#scrate::storage::generator::StorageFunctionMetadata] { + pub fn store_metadata_functions() -> &'static [#scrate::metadata::StorageFunctionMetadata] { #store_functions_to_metadata } #[doc(hidden)] @@ -284,7 +284,7 @@ fn decl_store_extra_genesis( use #scrate::codec::{Encode, Decode}; let v = (#builder)(&self); - <#name<#traitinstance, #instance> as #scrate::storage::generator::StorageValue<#typ>>::put(&v, &storage); + <#name<#traitinstance, #instance> as #scrate::storage::hashed::generator::StorageValue<#typ>>::put(&v, &storage); }} }, DeclStorageTypeInfosKind::Map { key_type, .. } => { @@ -294,7 +294,7 @@ fn decl_store_extra_genesis( let data = (#builder)(&self); for (k, v) in data.into_iter() { - <#name<#traitinstance, #instance> as #scrate::storage::generator::StorageMap<#key_type, #typ>>::insert(&k, &v, &storage); + <#name<#traitinstance, #instance> as #scrate::storage::hashed::generator::StorageMap<#key_type, #typ>>::insert(&k, &v, &storage); } }} }, @@ -402,7 +402,7 @@ fn decl_store_extra_genesis( quote!{ #[serde(skip)] - pub _genesis_phantom_data: #scrate::storage::generator::PhantomData<(#traitinstance #comma_instance)>, + pub _genesis_phantom_data: #scrate::rstd::marker::PhantomData<(#traitinstance #comma_instance)>, }, quote!{ _genesis_phantom_data: Default::default(), @@ -440,12 +440,12 @@ fn decl_store_extra_genesis( #[cfg(feature = "std")] impl#fparam_impl #scrate::runtime_primitives::BuildStorage for GenesisConfig#sparam { fn assimilate_storage(self, r: &mut #scrate::runtime_primitives::StorageOverlay, c: &mut #scrate::runtime_primitives::ChildrenStorageOverlay) -> ::std::result::Result<(), String> { - use #scrate::rstd::{cell::RefCell, marker::PhantomData}; - let storage = (RefCell::new(r), PhantomData::::default()); + use #scrate::rstd::cell::RefCell; + let storage = RefCell::new(r); #builders - let r = storage.0.into_inner(); + let r = storage.into_inner(); #scall(r, c, &self); @@ -589,14 +589,14 @@ fn decl_storage_items( DeclStorageTypeInfosKind::Simple => { i.simple_value() }, - DeclStorageTypeInfosKind::Map { key_type, is_linked: false } => { - i.map(key_type) + DeclStorageTypeInfosKind::Map { key_type, is_linked: false, hasher } => { + i.map(hasher.into_storage_hasher_struct(), key_type) }, - DeclStorageTypeInfosKind::Map { key_type, is_linked: true } => { - i.linked_map(key_type) + DeclStorageTypeInfosKind::Map { key_type, is_linked: true, hasher } => { + i.linked_map(hasher.into_storage_hasher_struct(), key_type) }, - DeclStorageTypeInfosKind::DoubleMap { key1_type, key2_type, key2_hasher } => { - i.double_map(key1_type, key2_type, key2_hasher) + DeclStorageTypeInfosKind::DoubleMap { key1_type, key2_type, key2_hasher, hasher } => { + i.double_map(hasher.into_hashable_fn(), key1_type, key2_type, key2_hasher) }, }; impls.extend(implementation) @@ -662,15 +662,15 @@ fn impl_store_fns( quote!{ #( #[ #attrs ] )* pub fn #get_fn() -> #value_type { - <#name<#traitinstance, #instance> as #scrate::storage::generator::StorageValue<#typ>> :: get(&#scrate::storage::RuntimeStorage) + <#name<#traitinstance, #instance> as #scrate::storage::hashed::generator::StorageValue<#typ>> :: get(&#scrate::storage::RuntimeStorage) } } }, DeclStorageTypeInfosKind::Map { key_type, .. } => { quote!{ #( #[ #attrs ] )* - pub fn #get_fn>(key: K) -> #value_type { - <#name<#traitinstance, #instance> as #scrate::storage::generator::StorageMap<#key_type, #typ>> :: get(key.borrow(), &#scrate::storage::RuntimeStorage) + pub fn #get_fn>(key: K) -> #value_type { + <#name<#traitinstance, #instance> as #scrate::storage::hashed::generator::StorageMap<#key_type, #typ>> :: get(key.borrow(), &#scrate::storage::RuntimeStorage) } } } @@ -678,8 +678,8 @@ fn impl_store_fns( quote!{ pub fn #get_fn(k1: KArg1, k2: KArg2) -> #value_type where - KArg1: #scrate::storage::generator::Borrow<#key1_type>, - KArg2: #scrate::storage::generator::Borrow<#key2_type>, + KArg1: #scrate::rstd::borrow::Borrow<#key1_type>, + KArg2: #scrate::rstd::borrow::Borrow<#key2_type>, { <#name<#traitinstance> as #scrate::storage::unhashed::generator::StorageDoubleMap<#key1_type, #key2_type, #typ>> :: get(k1.borrow(), k2.borrow(), &#scrate::storage::RuntimeStorage) } @@ -727,42 +727,46 @@ fn store_functions_to_metadata ( let stype = match type_infos.kind { DeclStorageTypeInfosKind::Simple => { quote!{ - #scrate::storage::generator::StorageFunctionType::Plain( - #scrate::storage::generator::DecodeDifferent::Encode(#styp), + #scrate::metadata::StorageFunctionType::Plain( + #scrate::metadata::DecodeDifferent::Encode(#styp), ) } }, - DeclStorageTypeInfosKind::Map { key_type, is_linked } => { + DeclStorageTypeInfosKind::Map { key_type, is_linked, hasher } => { + let hasher = hasher.into_metadata(); let kty = clean_type_string("e!(#key_type).to_string()); quote!{ - #scrate::storage::generator::StorageFunctionType::Map { - key: #scrate::storage::generator::DecodeDifferent::Encode(#kty), - value: #scrate::storage::generator::DecodeDifferent::Encode(#styp), + #scrate::metadata::StorageFunctionType::Map { + hasher: #scrate::metadata::#hasher, + key: #scrate::metadata::DecodeDifferent::Encode(#kty), + value: #scrate::metadata::DecodeDifferent::Encode(#styp), is_linked: #is_linked, } } }, - DeclStorageTypeInfosKind::DoubleMap { key1_type, key2_type, key2_hasher } => { + DeclStorageTypeInfosKind::DoubleMap { key1_type, key2_type, key2_hasher, hasher } => { + let hasher = hasher.into_metadata(); let k1ty = clean_type_string("e!(#key1_type).to_string()); let k2ty = clean_type_string("e!(#key2_type).to_string()); let k2_hasher = clean_type_string(&key2_hasher.to_string()); quote!{ - #scrate::storage::generator::StorageFunctionType::DoubleMap { - key1: #scrate::storage::generator::DecodeDifferent::Encode(#k1ty), - key2: #scrate::storage::generator::DecodeDifferent::Encode(#k2ty), - value: #scrate::storage::generator::DecodeDifferent::Encode(#styp), - key2_hasher: #scrate::storage::generator::DecodeDifferent::Encode(#k2_hasher), + #scrate::metadata::StorageFunctionType::DoubleMap { + hasher: #scrate::metadata::#hasher, + key1: #scrate::metadata::DecodeDifferent::Encode(#k1ty), + key2: #scrate::metadata::DecodeDifferent::Encode(#k2ty), + value: #scrate::metadata::DecodeDifferent::Encode(#styp), + key2_hasher: #scrate::metadata::DecodeDifferent::Encode(#k2_hasher), } } }, }; let modifier = if type_infos.is_option { quote!{ - #scrate::storage::generator::StorageFunctionModifier::Optional + #scrate::metadata::StorageFunctionModifier::Optional } } else { quote!{ - #scrate::storage::generator::StorageFunctionModifier::Default + #scrate::metadata::StorageFunctionModifier::Default } }; let default = default_value.inner.as_ref().map(|d| &d.expr) @@ -786,16 +790,16 @@ fn store_functions_to_metadata ( let struct_name = proc_macro2::Ident::new(&("__GetByteStruct".to_string() + &str_name), name.span()); let cache_name = proc_macro2::Ident::new(&("__CACHE_GET_BYTE_STRUCT_".to_string() + &str_name), name.span()); let item = quote! { - #scrate::storage::generator::StorageFunctionMetadata { - name: #scrate::storage::generator::DecodeDifferent::Encode(#str_name), + #scrate::metadata::StorageFunctionMetadata { + name: #scrate::metadata::DecodeDifferent::Encode(#str_name), modifier: #modifier, ty: #stype, - default: #scrate::storage::generator::DecodeDifferent::Encode( - #scrate::storage::generator::DefaultByteGetter( + default: #scrate::metadata::DecodeDifferent::Encode( + #scrate::metadata::DefaultByteGetter( &#struct_name::<#traitinstance, #instance>(#scrate::rstd::marker::PhantomData) ) ), - documentation: #scrate::storage::generator::DecodeDifferent::Encode(&[ #docs ]), + documentation: #scrate::metadata::DecodeDifferent::Encode(&[ #docs ]), }, }; items.extend(item); @@ -806,7 +810,7 @@ fn store_functions_to_metadata ( #[allow(non_upper_case_globals)] static #cache_name: #scrate::once_cell::sync::OnceCell<#scrate::rstd::vec::Vec> = #scrate::once_cell::sync::OnceCell::INIT; #[cfg(feature = "std")] - impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::storage::generator::DefaultByte for #struct_name<#traitinstance, #instance> { + impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::metadata::DefaultByte for #struct_name<#traitinstance, #instance> { fn default_byte(&self) -> #scrate::rstd::vec::Vec { use #scrate::codec::Encode; #cache_name.get_or_init(|| { @@ -816,7 +820,7 @@ fn store_functions_to_metadata ( } } #[cfg(not(feature = "std"))] - impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::storage::generator::DefaultByte for #struct_name<#traitinstance, #instance> { + impl<#traitinstance: #traittype, #instance #bound_instantiable> #scrate::metadata::DefaultByte for #struct_name<#traitinstance, #instance> { fn default_byte(&self) -> #scrate::rstd::vec::Vec { use #scrate::codec::Encode; let def_val: #value_type = #default; @@ -848,10 +852,12 @@ pub(crate) struct DeclStorageTypeInfos<'a> { enum DeclStorageTypeInfosKind<'a> { Simple, Map { + hasher: HasherKind, key_type: &'a syn::Type, is_linked: bool, }, DoubleMap { + hasher: HasherKind, key1_type: &'a syn::Type, key2_type: &'a syn::Type, key2_hasher: TokenStream2, @@ -871,14 +877,17 @@ fn get_type_infos(storage_type: &DeclStorageType) -> DeclStorageTypeInfos { let (value_type, kind) = match storage_type { DeclStorageType::Simple(ref st) => (st, DeclStorageTypeInfosKind::Simple), DeclStorageType::Map(ref map) => (&map.value, DeclStorageTypeInfosKind::Map { + hasher: map.hasher.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), key_type: &map.key, is_linked: false, }), DeclStorageType::LinkedMap(ref map) => (&map.value, DeclStorageTypeInfosKind::Map { + hasher: map.hasher.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), key_type: &map.key, is_linked: true, }), DeclStorageType::DoubleMap(ref map) => (&map.value, DeclStorageTypeInfosKind::DoubleMap { + hasher: map.hasher.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), key1_type: &map.key1, key2_type: &map.key2.content, key2_hasher: { let h = &map.key2_hasher; quote! { #h } }, diff --git a/srml/support/procedural/tools/src/syn_ext.rs b/srml/support/procedural/tools/src/syn_ext.rs index c2136b2cd8..c6b0b4aefb 100644 --- a/srml/support/procedural/tools/src/syn_ext.rs +++ b/srml/support/procedural/tools/src/syn_ext.rs @@ -72,7 +72,7 @@ groups_impl!(Braces, Brace, Brace, parse_braces); groups_impl!(Brackets, Bracket, Bracket, parse_brackets); groups_impl!(Parens, Paren, Parenthesis, parse_parens); -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct CustomToken(std::marker::PhantomData); impl Parse for CustomToken { diff --git a/srml/support/src/event.rs b/srml/support/src/event.rs index e4168c318a..739c9f660c 100644 --- a/srml/support/src/event.rs +++ b/srml/support/src/event.rs @@ -24,29 +24,19 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// # Simple Event Example: /// /// ```rust -/// #[macro_use] -/// extern crate srml_support; -/// #[macro_use] -/// extern crate parity_codec as codec; -/// -/// decl_event!( -/// pub enum Event { +/// srml_support::decl_event!( +/// pub enum Event { /// Success, /// Failure(String), /// } /// ); +/// ///# fn main() {} /// ``` /// /// # Generic Event Example: /// /// ```rust -/// #[macro_use] -/// extern crate srml_support; -/// extern crate parity_codec as codec; -/// #[macro_use] -/// extern crate parity_codec; -/// /// trait Trait { /// type Balance; /// type Token; @@ -54,8 +44,8 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// /// mod event1 { /// // Event that specifies the generic parameter explicitly (`Balance`). -/// decl_event!( -/// pub enum Event where Balance = ::Balance { +/// srml_support::decl_event!( +/// pub enum Event where Balance = ::Balance { /// Message(Balance), /// } /// ); @@ -65,8 +55,8 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// // Event that uses the generic parameter `Balance`. /// // If no name for the generic parameter is specified explicitly, /// // the name will be taken from the type name of the trait. -/// decl_event!( -/// pub enum Event where ::Balance { +/// srml_support::decl_event!( +/// pub enum Event where ::Balance { /// Message(Balance), /// } /// ); @@ -74,12 +64,13 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// /// mod event3 { /// // And we even support declaring multiple generic parameters! -/// decl_event!( -/// pub enum Event where ::Balance, ::Token { +/// srml_support::decl_event!( +/// pub enum Event where ::Balance, ::Token { /// Message(Balance, Token), /// } /// ); /// } +/// ///# fn main() {} /// ``` /// @@ -88,12 +79,6 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// # Generic Event with Instance Example: /// /// ```rust -/// #[macro_use] -/// extern crate srml_support; -/// extern crate parity_codec as codec; -/// #[macro_use] -/// extern crate parity_codec; -/// ///# struct DefaultInstance; ///# trait Instance {} ///# impl Instance for DefaultInstance {} @@ -103,7 +88,7 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn /// } /// /// // For module with instances, DefaultInstance is optionnal -/// decl_event!( +/// srml_support::decl_event!( /// pub enum Event where /// ::Balance, /// ::Token @@ -504,7 +489,7 @@ macro_rules! __impl_outer_event_json_metadata { mod tests { use super::*; use serde::Serialize; - use parity_codec::{Encode, Decode}; + use codec::{Encode, Decode}; mod system { pub trait Trait { diff --git a/srml/support/src/hashable.rs b/srml/support/src/hashable.rs index 9199a0958d..b3ee2b3612 100644 --- a/srml/support/src/hashable.rs +++ b/srml/support/src/hashable.rs @@ -17,16 +17,24 @@ //! Hashable trait. use crate::codec::Codec; -use runtime_io::{blake2_256, twox_128, twox_256}; +use runtime_io::{blake2_128, blake2_256, twox_128, twox_256}; +use crate::storage::hashed::generator::StorageHasher; +use crate::Twox64Concat; +use crate::rstd::prelude::Vec; -/// Trait for available hash functions. +// This trait must be kept coherent with srml-support-procedural HasherKind usage pub trait Hashable: Sized { + fn blake2_128(&self) -> [u8; 16]; fn blake2_256(&self) -> [u8; 32]; fn twox_128(&self) -> [u8; 16]; fn twox_256(&self) -> [u8; 32]; + fn twox_64_concat(&self) -> Vec; } impl Hashable for T { + fn blake2_128(&self) -> [u8; 16] { + self.using_encoded(blake2_128) + } fn blake2_256(&self) -> [u8; 32] { self.using_encoded(blake2_256) } @@ -36,4 +44,7 @@ impl Hashable for T { fn twox_256(&self) -> [u8; 32] { self.using_encoded(twox_256) } + fn twox_64_concat(&self) -> Vec { + self.using_encoded(Twox64Concat::hash) + } } diff --git a/srml/support/src/lib.rs b/srml/support/src/lib.rs index 26ed857058..78edc361d5 100644 --- a/srml/support/src/lib.rs +++ b/srml/support/src/lib.rs @@ -27,7 +27,7 @@ pub use serde; #[doc(hidden)] pub use sr_std as rstd; #[doc(hidden)] -pub use parity_codec as codec; +pub use codec; #[cfg(feature = "std")] #[doc(hidden)] pub use once_cell; @@ -35,8 +35,8 @@ pub use once_cell; pub use paste; pub use sr_primitives as runtime_primitives; -pub use self::storage::generator::Storage as GenericStorage; -pub use self::storage::unhashed::generator::UnhashedStorage as GenericUnhashedStorage; +pub use self::storage::hashed::generator::{HashedStorage, Twox256, Twox128, Blake2_256, Blake2_128, Twox64Concat}; +pub use self::storage::unhashed::generator::UnhashedStorage; #[macro_use] pub mod dispatch; @@ -56,7 +56,7 @@ pub mod inherent; mod double_map; pub mod traits; -pub use self::storage::{StorageVec, StorageList, StorageValue, StorageMap, EnumerableStorageMap, StorageDoubleMap}; +pub use self::storage::{StorageList, StorageValue, StorageMap, EnumerableStorageMap, StorageDoubleMap}; pub use self::hashable::Hashable; pub use self::dispatch::{Parameter, Dispatchable, Callable, IsSubType}; pub use self::double_map::StorageDoubleMapWithHasher; @@ -179,13 +179,13 @@ macro_rules! for_each_tuple { #[cfg(test)] mod tests { use super::*; - use parity_codec::Codec; + use codec::Codec; use runtime_io::{with_externalities, Blake2Hasher}; use runtime_primitives::BuildStorage; pub use srml_metadata::{ DecodeDifferent, StorageMetadata, StorageFunctionMetadata, StorageFunctionType, StorageFunctionModifier, - DefaultByte, DefaultByteGetter, + DefaultByte, DefaultByteGetter, StorageHasher }; pub use rstd::marker::PhantomData; @@ -209,11 +209,11 @@ mod tests { decl_storage! { trait Store for Module as Example { - pub Data get(data) build(|_| vec![(15u32, 42u64)]): linked_map u32 => u64; - pub GenericData get(generic_data): linked_map T::BlockNumber => T::BlockNumber; + pub Data get(data) build(|_| vec![(15u32, 42u64)]): linked_map hasher(twox_64_concat) u32 => u64; + pub GenericData get(generic_data): linked_map hasher(twox_128) T::BlockNumber => T::BlockNumber; pub GenericData2 get(generic_data2): linked_map T::BlockNumber => Option; - pub DataDM config(test_config) build(|_| vec![(15u32, 16u32, 42u64)]): double_map u32, blake2_256(u32) => u64; + pub DataDM config(test_config) build(|_| vec![(15u32, 16u32, 42u64)]): double_map hasher(twox_64_concat) u32, blake2_256(u32) => u64; pub GenericDataDM: double_map T::BlockNumber, twox_128(T::BlockNumber) => T::BlockNumber; pub GenericData2DM: double_map T::BlockNumber, twox_256(T::BlockNumber) => Option; } @@ -354,6 +354,7 @@ mod tests { name: DecodeDifferent::Encode("Data"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map{ + hasher: StorageHasher::Twox64Concat, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("u64"), is_linked: true }, default: DecodeDifferent::Encode( @@ -365,6 +366,7 @@ mod tests { name: DecodeDifferent::Encode("GenericData"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map{ + hasher: StorageHasher::Twox128, key: DecodeDifferent::Encode("T::BlockNumber"), value: DecodeDifferent::Encode("T::BlockNumber"), is_linked: true }, default: DecodeDifferent::Encode( @@ -376,6 +378,7 @@ mod tests { name: DecodeDifferent::Encode("GenericData2"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map{ + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("T::BlockNumber"), value: DecodeDifferent::Encode("T::BlockNumber"), is_linked: true }, default: DecodeDifferent::Encode( @@ -387,6 +390,7 @@ mod tests { name: DecodeDifferent::Encode("DataDM"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::DoubleMap{ + hasher: StorageHasher::Twox64Concat, key1: DecodeDifferent::Encode("u32"), key2: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("u64"), @@ -401,6 +405,7 @@ mod tests { name: DecodeDifferent::Encode("GenericDataDM"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::DoubleMap{ + hasher: StorageHasher::Blake2_256, key1: DecodeDifferent::Encode("T::BlockNumber"), key2: DecodeDifferent::Encode("T::BlockNumber"), value: DecodeDifferent::Encode("T::BlockNumber"), @@ -415,6 +420,7 @@ mod tests { name: DecodeDifferent::Encode("GenericData2DM"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::DoubleMap{ + hasher: StorageHasher::Blake2_256, key1: DecodeDifferent::Encode("T::BlockNumber"), key2: DecodeDifferent::Encode("T::BlockNumber"), value: DecodeDifferent::Encode("T::BlockNumber"), diff --git a/srml/support/src/metadata.rs b/srml/support/src/metadata.rs index f7594d27b7..407408b52c 100644 --- a/srml/support/src/metadata.rs +++ b/srml/support/src/metadata.rs @@ -16,10 +16,14 @@ pub use srml_metadata::{ DecodeDifferent, FnEncode, RuntimeMetadata, - ModuleMetadata, RuntimeMetadataV3, + ModuleMetadata, RuntimeMetadataV4, DefaultByteGetter, RuntimeMetadataPrefixed, + StorageMetadata, StorageFunctionMetadata, + StorageFunctionType, StorageFunctionModifier, + DefaultByte, StorageHasher }; + /// Implements the metadata support for the given runtime and all its modules. /// /// Example: @@ -36,8 +40,8 @@ macro_rules! impl_runtime_metadata { ) => { impl $runtime { pub fn metadata() -> $crate::metadata::RuntimeMetadataPrefixed { - $crate::metadata::RuntimeMetadata::V3 ( - $crate::metadata::RuntimeMetadataV3 { + $crate::metadata::RuntimeMetadata::V4 ( + $crate::metadata::RuntimeMetadataV4 { modules: $crate::__runtime_modules_to_metadata!($runtime;; $( $rest )*), } ).into() @@ -377,8 +381,8 @@ mod tests { event_module2::Module with Event Storage Call, ); - const EXPECTED_METADATA: RuntimeMetadata = RuntimeMetadata::V3( - RuntimeMetadataV3 { + const EXPECTED_METADATA: RuntimeMetadata = RuntimeMetadata::V4( + RuntimeMetadataV4 { modules: DecodeDifferent::Encode(&[ ModuleMetadata { name: DecodeDifferent::Encode("system"), diff --git a/srml/support/src/storage/child.rs b/srml/support/src/storage/child.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/srml/support/src/storage/hashed/generator.rs b/srml/support/src/storage/hashed/generator.rs new file mode 100644 index 0000000000..12600a9eaf --- /dev/null +++ b/srml/support/src/storage/hashed/generator.rs @@ -0,0 +1,285 @@ +// Copyright 2019 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! Abstract storage to use on HashedStorage trait + +use crate::codec; +use crate::rstd::prelude::{Vec, Box}; +#[cfg(feature = "std")] +use crate::storage::unhashed::generator::UnhashedStorage; +use runtime_io::{twox_64, twox_128, blake2_128, twox_256, blake2_256}; + +pub trait StorageHasher: 'static { + type Output: AsRef<[u8]>; + fn hash(x: &[u8]) -> Self::Output; +} + +/// Hash storage keys with `concat(twox128(key), key)` +pub struct Twox64Concat; +impl StorageHasher for Twox64Concat { + type Output = Vec; + fn hash(x: &[u8]) -> Vec { + twox_64(x) + .into_iter() + .chain(x.into_iter()) + .cloned() + .collect::>() + } +} + +#[test] +fn test_twox_64_concat() { + let r = Twox64Concat::hash(b"foo"); + assert_eq!(r.split_at(8), (&twox_128(b"foo")[..8], &b"foo"[..])) +} + +/// Hash storage keys with blake2 128 +pub struct Blake2_128; +impl StorageHasher for Blake2_128 { + type Output = [u8; 16]; + fn hash(x: &[u8]) -> [u8; 16] { + blake2_128(x) + } +} + +/// Hash storage keys with blake2 256 +pub struct Blake2_256; +impl StorageHasher for Blake2_256 { + type Output = [u8; 32]; + fn hash(x: &[u8]) -> [u8; 32] { + blake2_256(x) + } +} + +/// Hash storage keys with twox 128 +pub struct Twox128; +impl StorageHasher for Twox128 { + type Output = [u8; 16]; + fn hash(x: &[u8]) -> [u8; 16] { + twox_128(x) + } +} + +/// Hash storage keys with twox 256 +pub struct Twox256; +impl StorageHasher for Twox256 { + type Output = [u8; 32]; + fn hash(x: &[u8]) -> [u8; 32] { + twox_256(x) + } +} + +/// Abstraction around storage. +pub trait HashedStorage { + /// true if the key exists in storage. + fn exists(&self, key: &[u8]) -> bool; + + /// Load the bytes of a key from storage. Can panic if the type is incorrect. + fn get(&self, key: &[u8]) -> Option; + + /// Load the bytes of a key from storage. Can panic if the type is incorrect. Will panic if + /// it's not there. + fn require(&self, key: &[u8]) -> T { + self.get(key).expect("Required values must be in storage") + } + + /// Load the bytes of a key from storage. Can panic if the type is incorrect. The type's + /// default is returned if it's not there. + fn get_or_default(&self, key: &[u8]) -> T { + self.get(key).unwrap_or_default() + } + + /// Put a value in under a key. + fn put(&self, key: &[u8], val: &T); + + /// Remove the bytes of a key from storage. + fn kill(&self, key: &[u8]); + + /// Take a value from storage, deleting it after reading. + fn take(&self, key: &[u8]) -> Option { + let value = self.get(key); + self.kill(key); + value + } + + /// Take a value from storage, deleting it after reading. + fn take_or_panic(&self, key: &[u8]) -> T { + self.take(key).expect("Required values must be in storage") + } + + /// Take a value from storage, deleting it after reading. + fn take_or_default(&self, key: &[u8]) -> T { + self.take(key).unwrap_or_default() + } + + /// Get a Vec of bytes from storage. + fn get_raw(&self, key: &[u8]) -> Option>; + + /// Put a raw byte slice into storage. + fn put_raw(&self, key: &[u8], value: &[u8]); +} + +// We use a construct like this during when genesis storage is being built. +#[cfg(feature = "std")] +impl HashedStorage for std::cell::RefCell<&mut sr_primitives::StorageOverlay> { + fn exists(&self, key: &[u8]) -> bool { + UnhashedStorage::exists(self, &H::hash(key).as_ref()) + } + + fn get(&self, key: &[u8]) -> Option { + UnhashedStorage::get(self, &H::hash(key).as_ref()) + } + + fn put(&self, key: &[u8], val: &T) { + UnhashedStorage::put(self, &H::hash(key).as_ref(), val) + } + + fn kill(&self, key: &[u8]) { + UnhashedStorage::kill(self, &H::hash(key).as_ref()) + } + + fn get_raw(&self, key: &[u8]) -> Option> { + UnhashedStorage::get_raw(self, &H::hash(key).as_ref()) + } + + fn put_raw(&self, key: &[u8], value: &[u8]) { + UnhashedStorage::put_raw(self, &H::hash(key).as_ref(), value) + } +} + +/// A strongly-typed value kept in storage. +pub trait StorageValue { + /// The type that get/take returns. + type Query; + + /// Get the storage key. + fn key() -> &'static [u8]; + + /// true if the value is defined in storage. + fn exists>(storage: &S) -> bool { + storage.exists(Self::key()) + } + + /// Load the value from the provided storage instance. + fn get>(storage: &S) -> Self::Query; + + /// Take a value from storage, removing it afterwards. + fn take>(storage: &S) -> Self::Query; + + /// Store a value under this key into the provided storage instance. + fn put>(val: &T, storage: &S) { + storage.put(Self::key(), val) + } + + /// Mutate this value + fn mutate R, S: HashedStorage>(f: F, storage: &S) -> R; + + /// Clear the storage value. + fn kill>(storage: &S) { + storage.kill(Self::key()) + } + + /// Append the given items to the value in the storage. + /// + /// `T` is required to implement `codec::EncodeAppend`. + fn append, I: codec::Encode>( + items: &[I], storage: &S + ) -> Result<(), &'static str> where T: codec::EncodeAppend { + let new_val = ::append( + storage.get_raw(Self::key()).unwrap_or_default(), + items, + ).ok_or_else(|| "Could not append given item")?; + storage.put_raw(Self::key(), &new_val); + Ok(()) + } +} + +/// A strongly-typed list in storage. +pub trait StorageList { + /// Get the prefix key in storage. + fn prefix() -> &'static [u8]; + + /// Get the key used to put the length field. + fn len_key() -> Vec; + + /// Get the storage key used to fetch a value at a given index. + fn key_for(index: u32) -> Vec; + + /// Read out all the items. + fn items>(storage: &S) -> Vec; + + /// Set the current set of items. + fn set_items>(items: &[T], storage: &S); + + /// Set the item at the given index. + fn set_item>(index: u32, item: &T, storage: &S); + + /// Load the value at given index. Returns `None` if the index is out-of-bounds. + fn get>(index: u32, storage: &S) -> Option; + + /// Load the length of the list + fn len>(storage: &S) -> u32; + + /// Clear the list. + fn clear>(storage: &S); +} + +/// A strongly-typed map in storage. +pub trait StorageMap { + /// The type that get/take returns. + type Query; + + type Hasher: StorageHasher; + + /// Get the prefix key in storage. + fn prefix() -> &'static [u8]; + + /// Get the storage key used to fetch a value corresponding to a specific key. + fn key_for(x: &K) -> Vec; + + /// true if the value is defined in storage. + fn exists>(key: &K, storage: &S) -> bool { + storage.exists(&Self::key_for(key)[..]) + } + + /// Load the value associated with the given key from the map. + fn get>(key: &K, storage: &S) -> Self::Query; + + /// Take the value under a key. + fn take>(key: &K, storage: &S) -> Self::Query; + + /// Store a value to be associated with the given key from the map. + fn insert>(key: &K, val: &V, storage: &S) { + storage.put(&Self::key_for(key)[..], val); + } + + /// Remove the value under a key. + fn remove>(key: &K, storage: &S) { + storage.kill(&Self::key_for(key)[..]); + } + + /// Mutate the value under a key. + fn mutate R, S: HashedStorage>(key: &K, f: F, storage: &S) -> R; +} + +/// A `StorageMap` with enumerable entries. +pub trait EnumerableStorageMap: StorageMap { + /// Return current head element. + fn head>(storage: &S) -> Option; + + /// Enumerate all elements in the map. + fn enumerate<'a, S: HashedStorage>(storage: &'a S) -> Box + 'a> where K: 'a, V: 'a; +} diff --git a/srml/support/src/storage/hashed/mod.rs b/srml/support/src/storage/hashed/mod.rs new file mode 100644 index 0000000000..5c65cf0513 --- /dev/null +++ b/srml/support/src/storage/hashed/mod.rs @@ -0,0 +1,223 @@ +// Copyright 2019 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! Operation on runtime storage using hashed keys. + +pub mod generator; +use super::unhashed; +use crate::rstd::prelude::*; +use crate::rstd::borrow::Borrow; +use runtime_io::{self, twox_128}; +use crate::codec::{Codec, Encode, Decode, KeyedVec}; + +/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. +pub fn get R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> Option { + unhashed::get(&hash(key).as_ref()) +} + +/// Return the value of the item in storage under `key`, or the type's default if there is no +/// explicit entry. +pub fn get_or_default R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> T { + unhashed::get_or_default(&hash(key).as_ref()) +} + +/// Return the value of the item in storage under `key`, or `default_value` if there is no +/// explicit entry. +pub fn get_or R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8], default_value: T) -> T { + unhashed::get_or(&hash(key).as_ref(), default_value) +} + +/// Return the value of the item in storage under `key`, or `default_value()` if there is no +/// explicit entry. +pub fn get_or_else T, HashFn: Fn(&[u8]) -> R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8], default_value: F) -> T { + unhashed::get_or_else(&hash(key).as_ref(), default_value) +} + +/// Put `value` in storage under `key`. +pub fn put R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8], value: &T) { + unhashed::put(&hash(key).as_ref(), value) +} + +/// Remove `key` from storage, returning its value if it had an explicit entry or `None` otherwise. +pub fn take R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> Option { + unhashed::take(&hash(key).as_ref()) +} + +/// Remove `key` from storage, returning its value, or, if there was no explicit entry in storage, +/// the default for its type. +pub fn take_or_default R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> T { + unhashed::take_or_default(&hash(key).as_ref()) +} + +/// Return the value of the item in storage under `key`, or `default_value` if there is no +/// explicit entry. Ensure there is no explicit entry on return. +pub fn take_or R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8], default_value: T) -> T { + unhashed::take_or(&hash(key).as_ref(), default_value) +} + +/// Return the value of the item in storage under `key`, or `default_value()` if there is no +/// explicit entry. Ensure there is no explicit entry on return. +pub fn take_or_else T, HashFn: Fn(&[u8]) -> R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8], default_value: F) -> T { + unhashed::take_or_else(&hash(key).as_ref(), default_value) +} + +/// Check to see if `key` has an explicit entry in storage. +pub fn exists R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> bool { + unhashed::exists(&hash(key).as_ref()) +} + +/// Ensure `key` has no explicit entry in storage. +pub fn kill R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) { + unhashed::kill(&hash(key).as_ref()) +} + +/// Get a Vec of bytes from storage. +pub fn get_raw R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> Option> { + unhashed::get_raw(&hash(key).as_ref()) +} + +/// Put a raw byte slice into storage. +pub fn put_raw R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8], value: &[u8]) { + unhashed::put_raw(&hash(key).as_ref(), value) +} + +/// A trait to conveniently store a vector of storable data. +/// +/// It uses twox_128 hasher. Final keys in trie are `twox_128(concatenation(PREFIX,count))` +pub trait StorageVec { + type Item: Default + Sized + Codec; + const PREFIX: &'static [u8]; + + /// Get the current set of items. + fn items() -> Vec { + (0..Self::count()).into_iter().map(Self::item).collect() + } + + /// Set the current set of items. + fn set_items(items: I) + where + I: IntoIterator, + T: Borrow, + { + let mut count: u32 = 0; + + for i in items.into_iter() { + put(&twox_128, &count.to_keyed_vec(Self::PREFIX), i.borrow()); + count = count.checked_add(1).expect("exceeded runtime storage capacity"); + } + + Self::set_count(count); + } + + /// Push an item. + fn push(item: &Self::Item) { + let len = Self::count(); + put(&twox_128, &len.to_keyed_vec(Self::PREFIX), item); + Self::set_count(len + 1); + } + + fn set_item(index: u32, item: &Self::Item) { + if index < Self::count() { + put(&twox_128, &index.to_keyed_vec(Self::PREFIX), item); + } + } + + fn clear_item(index: u32) { + if index < Self::count() { + kill(&twox_128, &index.to_keyed_vec(Self::PREFIX)); + } + } + + fn item(index: u32) -> Self::Item { + get_or_default(&twox_128, &index.to_keyed_vec(Self::PREFIX)) + } + + fn set_count(count: u32) { + (count..Self::count()).for_each(Self::clear_item); + put(&twox_128, &b"len".to_keyed_vec(Self::PREFIX), &count); + } + + fn count() -> u32 { + get_or_default(&twox_128, &b"len".to_keyed_vec(Self::PREFIX)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use runtime_io::{twox_128, TestExternalities, with_externalities}; + + #[test] + fn integers_can_be_stored() { + let mut t = TestExternalities::default(); + with_externalities(&mut t, || { + let x = 69u32; + put(&twox_128, b":test", &x); + let y: u32 = get(&twox_128, b":test").unwrap(); + assert_eq!(x, y); + }); + with_externalities(&mut t, || { + let x = 69426942i64; + put(&twox_128, b":test", &x); + let y: i64 = get(&twox_128, b":test").unwrap(); + assert_eq!(x, y); + }); + } + + #[test] + fn bools_can_be_stored() { + let mut t = TestExternalities::default(); + with_externalities(&mut t, || { + let x = true; + put(&twox_128, b":test", &x); + let y: bool = get(&twox_128, b":test").unwrap(); + assert_eq!(x, y); + }); + + with_externalities(&mut t, || { + let x = false; + put(&twox_128, b":test", &x); + let y: bool = get(&twox_128, b":test").unwrap(); + assert_eq!(x, y); + }); + } + + #[test] + fn vecs_can_be_retrieved() { + let mut t = TestExternalities::default(); + with_externalities(&mut t, || { + runtime_io::set_storage(&twox_128(b":test"), b"\x2cHello world"); + let x = b"Hello world".to_vec(); + let y = get::, _, _>(&twox_128, b":test").unwrap(); + assert_eq!(x, y); + }); + } + + #[test] + fn vecs_can_be_stored() { + let mut t = TestExternalities::default(); + let x = b"Hello world".to_vec(); + + with_externalities(&mut t, || { + put(&twox_128, b":test", &x); + }); + + with_externalities(&mut t, || { + let y: Vec = get(&twox_128, b":test").unwrap(); + assert_eq!(x, y); + }); + } +} diff --git a/srml/support/src/storage/mod.rs b/srml/support/src/storage/mod.rs index 74b55673e7..fb23383c9d 100644 --- a/srml/support/src/storage/mod.rs +++ b/srml/support/src/storage/mod.rs @@ -18,12 +18,14 @@ use crate::rstd::prelude::*; use crate::rstd::borrow::Borrow; -use runtime_io::{self, twox_128}; -use crate::codec::{Codec, Encode, Decode, KeyedVec, Input, EncodeAppend}; +use codec::{Codec, Encode, Decode, KeyedVec, Input, EncodeAppend}; +use hashed::generator::{HashedStorage, StorageHasher}; +use unhashed::generator::UnhashedStorage; #[macro_use] -pub mod generator; +pub mod storage_items; pub mod unhashed; +pub mod hashed; struct IncrementalInput<'a> { key: &'a [u8], @@ -54,116 +56,44 @@ impl<'a> Input for IncrementalChildInput<'a> { } } - -/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. -pub fn get(key: &[u8]) -> Option { - unhashed::get(&twox_128(key)) -} - -/// Return the value of the item in storage under `key`, or the type's default if there is no -/// explicit entry. -pub fn get_or_default(key: &[u8]) -> T { - unhashed::get_or_default(&twox_128(key)) -} - -/// Return the value of the item in storage under `key`, or `default_value` if there is no -/// explicit entry. -pub fn get_or(key: &[u8], default_value: T) -> T { - unhashed::get_or(&twox_128(key), default_value) -} - -/// Return the value of the item in storage under `key`, or `default_value()` if there is no -/// explicit entry. -pub fn get_or_else T>(key: &[u8], default_value: F) -> T { - unhashed::get_or_else(&twox_128(key), default_value) -} - -/// Put `value` in storage under `key`. -pub fn put(key: &[u8], value: &T) { - unhashed::put(&twox_128(key), value) -} - -/// Remove `key` from storage, returning its value if it had an explicit entry or `None` otherwise. -pub fn take(key: &[u8]) -> Option { - unhashed::take(&twox_128(key)) -} - -/// Remove `key` from storage, returning its value, or, if there was no explicit entry in storage, -/// the default for its type. -pub fn take_or_default(key: &[u8]) -> T { - unhashed::take_or_default(&twox_128(key)) -} - -/// Return the value of the item in storage under `key`, or `default_value` if there is no -/// explicit entry. Ensure there is no explicit entry on return. -pub fn take_or(key: &[u8], default_value: T) -> T { - unhashed::take_or(&twox_128(key), default_value) -} - -/// Return the value of the item in storage under `key`, or `default_value()` if there is no -/// explicit entry. Ensure there is no explicit entry on return. -pub fn take_or_else T>(key: &[u8], default_value: F) -> T { - unhashed::take_or_else(&twox_128(key), default_value) -} - -/// Check to see if `key` has an explicit entry in storage. -pub fn exists(key: &[u8]) -> bool { - unhashed::exists(&twox_128(key)) -} - -/// Ensure `key` has no explicit entry in storage. -pub fn kill(key: &[u8]) { - unhashed::kill(&twox_128(key)) -} - -/// Get a Vec of bytes from storage. -pub fn get_raw(key: &[u8]) -> Option> { - unhashed::get_raw(&twox_128(key)) -} - -/// Put a raw byte slice into storage. -pub fn put_raw(key: &[u8], value: &[u8]) { - unhashed::put_raw(&twox_128(key), value) -} - /// The underlying runtime storage. pub struct RuntimeStorage; -impl crate::GenericStorage for RuntimeStorage { +impl HashedStorage for RuntimeStorage { fn exists(&self, key: &[u8]) -> bool { - exists(key) + hashed::exists(&H::hash, key) } /// Load the bytes of a key from storage. Can panic if the type is incorrect. fn get(&self, key: &[u8]) -> Option { - get(key) + hashed::get(&H::hash, key) } /// Put a value in under a key. fn put(&self, key: &[u8], val: &T) { - put(key, val) + hashed::put(&H::hash, key, val) } /// Remove the bytes of a key from storage. fn kill(&self, key: &[u8]) { - kill(key) + hashed::kill(&H::hash, key) } /// Take a value from storage, deleting it after reading. fn take(&self, key: &[u8]) -> Option { - take(key) + hashed::take(&H::hash, key) } fn get_raw(&self, key: &[u8]) -> Option> { - get_raw(key) + hashed::get_raw(&H::hash, key) } fn put_raw(&self, key: &[u8], value: &[u8]) { - put_raw(key, value) + hashed::put_raw(&H::hash, key, value) } } -impl crate::GenericUnhashedStorage for RuntimeStorage { +impl UnhashedStorage for RuntimeStorage { fn exists(&self, key: &[u8]) -> bool { unhashed::exists(key) } @@ -235,11 +165,11 @@ pub trait StorageValue { where T: EncodeAppend; } -impl StorageValue for U where U: generator::StorageValue { +impl StorageValue for U where U: hashed::generator::StorageValue { type Query = U::Query; fn key() -> &'static [u8] { - >::key() + >::key() } fn exists() -> bool { U::exists(&RuntimeStorage) @@ -296,17 +226,17 @@ pub trait StorageList { fn clear(); } -impl StorageList for U where U: generator::StorageList { +impl StorageList for U where U: hashed::generator::StorageList { fn prefix() -> &'static [u8] { - >::prefix() + >::prefix() } fn len_key() -> Vec { - >::len_key() + >::len_key() } fn key_for(index: u32) -> Vec { - >::key_for(index) + >::key_for(index) } fn items() -> Vec { @@ -364,15 +294,15 @@ pub trait StorageMap { fn take>(key: KeyArg) -> Self::Query; } -impl StorageMap for U where U: generator::StorageMap { +impl StorageMap for U where U: hashed::generator::StorageMap { type Query = U::Query; fn prefix() -> &'static [u8] { - >::prefix() + >::prefix() } fn key_for>(key: KeyArg) -> Vec { - >::key_for(key.borrow()) + >::key_for(key.borrow()) } fn exists>(key: KeyArg) -> bool { @@ -412,13 +342,13 @@ pub trait EnumerableStorageMap: StorageMap { fn enumerate() -> Box> where K: 'static, V: 'static; } -impl EnumerableStorageMap for U where U: generator::EnumerableStorageMap { +impl EnumerableStorageMap for U where U: hashed::generator::EnumerableStorageMap { fn head() -> Option { - >::head(&RuntimeStorage) + >::head(&RuntimeStorage) } fn enumerate() -> Box> where K: 'static, V: 'static { - >::enumerate(&RuntimeStorage) + >::enumerate(&RuntimeStorage) } } @@ -525,72 +455,13 @@ where } } -/// A trait to conveniently store a vector of storable data. -pub trait StorageVec { - type Item: Default + Sized + Codec; - const PREFIX: &'static [u8]; - - /// Get the current set of items. - fn items() -> Vec { - (0..Self::count()).into_iter().map(Self::item).collect() - } - - /// Set the current set of items. - fn set_items(items: I) - where - I: IntoIterator, - T: Borrow, - { - let mut count: u32 = 0; - - for i in items.into_iter() { - put(&count.to_keyed_vec(Self::PREFIX), i.borrow()); - count = count.checked_add(1).expect("exceeded runtime storage capacity"); - } - - Self::set_count(count); - } - - /// Push an item. - fn push(item: &Self::Item) { - let len = Self::count(); - put(&len.to_keyed_vec(Self::PREFIX), item); - Self::set_count(len + 1); - } - - fn set_item(index: u32, item: &Self::Item) { - if index < Self::count() { - put(&index.to_keyed_vec(Self::PREFIX), item); - } - } - - fn clear_item(index: u32) { - if index < Self::count() { - kill(&index.to_keyed_vec(Self::PREFIX)); - } - } - - fn item(index: u32) -> Self::Item { - get_or_default(&index.to_keyed_vec(Self::PREFIX)) - } - - fn set_count(count: u32) { - (count..Self::count()).for_each(Self::clear_item); - put(&b"len".to_keyed_vec(Self::PREFIX), &count); - } - - fn count() -> u32 { - get_or_default(&b"len".to_keyed_vec(Self::PREFIX)) - } -} - /// child storage NOTE could replace unhashed by having only one kind of storage (root being null storage /// key (storage_key can become Option<&[u8]>). /// This module is a currently only a variant of unhashed with additional `storage_key`. /// Note that `storage_key` must be unique and strong (strong in the sense of being long enough to /// avoid collision from a resistant hash function (which unique implies)). pub mod child { - use super::{runtime_io, Codec, Decode, Vec, IncrementalChildInput}; + use super::{Codec, Decode, Vec, IncrementalChildInput}; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. pub fn get(storage_key: &[u8], key: &[u8]) -> Option { @@ -681,71 +552,3 @@ pub mod child { pub use super::unhashed::StorageVec; } - -#[cfg(test)] -mod tests { - use super::*; - use runtime_io::{twox_128, TestExternalities, with_externalities}; - - #[test] - fn integers_can_be_stored() { - let mut t = TestExternalities::default(); - with_externalities(&mut t, || { - let x = 69u32; - put(b":test", &x); - let y: u32 = get(b":test").unwrap(); - assert_eq!(x, y); - }); - with_externalities(&mut t, || { - let x = 69426942i64; - put(b":test", &x); - let y: i64 = get(b":test").unwrap(); - assert_eq!(x, y); - }); - } - - #[test] - fn bools_can_be_stored() { - let mut t = TestExternalities::default(); - with_externalities(&mut t, || { - let x = true; - put(b":test", &x); - let y: bool = get(b":test").unwrap(); - assert_eq!(x, y); - }); - - with_externalities(&mut t, || { - let x = false; - put(b":test", &x); - let y: bool = get(b":test").unwrap(); - assert_eq!(x, y); - }); - } - - #[test] - fn vecs_can_be_retrieved() { - let mut t = TestExternalities::default(); - with_externalities(&mut t, || { - runtime_io::set_storage(&twox_128(b":test"), b"\x2cHello world"); - let x = b"Hello world".to_vec(); - let y = get::>(b":test").unwrap(); - assert_eq!(x, y); - - }); - } - - #[test] - fn vecs_can_be_stored() { - let mut t = TestExternalities::default(); - let x = b"Hello world".to_vec(); - - with_externalities(&mut t, || { - put(b":test", &x); - }); - - with_externalities(&mut t, || { - let y: Vec = get(b":test").unwrap(); - assert_eq!(x, y); - }); - } -} diff --git a/srml/support/src/storage/generator.rs b/srml/support/src/storage/storage_items.rs similarity index 72% rename from srml/support/src/storage/generator.rs rename to srml/support/src/storage/storage_items.rs index 3d57d200e2..720cac64c5 100644 --- a/srml/support/src/storage/generator.rs +++ b/srml/support/src/storage/storage_items.rs @@ -46,10 +46,6 @@ //!# fn main() { } //! ``` -use crate::codec; -use crate::rstd::vec::Vec; -#[cfg(feature = "std")] -use crate::storage::unhashed::generator::UnhashedStorage; #[doc(hidden)] pub use crate::rstd::borrow::Borrow; #[doc(hidden)] @@ -57,204 +53,6 @@ pub use crate::rstd::marker::PhantomData; #[doc(hidden)] pub use crate::rstd::boxed::Box; -pub use srml_metadata::{ - DecodeDifferent, StorageMetadata, StorageFunctionMetadata, - StorageFunctionType, StorageFunctionModifier, - DefaultByte, DefaultByteGetter, -}; - -/// Abstraction around storage. -pub trait Storage { - /// true if the key exists in storage. - fn exists(&self, key: &[u8]) -> bool; - - /// Load the bytes of a key from storage. Can panic if the type is incorrect. - fn get(&self, key: &[u8]) -> Option; - - /// Load the bytes of a key from storage. Can panic if the type is incorrect. Will panic if - /// it's not there. - fn require(&self, key: &[u8]) -> T { self.get(key).expect("Required values must be in storage") } - - /// Load the bytes of a key from storage. Can panic if the type is incorrect. The type's - /// default is returned if it's not there. - fn get_or_default(&self, key: &[u8]) -> T { self.get(key).unwrap_or_default() } - - /// Put a value in under a key. - fn put(&self, key: &[u8], val: &T); - - /// Remove the bytes of a key from storage. - fn kill(&self, key: &[u8]); - - /// Take a value from storage, deleting it after reading. - fn take(&self, key: &[u8]) -> Option { - let value = self.get(key); - self.kill(key); - value - } - - /// Take a value from storage, deleting it after reading. - fn take_or_panic(&self, key: &[u8]) -> T { self.take(key).expect("Required values must be in storage") } - - /// Take a value from storage, deleting it after reading. - fn take_or_default(&self, key: &[u8]) -> T { self.take(key).unwrap_or_default() } - - /// Get a Vec of bytes from storage. - fn get_raw(&self, key: &[u8]) -> Option>; - - /// Put a raw byte slice into storage. - fn put_raw(&self, key: &[u8], value: &[u8]); -} - -// We use a construct like this during when genesis storage is being built. -#[cfg(feature = "std")] -impl Storage for (crate::rstd::cell::RefCell<&mut sr_primitives::StorageOverlay>, PhantomData) { - fn exists(&self, key: &[u8]) -> bool { - UnhashedStorage::exists(self, &S::hash(key)) - } - - fn get(&self, key: &[u8]) -> Option { - UnhashedStorage::get(self, &S::hash(key)) - } - - fn put(&self, key: &[u8], val: &T) { - UnhashedStorage::put(self, &S::hash(key), val) - } - - fn kill(&self, key: &[u8]) { - UnhashedStorage::kill(self, &S::hash(key)) - } - - fn get_raw(&self, key: &[u8]) -> Option> { - UnhashedStorage::get_raw(self, key) - } - - fn put_raw(&self, key: &[u8], value: &[u8]) { - UnhashedStorage::put_raw(self, key, value) - } -} - -/// A strongly-typed value kept in storage. -pub trait StorageValue { - /// The type that get/take returns. - type Query; - - /// Get the storage key. - fn key() -> &'static [u8]; - - /// true if the value is defined in storage. - fn exists(storage: &S) -> bool { - storage.exists(Self::key()) - } - - /// Load the value from the provided storage instance. - fn get(storage: &S) -> Self::Query; - - /// Take a value from storage, removing it afterwards. - fn take(storage: &S) -> Self::Query; - - /// Store a value under this key into the provided storage instance. - fn put(val: &T, storage: &S) { - storage.put(Self::key(), val) - } - - /// Mutate this value - fn mutate R, S: Storage>(f: F, storage: &S) -> R; - - /// Clear the storage value. - fn kill(storage: &S) { - storage.kill(Self::key()) - } - - /// Append the given items to the value in the storage. - /// - /// `T` is required to implement `codec::EncodeAppend`. - fn append( - items: &[I], storage: &S - ) -> Result<(), &'static str> where T: codec::EncodeAppend { - let new_val = ::append( - storage.get_raw(Self::key()).unwrap_or_default(), - items, - ).ok_or_else(|| "Could not append given item")?; - storage.put_raw(Self::key(), &new_val); - Ok(()) - } -} - -/// A strongly-typed list in storage. -pub trait StorageList { - /// Get the prefix key in storage. - fn prefix() -> &'static [u8]; - - /// Get the key used to put the length field. - fn len_key() -> Vec; - - /// Get the storage key used to fetch a value at a given index. - fn key_for(index: u32) -> Vec; - - /// Read out all the items. - fn items(storage: &S) -> Vec; - - /// Set the current set of items. - fn set_items(items: &[T], storage: &S); - - /// Set the item at the given index. - fn set_item(index: u32, item: &T, storage: &S); - - /// Load the value at given index. Returns `None` if the index is out-of-bounds. - fn get(index: u32, storage: &S) -> Option; - - /// Load the length of the list - fn len(storage: &S) -> u32; - - /// Clear the list. - fn clear(storage: &S); -} - -/// A strongly-typed map in storage. -pub trait StorageMap { - /// The type that get/take returns. - type Query; - - /// Get the prefix key in storage. - fn prefix() -> &'static [u8]; - - /// Get the storage key used to fetch a value corresponding to a specific key. - fn key_for(x: &K) -> Vec; - - /// true if the value is defined in storage. - fn exists(key: &K, storage: &S) -> bool { - storage.exists(&Self::key_for(key)[..]) - } - - /// Load the value associated with the given key from the map. - fn get(key: &K, storage: &S) -> Self::Query; - - /// Take the value under a key. - fn take(key: &K, storage: &S) -> Self::Query; - - /// Store a value to be associated with the given key from the map. - fn insert(key: &K, val: &V, storage: &S) { - storage.put(&Self::key_for(key)[..], val); - } - - /// Remove the value under a key. - fn remove(key: &K, storage: &S) { - storage.kill(&Self::key_for(key)[..]); - } - - /// Mutate the value under a key. - fn mutate R, S: Storage>(key: &K, f: F, storage: &S) -> R; -} - -/// A `StorageMap` with enumerable entries. -pub trait EnumerableStorageMap: StorageMap { - /// Return current head element. - fn head(storage: &S) -> Option; - - /// Enumerate all elements in the map. - fn enumerate<'a, S: Storage>(storage: &'a S) -> Box + 'a> where K: 'a, V: 'a; -} - // FIXME #1466 Remove this in favor of `decl_storage` macro. /// Declares strongly-typed wrappers around codec-compatible types in storage. #[macro_export] @@ -380,12 +178,12 @@ macro_rules! __storage_items_internal { // generator for values. (($($vis:tt)*) ($get_fn:ident) ($wraptype:ident $gettype:ty) ($getter:ident) ($taker:ident) $name:ident : $key:expr => $ty:ty) => { $crate::__storage_items_internal!{ ($($vis)*) () ($wraptype $gettype) ($getter) ($taker) $name : $key => $ty } - pub fn $get_fn() -> $gettype { <$name as $crate::storage::generator::StorageValue<$ty>> :: get(&$crate::storage::RuntimeStorage) } + pub fn $get_fn() -> $gettype { <$name as $crate::storage::hashed::generator::StorageValue<$ty>> :: get(&$crate::storage::RuntimeStorage) } }; (($($vis:tt)*) () ($wraptype:ident $gettype:ty) ($getter:ident) ($taker:ident) $name:ident : $key:expr => $ty:ty) => { $($vis)* struct $name; - impl $crate::storage::generator::StorageValue<$ty> for $name { + impl $crate::storage::hashed::generator::StorageValue<$ty> for $name { type Query = $gettype; /// Get the storage key. @@ -394,29 +192,29 @@ macro_rules! __storage_items_internal { } /// Load the value from the provided storage instance. - fn get(storage: &S) -> Self::Query { + fn get>(storage: &S) -> Self::Query { storage.$getter($key) } /// Take a value from storage, removing it afterwards. - fn take(storage: &S) -> Self::Query { + fn take>(storage: &S) -> Self::Query { storage.$taker($key) } /// Mutate this value. - fn mutate R, S: $crate::GenericStorage>(f: F, storage: &S) -> R { - let mut val = >::get(storage); + fn mutate R, S: $crate::HashedStorage<$crate::Twox128>>(f: F, storage: &S) -> R { + let mut val = >::get(storage); let ret = f(&mut val); $crate::__handle_wrap_internal!($wraptype { // raw type case - >::put(&val, storage) + >::put(&val, storage) } { // Option<> type case match val { - Some(ref val) => >::put(&val, storage), - None => >::kill(storage), + Some(ref val) => >::put(&val, storage), + None => >::kill(storage), } }); @@ -428,15 +226,17 @@ macro_rules! __storage_items_internal { (($($vis:tt)*) ($get_fn:ident) ($wraptype:ident $gettype:ty) ($getter:ident) ($taker:ident) $name:ident : $prefix:expr => map [$kty:ty => $ty:ty]) => { $crate::__storage_items_internal!{ ($($vis)*) () ($wraptype $gettype) ($getter) ($taker) $name : $prefix => map [$kty => $ty] } pub fn $get_fn>(key: K) -> $gettype { - <$name as $crate::storage::generator::StorageMap<$kty, $ty>> :: get(key.borrow(), &$crate::storage::RuntimeStorage) + <$name as $crate::storage::hashed::generator::StorageMap<$kty, $ty>> :: get(key.borrow(), &$crate::storage::RuntimeStorage) } }; (($($vis:tt)*) () ($wraptype:ident $gettype:ty) ($getter:ident) ($taker:ident) $name:ident : $prefix:expr => map [$kty:ty => $ty:ty]) => { $($vis)* struct $name; - impl $crate::storage::generator::StorageMap<$kty, $ty> for $name { + impl $crate::storage::hashed::generator::StorageMap<$kty, $ty> for $name { type Query = $gettype; + type Hasher = $crate::Blake2_256; + /// Get the prefix key in storage. fn prefix() -> &'static [u8] { $prefix @@ -450,31 +250,31 @@ macro_rules! __storage_items_internal { } /// Load the value associated with the given key from the map. - fn get(key: &$kty, storage: &S) -> Self::Query { - let key = <$name as $crate::storage::generator::StorageMap<$kty, $ty>>::key_for(key); + fn get>(key: &$kty, storage: &S) -> Self::Query { + let key = <$name as $crate::storage::hashed::generator::StorageMap<$kty, $ty>>::key_for(key); storage.$getter(&key[..]) } /// Take the value, reading and removing it. - fn take(key: &$kty, storage: &S) -> Self::Query { - let key = <$name as $crate::storage::generator::StorageMap<$kty, $ty>>::key_for(key); + fn take>(key: &$kty, storage: &S) -> Self::Query { + let key = <$name as $crate::storage::hashed::generator::StorageMap<$kty, $ty>>::key_for(key); storage.$taker(&key[..]) } /// Mutate the value under a key. - fn mutate R, S: $crate::GenericStorage>(key: &$kty, f: F, storage: &S) -> R { - let mut val = >::take(key, storage); + fn mutate R, S: $crate::HashedStorage>(key: &$kty, f: F, storage: &S) -> R { + let mut val = >::take(key, storage); let ret = f(&mut val); $crate::__handle_wrap_internal!($wraptype { // raw type case - >::insert(key, &val, storage) + >::insert(key, &val, storage) } { // Option<> type case match val { - Some(ref val) => >::insert(key, &val, storage), - None => >::remove(key, storage), + Some(ref val) => >::insert(key, &val, storage), + None => >::remove(key, storage), } }); @@ -487,19 +287,19 @@ macro_rules! __storage_items_internal { $($vis)* struct $name; impl $name { - fn clear_item(index: u32, storage: &S) { - if index < <$name as $crate::storage::generator::StorageList<$ty>>::len(storage) { - storage.kill(&<$name as $crate::storage::generator::StorageList<$ty>>::key_for(index)); + fn clear_item>(index: u32, storage: &S) { + if index < <$name as $crate::storage::hashed::generator::StorageList<$ty>>::len(storage) { + storage.kill(&<$name as $crate::storage::hashed::generator::StorageList<$ty>>::key_for(index)); } } - fn set_len(count: u32, storage: &S) { - (count..<$name as $crate::storage::generator::StorageList<$ty>>::len(storage)).for_each(|i| $name::clear_item(i, storage)); - storage.put(&<$name as $crate::storage::generator::StorageList<$ty>>::len_key(), &count); + fn set_len>(count: u32, storage: &S) { + (count..<$name as $crate::storage::hashed::generator::StorageList<$ty>>::len(storage)).for_each(|i| $name::clear_item(i, storage)); + storage.put(&<$name as $crate::storage::hashed::generator::StorageList<$ty>>::len_key(), &count); } } - impl $crate::storage::generator::StorageList<$ty> for $name { + impl $crate::storage::hashed::generator::StorageList<$ty> for $name { /// Get the prefix key in storage. fn prefix() -> &'static [u8] { $prefix @@ -520,43 +320,43 @@ macro_rules! __storage_items_internal { } /// Read out all the items. - fn items(storage: &S) -> $crate::rstd::vec::Vec<$ty> { - (0..<$name as $crate::storage::generator::StorageList<$ty>>::len(storage)) - .map(|i| <$name as $crate::storage::generator::StorageList<$ty>>::get(i, storage).expect("all items within length are set; qed")) + fn items>(storage: &S) -> $crate::rstd::vec::Vec<$ty> { + (0..<$name as $crate::storage::hashed::generator::StorageList<$ty>>::len(storage)) + .map(|i| <$name as $crate::storage::hashed::generator::StorageList<$ty>>::get(i, storage).expect("all items within length are set; qed")) .collect() } /// Set the current set of items. - fn set_items(items: &[$ty], storage: &S) { + fn set_items>(items: &[$ty], storage: &S) { $name::set_len(items.len() as u32, storage); items.iter() .enumerate() - .for_each(|(i, item)| <$name as $crate::storage::generator::StorageList<$ty>>::set_item(i as u32, item, storage)); + .for_each(|(i, item)| <$name as $crate::storage::hashed::generator::StorageList<$ty>>::set_item(i as u32, item, storage)); } - fn set_item(index: u32, item: &$ty, storage: &S) { - if index < <$name as $crate::storage::generator::StorageList<$ty>>::len(storage) { - storage.put(&<$name as $crate::storage::generator::StorageList<$ty>>::key_for(index)[..], item); + fn set_item>(index: u32, item: &$ty, storage: &S) { + if index < <$name as $crate::storage::hashed::generator::StorageList<$ty>>::len(storage) { + storage.put(&<$name as $crate::storage::hashed::generator::StorageList<$ty>>::key_for(index)[..], item); } } /// Load the value at given index. Returns `None` if the index is out-of-bounds. - fn get(index: u32, storage: &S) -> Option<$ty> { - storage.get(&<$name as $crate::storage::generator::StorageList<$ty>>::key_for(index)[..]) + fn get>(index: u32, storage: &S) -> Option<$ty> { + storage.get(&<$name as $crate::storage::hashed::generator::StorageList<$ty>>::key_for(index)[..]) } /// Load the length of the list. - fn len(storage: &S) -> u32 { - storage.get(&<$name as $crate::storage::generator::StorageList<$ty>>::len_key()).unwrap_or_default() + fn len>(storage: &S) -> u32 { + storage.get(&<$name as $crate::storage::hashed::generator::StorageList<$ty>>::len_key()).unwrap_or_default() } /// Clear the list. - fn clear(storage: &S) { - for i in 0..<$name as $crate::storage::generator::StorageList<$ty>>::len(storage) { + fn clear>(storage: &S) { + for i in 0..<$name as $crate::storage::hashed::generator::StorageList<$ty>>::len(storage) { $name::clear_item(i, storage); } - storage.kill(&<$name as $crate::storage::generator::StorageList<$ty>>::len_key()[..]) + storage.kill(&<$name as $crate::storage::hashed::generator::StorageList<$ty>>::len_key()[..]) } } }; @@ -584,35 +384,11 @@ macro_rules! __handle_wrap_internal { mod tests { use std::collections::HashMap; use std::cell::RefCell; - use codec::{Decode, Encode}; use super::*; + use crate::metadata::*; + use crate::metadata::StorageHasher; use crate::rstd::marker::PhantomData; - - impl Storage for RefCell, Vec>> { - fn exists(&self, key: &[u8]) -> bool { - self.borrow_mut().get(key).is_some() - } - - fn get(&self, key: &[u8]) -> Option { - self.borrow_mut().get(key).map(|v| T::decode(&mut &v[..]).unwrap()) - } - - fn put(&self, key: &[u8], val: &T) { - self.borrow_mut().insert(key.to_owned(), val.encode()); - } - - fn kill(&self, key: &[u8]) { - self.borrow_mut().remove(key); - } - - fn put_raw(&self, key: &[u8], value: &[u8]) { - self.borrow_mut().insert(key.to_owned(), value.to_owned()); - } - - fn get_raw(&self, key: &[u8]) -> Option> { - self.borrow().get(key).cloned() - } - } + use crate::storage::hashed::generator::*; storage_items! { Value: b"a" => u32; @@ -622,7 +398,8 @@ mod tests { #[test] fn value() { - let storage = RefCell::new(HashMap::new()); + let mut overlay = HashMap::new(); + let storage = RefCell::new(&mut overlay); assert!(Value::get(&storage).is_none()); Value::put(&100_000, &storage); assert_eq!(Value::get(&storage), Some(100_000)); @@ -632,7 +409,8 @@ mod tests { #[test] fn list() { - let storage = RefCell::new(HashMap::new()); + let mut overlay = HashMap::new(); + let storage = RefCell::new(&mut overlay); assert_eq!(List::len(&storage), 0); assert!(List::items(&storage).is_empty()); @@ -651,7 +429,8 @@ mod tests { #[test] fn map() { - let storage = RefCell::new(HashMap::new()); + let mut overlay = HashMap::new(); + let storage = RefCell::new(&mut overlay); assert!(Map::get(&5, &storage).is_none()); Map::insert(&5, &[1; 32], &storage); assert_eq!(Map::get(&5, &storage), Some([1; 32])); @@ -661,7 +440,7 @@ mod tests { } pub trait Trait { - type Origin: codec::Encode + codec::Decode + ::std::default::Default; + type Origin: crate::codec::Encode + crate::codec::Decode + ::std::default::Default; type BlockNumber; } @@ -850,6 +629,7 @@ mod tests { name: DecodeDifferent::Encode("MAPU32"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -863,6 +643,7 @@ mod tests { name: DecodeDifferent::Encode("PUBMAPU32"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -876,6 +657,7 @@ mod tests { name: DecodeDifferent::Encode("MAPU32MYDEF"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -889,6 +671,7 @@ mod tests { name: DecodeDifferent::Encode("PUBMAPU32MYDEF"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -902,6 +685,7 @@ mod tests { name: DecodeDifferent::Encode("GETMAPU32"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -915,6 +699,7 @@ mod tests { name: DecodeDifferent::Encode("PUBGETMAPU32"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -928,6 +713,7 @@ mod tests { name: DecodeDifferent::Encode("GETMAPU32MYDEF"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -941,6 +727,7 @@ mod tests { name: DecodeDifferent::Encode("PUBGETMAPU32MYDEF"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: false, @@ -954,6 +741,7 @@ mod tests { name: DecodeDifferent::Encode("LINKEDMAPU32"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: true, @@ -967,6 +755,7 @@ mod tests { name: DecodeDifferent::Encode("PUBLINKEDMAPU32MYDEF"), modifier: StorageFunctionModifier::Optional, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: true, @@ -980,6 +769,7 @@ mod tests { name: DecodeDifferent::Encode("GETLINKEDMAPU32"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: true, @@ -993,6 +783,7 @@ mod tests { name: DecodeDifferent::Encode("PUBGETLINKEDMAPU32MYDEF"), modifier: StorageFunctionModifier::Default, ty: StorageFunctionType::Map { + hasher: StorageHasher::Blake2_256, key: DecodeDifferent::Encode("u32"), value: DecodeDifferent::Encode("String"), is_linked: true, diff --git a/srml/support/src/storage/unhashed/generator.rs b/srml/support/src/storage/unhashed/generator.rs index 6993059c2a..25592dce6d 100644 --- a/srml/support/src/storage/unhashed/generator.rs +++ b/srml/support/src/storage/unhashed/generator.rs @@ -15,7 +15,6 @@ // along with Substrate. If not, see . use crate::codec; -use runtime_io::twox_128; use crate::rstd::vec::Vec; /// Abstraction around storage with unhashed access. @@ -65,36 +64,36 @@ pub trait UnhashedStorage { // We use a construct like this during when genesis storage is being built. #[cfg(feature = "std")] -impl UnhashedStorage for (crate::rstd::cell::RefCell<&mut sr_primitives::StorageOverlay>, H) { +impl UnhashedStorage for std::cell::RefCell<&mut sr_primitives::StorageOverlay> { fn exists(&self, key: &[u8]) -> bool { - self.0.borrow().contains_key(key) + self.borrow().contains_key(key) } fn get(&self, key: &[u8]) -> Option { - self.0.borrow().get(key) + self.borrow().get(key) .map(|x| codec::Decode::decode(&mut x.as_slice()).expect("Unable to decode expected type.")) } fn put(&self, key: &[u8], val: &T) { - self.0.borrow_mut().insert(key.to_vec(), codec::Encode::encode(val)); + self.borrow_mut().insert(key.to_vec(), codec::Encode::encode(val)); } fn kill(&self, key: &[u8]) { - self.0.borrow_mut().remove(key); + self.borrow_mut().remove(key); } fn kill_prefix(&self, prefix: &[u8]) { - self.0.borrow_mut().retain(|key, _| { + self.borrow_mut().retain(|key, _| { !key.starts_with(prefix) }) } fn get_raw(&self, key: &[u8]) -> Option> { - self.0.borrow().get(key).cloned() + self.borrow().get(key).cloned() } fn put_raw(&self, key: &[u8], value: &[u8]) { - self.0.borrow_mut().insert(key.to_vec(), value.to_vec()); + self.borrow_mut().insert(key.to_vec(), value.to_vec()); } } @@ -121,11 +120,7 @@ pub trait StorageDoubleMap fn key_for(k1: &K1, k2: &K2) -> Vec; /// Get the storage prefix used to fetch keys corresponding to a specific key1. - fn prefix_for(k1: &K1) -> Vec { - let mut key = Self::prefix().to_vec(); - codec::Encode::encode_to(k1, &mut key); - twox_128(&key).to_vec() - } + fn prefix_for(k1: &K1) -> Vec; /// true if the value is defined in storage. fn exists(k1: &K1, k2: &K2, storage: &S) -> bool { diff --git a/srml/support/src/storage/unhashed/mod.rs b/srml/support/src/storage/unhashed/mod.rs index 225c6756b8..40e18d0cd2 100644 --- a/srml/support/src/storage/unhashed/mod.rs +++ b/srml/support/src/storage/unhashed/mod.rs @@ -17,7 +17,7 @@ //! Operation on unhashed runtime storage use crate::rstd::borrow::Borrow; -use super::{runtime_io, Codec, Encode, Decode, KeyedVec, Vec, IncrementalInput}; +use super::{Codec, Encode, Decode, KeyedVec, Vec, IncrementalInput}; pub mod generator; -- GitLab From 8a28b59dd97ac8f7f165d649b0a2f3e4b1965e81 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 24 Apr 2019 11:58:08 +0200 Subject: [PATCH 002/229] Silence the spam a little bit (#2362) --- core/network-libp2p/src/custom_proto/handler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/network-libp2p/src/custom_proto/handler.rs b/core/network-libp2p/src/custom_proto/handler.rs index d464ed37a9..beac1dec25 100644 --- a/core/network-libp2p/src/custom_proto/handler.rs +++ b/core/network-libp2p/src/custom_proto/handler.rs @@ -690,7 +690,7 @@ where } ProtocolState::BackCompat { substream: existing, mut shutdown } => { - warn!(target: "sub-libp2p", "Received extra substream after having already one \ + debug!(target: "sub-libp2p", "Received extra substream after having already one \ open in backwards-compatibility mode with {:?}", self.remote_peer_id); substream.shutdown(); shutdown.push(substream); -- GitLab From 2a991ddd61dac151e6828695d6f73a7014449464 Mon Sep 17 00:00:00 2001 From: Marcio Diaz Date: Wed, 24 Apr 2019 11:58:30 +0200 Subject: [PATCH 003/229] Use from_ss58check and to_ss58check from Ss58Codec for ed25519 (#2355) * fix: use Ss58Codec for from_ss58check and to_ss58check * Update lib.rs * chore: clean --- Cargo.lock | 1230 ++++++++++++++++---------------- core/keystore/src/lib.rs | 3 +- core/primitives/src/ed25519.rs | 34 +- subkey/src/vanity.rs | 2 +- 4 files changed, 619 insertions(+), 650 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62880e324e..9069255fcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ name = "MacTypes-sys" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -15,7 +15,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -41,10 +41,10 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.6.9" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -56,7 +56,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -65,7 +65,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -119,9 +119,9 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -131,15 +131,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -148,7 +148,7 @@ version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -189,22 +189,23 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.43.2" +version = "0.47.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cexpr 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -248,10 +249,10 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -267,7 +268,7 @@ dependencies = [ [[package]] name = "block-padding" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -278,6 +279,14 @@ name = "bs58" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bstr" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bumpalo" version = "2.4.1" @@ -332,10 +341,10 @@ dependencies = [ [[package]] name = "cexpr" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -359,7 +368,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -413,7 +422,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -421,36 +430,38 @@ name = "core-foundation-sys" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -469,7 +480,7 @@ dependencies = [ "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -479,7 +490,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -591,11 +602,13 @@ dependencies = [ [[package]] name = "csv" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -603,7 +616,7 @@ name = "csv-core" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -617,7 +630,7 @@ dependencies = [ [[package]] name = "ctr" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -626,11 +639,11 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.1.1" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -644,13 +657,13 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "1.0.3" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -664,7 +677,7 @@ name = "derive_more" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", @@ -711,7 +724,7 @@ version = "1.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -719,7 +732,7 @@ dependencies = [ [[package]] name = "either" -version = "1.5.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -738,7 +751,7 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -752,7 +765,7 @@ name = "erased-serde" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -760,16 +773,16 @@ name = "error-chain" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "exit-future" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -777,7 +790,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -786,7 +799,7 @@ name = "failure_derive" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -802,7 +815,7 @@ name = "fdlimit" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -826,7 +839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -863,9 +876,9 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -898,7 +911,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -930,7 +943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "get_if_addrs-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -940,7 +953,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -950,31 +963,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "globset" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "h2" -version = "0.1.16" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -984,7 +997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hash256-std-hasher" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1009,7 +1022,7 @@ name = "heapsize" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1027,16 +1040,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hex-literal" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal-impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex-literal-impl" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1073,7 +1086,7 @@ dependencies = [ [[package]] name = "http" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1104,7 +1117,7 @@ dependencies = [ "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1114,26 +1127,27 @@ dependencies = [ [[package]] name = "hyper" -version = "0.12.23" +version = "0.12.27" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1162,7 +1176,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1185,7 +1199,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1194,7 +1208,7 @@ name = "itertools" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1212,74 +1226,74 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "10.0.1" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-derive" -version = "10.0.2" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-http-server" -version = "10.0.1" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hyper 0.12.23 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.27 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-server-utils 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-pubsub" -version = "10.0.1" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-server-utils" -version = "10.0.1" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-ws-server" -version = "10.0.1" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-server-utils 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-ws 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1293,11 +1307,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "keccak-hasher" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash256-std-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1338,9 +1352,9 @@ dependencies = [ "interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1361,7 +1375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.48" +version = "0.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1370,7 +1384,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1399,13 +1413,13 @@ dependencies = [ "libp2p-websocket 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.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-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1424,18 +1438,18 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1462,7 +1476,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1476,11 +1490,11 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1496,10 +1510,10 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1520,13 +1534,13 @@ dependencies = [ "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1545,9 +1559,9 @@ dependencies = [ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1565,7 +1579,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1574,16 +1588,16 @@ name = "libp2p-noise" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", - "snow 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "x25519-dalek 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1601,7 +1615,7 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1626,7 +1640,7 @@ dependencies = [ "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1637,21 +1651,21 @@ dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1670,7 +1684,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1696,10 +1710,10 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "websocket 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)", + "websocket 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1710,20 +1724,19 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "librocksdb-sys" -version = "5.14.3" +version = "5.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bindgen 0.43.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bindgen 0.47.3 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1785,11 +1798,6 @@ dependencies = [ "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "make-cmd" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "matches" version = "0.1.8" @@ -1797,11 +1805,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memchr" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1826,13 +1833,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "merlin" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1854,7 +1860,7 @@ dependencies = [ "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.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (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)", @@ -1879,7 +1885,7 @@ 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.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1902,9 +1908,9 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1922,15 +1928,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.20 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.43 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1939,19 +1945,19 @@ version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1959,9 +1965,9 @@ dependencies = [ name = "node-cli" version = "1.0.0" dependencies = [ - "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "node-executor 1.0.0", "node-primitives 1.0.0", @@ -1969,7 +1975,7 @@ dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", - "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-basic-authorship 1.0.0", "substrate-cli 1.0.0", "substrate-client 1.0.0", @@ -1983,7 +1989,7 @@ dependencies = [ "substrate-service-test 1.0.0", "substrate-telemetry 1.0.0", "substrate-transaction-pool 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2021,7 +2027,7 @@ version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "sr-std 1.0.0", "substrate-primitives 1.0.0", @@ -2032,13 +2038,13 @@ dependencies = [ name = "node-runtime" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 1.0.0", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "sr-std 1.0.0", "sr-version 1.0.0", @@ -2071,11 +2077,11 @@ dependencies = [ name = "node-template" version = "1.0.0" dependencies = [ - "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "node-template-runtime 1.0.0", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2091,7 +2097,7 @@ dependencies = [ "substrate-primitives 1.0.0", "substrate-service 1.0.0", "substrate-transaction-pool 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2102,7 +2108,7 @@ version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -2135,10 +2141,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "nom" -version = "4.2.0" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2157,12 +2163,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ole32-sys" version = "0.2.0" @@ -2187,15 +2198,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.16" +version = "0.10.20" 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.7 (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.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2205,12 +2216,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.40" +version = "0.9.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2219,7 +2231,7 @@ name = "output_vt100" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2250,7 +2262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2259,7 +2271,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2285,21 +2297,21 @@ dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-multihash" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2360,10 +2372,10 @@ name = "parking_lot_core" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2371,11 +2383,11 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (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.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2383,29 +2395,29 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.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.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "paste-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2484,10 +2496,10 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2499,15 +2511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.4.27" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2515,7 +2519,7 @@ dependencies = [ [[package]] name = "protobuf" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2538,20 +2542,12 @@ name = "quick-error" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "quote" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quote" version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2559,7 +2555,7 @@ name = "rand" version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2569,10 +2565,10 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2582,9 +2578,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2593,16 +2589,16 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2648,31 +2644,31 @@ name = "rand_jitter" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_os" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2698,7 +2694,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2709,8 +2705,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2723,7 +2719,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.51" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2731,7 +2727,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2741,19 +2737,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "1.1.0" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2764,7 +2760,7 @@ name = "remove_dir_all" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2786,10 +2782,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2797,8 +2793,8 @@ name = "rocksdb" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "librocksdb-sys 5.14.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "librocksdb-sys 5.17.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2807,7 +2803,7 @@ version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2815,7 +2811,7 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2843,7 +2839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2874,23 +2870,23 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "schnorrkel" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.1.1" +source = "git+https://github.com/paritytech/schnorrkel#1762df02ac48ba5c3fa8c162e19a393247079f88" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "merlin 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "merlin 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2901,13 +2897,13 @@ dependencies = [ [[package]] name = "schnorrkel" version = "0.1.1" -source = "git+https://github.com/paritytech/schnorrkel#1762df02ac48ba5c3fa8c162e19a393247079f88" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "merlin 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "merlin 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2936,7 +2932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2947,7 +2943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "MacTypes-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2970,30 +2966,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.87" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.87" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha-1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3018,7 +3025,7 @@ name = "sha2" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3029,7 +3036,7 @@ name = "sha3" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3075,8 +3082,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3095,22 +3102,19 @@ name = "slog_derive" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" -version = "0.6.8" +version = "0.6.9" 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]] name = "snow" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3120,8 +3124,9 @@ dependencies = [ "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (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.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3139,9 +3144,9 @@ name = "sr-api-macros" version = "1.0.0" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "sr-version 1.0.0", @@ -3176,8 +3181,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-std 1.0.0", "substrate-primitives 1.0.0", @@ -3193,7 +3198,7 @@ dependencies = [ "sr-std 1.0.0", "substrate-primitives 1.0.0", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3209,7 +3214,7 @@ version = "1.0.0" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "sr-std 1.0.0", ] @@ -3218,9 +3223,9 @@ dependencies = [ name = "srml-assets" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3233,11 +3238,11 @@ dependencies = [ name = "srml-aura" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3255,10 +3260,10 @@ dependencies = [ name = "srml-balances" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3272,9 +3277,9 @@ dependencies = [ name = "srml-consensus" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3289,11 +3294,11 @@ name = "srml-contract" version = "1.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-sandbox 1.0.0", @@ -3312,10 +3317,10 @@ dependencies = [ name = "srml-council" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3330,10 +3335,10 @@ dependencies = [ name = "srml-democracy" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3347,9 +3352,9 @@ dependencies = [ name = "srml-example" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "srml-balances 1.0.0", @@ -3362,9 +3367,9 @@ dependencies = [ name = "srml-executive" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3379,11 +3384,11 @@ dependencies = [ name = "srml-finality-tracker" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3398,7 +3403,7 @@ name = "srml-grandpa" version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3415,11 +3420,11 @@ dependencies = [ name = "srml-indices" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3434,7 +3439,7 @@ name = "srml-metadata" version = "1.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", "substrate-primitives 1.0.0", ] @@ -3443,11 +3448,11 @@ dependencies = [ name = "srml-session" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3462,10 +3467,10 @@ dependencies = [ name = "srml-staking" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3483,9 +3488,9 @@ dependencies = [ name = "srml-sudo" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3500,12 +3505,12 @@ name = "srml-support" version = "1.0.0" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3519,7 +3524,7 @@ dependencies = [ name = "srml-support-procedural" version = "1.0.0" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 1.0.0", "srml-support-procedural-tools 1.0.0", @@ -3531,7 +3536,7 @@ name = "srml-support-procedural-tools" version = "1.0.0" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "srml-support-procedural-tools-derive 1.0.0", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3541,7 +3546,7 @@ dependencies = [ name = "srml-support-procedural-tools-derive" version = "1.0.0" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3551,7 +3556,7 @@ name = "srml-support-test" version = "0.1.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "srml-support 1.0.0", "substrate-inherents 1.0.0", @@ -3562,11 +3567,11 @@ dependencies = [ name = "srml-system" version = "1.0.0" dependencies = [ - "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3578,9 +3583,9 @@ dependencies = [ name = "srml-timestamp" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3594,9 +3599,9 @@ dependencies = [ name = "srml-treasury" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -3623,14 +3628,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "stdweb" -version = "0.4.13" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-macros 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3638,31 +3644,31 @@ name = "stdweb-derive" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "stdweb-internal-macros" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "stdweb-internal-runtime" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3685,20 +3691,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3714,7 +3720,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3727,17 +3733,17 @@ dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-bip39 0.2.0 (git+https://github.com/paritytech/substrate-bip39)", + "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", "substrate-primitives 1.0.0", - "tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate" version = "1.0.0" dependencies = [ - "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "node-cli 1.0.0", @@ -3763,12 +3769,12 @@ dependencies = [ [[package]] name = "substrate-bip39" -version = "0.2.0" -source = "git+https://github.com/paritytech/substrate-bip39#080da45923885cfec2379cef3dee4e7f43e6c260" +version = "0.2.1" +source = "git+https://github.com/paritytech/substrate-bip39#44307fda4ea17fe97aeb93af317fbc8f6ed34193" dependencies = [ "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3782,16 +3788,16 @@ dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", - "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-client 1.0.0", "substrate-keyring 1.0.0", "substrate-network 0.1.0", @@ -3800,10 +3806,10 @@ dependencies = [ "substrate-service 1.0.0", "substrate-state-machine 1.0.0", "substrate-telemetry 1.0.0", - "sysinfo 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sysinfo 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3815,7 +3821,7 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3890,7 +3896,7 @@ dependencies = [ "substrate-service 1.0.0", "substrate-telemetry 1.0.0", "substrate-test-client 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3945,7 +3951,7 @@ dependencies = [ "substrate-service 1.0.0", "substrate-telemetry 1.0.0", "substrate-test-client 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3973,7 +3979,7 @@ dependencies = [ "substrate-inherents 1.0.0", "substrate-primitives 1.0.0", "substrate-test-client 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3981,7 +3987,7 @@ name = "substrate-consensus-rhd" version = "1.0.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3998,7 +4004,7 @@ dependencies = [ "substrate-keyring 1.0.0", "substrate-primitives 1.0.0", "substrate-transaction-pool 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4015,7 +4021,7 @@ dependencies = [ "substrate-consensus-common 1.0.0", "substrate-inherents 1.0.0", "substrate-primitives 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4025,7 +4031,7 @@ dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4040,7 +4046,7 @@ dependencies = [ "substrate-trie 1.0.0", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4055,7 +4061,7 @@ dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "srml-finality-tracker 1.0.0", "substrate-client 1.0.0", @@ -4068,7 +4074,7 @@ dependencies = [ "substrate-service 1.0.0", "substrate-telemetry 1.0.0", "substrate-test-client 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4096,7 +4102,7 @@ dependencies = [ name = "substrate-keyring" version = "1.0.0" dependencies = [ - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4112,7 +4118,7 @@ dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-crypto 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 1.0.0", "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4144,7 +4150,7 @@ dependencies = [ "substrate-peerset 1.0.0", "substrate-primitives 1.0.0", "substrate-test-client 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4162,15 +4168,15 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-peerset 1.0.0", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4192,7 +4198,7 @@ dependencies = [ "substrate-primitives 1.0.0", "substrate-test-client 1.0.0", "substrate-transaction-pool 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4207,7 +4213,7 @@ dependencies = [ name = "substrate-panic-handler" version = "1.0.0" dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4220,7 +4226,7 @@ dependencies = [ "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4231,28 +4237,28 @@ dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash256-std-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", - "substrate-bip39 0.2.0 (git+https://github.com/paritytech/substrate-bip39)", + "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", "substrate-serializer 1.0.0", - "tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4262,16 +4268,16 @@ dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-derive 10.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-derive 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-version 1.0.0", @@ -4284,18 +4290,18 @@ dependencies = [ "substrate-test-client 1.0.0", "substrate-test-runtime 1.0.0", "substrate-transaction-pool 1.0.0", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-rpc-servers" version = "1.0.0" dependencies = [ - "jsonrpc-http-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-ws-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-http-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-ws-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "substrate-rpc 1.0.0", ] @@ -4304,8 +4310,8 @@ dependencies = [ name = "substrate-serializer" version = "1.0.0" dependencies = [ - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4313,14 +4319,14 @@ name = "substrate-service" version = "1.0.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", @@ -4338,7 +4344,7 @@ dependencies = [ "substrate-test-client 1.0.0", "substrate-transaction-pool 1.0.0", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4356,7 +4362,7 @@ dependencies = [ "substrate-primitives 1.0.0", "substrate-service 1.0.0", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4376,7 +4382,7 @@ version = "1.0.0" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4395,8 +4401,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (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.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4426,11 +4432,11 @@ name = "substrate-test-runtime" version = "1.0.0" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", "sr-primitives 1.0.0", "sr-std 1.0.0", @@ -4461,7 +4467,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "substrate-primitives 1.0.0", "substrate-test-runtime 1.0.0", @@ -4488,18 +4494,18 @@ dependencies = [ name = "substrate-trie" version = "1.0.0" dependencies = [ - "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 1.0.0", "substrate-primitives 1.0.0", - "trie-bench 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-bench 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-standardmap 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-standardmap 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4517,7 +4523,7 @@ name = "syn" version = "0.15.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4527,7 +4533,7 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4535,13 +4541,13 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4565,15 +4571,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4586,11 +4592,12 @@ dependencies = [ [[package]] name = "termion" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4615,14 +4622,14 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tiny-bip39" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4647,8 +4654,8 @@ name = "tinytemplate" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4658,28 +4665,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (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.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4693,7 +4700,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4713,7 +4720,7 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4731,13 +4738,13 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-io" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4747,7 +4754,7 @@ dependencies = [ [[package]] name = "tokio-reactor" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4755,16 +4762,17 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (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.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-sync" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4780,13 +4788,13 @@ dependencies = [ "futures 0.1.26 (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.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-threadpool" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4794,7 +4802,7 @@ dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4818,7 +4826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4839,8 +4847,8 @@ dependencies = [ "log 0.4.6 (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.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4851,13 +4859,13 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (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.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (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-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4865,7 +4873,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4875,17 +4883,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "trie-bench" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-standardmap 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-standardmap 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4910,12 +4918,12 @@ dependencies = [ [[package]] name = "trie-standardmap" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4977,7 +4985,7 @@ dependencies = [ [[package]] name = "unicase" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4996,7 +5004,7 @@ name = "unicode-normalization" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5014,14 +5022,6 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "unsigned-varint" version = "0.2.2" @@ -5086,9 +5086,9 @@ name = "wabt" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "wabt-sys 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5108,7 +5108,7 @@ version = "2.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5138,7 +5138,7 @@ dependencies = [ "bumpalo 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5168,7 +5168,7 @@ name = "wasm-bindgen-macro-support" version = "0.2.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5188,7 +5188,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5197,12 +5197,12 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi-validation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5229,7 +5229,7 @@ dependencies = [ [[package]] name = "websocket" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5241,7 +5241,7 @@ dependencies = [ "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5252,15 +5252,16 @@ name = "weedle" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "which" -version = "1.0.5" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5270,7 +5271,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5292,7 +5293,7 @@ name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5305,7 +5306,7 @@ name = "wincolor" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5320,7 +5321,7 @@ dependencies = [ "log 0.4.6 (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.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.20 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (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.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5338,11 +5339,11 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5369,7 +5370,7 @@ dependencies = [ "quick-error 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5382,7 +5383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" "checksum aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" "checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" -"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f10b352bc3fc08ae24dc5d2d3ddcac153678533986122dc283d747b12071000" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" @@ -5393,23 +5394,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" -"checksum bindgen 0.43.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d52d263eacd15d26cbcf215d254b410bd58212aaa2d3c453a04b2d3b3adcf41" +"checksum bindgen 0.47.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df683a55b54b41d5ea8ebfaebb5aa7e6b84e3f3006a78f010dadc9ca88469260" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5da9b3d9f6f585199287a473f4f8dfab6566cf827d15c00c219f53c645687ead" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d" +"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" -"checksum block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d75255892aeb580d3c566f213a2b6fdc1c66667839f45719ee1d30ebf2aea591" +"checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0de79cfb98e7aa9988188784d8664b4b5dad6eaaa0863b91d9a4ed871d4f7a42" +"checksum bstr 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6c8203ca06c502958719dae5f653a79e0cc6ba808ed02beffbf27d09610f2143" "checksum bumpalo 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4639720be048090544634e0402490838995ccdc9d2fe648f528f30d3c33ae71f" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" @@ -5419,7 +5421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" "checksum cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "389803e36973d242e7fecb092b2de44a3d35ac62524b3b9339e51d577d668e02" -"checksum cexpr 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "644d693ecfa91955ed32dcc7eda4914e1be97a641fb6f0645a37348e20b230da" +"checksum cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7fa24eb00d5ffab90eaeaf1092ac85c04c64aaf358ea6f84505b8116d24c6af" "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef0c1bcf2e99c649104bd7a7012d8f8802684400e03db0ec0af48583c6fa0e4" @@ -5430,8 +5432,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" -"checksum criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "1c6e5ee5b9652d4f851418c448af105642e1f99e9a2741a8ff45c0d2c911b1e0" -"checksum criterion-plot 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4107e4a5abb94267e0149922b8ff49dc70a87cc202820fdbfc0d3e1edbdc4b16" +"checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" +"checksum criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" "checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" @@ -5446,13 +5448,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum crypto-mac 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "779015233ac67d65098614aec748ac1c756ab6677fa2e14cf8b37c08dfed1198" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -"checksum csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd1c44c58078cfbeaf11fbb3eac9ae5534c23004ed770cc4bfb48e658ae4f04" +"checksum csv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9044e25afb0924b5a5fc5511689b0918629e85d68ea591e5e87fbf1e85ea1b3b" "checksum csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5cdef62f37e6ffe7d1f07a381bc0db32b7a3ff1cac0de56cb0d81e71f53d65" "checksum ctor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3b4c17619643c1252b5f690084b82639dd7fac141c57c8e77a00e0148132092c" -"checksum ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "044f882973b245404e90c90e7e42e8ee8d7a64edfd7adf83d684fb97e8e2c1b6" -"checksum ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "630391922b1b893692c6334369ff528dcc3a9d8061ccf4c803aa8f83cb13db5e" +"checksum ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" +"checksum ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5531b7f0698d9220b4729f8811931dbe0e91a05be2f7b3245fdc50dd856bae26" "checksum cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" -"checksum curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dae47cc3529cdab597dbc8b606e565707209b506e55848f3c15679214a56c956" +"checksum curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1f8a6fc0376eb52dc18af94915cc04dfdf8353746c0e8c550ae683a0815e5c1" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" "checksum derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe9f11be34f800b3ecaaed0ec9ec2e015d1d0ba0c8644c1310f73d6e8994615" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" @@ -5461,13 +5463,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" "checksum dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" -"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" +"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" "checksum elastic-array 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "073be79b6538296faf81c631872676600616073817dd9a440c477ad09b408983" "checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" "checksum environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c7464757b80de8930c91c9afe77ddce501826bf9d134a87db2c67d9dc177e2c" "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "87559b08e99a81a92bbb867d237543e43495857749f688e0773390a20d56c61c" +"checksum exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d8013f441e38e31c670e7f34ec8f1d5d3a2bd9d303c1ff83976ca886005e8f48" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" @@ -5489,25 +5491,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7" "checksum get_if_addrs-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4743617a7464bbda3c8aec8558ff2f9429047e025771037df561d383337ff865" -"checksum h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb2b25a33e231484694267af28fec74ac63b5ccf51ee2065a5e313b834d836e" +"checksum globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4feaabe24a0a658fd9cf4a9acf6ed284f045c77df0f49020ba3245cfb7b454" +"checksum h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "85ab6286db06040ddefb71641b50017c06874614001a134b423783e2db2920bd" "checksum hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ba7fb417e5c470acdd61068c79767d0e65962e70836cf6c9dfd2409f06345ce0" -"checksum hash256-std-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1224388a21c88a80ae7087a2a245ca6d80acc97a9186b75789fb3eeefd0609af" +"checksum hash256-std-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8b2027c19ec91eb304999abae7307d225cf93be42af53b0039f76e98ed5af86" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum hashmap_core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8e04cb7a5051270ef3fa79f8c7604d581ecfa73d520e74f554e45541c4b5881a" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" -"checksum hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae0e5c30fb65e661a0e39860e37100dfbe4d39aff865e9357a6a4ed0b5bbf303" -"checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" +"checksum hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc2928beef125e519d69ae1baa8c37ea2e0d3848545217f6db0179c5eb1d639" +"checksum hex-literal-impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "520870c3213943eb8d7803e80180d12a6c7ceb4ae74602544529d1643dc4ddda" "checksum hmac 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a13f4163aa0c5ca1be584aace0e2212b2e41be5478218d4f657f5f778b2ae2a" "checksum hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f127a908633569f208325f86f71255d3363c79721d7f9fe31cd5569908819771" "checksum hmac-drbg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe727d41d2eec0a6574d887914347e5ff96a3b87177817e2a9820c5c87fecc2" -"checksum http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "1a10e5b573b9a0146545010f50772b9e8b1dd0a256564cc4307694c68832a2f5" +"checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "df0caae6b71d266b91b4a83111a61d2b94ed2e2bea024c532b933dcff867e58c" -"checksum hyper 0.12.23 (registry+https://github.com/rust-lang/crates.io-index)" = "860faf61a9957c9cb0e23e69f1c8290e92f6eb660fcdd1f2d6777043a2ae1a46" +"checksum hyper 0.12.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4f2777434f26af6e4ce4fdcdccd3bed9d861d11e87bcbe72c0f51ddaca8ff848" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum impl-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2050d823639fbeae26b2b5ba09aca8907793117324858070ade0673c49f793b" "checksum impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5158079de9d4158e0ce1de3ae0bd7be03904efc40b3d7dd8b8c301cbf6b52b56" @@ -5518,14 +5520,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3c994fd445b81741d77f6bcd227d6ed645b95b35a2ecfd2050767450ff1c0b6d" -"checksum jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a5152c3fda235dfd68341b3edf4121bc4428642c93acbd6de88c26bf95fc5d7" -"checksum jsonrpc-derive 10.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c14be84e86c75935be83a34c6765bf31f97ed6c9163bb0b83007190e9703940a" -"checksum jsonrpc-http-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "99e1ce36c7cc9dcab398024d76849ab2cb917ee812653bce6f74fc9eb7c82d16" -"checksum jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "56608ed54b1b2a69f4357cb8bdfbcbd99fe1179383c03a09bb428931bd35f592" -"checksum jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5521613b31ea22d36d9f95ad642058dccec846a94ed8690957652d479f620707" -"checksum jsonrpc-ws-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20b8333a5a6e6ccbcf5c90f90919de557cba4929efa164e9bd0e8e497eb20e46" +"checksum jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15eef5f8b6bef5ac5f7440a957ff95d036e2f98706947741bfc93d1976db4c" +"checksum jsonrpc-derive 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2dae61ca8a3b047fb11309b00661bc56837085bd07e46f907b9c562c0b03e68" +"checksum jsonrpc-http-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11d2a00824306155b8ef57fe957f31b8cd8ad24262f15cf911d84dcf9a3f206d" +"checksum jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37fce55133ee264d0ab42bd862efcd45ae1d062cda599f4cc12ccc4be3195f2a" +"checksum jsonrpc-server-utils 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9527f01ef25f251d64082cbefc0c6d6f367349afe6848ef908a674e06b2bdd3" +"checksum jsonrpc-ws-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3889012aa638a2f18eb1a879f46fc8b34e7e1423cbff3247cd1531de0d51084b" "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" -"checksum keccak-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a02fb74dc1b613522069b5f2023c014756ce121c6c6fb39364c139b0efc39a2d" +"checksum keccak-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "af672553b2abac1c86c29fd62c79880638b6abc91d96db4aa42a5baab2bc1ca9" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" @@ -5533,7 +5535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" +"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" "checksum libp2p 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0231edab431064b30b7749484a39735eb36492cef4658c372c9059e58c3003aa" "checksum libp2p-core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1a3bad2ed26297112847678683dd221473a0d44297250b61f004e1b35e72493" @@ -5553,7 +5555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum libp2p-uds 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ab0b9ca050105fd94229c48911c0c84aef4d6b86a53d1b6df81d938354e47e" "checksum libp2p-websocket 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81692c3141a9aefd84f4faffdc93985af3858ef82ed7fe8185e6b27437b36183" "checksum libp2p-yamux 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6ff51a5b2056bacee1c9f2ed8455cdf3c5c619261ddb4efc783119130aaf52" -"checksum librocksdb-sys 5.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b9024327233e7fac7982440f73301c00046d438c5b1011e8f4e394226ce19007" +"checksum librocksdb-sys 5.17.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7dfb546562f9b450237bb8df7a31961849ee9fb1186d9e356db1d7a6b7609ff2" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c" @@ -5561,13 +5563,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -"checksum make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" +"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7623b01a4f1b7acb7cf8e3f678f05e15e6ae26cb0b738dfeb5cc186fd6b82ef4" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" -"checksum merlin 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a9e97b439f6d38cbe2a4a4aa93f6770c5305f62761b78b1851406c09c87ee2a" +"checksum merlin 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "83c2dda19c01176e8e7148f7bdb88bbdf215a8db0641f89fc40e4b81736aeda5" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "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" @@ -5577,19 +5578,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef320dab323286b50fb5cdda23f61c796a72a89998ab565ca32525c5c556f2da" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" +"checksum nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46f0f3210768d796e8fa79ec70ee6af172dacbe7147f5e69be5240a47778302b" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nohash-hasher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d138afcce92d219ccb6eb53d9b1e8a96ac0d633cfd3c53cd9856d96d1741bb8" -"checksum nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b30adc557058ce00c9d0d7cb3c6e0b5bc6f36e2e2eabe74b0ba726d194abd588" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "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.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" +"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" "checksum once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" -"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" +"checksum openssl 0.10.20 (registry+https://github.com/rust-lang/crates.io-index)" = "5a0d6b781aac4ac1bd6cafe2a2f0ad8c16ae8e1dd5184822a16c50139f8838d9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" +"checksum openssl-sys 0.9.43 (registry+https://github.com/rust-lang/crates.io-index)" = "33c86834957dd5b915623e94f2f4ab2c70dd8f6b70679824155d5ae21dbd495d" "checksum output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" @@ -5598,7 +5600,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00a486fd383382ddcb2de928364b1f82571c1e48274fc43b7667a4738ee4056c" "checksum parity-crypto 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b9db194dfbcfe3b398d63d765437a5c7232d59906e203055f0e993f6458ff1" "checksum parity-multiaddr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18a130a727008cfcd1068a28439fe939897ccad28664422aeca65b384d6de6d0" -"checksum parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8eab0287ccde7821e337a124dc5a4f1d6e4c25d10cc91e3f9361615dd95076" +"checksum parity-multihash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05d6a68e07ab34a9e87bd8dd4936f6bb5be21e4f6dbcdbaf04d8e854eba0af01" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" "checksum parity-ws 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2fec5048fba72a2e01baeb0d08089db79aead4b57e2443df172fb1840075a233" "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" @@ -5607,8 +5609,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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 parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" -"checksum paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f50392d1265092fbee9273414cc40eb6d47d307bd66222c477bb8450c8504f9d" -"checksum paste-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a3cd512fe3a55e8933b2dcad913e365639db86d512e4004c3084b86864d9467a" +"checksum paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4a4a1c555c6505821f9d58b8779d0f630a6b7e4e1be24ba718610acf01fa79" +"checksum paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26e796e623b8b257215f27e6c80a5478856cae305f5b59810ff9acdaa34570e6" "checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" @@ -5618,15 +5620,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edb92f1ebfc177432c03287b15d48c202e6e2c95993a7af3ba039abb43b1492e" "checksum proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4c6cf4e5b00300d151dfffae39f529dfa5188f42eeb14201229aa420d6aad10c" "checksum proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c725b36c99df7af7bf9324e9c999b9e37d92c8f8caf106d82e1d7953218d2d8" -"checksum proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3e90aa19cd73dedc2d0e1e8407473f073d735fef0ab521438de6da8ee449ab66" +"checksum proc-macro-hack 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6a9bed9ebc40cf53e3a76d7486c54d05002eae6485b2711ab9104476fb2eb8bc" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" -"checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4" -"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" -"checksum protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82d117bc7565ce6be0150159251c9b1eeec7b129f5a2aa86e10acb5970de1cb" +"checksum proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)" = "ba92c84f814b3f9a44c5cfca7d2ad77fa10710867d2bbb1b3d175ab5f47daa12" +"checksum protobuf 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc7badf647ae2fa27ba51c218e347386c88cc604fcfe71f2aba0ad017f3f2b75" "checksum pwasm-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "efb0dcbddbb600f47a7098d33762a00552c671992171637f5bb310b37fe1f0e4" "checksum quick-error 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb6ccf8db7bbcb9c2eae558db5ab4f3da1c2a87e4e597ed394726bc8ea6ca1d" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" @@ -5638,24 +5638,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" -"checksum rand_os 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b7c690732391ae0abafced5015ffb53656abfaec61b342290e5eb56b286a679d" -"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03b418169fb9c46533f326efd6eed2576699c44ca92d3052a066214a8d828929" "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" +"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d813022b2e00774a48eaf43caaa3c20b45f040ba8cbf398e2e8911a06668dbe6" -"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" -"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" +"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" +"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum rhododendron 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9381ed76c1ec4e8994f1f7d2c6d7e33eed3ff7176e16fece09c2e993fc4a5a" "checksum ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "426bc186e3e95cac1e4a4be125a4aca7e84c2d616ffc02244eef36e2a60a093c" "checksum rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1651697fefd273bfb4fd69466cc2a9d20de557a0213b97233b22b5e95924b5e" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" +"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -5664,9 +5664,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f7bf422d23a88c16d5090d455f182bc99c60af4df6a345c63428acf5129e347" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" -"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" -"checksum schnorrkel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a700659388785588c75b197cecda0f23c7112a9281ef703e8ffc651061ce014c" +"checksum schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339" "checksum schnorrkel 0.1.1 (git+https://github.com/paritytech/schnorrkel)" = "" +"checksum schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eff518f9bed3d803a0d002af0ab96339b0ebbedde3bec98a684986134b7a39" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" "checksum security-framework 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfab8dda0e7a327c696d893df9ffa19cadc4bd195797997f5223cf5831beaf05" @@ -5674,9 +5674,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum send_wrapper 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" -"checksum serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)" = "2e20fde37801e83c891a2dc4ebd3b81f0da4d1fb67a9e0a2a3b921e2536a58ee" -"checksum serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)" = "633e97856567e518b59ffb2ad7c7a4fd4c5d91d9c7f32dd38a27b2bf7e8114ea" -"checksum serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "27dce848e7467aa0e2fcaf0a413641499c0b745452aaca1194d24dedde9e13c9" +"checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" +"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" @@ -5688,54 +5689,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum slog_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eff3b513cf2e0d1a60e1aba152dc72bedc5b05585722bb3cebd7bcb1e31b98f" -"checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15" -"checksum snow 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7251f8920e9043106cfe466c04ed3eb257b8315a7699259c4fd0af6dffb6aef6" +"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" +"checksum snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a64f02fd208ef15bd2d1a65861df4707e416151e1272d02c8faafad1c138100" "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" -"checksum stdweb 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "461e7f2e33670b1c33f1ea22bb2f86de6136fabd0c4d27d167ed425c231143ca" +"checksum stdweb 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "b2c1d5ac2f828b2877a6be60a51b8e3ebb57b56862b10be1a72676ca8900b69d" "checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" -"checksum stdweb-internal-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "432465093692af7379dcd196ce4be398c906958d91b412fff9102a66238d6f26" -"checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" +"checksum stdweb-internal-macros 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e68f7d08b76979a43e93fe043b66d2626e35d41d68b0b85519202c6dd8ac59fa" +"checksum stdweb-internal-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d52317523542cc0af5b7e31017ad0f7d1e78da50455e38d5657cd17754f617da" "checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" -"checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" +"checksum structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3d0760c312538987d363c36c42339b55f5ee176ea8808bbe4543d484a291c8d1" +"checksum structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "528aeb7351d042e6ffbc2a6fb76a86f9b622fdf7c25932798e7a82cb03bc94c6" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" -"checksum substrate-bip39 0.2.0 (git+https://github.com/paritytech/substrate-bip39)" = "" +"checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" "checksum syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)" = "d2b4cfac95805274c6afdb12d8f770fa2d27c045953e7b630a81801953699a9a" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum sysinfo 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4da1ccc493b46042d6f5352910a7f18ed8fe81307dd7db3f2e2d8a7db6f6284" +"checksum sysinfo 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a0cb7899e248ed0baa6ef6f8406352523c2f99bc7c4b1800f4cd6d5dde99eb" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -"checksum tempfile 3.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "37daa55a7240c4931c84559f03b3cad7d19535840d1c4a0cc4e9b2fb0dcf70ff" +"checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f5388a470627f97a01a6e13389ced797a42b1611f9de7e0f6ca705675ac55297" +"checksum tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c1c5676413eaeb1ea35300a0224416f57abc3bd251657e0fafc12c47ff98c060" "checksum tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e9175261fbdb60781fcd388a4d6cc7e14764a2b629a7ad94abb439aed223a44f" "checksum tinytemplate 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7655088894274afb52b807bd3c87072daa1fedd155068b8705cabfd628956115" "checksum tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5462b0f968c0457efe38fcd2df7e487096b992419e4f5337b06775a614bbda4b" -"checksum tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "65641e515a437b308ab131a82ce3042ff9795bef5d6c5a9be4eb24195c417fd9" +"checksum tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "cec6c34409089be085de9403ba2010b80e36938c9ca992c4f67f407bb13db0b1" "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" "checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" "checksum tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82c65483db54eb91b4ef3a9389a3364558590faf30ce473141707c0e16fda975" "checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e" "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" -"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" -"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" -"checksum tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fda385df506bf7546e70872767f71e81640f1f251bdf2fd8eb81a0eaec5fe022" +"checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" +"checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" +"checksum tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2f843ffdf8d6e1f90bddd48da43f99ab071660cd92b7ec560ef3cdfd7a409a" "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" -"checksum tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "ec5759cf26cf9659555f36c431b515e3d05f66831741c85b4b5d5dfb9cf1323c" +"checksum tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2" "checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" "checksum tokio-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "354b8cd83825b3c20217a9dc174d6a0c67441a2fae5c41bcb1ea6679f6ae0f7c" "checksum tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "350c9edade9830dc185ae48ba45667a445ab59f6167ef6d0254ec9d2430d9dd3" @@ -5743,10 +5744,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" -"checksum trie-bench 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eafa32a8662c06f5bf135984bc1a12821fd38770b5c2f2f9e8750327fcbe3955" +"checksum trie-bench 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ba20f7d9865497ea46511860b43e05a44f4ac9a76ee089d34cd80a839a690264" "checksum trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1ba73747fd3a64ab531274c04cb588dfa9d30d972d62990831e63fbce2cfec59" "checksum trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa2e20c4f1418ac2e71ddc418e35e1b56e34022e2146209ffdbf1b2de8b1bd9" -"checksum trie-standardmap 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006314f54f2ea7944a878e66fd93ad7978095bc355f30a2f26ec40f664d86c86" +"checksum trie-standardmap 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e4e24277af05f38f3aaf03ac78e3a154be83f13db9c8ef0cb95bb1aa764a477b" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" "checksum twox-hash 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09871da9f15424236082e0b220fd404a4eb6bebc7205c67653701229234ac64c" @@ -5755,13 +5756,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum uint 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7780bb27fd8a22295e0d9d53ae3be253f715a0dccb1808527f478f1c2603708" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -"checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" +"checksum unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41d17211f887da8e4a70a45b9536f26fc5de166b81e2d5d80de4a17fd22553bd" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "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 unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2c64cdf40b4a9645534a943668681bcb219faf51874d4b65d2e0abda1b10a2ab" "checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" @@ -5782,14 +5782,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum wasm-bindgen-macro-support 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9168c413491e4233db7b6884f09a43beb00c14d11d947ffd165242daa48a2385" "checksum wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "326c32126e1a157b6ced7400061a84ac5b11182b2cda6edad7314eb3ae9ac9fe" "checksum wasm-bindgen-webidl 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "613dbf4d7d3bf10aeb212b35de14a8ef07222c26526d4f931061a83fc9e2a851" -"checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" +"checksum wasmi 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aebbaef470840d157a5c47c8c49f024da7b1b80e90ff729ca982b2b80447e78b" "checksum wasmi-validation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab380192444b3e8522ae79c0a1976e42a82920916ccdfbce3def89f456ea33f3" "checksum web-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "24129e4be2281109b3e15a328d3d7f233ee232a5405f75ba1e9bb59a25ebc4d4" -"checksum websocket 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d2c67346c042adbd4f5b2a49700e340befc5b772094fec8d36df6b825523d933" +"checksum websocket 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7cc2d74d89f9df981ab41ae624e33cf302fdf456b93455c6a31911a99c9f0bb8" "checksum weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044" -"checksum which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2" +"checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "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 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "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-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" @@ -5797,7 +5797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "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" -"checksum x25519-dalek 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4aca1ba6bec2719576bd20dfe5b24d9359552e616d10bff257e50cd85f745d17" +"checksum x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538" "checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" "checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" "checksum yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9073f5dbc901abb0b2ec4f866e726fed2f54953bdf81f8a5fde7762b7cc3b3" diff --git a/core/keystore/src/lib.rs b/core/keystore/src/lib.rs index 59c1a65cfb..ff737535f9 100644 --- a/core/keystore/src/lib.rs +++ b/core/keystore/src/lib.rs @@ -138,6 +138,7 @@ impl Store { mod tests { use super::*; use tempdir::TempDir; + use substrate_primitives::crypto::Ss58Codec; #[test] fn basic_store() { @@ -162,6 +163,6 @@ mod tests { let mut store = Store::open(temp_dir.path().to_owned()).unwrap(); let pair = store.generate_from_seed("0x3d97c819d68f9bafa7d6e79cb991eebcd77d966c5334c0b94d9e1fa7ad0869dc").unwrap(); - assert_eq!("5DKUrgFqCPV8iAXx9sjy1nyBygQCeiUYRFWurZGhnrn3HBL8", pair.public().to_ss58check()); + assert_eq!("5DKUrgFqCPV8iAXx9sjy1nyBygQCeiUYRFWurZGhnrn3HJCA", pair.public().to_ss58check()); } } diff --git a/core/primitives/src/ed25519.rs b/core/primitives/src/ed25519.rs index 937cc19a89..d095c6445d 100644 --- a/core/primitives/src/ed25519.rs +++ b/core/primitives/src/ed25519.rs @@ -29,13 +29,11 @@ use blake2_rfc; #[cfg(feature = "std")] use ring::{signature, signature::KeyPair, rand::{SecureRandom, SystemRandom}}; #[cfg(feature = "std")] -use base58::{ToBase58, FromBase58}; -#[cfg(feature = "std")] use substrate_bip39::seed_from_entropy; #[cfg(feature = "std")] use bip39::{Mnemonic, Language, MnemonicType}; #[cfg(feature = "std")] -use crate::crypto::{Pair as TraitPair, DeriveJunction, SecretStringError, Derive}; +use crate::crypto::{Pair as TraitPair, DeriveJunction, SecretStringError, Derive, Ss58Codec}; #[cfg(feature = "std")] use serde::{de, Serializer, Serialize, Deserializer, Deserialize}; use crate::crypto::UncheckedFrom; @@ -324,36 +322,6 @@ impl Public { #[cfg(feature = "std")] impl Derive for Public {} -#[cfg(feature = "std")] -impl Public { - /// Some if the string is a properly encoded SS58Check address. - pub fn from_ss58check(s: &str) -> Result { - let d = s.from_base58().map_err(|_| PublicError::BadBase58)?; // failure here would be invalid encoding. - if d.len() != 35 { - // Invalid length. - return Err(PublicError::BadLength); - } - if d[0] != 42 { - // Invalid version. - return Err(PublicError::UnknownVersion); - } - if d[33..35] != blake2_rfc::blake2b::blake2b(64, &[], &d[0..33]).as_bytes()[0..2] { - // Invalid checksum. - return Err(PublicError::InvalidChecksum); - } - Ok(Self::from_slice(&d[1..33])) - } - - /// Return the ss58-check string for this key. - pub fn to_ss58check(&self) -> String { - let mut v = vec![42u8]; - v.extend(self.as_slice()); - let r = blake2_rfc::blake2b::blake2b(64, &[], &v); - v.extend(&r.as_bytes()[0..2]); - v.to_base58() - } -} - #[cfg(feature = "std")] impl AsRef for Pair { fn as_ref(&self) -> &Pair { diff --git a/subkey/src/vanity.rs b/subkey/src/vanity.rs index 785eb95aa5..400b3bae82 100644 --- a/subkey/src/vanity.rs +++ b/subkey/src/vanity.rs @@ -105,7 +105,7 @@ pub(super) fn generate_key>(desired: &str) -> Result Date: Wed, 24 Apr 2019 12:23:59 +0200 Subject: [PATCH 004/229] Subkey can construct and sign transfer txs (#2109) * First effort * Fix for encoding * !fixed subkey xfer creation (still brittle because of double-hardcoded genesis_hash (#2221) * CLI genesis hash * Add test * Slightly nicer text * Fix Elm hash * Update lock file --- Cargo.lock | 5 +++ core/primitives/src/crypto.rs | 22 ++++++++--- subkey/Cargo.toml | 5 +++ subkey/src/cli.yml | 24 ++++++++++++ subkey/src/main.rs | 74 ++++++++++++++++++++++++++++++++++- 5 files changed, 123 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9069255fcc..452da42fb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3731,9 +3731,14 @@ version = "1.0.0" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "node-primitives 1.0.0", + "node-runtime 1.0.0", + "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 1.0.0", "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", "substrate-primitives 1.0.0", "tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/core/primitives/src/crypto.rs b/core/primitives/src/crypto.rs index e0ecd4ce42..dc886c7b38 100644 --- a/core/primitives/src/crypto.rs +++ b/core/primitives/src/crypto.rs @@ -215,7 +215,9 @@ pub trait Derive: Sized { /// Derive a child key from a series of given junctions. /// /// Will be `None` for public keys if there are any hard junctions in there. - fn derive>(&self, _path: Iter) -> Option { None } + fn derive>(&self, _path: Iter) -> Option { + None + } } #[cfg(feature = "std")] @@ -266,11 +268,19 @@ impl + AsRef<[u8]> + Default + Derive> Ss58Codec for T { let cap = re.captures(s).ok_or(PublicError::InvalidFormat)?; let re_junction = Regex::new(r"/(/?[^/]+)") .expect("constructed from known-good static value; qed"); - let path = re_junction.captures_iter(&cap["path"]) - .map(|f| DeriveJunction::from(&f[1])); - Self::from_ss58check(cap.name("ss58").map(|r| r.as_str()).unwrap_or(DEV_ADDRESS))? - .derive(path) - .ok_or(PublicError::InvalidPath) + let addr = Self::from_ss58check( + cap.name("ss58") + .map(|r| r.as_str()) + .unwrap_or(DEV_ADDRESS) + )?; + if cap["path"].is_empty() { + Ok(addr) + } else { + let path = re_junction.captures_iter(&cap["path"]) + .map(|f| DeriveJunction::from(&f[1])); + addr.derive(path) + .ok_or(PublicError::InvalidPath) + } } } diff --git a/subkey/Cargo.toml b/subkey/Cargo.toml index 12ae7bdbbe..280f18887e 100644 --- a/subkey/Cargo.toml +++ b/subkey/Cargo.toml @@ -6,6 +6,9 @@ edition = "2018" [dependencies] substrate-primitives = { version = "*", path = "../core/primitives" } +node-runtime = { version = "*", path = "../node/runtime" } +node-primitives = { version = "*", path = "../node/primitives" } +sr-primitives = { version = "*", path = "../core/sr-primitives" } rand = "0.6" clap = { version = "~2.32", features = ["yaml"] } tiny-bip39 = "0.6.0" @@ -13,6 +16,8 @@ rustc-hex = "2.0" substrate-bip39 = { git = "https://github.com/paritytech/substrate-bip39" } schnorrkel = "0.1" hex = "0.3" +hex-literal = "0.1" +parity-codec = "3.2" [features] bench = [] diff --git a/subkey/src/cli.yml b/subkey/src/cli.yml index cc131703eb..8b839cd443 100644 --- a/subkey/src/cli.yml +++ b/subkey/src/cli.yml @@ -40,6 +40,30 @@ subcommands: long: hex help: The message on STDIN is hex-encoded data takes_value: false + - transfer: + about: Author and sign a Node balances::Transfer transaction with a given (secret) key + args: + - from: + index: 1 + required: true + help: The signing secret key URI. + - to: + index: 2 + required: true + help: The destination account public key URI. + - amount: + index: 3 + required: true + help: The number of units to transfer. + - index: + index: 4 + required: true + help: The signing account's transaction index. + - genesis: + short: g + long: genesis + help: The genesis hash or a recognised chain identifier (dev, elm, alex). + takes_value: true - verify: about: Verify a signature for a message, provided on STDIN, with a given (public or secret) key args: diff --git a/subkey/src/main.rs b/subkey/src/main.rs index 5caf58d45b..2aa8609623 100644 --- a/subkey/src/main.rs +++ b/subkey/src/main.rs @@ -20,14 +20,19 @@ extern crate test; extern crate substrate_bip39; extern crate rustc_hex; +#[macro_use] extern crate hex_literal; use std::io::{stdin, Read}; use clap::load_yaml; use rand::{RngCore, rngs::OsRng}; use substrate_bip39::mini_secret_from_entropy; use bip39::{Mnemonic, Language, MnemonicType}; -use substrate_primitives::{ed25519, sr25519, hexdisplay::HexDisplay, Pair, crypto::Ss58Codec}; +use substrate_primitives::{ed25519, sr25519, hexdisplay::HexDisplay, Pair, crypto::Ss58Codec, blake2_256}; +use parity_codec::{Encode, Decode, Compact}; +use sr_primitives::generic::Era; use schnorrkel::keys::MiniSecretKey; +use node_primitives::{Balance, Index, Hash}; +use node_runtime::{Call, UncheckedExtrinsic, BalancesCall}; mod vanity; @@ -173,6 +178,54 @@ fn execute>(matches: clap::ArgMatches) where let sig = pair.sign(&message); println!("{}", hex::encode(&sig)); } + ("transfer", Some(matches)) => { + let signer = matches.value_of("from") + .expect("parameter is required; thus it can't be None; qed"); + let signer = Sr25519::pair_from_suri(signer, password); + + let to = matches.value_of("to") + .expect("parameter is required; thus it can't be None; qed"); + let to = sr25519::Public::from_string(to).ok().or_else(|| + sr25519::Pair::from_string(to, password).ok().map(|p| p.public()) + ).expect("Invalid 'to' URI; expecting either a secret URI or a public URI."); + + let amount = matches.value_of("amount") + .expect("parameter is required; thus it can't be None; qed"); + let amount = str::parse::(amount) + .expect("Invalid 'amount' parameter; expecting an integer."); + + let index = matches.value_of("index") + .expect("parameter is required; thus it can't be None; qed"); + let index = str::parse::(index) + .expect("Invalid 'amount' parameter; expecting an integer."); + + let function = Call::Balances(BalancesCall::transfer(to.into(), amount)); + + let genesis_hash: Hash = match matches.value_of("genesis").unwrap_or("alex") { + "elm" => hex!["10c08714a10c7da78f40a60f6f732cf0dba97acfb5e2035445b032386157d5c3"].into(), + "alex" => hex!["dcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b"].into(), + h => hex::decode(h).ok().and_then(|x| Decode::decode(&mut &x[..])).expect("Invalid genesis hash or unrecognised chain identifier"), + }; + + println!("Using a genesis hash of {}", HexDisplay::from(&genesis_hash.as_ref())); + + let era = Era::immortal(); + let raw_payload = (Compact(index), function, era, genesis_hash); + let signature = raw_payload.using_encoded(|payload| if payload.len() > 256 { + signer.sign(&blake2_256(payload)[..]) + } else { + println!("Signing {}", HexDisplay::from(&payload)); + signer.sign(payload) + }); + let extrinsic = UncheckedExtrinsic::new_signed( + index, + raw_payload.1, + signer.public().into(), + signature.into(), + era, + ); + println!("0x{}", hex::encode(&extrinsic.encode())); + } ("verify", Some(matches)) => { let sig_data = matches.value_of("sig") .expect("signature parameter is required; thus it can't be None; qed"); @@ -218,3 +271,22 @@ fn main() { fn print_usage(matches: &clap::ArgMatches) { println!("{}", matches.usage()); } + +#[cfg(test)] +mod tests { + use super::{Hash, Decode}; + #[test] + fn should_work() { + let s = "0123456789012345678901234567890123456789012345678901234567890123"; + + let d1: Hash = hex::decode(s).ok().and_then(|x| Decode::decode(&mut &x[..])).unwrap(); + + let d2: Hash = { + let mut gh: [u8; 32] = Default::default(); + gh.copy_from_slice(hex::decode(s).unwrap().as_ref()); + Hash::from(gh) + }; + + assert_eq!(d1, d2); + } +} -- GitLab From d9b328f08f5bf3fd650aa04a68017cd664906255 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Wed, 24 Apr 2019 12:51:46 +0200 Subject: [PATCH 005/229] =?UTF-8?q?Use=20balances::TotalIssuance=20for=20s?= =?UTF-8?q?caling=20between=20votes=20and=20balances=20(#=E2=80=A6=20(#236?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use balances::TotalIssuance for scaling between votes and balances (#2361) * Use total issuance to convert between votes and balances * Remove cruft * Bump runtime version --- core/sr-primitives/src/traits.rs | 29 ----------------------------- node/runtime/src/lib.rs | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/core/sr-primitives/src/traits.rs b/core/sr-primitives/src/traits.rs index 3004a5e069..9e43ddc60f 100644 --- a/core/sr-primitives/src/traits.rs +++ b/core/sr-primitives/src/traits.rs @@ -150,35 +150,6 @@ impl Convert for () { fn convert(_: A) -> B { Default::default() } } -/// A structure that converts the currency type into a lossy u64 -/// And back from u128 -pub struct CurrencyToVoteHandler; - -impl Convert for CurrencyToVoteHandler { - fn convert(x: u128) -> u64 { - if x >> 96 == 0 { - // Remove dust; divide by 2^32 - (x >> 32) as u64 - } else { - u64::max_value() - } - } -} - -impl Convert for CurrencyToVoteHandler { - fn convert(x: u128) -> u128 { - // if it practically fits in u64 - if x >> 64 == 0 { - // Add zero dust; multiply by 2^32 - x << 32 - } - else { - // 0000_0000_FFFF_FFFF_FFFF_FFFF_0000_0000 - (u64::max_value() << 32) as u128 - } - } -} - /// A structure that performs identity conversion. pub struct Identity; impl Convert for Identity { diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index 340220160e..b765abd380 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -34,8 +34,7 @@ use client::{ use runtime_primitives::{ApplyResult, generic, create_runtime_str}; use runtime_primitives::transaction_validity::TransactionValidity; use runtime_primitives::traits::{ - BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup, CurrencyToVoteHandler, - AuthorityIdFor, + BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup, AuthorityIdFor, Convert }; use version::RuntimeVersion; use council::{motions as council_motions, voting as council_voting}; @@ -59,8 +58,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("node"), impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, - spec_version: 65, - impl_version: 65, + spec_version: 66, + impl_version: 66, apis: RUNTIME_API_VERSIONS, }; @@ -73,6 +72,20 @@ pub fn native_version() -> NativeVersion { } } +pub struct CurrencyToVoteHandler; + +impl CurrencyToVoteHandler { + fn factor() -> u128 { (Balances::total_issuance() / u64::max_value() as u128).max(1) } +} + +impl Convert for CurrencyToVoteHandler { + fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 } +} + +impl Convert for CurrencyToVoteHandler { + fn convert(x: u128) -> u128 { x * Self::factor() } +} + impl system::Trait for Runtime { type Origin = Origin; type Index = Index; -- GitLab From cdd9b4f2e71695217baa04199a823a78faaea31b Mon Sep 17 00:00:00 2001 From: Marcio Diaz Date: Wed, 24 Apr 2019 13:09:51 +0200 Subject: [PATCH 006/229] Fix grandpa observer and maybe some test timeouts (#2359) * fix: grandpa observer and maybe test timeouts * Update core/finality-grandpa/src/observer.rs Co-Authored-By: gavofyork --- core/finality-grandpa/src/observer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/finality-grandpa/src/observer.rs b/core/finality-grandpa/src/observer.rs index 74b5076dae..cce68a64d4 100644 --- a/core/finality-grandpa/src/observer.rs +++ b/core/finality-grandpa/src/observer.rs @@ -90,9 +90,9 @@ fn grandpa_observer, RA, S>( }, }; - // if the commit we've received targets a block lower than the last + // if the commit we've received targets a block lower or equal to the last // finalized, ignore it and continue with the current state - if commit.target_number < last_finalized_number { + if commit.target_number <= last_finalized_number { return future::ok(last_finalized_number); } -- GitLab From ba16f60be235d863781d20fdbd60bba8b93a6112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Wed, 24 Apr 2019 16:54:09 +0100 Subject: [PATCH 007/229] git: allow diffing Cargo.lock (#2370) --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 9a0309f9e5..9bd26362b0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -Cargo.lock linguist-generated=true -diff +Cargo.lock linguist-generated=true -- GitLab From b787f7770f0a9e8d5f47df3caebd0d1c16b5d962 Mon Sep 17 00:00:00 2001 From: Stanislav Tkach Date: Thu, 25 Apr 2019 12:17:40 +0300 Subject: [PATCH 008/229] Update hex-literal version, simplify imports and remove unused dependencies (#2371) --- Cargo.lock | 57 ++++++++++----------- core/executor/Cargo.toml | 2 +- core/executor/src/wasm_executor.rs | 2 +- core/keyring/Cargo.toml | 1 - core/primitives/Cargo.toml | 4 +- core/primitives/benches/benches.rs | 3 +- core/primitives/src/crypto.rs | 2 +- core/primitives/src/ed25519.rs | 2 +- core/primitives/src/sr25519.rs | 2 +- core/rpc/Cargo.toml | 1 - core/sr-primitives/src/lib.rs | 3 -- core/state-machine/Cargo.toml | 4 +- core/state-machine/src/basic.rs | 2 +- core/state-machine/src/ext.rs | 2 +- core/state-machine/src/overlayed_changes.rs | 2 +- core/state-machine/src/testing.rs | 2 +- core/test-runtime/Cargo.toml | 2 - core/trie/Cargo.toml | 2 +- core/trie/src/lib.rs | 2 +- node-template/Cargo.toml | 1 - node/cli/Cargo.toml | 2 +- node/cli/src/chain_spec.rs | 2 +- node/runtime/Cargo.toml | 2 - srml/assets/Cargo.toml | 1 - srml/aura/Cargo.toml | 1 - srml/balances/Cargo.toml | 1 - srml/consensus/Cargo.toml | 1 - srml/contract/Cargo.toml | 2 +- srml/contract/src/tests.rs | 2 +- srml/council/Cargo.toml | 2 +- srml/council/src/motions.rs | 2 +- srml/democracy/Cargo.toml | 1 - srml/example/Cargo.toml | 1 - srml/executive/Cargo.toml | 2 +- srml/executive/src/lib.rs | 2 +- srml/finality-tracker/Cargo.toml | 1 - srml/indices/Cargo.toml | 1 - srml/session/Cargo.toml | 1 - srml/staking/Cargo.toml | 1 - srml/sudo/Cargo.toml | 1 - srml/support/Cargo.toml | 2 - srml/system/Cargo.toml | 1 - srml/timestamp/Cargo.toml | 1 - srml/treasury/Cargo.toml | 1 - subkey/Cargo.toml | 2 +- subkey/src/main.rs | 5 +- 46 files changed, 54 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 452da42fb6..9dd2198b81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1047,6 +1047,15 @@ dependencies = [ "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hex-literal" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hex-literal-impl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hex-literal-impl" version = "0.1.2" @@ -1055,6 +1064,14 @@ dependencies = [ "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hex-literal-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro-hack 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hmac" version = "0.4.2" @@ -1967,7 +1984,7 @@ version = "1.0.0" dependencies = [ "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "node-executor 1.0.0", "node-primitives 1.0.0", @@ -2038,7 +2055,6 @@ dependencies = [ name = "node-runtime" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 1.0.0", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2081,7 +2097,6 @@ dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "node-template-runtime 1.0.0", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3223,7 +3238,6 @@ dependencies = [ name = "srml-assets" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3238,7 +3252,6 @@ dependencies = [ name = "srml-aura" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3260,7 +3273,6 @@ dependencies = [ name = "srml-balances" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3277,7 +3289,6 @@ dependencies = [ name = "srml-consensus" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3294,7 +3305,7 @@ name = "srml-contract" version = "1.0.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3317,7 +3328,7 @@ dependencies = [ name = "srml-council" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3335,7 +3346,6 @@ dependencies = [ name = "srml-democracy" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3352,7 +3362,6 @@ dependencies = [ name = "srml-example" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3367,7 +3376,7 @@ dependencies = [ name = "srml-executive" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3384,7 +3393,6 @@ dependencies = [ name = "srml-finality-tracker" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3420,7 +3428,6 @@ dependencies = [ name = "srml-indices" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3448,7 +3455,6 @@ dependencies = [ name = "srml-session" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3467,7 +3473,6 @@ dependencies = [ name = "srml-staking" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3488,7 +3493,6 @@ dependencies = [ name = "srml-sudo" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3505,7 +3509,6 @@ name = "srml-support" version = "1.0.0" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3568,7 +3571,6 @@ name = "srml-system" version = "1.0.0" dependencies = [ "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3583,7 +3585,6 @@ dependencies = [ name = "srml-timestamp" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3599,7 +3600,6 @@ dependencies = [ name = "srml-treasury" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 1.0.0", @@ -3731,7 +3731,7 @@ version = "1.0.0" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 1.0.0", "node-runtime 1.0.0", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4036,7 +4036,7 @@ dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4107,7 +4107,6 @@ dependencies = [ name = "substrate-keyring" version = "1.0.0" dependencies = [ - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4245,7 +4244,7 @@ dependencies = [ "hash256-std-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4273,7 +4272,6 @@ dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-derive 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4387,7 +4385,7 @@ version = "1.0.0" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4437,7 +4435,6 @@ name = "substrate-test-runtime" version = "1.0.0" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4501,7 +4498,7 @@ version = "1.0.0" dependencies = [ "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5506,7 +5503,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc2928beef125e519d69ae1baa8c37ea2e0d3848545217f6db0179c5eb1d639" +"checksum hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3da68162fdd2147e66682e78e729bd77f93b4c99656db058c5782d8c6b6225a" "checksum hex-literal-impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "520870c3213943eb8d7803e80180d12a6c7ceb4ae74602544529d1643dc4ddda" +"checksum hex-literal-impl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06095d08c7c05760f11a071b3e1d4c5b723761c01bd8d7201c30a9536668a612" "checksum hmac 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a13f4163aa0c5ca1be584aace0e2212b2e41be5478218d4f657f5f778b2ae2a" "checksum hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f127a908633569f208325f86f71255d3363c79721d7f9fe31cd5569908819771" "checksum hmac-drbg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe727d41d2eec0a6574d887914347e5ff96a3b87177817e2a9820c5c87fecc2" diff --git a/core/executor/Cargo.toml b/core/executor/Cargo.toml index 0278c1704d..d56fb00ad9 100644 --- a/core/executor/Cargo.toml +++ b/core/executor/Cargo.toml @@ -25,7 +25,7 @@ tiny-keccak = "1.4.2" [dev-dependencies] assert_matches = "1.1" wabt = "~0.7.4" -hex-literal = "0.1.0" +hex-literal = "0.2.0" [features] default = [] diff --git a/core/executor/src/wasm_executor.rs b/core/executor/src/wasm_executor.rs index cc355f6bba..3fe1a1c3cc 100644 --- a/core/executor/src/wasm_executor.rs +++ b/core/executor/src/wasm_executor.rs @@ -897,7 +897,7 @@ mod tests { use parity_codec::Encode; use state_machine::TestExternalities; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; use primitives::map; #[test] diff --git a/core/keyring/Cargo.toml b/core/keyring/Cargo.toml index 74f898b83f..01fa362cad 100644 --- a/core/keyring/Cargo.toml +++ b/core/keyring/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [dependencies] substrate-primitives = { path = "../primitives" } sr-primitives = { path = "../sr-primitives" } -hex-literal = { version = "0.1.0" } lazy_static = { version = "1.0" } strum = "0.14.0" strum_macros = "0.14.0" diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 02133e0655..6d50c8be0e 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -18,7 +18,6 @@ hash-db = { version = "0.12", default-features = false } hash256-std-hasher = { version = "0.12", default-features = false } ring = { version = "0.14", optional = true } untrusted = { version = "0.6", optional = true } -hex-literal = { version = "0.1", optional = true } base58 = { version = "0.1", optional = true } blake2-rfc = { version = "0.2.18", optional = true } schnorrkel = { version = "0.1", optional = true } @@ -33,7 +32,7 @@ regex = {version = "1.1", optional = true } substrate-serializer = { path = "../serializer" } pretty_assertions = "0.6" heapsize = "0.4" -hex-literal = "0.1" +hex-literal = "0.2" rand = "0.6" [features] @@ -57,7 +56,6 @@ std = [ "blake2-rfc", "ring", "untrusted", - "hex-literal", "hex", "base58", "substrate-bip39", diff --git a/core/primitives/benches/benches.rs b/core/primitives/benches/benches.rs index b81ef9dc42..a38f5fdae2 100644 --- a/core/primitives/benches/benches.rs +++ b/core/primitives/benches/benches.rs @@ -16,10 +16,9 @@ #![feature(test)] extern crate test; -use hex_literal::{hex, hex_impl}; +use hex_literal::hex; use substrate_primitives::hashing::{twox_128, blake2_128}; - const MAX_KEY_SIZE: u32 = 32; fn data_set() -> Vec> { diff --git a/core/primitives/src/crypto.rs b/core/primitives/src/crypto.rs index dc886c7b38..dce30fad71 100644 --- a/core/primitives/src/crypto.rs +++ b/core/primitives/src/crypto.rs @@ -410,7 +410,7 @@ pub trait Pair: Sized { #[cfg(test)] mod tests { use crate::DeriveJunction; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; use super::*; #[derive(Eq, PartialEq, Debug)] diff --git a/core/primitives/src/ed25519.rs b/core/primitives/src/ed25519.rs index d095c6445d..8bf3ae4ad0 100644 --- a/core/primitives/src/ed25519.rs +++ b/core/primitives/src/ed25519.rs @@ -490,7 +490,7 @@ impl Pair { #[cfg(test)] mod test { use super::*; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; use crate::crypto::DEV_PHRASE; #[test] diff --git a/core/primitives/src/sr25519.rs b/core/primitives/src/sr25519.rs index e70e35c1ae..8f309ec030 100644 --- a/core/primitives/src/sr25519.rs +++ b/core/primitives/src/sr25519.rs @@ -504,7 +504,7 @@ impl Pair { mod test { use super::*; use crate::crypto::{Ss58Codec, DEV_PHRASE, DEV_ADDRESS}; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; #[test] fn default_phrase_should_be_used() { diff --git a/core/rpc/Cargo.toml b/core/rpc/Cargo.toml index 600cd9ac48..4b00f2bf2d 100644 --- a/core/rpc/Cargo.toml +++ b/core/rpc/Cargo.toml @@ -32,4 +32,3 @@ test_client = { package = "substrate-test-client", path = "../test-client" } test_runtime = { package = "substrate-test-runtime", path = "../test-runtime" } consensus = { package = "substrate-consensus-common", path = "../consensus/common" } rustc-hex = "2.0" -hex-literal = "0.1" diff --git a/core/sr-primitives/src/lib.rs b/core/sr-primitives/src/lib.rs index e1ec698a4a..08c6b3c9a9 100644 --- a/core/sr-primitives/src/lib.rs +++ b/core/sr-primitives/src/lib.rs @@ -33,9 +33,6 @@ use rstd::prelude::*; use substrate_primitives::{crypto, ed25519, sr25519, hash::{H256, H512}}; use codec::{Encode, Decode}; -#[cfg(feature = "std")] -use substrate_primitives::hexdisplay::ascii_format; - #[cfg(feature = "std")] pub mod testing; diff --git a/core/state-machine/Cargo.toml b/core/state-machine/Cargo.toml index eed53d49c3..171ae15b28 100644 --- a/core/state-machine/Cargo.toml +++ b/core/state-machine/Cargo.toml @@ -6,7 +6,6 @@ description = "Substrate State Machine" edition = "2018" [dependencies] -hex-literal = "0.1.0" log = "0.4" parking_lot = "0.7.1" heapsize = "0.4" @@ -17,3 +16,6 @@ trie = { package = "substrate-trie", path = "../trie" } primitives = { package = "substrate-primitives", path = "../primitives" } panic-handler = { package = "substrate-panic-handler", path = "../panic-handler" } parity-codec = "3.3" + +[dev-dependencies] +hex-literal = "0.2.0" diff --git a/core/state-machine/src/basic.rs b/core/state-machine/src/basic.rs index 0c95de61cb..a4863485b7 100644 --- a/core/state-machine/src/basic.rs +++ b/core/state-machine/src/basic.rs @@ -166,7 +166,7 @@ impl Externalities for BasicExternalities where H::Out: Ord + Heap mod tests { use super::*; use primitives::{Blake2Hasher, H256}; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; #[test] fn commit_should_work() { diff --git a/core/state-machine/src/ext.rs b/core/state-machine/src/ext.rs index c88798f37f..a9f2ab9d0e 100644 --- a/core/state-machine/src/ext.rs +++ b/core/state-machine/src/ext.rs @@ -360,7 +360,7 @@ where #[cfg(test)] mod tests { - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; use parity_codec::Encode; use primitives::{Blake2Hasher}; use primitives::storage::well_known_keys::EXTRINSIC_INDEX; diff --git a/core/state-machine/src/overlayed_changes.rs b/core/state-machine/src/overlayed_changes.rs index 56e69323e8..c98882726e 100644 --- a/core/state-machine/src/overlayed_changes.rs +++ b/core/state-machine/src/overlayed_changes.rs @@ -309,7 +309,7 @@ impl From>> for OverlayedValue { #[cfg(test)] mod tests { - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; use primitives::{Blake2Hasher, H256}; use primitives::storage::well_known_keys::EXTRINSIC_INDEX; use crate::backend::InMemory; diff --git a/core/state-machine/src/testing.rs b/core/state-machine/src/testing.rs index ac096c0c3e..3adf277bf3 100644 --- a/core/state-machine/src/testing.rs +++ b/core/state-machine/src/testing.rs @@ -180,7 +180,7 @@ impl Externalities for TestExternalities where H::Out: Ord + He mod tests { use super::*; use primitives::{Blake2Hasher, H256}; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; #[test] fn commit_should_work() { diff --git a/core/test-runtime/Cargo.toml b/core/test-runtime/Cargo.toml index 2a4540090e..6b3d6f7d9f 100644 --- a/core/test-runtime/Cargo.toml +++ b/core/test-runtime/Cargo.toml @@ -6,7 +6,6 @@ edition = "2018" [dependencies] log = { version = "0.4", optional = true } -hex-literal = { version = "0.1.0", optional = true } serde = { version = "1.0", optional = true, features = ["derive"] } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } keyring = { package = "substrate-keyring", path = "../keyring", optional = true } @@ -35,7 +34,6 @@ substrate-test-client = { path = "../test-client" } default = ["std"] std = [ "log", - "hex-literal", "serde", "substrate-client/std", "keyring", diff --git a/core/trie/Cargo.toml b/core/trie/Cargo.toml index 1fd1b7b3bd..b47148c28d 100644 --- a/core/trie/Cargo.toml +++ b/core/trie/Cargo.toml @@ -25,7 +25,7 @@ trie-bench = { version = "0.12" } trie-standardmap = { version = "0.12" } keccak-hasher = { version = "0.12" } criterion = "0.2" -hex-literal = "0.1.0" +hex-literal = "0.2.0" [features] default = ["std"] diff --git a/core/trie/src/lib.rs b/core/trie/src/lib.rs index a9a9860f94..e29402b63c 100644 --- a/core/trie/src/lib.rs +++ b/core/trie/src/lib.rs @@ -339,7 +339,7 @@ mod tests { use hash_db::{HashDB, Hasher}; use trie_db::{DBValue, TrieMut, Trie}; use trie_standardmap::{Alphabet, ValueMode, StandardMap}; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; fn check_equivalent(input: &Vec<(&[u8], &[u8])>) { { diff --git a/node-template/Cargo.toml b/node-template/Cargo.toml index 7ef20cc89f..3e9d8656ea 100644 --- a/node-template/Cargo.toml +++ b/node-template/Cargo.toml @@ -17,7 +17,6 @@ log = "0.4" tokio = "0.1" exit-future = "0.1" parking_lot = "0.7.1" -hex-literal = "0.1" parity-codec = "3.3" trie-root = "0.12.2" sr-io = { path = "../core/sr-io" } diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index a26d8f3ae8..0ca5dc34f6 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -19,7 +19,7 @@ primitives = { package = "substrate-primitives", path = "../../core/primitives" inherents = { package = "substrate-inherents", path = "../../core/inherents" } node-runtime = { path = "../runtime" } node-primitives = { path = "../primitives" } -hex-literal = "0.1" +hex-literal = "0.2" substrate-basic-authorship = { path = "../../core/basic-authorship" } substrate-service = { path = "../../core/service" } transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" } diff --git a/node/cli/src/chain_spec.rs b/node/cli/src/chain_spec.rs index b09d55c6e9..0c017d2fac 100644 --- a/node/cli/src/chain_spec.rs +++ b/node/cli/src/chain_spec.rs @@ -23,7 +23,7 @@ use node_runtime::{ConsensusConfig, CouncilSeatsConfig, CouncilVotingConfig, Dem SudoConfig, ContractConfig, GrandpaConfig, IndicesConfig, Permill, Perbill}; pub use node_runtime::GenesisConfig; use substrate_service; -use hex_literal::{hex, hex_impl}; +use hex_literal::hex; use substrate_telemetry::TelemetryEndpoints; const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; diff --git a/node/runtime/Cargo.toml b/node/runtime/Cargo.toml index f8e0e047bc..d6d5207747 100644 --- a/node/runtime/Cargo.toml +++ b/node/runtime/Cargo.toml @@ -34,7 +34,6 @@ sudo = { package = "srml-sudo", path = "../../srml/sudo", default-features = fal node-primitives = { path = "../primitives", default-features = false } consensus_aura = { package = "substrate-consensus-aura-primitives", path = "../../core/consensus/aura/primitives", default-features = false } rustc-hex = { version = "2.0", optional = true } -hex-literal = { version = "0.1.0", optional = true } serde = { version = "1.0", optional = true } substrate-keyring = { path = "../../core/keyring", optional = true } consensus_authorities = { package = "substrate-consensus-authorities", path = "../../core/consensus/authorities", default-features = false } @@ -73,7 +72,6 @@ std = [ "client/std", "consensus_aura/std", "rustc-hex", - "hex-literal", "substrate-keyring", "offchain-primitives/std", "consensus_authorities/std", diff --git a/srml/assets/Cargo.toml b/srml/assets/Cargo.toml index 066dd42ffd..726c7f3580 100644 --- a/srml/assets/Cargo.toml +++ b/srml/assets/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } parity-codec = { version = "3.3", default-features = false } # Needed for various traits. In our case, `OnFinalize`. diff --git a/srml/aura/Cargo.toml b/srml/aura/Cargo.toml index b22fea8ffd..4ec1c27c71 100644 --- a/srml/aura/Cargo.toml +++ b/srml/aura/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" parity-codec = { version = "3.3", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true } inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } diff --git a/srml/balances/Cargo.toml b/srml/balances/Cargo.toml index 804ee60364..df8c31c865 100644 --- a/srml/balances/Cargo.toml +++ b/srml/balances/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.3", default-features = false, features = ["derive"] } diff --git a/srml/consensus/Cargo.toml b/srml/consensus/Cargo.toml index ef3e943c8d..267e394ffb 100644 --- a/srml/consensus/Cargo.toml +++ b/srml/consensus/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true, features = ["derive"] } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } substrate-primitives = { path = "../../core/primitives", default-features = false } diff --git a/srml/contract/Cargo.toml b/srml/contract/Cargo.toml index 28ca8f9eb9..6d302c208c 100644 --- a/srml/contract/Cargo.toml +++ b/srml/contract/Cargo.toml @@ -22,7 +22,7 @@ timestamp = { package = "srml-timestamp", path = "../timestamp", default-feature [dev-dependencies] wabt = "~0.7.4" assert_matches = "1.1" -hex-literal = "0.1.0" +hex-literal = "0.2.0" consensus = { package = "srml-consensus", path = "../consensus" } balances = { package = "srml-balances", path = "../balances" } diff --git a/srml/contract/src/tests.rs b/srml/contract/src/tests.rs index d6fa2677df..0e7270769c 100644 --- a/srml/contract/src/tests.rs +++ b/srml/contract/src/tests.rs @@ -29,7 +29,7 @@ use srml_support::{storage::child, StorageMap, assert_ok, impl_outer_event, impl use substrate_primitives::Blake2Hasher; use system::{self, Phase, EventRecord}; use {wabt, balances, consensus}; -use hex_literal::*; +use hex_literal::hex; use assert_matches::assert_matches; use crate::{ ContractAddressFor, GenesisConfig, Module, RawEvent, diff --git a/srml/council/Cargo.toml b/srml/council/Cargo.toml index 87de0ae0d1..c4d535af53 100644 --- a/srml/council/Cargo.toml +++ b/srml/council/Cargo.toml @@ -17,7 +17,7 @@ democracy = { package = "srml-democracy", path = "../democracy", default-feature system = { package = "srml-system", path = "../system", default-features = false } [dev-dependencies] -hex-literal = "0.1.0" +hex-literal = "0.2.0" balances = { package = "srml-balances", path = "../balances" } [features] diff --git a/srml/council/src/motions.rs b/srml/council/src/motions.rs index 3bbe463780..393ebce4f8 100644 --- a/srml/council/src/motions.rs +++ b/srml/council/src/motions.rs @@ -205,7 +205,7 @@ mod tests { use crate::tests::{Call, Origin, Event as OuterEvent}; use srml_support::{Hashable, assert_ok, assert_noop}; use system::{EventRecord, Phase}; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; #[test] fn motions_basic_environment_works() { diff --git a/srml/democracy/Cargo.toml b/srml/democracy/Cargo.toml index e789c733d6..8fbe34bb2e 100644 --- a/srml/democracy/Cargo.toml +++ b/srml/democracy/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true, features = ["derive"] } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.3", default-features = false, features = ["derive"] } diff --git a/srml/example/Cargo.toml b/srml/example/Cargo.toml index c62b61f7b3..ae9f2f508e 100644 --- a/srml/example/Cargo.toml +++ b/srml/example/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } parity-codec = { version = "3.3", default-features = false } srml-support = { path = "../support", default-features = false } diff --git a/srml/executive/Cargo.toml b/srml/executive/Cargo.toml index 0526e86ca9..ef2190da54 100644 --- a/srml/executive/Cargo.toml +++ b/srml/executive/Cargo.toml @@ -14,7 +14,7 @@ srml-support = { path = "../support", default-features = false } system = { package = "srml-system", path = "../system", default-features = false } [dev-dependencies] -hex-literal = "0.1.0" +hex-literal = "0.2.0" substrate-primitives = { path = "../../core/primitives" } srml-indices = { path = "../indices" } balances = { package = "srml-balances", path = "../balances" } diff --git a/srml/executive/src/lib.rs b/srml/executive/src/lib.rs index 271d7156ac..6ca10bed2d 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -365,7 +365,7 @@ mod tests { use primitives::testing::{Digest, DigestItem, Header, Block}; use srml_support::{traits::Currency, impl_outer_origin, impl_outer_event}; use system; - use hex_literal::{hex, hex_impl}; + use hex_literal::hex; impl_outer_origin! { pub enum Origin for Runtime { diff --git a/srml/finality-tracker/Cargo.toml b/srml/finality-tracker/Cargo.toml index c85534f1eb..b0b2c53b58 100644 --- a/srml/finality-tracker/Cargo.toml +++ b/srml/finality-tracker/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", default-features = false, features = ["derive"] } parity-codec = { version = "3.3", default-features = false } inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false } diff --git a/srml/indices/Cargo.toml b/srml/indices/Cargo.toml index 8c62cf13b5..ad666e7a54 100644 --- a/srml/indices/Cargo.toml +++ b/srml/indices/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.3", default-features = false, features = ["derive"] } diff --git a/srml/session/Cargo.toml b/srml/session/Cargo.toml index 036f5a55ec..7739e9746f 100644 --- a/srml/session/Cargo.toml +++ b/srml/session/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.3", default-features = false, features = ["derive"] } diff --git a/srml/staking/Cargo.toml b/srml/staking/Cargo.toml index cd10f783b1..e26814ffde 100644 --- a/srml/staking/Cargo.toml +++ b/srml/staking/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.3", default-features = false, features = ["derive"] } diff --git a/srml/sudo/Cargo.toml b/srml/sudo/Cargo.toml index 220127ba3b..788d24e1c3 100644 --- a/srml/sudo/Cargo.toml +++ b/srml/sudo/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } sr-std = { path = "../../core/sr-std", default-features = false } diff --git a/srml/support/Cargo.toml b/srml/support/Cargo.toml index ab16e98ee9..1d44412be7 100644 --- a/srml/support/Cargo.toml +++ b/srml/support/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = { version = "0.1.0", optional = true } serde = { version = "1.0", optional = true, features = ["derive"] } codec = { package = "parity-codec", version = "3.5.1", default-features = false, features = ["derive"] } srml-metadata = { path = "../metadata", default-features = false } @@ -25,7 +24,6 @@ srml-system = { path = "../system", default-features = false } [features] default = ["std"] std = [ - "hex-literal", "once_cell", "bitmask/std", "serde", diff --git a/srml/system/Cargo.toml b/srml/system/Cargo.toml index 0effeae251..0153906c97 100644 --- a/srml/system/Cargo.toml +++ b/srml/system/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true, features = ["derive"] } safe-mix = { version = "1.0", default-features = false} parity-codec = { version = "3.5", default-features = false, features = ["derive"] } diff --git a/srml/timestamp/Cargo.toml b/srml/timestamp/Cargo.toml index c86493890a..b785dd9184 100644 --- a/srml/timestamp/Cargo.toml +++ b/srml/timestamp/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } diff --git a/srml/treasury/Cargo.toml b/srml/treasury/Cargo.toml index a4f3960edd..e0716f6c59 100644 --- a/srml/treasury/Cargo.toml +++ b/srml/treasury/Cargo.toml @@ -5,7 +5,6 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] -hex-literal = "0.1.0" serde = { version = "1.0", optional = true, features = ["derive"] } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false } diff --git a/subkey/Cargo.toml b/subkey/Cargo.toml index 280f18887e..bd44c8754a 100644 --- a/subkey/Cargo.toml +++ b/subkey/Cargo.toml @@ -16,7 +16,7 @@ rustc-hex = "2.0" substrate-bip39 = { git = "https://github.com/paritytech/substrate-bip39" } schnorrkel = "0.1" hex = "0.3" -hex-literal = "0.1" +hex-literal = "0.2" parity-codec = "3.2" [features] diff --git a/subkey/src/main.rs b/subkey/src/main.rs index 2aa8609623..b0ad1b281d 100644 --- a/subkey/src/main.rs +++ b/subkey/src/main.rs @@ -18,11 +18,8 @@ #[cfg(feature = "bench")] extern crate test; -extern crate substrate_bip39; -extern crate rustc_hex; -#[macro_use] extern crate hex_literal; - use std::io::{stdin, Read}; +use hex_literal::hex; use clap::load_yaml; use rand::{RngCore, rngs::OsRng}; use substrate_bip39::mini_secret_from_entropy; -- GitLab From 9172ffaa86b413a221742c1ac3447a999028c288 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 25 Apr 2019 11:39:57 +0200 Subject: [PATCH 009/229] Remove the multiplexed networking system (#2373) * Remove the multiplexed networking system * Rename BackCompat to Normal * Remove CustomMessageId * Fix tests --- .../src/custom_proto/handler.rs | 315 ++---------------- core/network-libp2p/src/custom_proto/mod.rs | 2 +- .../src/custom_proto/upgrade.rs | 108 +----- core/network-libp2p/src/lib.rs | 4 +- core/network-libp2p/tests/test.rs | 13 +- core/network/src/message.rs | 22 +- 6 files changed, 36 insertions(+), 428 deletions(-) diff --git a/core/network-libp2p/src/custom_proto/handler.rs b/core/network-libp2p/src/custom_proto/handler.rs index beac1dec25..7c0ec61344 100644 --- a/core/network-libp2p/src/custom_proto/handler.rs +++ b/core/network-libp2p/src/custom_proto/handler.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use crate::custom_proto::upgrade::{CustomMessage, CustomMessageId, RegisteredProtocol}; +use crate::custom_proto::upgrade::{CustomMessage, RegisteredProtocol}; use crate::custom_proto::upgrade::{RegisteredProtocolEvent, RegisteredProtocolSubstream}; use futures::prelude::*; use libp2p::core::{ @@ -25,8 +25,8 @@ use libp2p::core::{ protocols_handler::SubstreamProtocol, upgrade::{InboundUpgrade, OutboundUpgrade} }; -use log::{debug, error, warn}; -use smallvec::{smallvec, SmallVec}; +use log::{debug, error}; +use smallvec::SmallVec; use std::{error, fmt, io, marker::PhantomData, mem, time::Duration, time::Instant}; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_timer::{Delay, clock::Clock}; @@ -69,26 +69,17 @@ use void::Void; /// /// ## How it works /// -/// For backwards compatibility reasons, the behaviour of the handler is quite complicated. After -/// enough nodes have upgraded, it should be simplified by using helpers provided by libp2p. -/// /// When the handler is created, it is initially in the `Init` state and waits for either a /// `Disable` or an `Enable` message from the outer layer. At any time, the outer layer is free to /// toggle the handler between the disabled and enabled states. /// /// When the handler is enabled for the first time, if it is the dialer of the connection, it tries -/// to open a substream. The substream negotiates either a protocol named `/substrate/xxx` or a -/// protocol named `/substrate/multi/xxx`. If it is the former, then we are in -/// "backwards-compatibility mode". If it is the latter, we are in normal operation mode. -/// -/// In "backwards-compatibility mode", we have one unique substream where bidirectional -/// communications happen. If the remote closes the substream, we consider that we are now -/// disconnected. Re-enabling is performed by re-opening the substream. +/// to open a substream. The substream negotiates either a protocol named `/substrate/xxx`, where +/// `xxx` is chosen by the user. /// -/// In normal operation mode, each request gets sent over a different substream where the response -/// is then sent back. If the remote refuses one of our substream open request, or if an error -/// happens on one substream, we consider that we are disconnected. Re-enabling is performed by -/// opening an outbound substream. +/// Then, we have one unique substream where bidirectional communications happen. If the remote +/// closes the substream, we consider that we are now disconnected. Re-enabling is performed by +/// re-opening the substream (even if we are not the dialer of the connection). /// pub struct CustomProtoHandlerProto { /// Configuration for the protocol upgrade to negotiate. @@ -159,7 +150,6 @@ pub struct CustomProtoHandler { /// `Clock` instance that uses the current execution context's source of time. clock: Clock, - } /// State of the handler. @@ -181,17 +171,13 @@ enum ProtocolState { /// Backwards-compatible mode. Contains the unique substream that is open. /// If we are in this state, we have sent a `CustomProtocolOpen` message to the outside. - BackCompat { + Normal { /// The unique substream where bidirectional communications happen. substream: RegisteredProtocolSubstream, /// Contains substreams which are being shut down. shutdown: SmallVec<[RegisteredProtocolSubstream; 4]>, }, - /// Normal functionning. Contains the substreams that are open. - /// If we are in this state, we have sent a `CustomProtocolOpen` message to the outside. - Normal(PerProtocolNormalState), - /// We are disabled. Contains substreams that are being closed. /// If we are in this state, either we have sent a `CustomProtocolClosed` message to the /// outside or we have never sent any `CustomProtocolOpen` in the first place. @@ -212,128 +198,6 @@ enum ProtocolState { Poisoned, } -/// Normal functionning mode for a protocol. -struct PerProtocolNormalState { - /// Optional substream that we opened. - outgoing_substream: Option>, - - /// Substreams that have been opened by the remote. We are waiting for a packet from it. - incoming_substreams: SmallVec<[RegisteredProtocolSubstream; 4]>, - - /// For each request that has been sent to the remote, contains the substream where we - /// expect a response. - pending_response: SmallVec<[(u64, RegisteredProtocolSubstream); 4]>, - - /// For each request received by the remote, contains the substream where to send back our - /// response. Once a response has been sent, the substream closes. - pending_send_back: SmallVec<[(u64, RegisteredProtocolSubstream); 4]>, - - /// List of messages waiting for a substream to open in order to be sent. - pending_messages: SmallVec<[TMessage; 6]>, - - /// Contains substreams which are being shut down. - shutdown: SmallVec<[RegisteredProtocolSubstream; 4]>, -} - -impl PerProtocolNormalState -where TMessage: CustomMessage, TSubstream: AsyncRead + AsyncWrite { - /// Polls for things that are new. Same API constraints as `Future::poll()`. - /// Optionally returns the event to produce. - /// You must pass the `protocol_id` as we need have to inject it in the returned event. - /// API note: Ideally we wouldn't need to be passed a `ProtocolId`, and we would return a - /// different enum that doesn't contain any `protocol_id`, and the caller would inject - /// the ID itself, but that's a ton of code for not much gain. - fn poll(&mut self) -> Option> { - for n in (0..self.pending_response.len()).rev() { - let (request_id, mut substream) = self.pending_response.swap_remove(n); - match substream.poll() { - Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(message)))) => { - if message.request_id() == CustomMessageId::Response(request_id) { - let event = CustomProtoHandlerOut::CustomMessage { - message - }; - self.shutdown.push(substream); - return Some(event); - } else { - self.shutdown.push(substream); - let event = CustomProtoHandlerOut::ProtocolError { - is_severe: true, - error: format!("Request ID doesn't match substream: expected {:?}, \ - got {:?}", request_id, message.request_id()).into(), - }; - return Some(event); - } - }, - Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { .. }))) => - unreachable!("Cannot receive Clogged message with new protocol version; QED"), - Ok(Async::NotReady) => - self.pending_response.push((request_id, substream)), - Ok(Async::Ready(None)) => { - self.shutdown.push(substream); - let event = CustomProtoHandlerOut::ProtocolError { - is_severe: false, - error: format!("Request ID {:?} didn't receive an answer", request_id).into(), - }; - return Some(event); - } - Err(err) => { - self.shutdown.push(substream); - let event = CustomProtoHandlerOut::ProtocolError { - is_severe: false, - error: format!("Error while waiting for an answer for {:?}: {}", - request_id, err).into(), - }; - return Some(event); - } - } - } - - for n in (0..self.incoming_substreams.len()).rev() { - let mut substream = self.incoming_substreams.swap_remove(n); - match substream.poll() { - Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(message)))) => { - return match message.request_id() { - CustomMessageId::Request(id) => { - self.pending_send_back.push((id, substream)); - Some(CustomProtoHandlerOut::CustomMessage { - message - }) - } - CustomMessageId::OneWay => { - self.shutdown.push(substream); - Some(CustomProtoHandlerOut::CustomMessage { - message - }) - } - _ => { - self.shutdown.push(substream); - Some(CustomProtoHandlerOut::ProtocolError { - is_severe: true, - error: format!("Received response in new substream").into(), - }) - } - } - }, - Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { .. }))) => - unreachable!("Cannot receive Clogged message with new protocol version; QED"), - Ok(Async::NotReady) => - self.incoming_substreams.push(substream), - Ok(Async::Ready(None)) => {} - Err(err) => { - self.shutdown.push(substream); - return Some(CustomProtoHandlerOut::ProtocolError { - is_severe: false, - error: format!("Error in incoming substream: {}", err).into(), - }); - } - } - } - - shutdown_list(&mut self.shutdown); - None - } -} - /// Event that can be received by a `CustomProtoHandler`. #[derive(Debug)] pub enum CustomProtoHandlerIn { @@ -414,26 +278,12 @@ where deadline: Delay::new(self.clock.now() + Duration::from_secs(60)) } - } else if incoming.iter().any(|s| s.is_multiplex()) { - let event = CustomProtoHandlerOut::CustomProtocolOpen { - version: incoming[0].protocol_version() - }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Normal(PerProtocolNormalState { - outgoing_substream: None, - incoming_substreams: incoming.into_iter().collect(), - pending_response: SmallVec::new(), - pending_send_back: SmallVec::new(), - pending_messages: SmallVec::new(), - shutdown: SmallVec::new(), - }) - } else { let event = CustomProtoHandlerOut::CustomProtocolOpen { version: incoming[0].protocol_version() }; self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::BackCompat { + ProtocolState::Normal { substream: incoming.into_iter().next() .expect("We have a check above that incoming isn't empty; QED"), shutdown: SmallVec::new() @@ -442,7 +292,6 @@ where } st @ ProtocolState::Opening { .. } => st, - st @ ProtocolState::BackCompat { .. } => st, st @ ProtocolState::Normal { .. } => st, ProtocolState::Disabled { shutdown, .. } => { ProtocolState::Disabled { shutdown, reenable: true } @@ -470,7 +319,7 @@ where ProtocolState::Disabled { shutdown: SmallVec::new(), reenable: false } } - ProtocolState::BackCompat { mut substream, mut shutdown } => { + ProtocolState::Normal { mut substream, mut shutdown } => { substream.shutdown(); shutdown.push(substream); let event = CustomProtoHandlerOut::CustomProtocolClosed { @@ -483,23 +332,6 @@ where } } - ProtocolState::Normal(state) => { - let mut out: SmallVec<[_; 6]> = SmallVec::new(); - out.extend(state.outgoing_substream.into_iter()); - out.extend(state.incoming_substreams.into_iter()); - out.extend(state.pending_response.into_iter().map(|(_, s)| s)); - out.extend(state.pending_send_back.into_iter().map(|(_, s)| s)); - for s in &mut out { - s.shutdown(); - } - out.extend(state.shutdown.into_iter()); - let event = CustomProtoHandlerOut::CustomProtocolClosed { - result: Ok(()) - }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Disabled { shutdown: out, reenable: false } - } - ProtocolState::Disabled { shutdown, .. } => ProtocolState::Disabled { shutdown, reenable: false }, }; @@ -557,25 +389,25 @@ where } } - ProtocolState::BackCompat { mut substream, shutdown } => { + ProtocolState::Normal { mut substream, shutdown } => { match substream.poll() { Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(message)))) => { let event = CustomProtoHandlerOut::CustomMessage { message }; return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::BackCompat { substream, shutdown } + ProtocolState::Normal { substream, shutdown } }, Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { messages }))) => { let event = CustomProtoHandlerOut::Clogged { messages, }; return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::BackCompat { substream, shutdown } + ProtocolState::Normal { substream, shutdown } } Ok(Async::NotReady) => { return_value = None; - ProtocolState::BackCompat { substream, shutdown } + ProtocolState::Normal { substream, shutdown } } Ok(Async::Ready(None)) => { let event = CustomProtoHandlerOut::CustomProtocolClosed { @@ -600,16 +432,6 @@ where } } - ProtocolState::Normal(mut norm_state) => { - if let Some(event) = norm_state.poll() { - return_value = Some(ProtocolsHandlerEvent::Custom(event)); - } else { - return_value = None; - } - - ProtocolState::Normal(norm_state) - } - ProtocolState::Disabled { mut shutdown, reenable } => { shutdown_list(&mut shutdown); // If `reenable` is `true`, that means we should open the substreams system again @@ -658,65 +480,18 @@ where version: substream.protocol_version() }; self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); - - match (substream.endpoint(), substream.is_multiplex()) { - (Endpoint::Dialer, true) => { - ProtocolState::Normal(PerProtocolNormalState { - outgoing_substream: Some(substream), - incoming_substreams: SmallVec::new(), - pending_response: SmallVec::new(), - pending_send_back: SmallVec::new(), - pending_messages: SmallVec::new(), - shutdown: SmallVec::new(), - }) - }, - (Endpoint::Listener, true) => { - ProtocolState::Normal(PerProtocolNormalState { - outgoing_substream: None, - incoming_substreams: smallvec![substream], - pending_response: SmallVec::new(), - pending_send_back: SmallVec::new(), - pending_messages: SmallVec::new(), - shutdown: SmallVec::new(), - }) - }, - (_, false) => { - ProtocolState::BackCompat { - substream, - shutdown: SmallVec::new() - } - }, + ProtocolState::Normal { + substream, + shutdown: SmallVec::new() } } - ProtocolState::BackCompat { substream: existing, mut shutdown } => { + ProtocolState::Normal { substream: existing, mut shutdown } => { debug!(target: "sub-libp2p", "Received extra substream after having already one \ open in backwards-compatibility mode with {:?}", self.remote_peer_id); substream.shutdown(); shutdown.push(substream); - ProtocolState::BackCompat { substream: existing, shutdown } - } - - ProtocolState::Normal(mut state) => { - if substream.endpoint() == Endpoint::Listener { - state.incoming_substreams.push(substream); - } else if !state.pending_messages.is_empty() { - let message = state.pending_messages.remove(0); - let request_id = message.request_id(); - substream.send_message(message); - if let CustomMessageId::Request(request_id) = request_id { - state.pending_response.push((request_id, substream)); - } else { - state.shutdown.push(substream); - } - } else { - debug!(target: "sub-libp2p", "Opened spurious outbound substream with {:?}", - self.remote_peer_id); - substream.shutdown(); - state.shutdown.push(substream); - } - - ProtocolState::Normal(state) + ProtocolState::Normal { substream: existing, shutdown } } ProtocolState::Disabled { mut shutdown, .. } => { @@ -730,54 +505,9 @@ where /// Sends a message to the remote. fn send_message(&mut self, message: TMessage) { match self.state { - ProtocolState::BackCompat { ref mut substream, .. } => + ProtocolState::Normal { ref mut substream, .. } => substream.send_message(message), - ProtocolState::Normal(ref mut state) => { - if let CustomMessageId::Request(request_id) = message.request_id() { - if let Some(mut outgoing_substream) = state.outgoing_substream.take() { - outgoing_substream.send_message(message); - state.pending_response.push((request_id, outgoing_substream)); - } else { - if state.pending_messages.len() >= 2048 { - let event = CustomProtoHandlerOut::Clogged { - messages: Vec::new(), - }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); - } - state.pending_messages.push(message); - self.events_queue.push(ProtocolsHandlerEvent::OutboundSubstreamRequest { - protocol: SubstreamProtocol::new(self.protocol.clone()), - info: () - }); - } - } else if let CustomMessageId::Response(request_id) = message.request_id() { - if let Some(pos) = state.pending_send_back.iter().position(|(id, _)| *id == request_id) { - let (_, mut substream) = state.pending_send_back.remove(pos); - substream.send_message(message); - state.shutdown.push(substream); - } else { - warn!(target: "sub-libp2p", "Libp2p layer received response to a \ - non-existing request ID {:?} with {:?}", request_id, self.remote_peer_id); - } - } else if let Some(mut outgoing_substream) = state.outgoing_substream.take() { - outgoing_substream.send_message(message); - state.shutdown.push(outgoing_substream); - } else { - if state.pending_messages.len() >= 2048 { - let event = CustomProtoHandlerOut::Clogged { - messages: Vec::new(), - }; - self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); - } - state.pending_messages.push(message); - self.events_queue.push(ProtocolsHandlerEvent::OutboundSubstreamRequest { - protocol: SubstreamProtocol::new(self.protocol.clone()), - info: () - }); - } - } - _ => debug!(target: "sub-libp2p", "Tried to send message over closed protocol \ with {:?}", self.remote_peer_id) } @@ -844,8 +574,7 @@ where TSubstream: AsyncRead + AsyncWrite, TMessage: CustomMessage { match self.state { ProtocolState::Init { .. } | ProtocolState::Opening { .. } => {} - ProtocolState::BackCompat { .. } | ProtocolState::Normal { .. } => - keep_forever = true, + ProtocolState::Normal { .. } => keep_forever = true, ProtocolState::Disabled { .. } | ProtocolState::Poisoned => return KeepAlive::No, } diff --git a/core/network-libp2p/src/custom_proto/mod.rs b/core/network-libp2p/src/custom_proto/mod.rs index cf2bf57153..261f710d8d 100644 --- a/core/network-libp2p/src/custom_proto/mod.rs +++ b/core/network-libp2p/src/custom_proto/mod.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . pub use self::behaviour::{CustomProto, CustomProtoOut}; -pub use self::upgrade::{CustomMessage, CustomMessageId, RegisteredProtocol}; +pub use self::upgrade::{CustomMessage, RegisteredProtocol}; mod behaviour; mod handler; diff --git a/core/network-libp2p/src/custom_proto/upgrade.rs b/core/network-libp2p/src/custom_proto/upgrade.rs index 00c3fc999d..bc61ff74e8 100644 --- a/core/network-libp2p/src/custom_proto/upgrade.rs +++ b/core/network-libp2p/src/custom_proto/upgrade.rs @@ -19,7 +19,7 @@ use bytes::Bytes; use libp2p::core::{Negotiated, Endpoint, UpgradeInfo, InboundUpgrade, OutboundUpgrade, upgrade::ProtocolName}; use libp2p::tokio_codec::Framed; use log::warn; -use std::{collections::VecDeque, io, iter, marker::PhantomData, vec::IntoIter as VecIntoIter}; +use std::{collections::VecDeque, io, marker::PhantomData, vec::IntoIter as VecIntoIter}; use futures::{prelude::*, future, stream}; use tokio_io::{AsyncRead, AsyncWrite}; use unsigned_varint::codec::UviBytes; @@ -100,9 +100,6 @@ pub struct RegisteredProtocolSubstream { /// If true, we have sent a "remote is clogged" event recently and shouldn't send another one /// unless the buffer empties then fills itself again. clogged_fuse: bool, - /// If true, then this substream uses the "/multi/" version of the protocol. This is a hint - /// that the handler can behave differently. - is_multiplex: bool, /// Marker to pin the generic. marker: PhantomData, } @@ -126,12 +123,6 @@ impl RegisteredProtocolSubstream { self.endpoint } - /// Returns true if we negotiated the "multiplexed" version. This means that the handler can - /// open multiple substreams instead of just one. - pub fn is_multiplex(&self) -> bool { - self.is_multiplex - } - /// Starts a graceful shutdown process on this substream. /// /// Note that "graceful" means that we sent a closing message. We don't wait for any @@ -162,31 +153,9 @@ pub trait CustomMessage { /// Tries to parse `bytes` received from the network into a message. fn from_bytes(bytes: &[u8]) -> Result where Self: Sized; - - /// Returns a unique ID that is used to match request and responses. - /// - /// The networking layer employs multiplexing in order to have multiple parallel data streams. - /// Transmitting messages over the network uses two kinds of substreams: - /// - /// - Undirectional substreams, where we send a single message then close the substream. - /// - Bidirectional substreams, where we send a message then wait for a response. Once the - /// response has arrived, we close the substream. - /// - /// If `request_id()` returns `OneWay`, then this message will be sent or received over a - /// unidirectional substream. If instead it returns `Request` or `Response`, then we use the - /// value to match a request with its response. - fn request_id(&self) -> CustomMessageId; } -/// See the documentation of `CustomMessage::request_id`. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum CustomMessageId { - OneWay, - Request(u64), - Response(u64), -} - -// These trait implementations exist mostly for testing convenience. This should eventually be +// This trait implementation exist mostly for testing convenience. This should eventually be // removed. impl CustomMessage for Vec { @@ -197,45 +166,6 @@ impl CustomMessage for Vec { fn from_bytes(bytes: &[u8]) -> Result { Ok(bytes.to_vec()) } - - fn request_id(&self) -> CustomMessageId { - CustomMessageId::OneWay - } -} - -impl CustomMessage for (Option, Vec) { - fn into_bytes(self) -> Vec { - use byteorder::WriteBytesExt; - use std::io::Write; - let mut out = Vec::new(); - out.write_u64::(self.0.unwrap_or(u64::max_value())) - .expect("Writing to a Vec can never fail"); - out.write_all(&self.1).expect("Writing to a Vec can never fail"); - out - } - - fn from_bytes(bytes: &[u8]) -> Result { - use byteorder::ReadBytesExt; - use std::io::Read; - let mut rdr = std::io::Cursor::new(bytes); - let id = rdr.read_u64::().map_err(|_| ())?; - let mut out = Vec::new(); - rdr.read_to_end(&mut out).map_err(|_| ())?; - let id = if id == u64::max_value() { - None - } else { - Some(id) - }; - Ok((id, out)) - } - - fn request_id(&self) -> CustomMessageId { - if let Some(id) = self.0 { - CustomMessageId::Request(id) - } else { - CustomMessageId::OneWay - } - } } /// Event produced by the `RegisteredProtocolSubstream`. @@ -328,33 +258,15 @@ impl UpgradeInfo for RegisteredProtocol { #[inline] fn protocol_info(&self) -> Self::InfoIter { // Report each version as an individual protocol. - self.supported_versions.iter().flat_map(|&version| { + self.supported_versions.iter().map(|&version| { let num = version.to_string(); - // Note that `name1` is the multiplex version, as we priviledge it over the old one. - let mut name1 = self.base_name.clone(); - name1.extend_from_slice(b"multi/"); - name1.extend_from_slice(num.as_bytes()); - let proto1 = RegisteredProtocolName { - name: name1, + let mut name = self.base_name.clone(); + name.extend_from_slice(num.as_bytes()); + RegisteredProtocolName { + name, version, - is_multiplex: true, - }; - - let mut name2 = self.base_name.clone(); - name2.extend_from_slice(num.as_bytes()); - let proto2 = RegisteredProtocolName { - name: name2, - version, - is_multiplex: false, - }; - - // Important note: we prioritize the backwards compatible mode for now. - // After some intensive testing has been done, we should switch to the new mode by - // default. - // Then finally we can remove the old mode after everyone has switched. - // See https://github.com/paritytech/substrate/issues/1692 - iter::once(proto2).chain(iter::once(proto1)) + } }).collect::>().into_iter() } } @@ -366,8 +278,6 @@ pub struct RegisteredProtocolName { name: Bytes, /// Version number. Stored in string form in `name`, but duplicated here for easier retrieval. version: u8, - /// If true, then this version is the one with the multiplexing. - is_multiplex: bool, } impl ProtocolName for RegisteredProtocolName { @@ -403,7 +313,6 @@ where TSubstream: AsyncRead + AsyncWrite, protocol_id: self.id, protocol_version: info.version, clogged_fuse: false, - is_multiplex: info.is_multiplex, marker: PhantomData, }) } @@ -432,7 +341,6 @@ where TSubstream: AsyncRead + AsyncWrite, protocol_id: self.id, protocol_version: info.version, clogged_fuse: false, - is_multiplex: info.is_multiplex, marker: PhantomData, }) } diff --git a/core/network-libp2p/src/lib.rs b/core/network-libp2p/src/lib.rs index 8c8b471931..639a74933d 100644 --- a/core/network-libp2p/src/lib.rs +++ b/core/network-libp2p/src/lib.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . //! Networking layer of Substrate. -//! +//! //! **Important**: This crate is unstable and the API and usage may change. //! @@ -27,7 +27,7 @@ mod transport; pub use crate::behaviour::Severity; pub use crate::config::*; -pub use crate::custom_proto::{CustomMessage, CustomMessageId, RegisteredProtocol}; +pub use crate::custom_proto::{CustomMessage, RegisteredProtocol}; pub use crate::config::{NetworkConfiguration, NodeKeyConfig, Secret, NonReservedPeerMode}; pub use crate::service_task::{start_service, Service, ServiceEvent}; pub use libp2p::{Multiaddr, multiaddr, build_multiaddr}; diff --git a/core/network-libp2p/tests/test.rs b/core/network-libp2p/tests/test.rs index b335b7c46b..ff4d5824e0 100644 --- a/core/network-libp2p/tests/test.rs +++ b/core/network-libp2p/tests/test.rs @@ -200,7 +200,7 @@ fn many_nodes_connectivity() { #[test] fn basic_two_nodes_requests_in_parallel() { let (mut service1, mut service2) = { - let mut l = build_nodes::<(Option, Vec)>(2, 50550).into_iter(); + let mut l = build_nodes::>(2, 50550).into_iter(); let a = l.next().unwrap(); let b = l.next().unwrap(); (a, b) @@ -209,17 +209,8 @@ fn basic_two_nodes_requests_in_parallel() { // Generate random messages with or without a request id. let mut to_send = { let mut to_send = Vec::new(); - let mut next_id = 0; for _ in 0..200 { // Note: don't make that number too high or the CPU usage will explode. - let id = if rand::random::() % 4 != 0 { - let i = next_id; - next_id += 1; - Some(i) - } else { - None - }; - - let msg = (id, (0..10).map(|_| rand::random::()).collect::>()); + let msg = (0..10).map(|_| rand::random::()).collect::>(); to_send.push(msg); } to_send diff --git a/core/network/src/message.rs b/core/network/src/message.rs index 6053d12f51..b2cc5a888a 100644 --- a/core/network/src/message.rs +++ b/core/network/src/message.rs @@ -125,7 +125,7 @@ pub struct RemoteReadResponse { /// Generic types. pub mod generic { use parity_codec::{Encode, Decode}; - use network_libp2p::{CustomMessage, CustomMessageId}; + use network_libp2p::CustomMessage; use runtime_primitives::Justification; use crate::config::Roles; use super::{ @@ -213,26 +213,6 @@ pub mod generic { fn from_bytes(bytes: &[u8]) -> Result { Decode::decode(&mut &bytes[..]).ok_or(()) } - - fn request_id(&self) -> CustomMessageId { - match *self { - Message::Status(_) => CustomMessageId::OneWay, - Message::BlockRequest(ref req) => CustomMessageId::Request(req.id), - Message::BlockResponse(ref resp) => CustomMessageId::Response(resp.id), - Message::BlockAnnounce(_) => CustomMessageId::OneWay, - Message::Transactions(_) => CustomMessageId::OneWay, - Message::Consensus(_) => CustomMessageId::OneWay, - Message::RemoteCallRequest(ref req) => CustomMessageId::Request(req.id), - Message::RemoteCallResponse(ref resp) => CustomMessageId::Response(resp.id), - Message::RemoteReadRequest(ref req) => CustomMessageId::Request(req.id), - Message::RemoteReadResponse(ref resp) => CustomMessageId::Response(resp.id), - Message::RemoteHeaderRequest(ref req) => CustomMessageId::Request(req.id), - Message::RemoteHeaderResponse(ref resp) => CustomMessageId::Response(resp.id), - Message::RemoteChangesRequest(ref req) => CustomMessageId::Request(req.id), - Message::RemoteChangesResponse(ref resp) => CustomMessageId::Response(resp.id), - Message::ChainSpecific(_) => CustomMessageId::OneWay, - } - } } /// Status sent on connection. -- GitLab From f8f9ef07f21115e270494efbce568c494b39d268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 25 Apr 2019 13:03:30 +0200 Subject: [PATCH 010/229] Fixes node-template-release (#2375) --- node-template/scripts/build.sh | 2 +- scripts/node-template-release/src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node-template/scripts/build.sh b/node-template/scripts/build.sh index edbcba835c..01d0fee354 100755 --- a/node-template/scripts/build.sh +++ b/node-template/scripts/build.sh @@ -2,7 +2,7 @@ set -e -PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null && pwd )" export CARGO_INCREMENTAL=0 diff --git a/scripts/node-template-release/src/main.rs b/scripts/node-template-release/src/main.rs index 871cc078ed..470d34ef0d 100644 --- a/scripts/node-template-release/src/main.rs +++ b/scripts/node-template-release/src/main.rs @@ -137,7 +137,7 @@ fn write_cargo_toml(path: &Path, cargo_toml: CargoToml) { /// Build and test the generated node-template fn build_and_test(path: &Path, cargo_tomls: &[PathBuf]) { // Build wasm - assert!(Command::new(path.join("build.sh")).current_dir(path).status().expect("Compiles wasm").success()); + assert!(Command::new(path.join("./scripts/build.sh")).current_dir(path).status().expect("Compiles wasm").success()); // Build node assert!(Command::new("cargo").args(&["build", "--all"]).current_dir(path).status().expect("Compiles node").success()); -- GitLab From e802919de80237f529e5bd91080a31748e1c3284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 25 Apr 2019 13:31:50 +0200 Subject: [PATCH 011/229] Allow localhost IP by default. (#2380) --- core/cli/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/cli/src/lib.rs b/core/cli/src/lib.rs index 296e8e3c3f..275399bdf3 100644 --- a/core/cli/src/lib.rs +++ b/core/cli/src/lib.rs @@ -483,7 +483,9 @@ where } else { Some(vec![ "http://localhost:*".into(), + "http://127.0.0.1:*".into(), "https://localhost:*".into(), + "https://127.0.0.1:*".into(), "https://polkadot.js.org".into(), "https://substrate-ui.parity.io".into(), ]) -- GitLab From a89639161ab558d6e3c44f9b5717b37a9c10425c Mon Sep 17 00:00:00 2001 From: thiolliere Date: Thu, 25 Apr 2019 15:48:19 +0200 Subject: [PATCH 012/229] remove use of hidden api in support procedural (#2383) --- Cargo.lock | 50 +++++----- srml/support/procedural/Cargo.toml | 4 +- srml/support/procedural/src/storage/mod.rs | 91 +++++++++---------- .../procedural/src/storage/transformation.rs | 22 ++--- srml/support/procedural/tools/src/lib.rs | 24 ----- srml/support/procedural/tools/src/syn_ext.rs | 27 ------ 6 files changed, 81 insertions(+), 137 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dd2198b81..0e83b961ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,7 +106,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -625,7 +625,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -680,7 +680,7 @@ dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -801,7 +801,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1260,7 +1260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1480,7 +1480,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2288,7 +2288,7 @@ dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2434,7 +2434,7 @@ dependencies = [ "proc-macro-hack 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2516,7 +2516,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2994,7 +2994,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3119,7 +3119,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3169,7 +3169,7 @@ dependencies = [ "substrate-primitives 1.0.0", "substrate-state-machine 1.0.0", "substrate-test-client 1.0.0", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3531,7 +3531,7 @@ dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 1.0.0", "srml-support-procedural-tools 1.0.0", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3542,7 +3542,7 @@ dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "srml-support-procedural-tools-derive 1.0.0", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3551,7 +3551,7 @@ version = "1.0.0" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3648,7 +3648,7 @@ dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3663,7 +3663,7 @@ dependencies = [ "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3706,7 +3706,7 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3722,7 +3722,7 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4522,7 +4522,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.31" +version = "0.15.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4537,7 +4537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5142,7 +5142,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5172,7 +5172,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5192,7 +5192,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5714,7 +5714,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" -"checksum syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)" = "d2b4cfac95805274c6afdb12d8f770fa2d27c045953e7b630a81801953699a9a" +"checksum syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)" = "846620ec526c1599c070eff393bfeeeb88a93afa2513fc3b49f1fea84cf7b0ed" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum sysinfo 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a0cb7899e248ed0baa6ef6f8406352523c2f99bc7c4b1800f4cd6d5dde99eb" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" diff --git a/srml/support/procedural/Cargo.toml b/srml/support/procedural/Cargo.toml index 26b648da0c..0f7586a795 100644 --- a/srml/support/procedural/Cargo.toml +++ b/srml/support/procedural/Cargo.toml @@ -13,6 +13,4 @@ sr-api-macros = { path = "../../../core/sr-api-macros" } proc-macro2 = "0.4.27" quote = { version = "0.6.12" } -# FIXME: https://github.com/paritytech/substrate/issues/2326 -# Remove this restriction once the dependency on erstwhile CustomKeyword trait is removed -syn = { version = ">= 0.15.30, < 0.15.32", features = ["full"] } +syn = { version = "0.15.32", features = ["full"] } diff --git a/srml/support/procedural/src/storage/mod.rs b/srml/support/procedural/src/storage/mod.rs index 649a48a181..1d9e62bdd7 100644 --- a/srml/support/procedural/src/storage/mod.rs +++ b/srml/support/procedural/src/storage/mod.rs @@ -18,11 +18,8 @@ //! `decl_storage` macro // end::description[] -use srml_support_procedural_tools::syn_ext as ext; -use srml_support_procedural_tools::{ToTokens, Parse, custom_keyword, custom_keyword_impl}; - +use srml_support_procedural_tools::{ToTokens, Parse, syn_ext as ext}; use syn::{Ident, Token}; -use syn::token::CustomKeyword; use proc_macro2::TokenStream as TokenStream2; use quote::quote; @@ -30,10 +27,28 @@ mod impls; pub mod transformation; +mod keyword { + syn::custom_keyword!(hiddencrate); + syn::custom_keyword!(add_extra_genesis); + syn::custom_keyword!(extra_genesis_skip_phantom_data_field); + syn::custom_keyword!(config); + syn::custom_keyword!(build); + syn::custom_keyword!(get); + syn::custom_keyword!(map); + syn::custom_keyword!(linked_map); + syn::custom_keyword!(double_map); + syn::custom_keyword!(blake2_256); + syn::custom_keyword!(blake2_128); + syn::custom_keyword!(twox_256); + syn::custom_keyword!(twox_128); + syn::custom_keyword!(twox_64_concat); + syn::custom_keyword!(hasher); +} + /// Parsing usage only #[derive(Parse, ToTokens, Debug)] struct StorageDefinition { - pub hidden_crate: Option, + pub hidden_crate: ext::Opt, pub visibility: syn::Visibility, pub trait_token: Token![trait], pub ident: Ident, @@ -51,25 +66,25 @@ struct StorageDefinition { pub as_token: Token![as], pub crate_ident: Ident, pub content: ext::Braces>, - pub extra_genesis: Option, - pub extra_genesis_skip_phantom_data_field: Option, + pub extra_genesis: ext::Opt, + pub extra_genesis_skip_phantom_data_field: ext::Opt, } #[derive(Parse, ToTokens, Debug)] struct SpecificHiddenCrate { - pub keyword: ext::CustomToken, + pub keyword: keyword::hiddencrate, pub ident: ext::Parens, } #[derive(Parse, ToTokens, Debug)] struct AddExtraGenesis { - pub extragenesis_keyword: ext::CustomToken, + pub extragenesis_keyword: keyword::add_extra_genesis, pub content: ext::Braces, } #[derive(Parse, ToTokens, Debug)] struct ExtraGenesisSkipPhantomDataField { - pub genesis_phantom_keyword: ext::CustomToken, + pub genesis_phantom_keyword: keyword::extra_genesis_skip_phantom_data_field, pub token: Token![;], } @@ -87,7 +102,7 @@ enum AddExtraGenesisLineEnum { #[derive(Parse, ToTokens, Debug)] struct AddExtraGenesisLine { pub attrs: ext::OuterAttributes, - pub config_keyword: ext::CustomToken, + pub config_keyword: keyword::config, pub extra_field: ext::Parens, pub coldot_token: Token![:], pub extra_type: syn::Type, @@ -102,9 +117,9 @@ struct DeclStorageLine { pub visibility: syn::Visibility, // name pub name: Ident, - pub getter: Option, - pub config: Option, - pub build: Option, + pub getter: ext::Opt, + pub config: ext::Opt, + pub build: ext::Opt, pub coldot_token: Token![:], pub storage_type: DeclStorageType, pub default_value: ext::Opt, @@ -113,19 +128,19 @@ struct DeclStorageLine { #[derive(Parse, ToTokens, Debug)] struct DeclStorageGetter { - pub getter_keyword: ext::CustomToken, + pub getter_keyword: keyword::get, pub getfn: ext::Parens, } #[derive(Parse, ToTokens, Debug)] struct DeclStorageConfig { - pub config_keyword: ext::CustomToken, + pub config_keyword: keyword::config, pub expr: ext::Parens>, } #[derive(Parse, ToTokens, Debug)] struct DeclStorageBuild { - pub build_keyword: ext::CustomToken, + pub build_keyword: keyword::build, pub expr: ext::Parens, } @@ -139,8 +154,8 @@ enum DeclStorageType { #[derive(Parse, ToTokens, Debug)] struct DeclStorageMap { - pub map_keyword: ext::CustomToken, - pub hasher: Option, + pub map_keyword: keyword::map, + pub hasher: ext::Opt, pub key: syn::Type, pub ass_keyword: Token![=>], pub value: syn::Type, @@ -148,8 +163,8 @@ struct DeclStorageMap { #[derive(Parse, ToTokens, Debug)] struct DeclStorageLinkedMap { - pub map_keyword: ext::CustomToken, - pub hasher: Option, + pub map_keyword: keyword::linked_map, + pub hasher: ext::Opt, pub key: syn::Type, pub ass_keyword: Token![=>], pub value: syn::Type, @@ -157,8 +172,8 @@ struct DeclStorageLinkedMap { #[derive(Parse, ToTokens, Debug)] struct DeclStorageDoubleMap { - pub map_keyword: ext::CustomToken, - pub hasher: Option, + pub map_keyword: keyword::double_map, + pub hasher: ext::Opt, pub key1: syn::Type, pub comma_keyword: Token![,], pub key2_hasher: Hasher, @@ -169,11 +184,11 @@ struct DeclStorageDoubleMap { #[derive(Parse, ToTokens, Debug)] enum Hasher { - Blake2_256(ext::CustomToken), - Blake2_128(ext::CustomToken), - Twox256(ext::CustomToken), - Twox128(ext::CustomToken), - Twox64Concat(ext::CustomToken), + Blake2_256(keyword::blake2_256), + Blake2_128(keyword::blake2_128), + Twox256(keyword::twox_256), + Twox128(keyword::twox_128), + Twox64Concat(keyword::twox_64_concat), } #[derive(Parse, ToTokens, Debug)] @@ -184,7 +199,7 @@ struct DeclStorageDefault { #[derive(Parse, ToTokens, Debug)] struct SetHasher { - pub hasher_keyword: ext::CustomToken, + pub hasher_keyword: keyword::hasher, pub inner: ext::Parens, } @@ -239,21 +254,3 @@ impl HasherKind { } } } - -custom_keyword_impl!(SpecificHiddenCrate, "hiddencrate", "hiddencrate as keyword"); -custom_keyword_impl!(DeclStorageConfig, "config", "build as keyword"); -custom_keyword!(ConfigKeyword, "config", "config as keyword"); -custom_keyword!(BuildKeyword, "build", "build as keyword"); -custom_keyword_impl!(DeclStorageBuild, "build", "storage build config"); -custom_keyword_impl!(AddExtraGenesis, "add_extra_genesis", "storage extra genesis"); -custom_keyword_impl!(DeclStorageGetter, "get", "storage getter"); -custom_keyword!(MapKeyword, "map", "map as keyword"); -custom_keyword!(LinkedMapKeyword, "linked_map", "linked_map as keyword"); -custom_keyword!(DoubleMapKeyword, "double_map", "double_map as keyword"); -custom_keyword!(Blake2_256Keyword, "blake2_256", "Blake2_256 as keyword"); -custom_keyword!(Blake2_128Keyword, "blake2_128", "Blake2_128 as keyword"); -custom_keyword!(Twox256Keyword, "twox_256", "Twox256 as keyword"); -custom_keyword!(Twox128Keyword, "twox_128", "Twox128 as keyword"); -custom_keyword!(Twox64ConcatKeyword, "twox_64_concat", "Twox64Concat as keyword"); -custom_keyword_impl!(ExtraGenesisSkipPhantomDataField, "extra_genesis_skip_phantom_data_field", "extra_genesis_skip_phantom_data_field as keyword"); -custom_keyword_impl!(SetHasher, "hasher", "storage hasher"); diff --git a/srml/support/procedural/src/storage/transformation.rs b/srml/support/procedural/src/storage/transformation.rs index 205fccdea5..04b2b832b6 100644 --- a/srml/support/procedural/src/storage/transformation.rs +++ b/srml/support/procedural/src/storage/transformation.rs @@ -74,7 +74,7 @@ pub fn decl_storage_impl(input: TokenStream) -> TokenStream { Err(err) => return err.to_compile_error().into(), }; - let hidden_crate_name = hidden_crate.map(|rc| rc.ident.content).map(|i| i.to_string()) + let hidden_crate_name = hidden_crate.inner.map(|rc| rc.ident.content).map(|i| i.to_string()) .unwrap_or_else(|| "decl_storage".to_string()); let scrate = generate_crate_access(&hidden_crate_name, "srml-support"); let scrate_decl = generate_hidden_includes( @@ -103,8 +103,8 @@ pub fn decl_storage_impl(input: TokenStream) -> TokenStream { &traittype, &instance_opts, &storage_lines, - &extra_genesis, - extra_genesis_skip_phantom_data_field.is_some(), + &extra_genesis.inner, + extra_genesis_skip_phantom_data_field.inner.is_some(), )); let decl_storage_items = decl_storage_items( &scrate, @@ -219,10 +219,10 @@ fn decl_store_extra_genesis( let mut opt_build; // need build line - if let Some(ref config) = config { + if let Some(ref config) = config.inner { let ident = if let Some(ident) = config.expr.content.as_ref() { quote!( #ident ) - } else if let Some(ref getter) = getter { + } else if let Some(ref getter) = getter.inner { let ident = &getter.getfn.content; quote!( #ident ) } else { @@ -259,7 +259,7 @@ fn decl_store_extra_genesis( quote!( #( #[ #attrs ] )* pub #ident: Vec<(#key1_type, #key2_type, #storage_type)>, ) }, }); - opt_build = Some(build.as_ref().map(|b| &b.expr.content).map(|b|quote!( #b )) + opt_build = Some(build.inner.as_ref().map(|b| &b.expr.content).map(|b|quote!( #b )) .unwrap_or_else(|| quote!( (|config: &GenesisConfig<#traitinstance, #instance>| config.#ident.clone()) ))); let fielddefault = default_value.inner.as_ref().map(|d| &d.expr).map(|d| @@ -271,7 +271,7 @@ fn decl_store_extra_genesis( config_field_default.extend(quote!( #ident: #fielddefault, )); } else { - opt_build = build.as_ref().map(|b| &b.expr.content).map(|b| quote!( #b )); + opt_build = build.inner.as_ref().map(|b| &b.expr.content).map(|b| quote!( #b )); } let typ = type_infos.typ; @@ -647,7 +647,7 @@ fn impl_store_fns( .. } = sline; - if let Some(getter) = getter { + if let Some(getter) = getter.inner.as_ref() { let get_fn = &getter.getfn.content; let type_infos = get_type_infos(storage_type); @@ -877,17 +877,17 @@ fn get_type_infos(storage_type: &DeclStorageType) -> DeclStorageTypeInfos { let (value_type, kind) = match storage_type { DeclStorageType::Simple(ref st) => (st, DeclStorageTypeInfosKind::Simple), DeclStorageType::Map(ref map) => (&map.value, DeclStorageTypeInfosKind::Map { - hasher: map.hasher.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), + hasher: map.hasher.inner.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), key_type: &map.key, is_linked: false, }), DeclStorageType::LinkedMap(ref map) => (&map.value, DeclStorageTypeInfosKind::Map { - hasher: map.hasher.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), + hasher: map.hasher.inner.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), key_type: &map.key, is_linked: true, }), DeclStorageType::DoubleMap(ref map) => (&map.value, DeclStorageTypeInfosKind::DoubleMap { - hasher: map.hasher.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), + hasher: map.hasher.inner.as_ref().map(|h| h.into()).unwrap_or(HasherKind::Blake2_256), key1_type: &map.key1, key2_type: &map.key2.content, key2_hasher: { let h = &map.key2_hasher; quote! { #h } }, diff --git a/srml/support/procedural/tools/src/lib.rs b/srml/support/procedural/tools/src/lib.rs index 34b96df810..fd7dd41391 100644 --- a/srml/support/procedural/tools/src/lib.rs +++ b/srml/support/procedural/tools/src/lib.rs @@ -27,30 +27,6 @@ use quote::quote; pub mod syn_ext; -#[macro_export] -macro_rules! custom_keyword_impl { - ($name:ident, $keyident:expr, $keydisp:expr) => { - - impl CustomKeyword for $name { - fn ident() -> &'static str { $keyident } - fn display() -> &'static str { $keydisp } - } - - } -} - -#[macro_export] -macro_rules! custom_keyword { - ($name:ident, $keyident:expr, $keydisp:expr) => { - - #[derive(Debug)] - struct $name; - - custom_keyword_impl!($name, $keyident, $keydisp); - - } -} - // FIXME #1569, remove the following functions, which are copied from sr-api-macros use proc_macro2::{TokenStream, Span}; use syn::Ident; diff --git a/srml/support/procedural/tools/src/syn_ext.rs b/srml/support/procedural/tools/src/syn_ext.rs index c6b0b4aefb..01177b9b3e 100644 --- a/srml/support/procedural/tools/src/syn_ext.rs +++ b/srml/support/procedural/tools/src/syn_ext.rs @@ -23,7 +23,6 @@ use syn::parse::{ ParseStream, Result, }; -use syn::token::CustomKeyword; use proc_macro2::TokenStream as T2; use quote::{ToTokens, quote}; use std::iter::once; @@ -72,32 +71,6 @@ groups_impl!(Braces, Brace, Brace, parse_braces); groups_impl!(Brackets, Bracket, Bracket, parse_brackets); groups_impl!(Parens, Paren, Parenthesis, parse_parens); -#[derive(Debug, Clone)] -pub struct CustomToken(std::marker::PhantomData); - -impl Parse for CustomToken { - fn parse(input: ParseStream) -> Result { - let ident: syn::Ident = input.parse()?; - - if ident.to_string().as_str() != T::ident() { - return Err(syn::parse::Error::new_spanned(ident, "expected another custom token")) - } - Ok(CustomToken(std::marker::PhantomData)) - } -} - -impl ToTokens for CustomToken { - fn to_tokens(&self, tokens: &mut T2) { - use std::str::FromStr; - tokens.extend(T2::from_str(T::ident()).expect("custom keyword should parse to ident")); - } -} - -impl CustomKeyword for CustomToken { - fn ident() -> &'static str { ::ident() } - fn display() -> &'static str { ::display() } -} - #[derive(Debug)] pub struct PunctuatedInner { pub inner: syn::punctuated::Punctuated, -- GitLab From 60e194e4e5c98717b926fcdcdf9ae0a806d95469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 25 Apr 2019 15:49:34 +0200 Subject: [PATCH 013/229] Unify & enforce same interface of sr-io (std & without-std) (#2381) * WiP: HTTP Apis. * Working on the API. * Add docs, clean up the API. * Expose ext_ stuff as well. * Implement HTTP helpers for offchain sr-io. * Remove HTTP stuff. * Remove spurious leading `::` Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * Rename in toml. * Add issue number. * Bump version. --- core/cli/src/lib.rs | 4 +- core/executor/wasm/src/lib.rs | 2 +- core/peerset/src/lib.rs | 1 - core/sr-io/Cargo.toml | 6 +- core/sr-io/src/lib.rs | 225 +++++- core/sr-io/with_std.rs | 387 +++++----- core/sr-io/without_std.rs | 987 +++++++++++++------------- core/test-runtime/wasm/Cargo.lock | 6 - node-template/runtime/wasm/Cargo.lock | 13 - node/runtime/src/lib.rs | 2 +- node/runtime/wasm/Cargo.lock | 17 - 11 files changed, 909 insertions(+), 741 deletions(-) diff --git a/core/cli/src/lib.rs b/core/cli/src/lib.rs index 275399bdf3..d0cef45585 100644 --- a/core/cli/src/lib.rs +++ b/core/cli/src/lib.rs @@ -745,10 +745,10 @@ fn init_logger(pattern: &str) { builder.filter(None, log::LevelFilter::Info); if let Ok(lvl) = std::env::var("RUST_LOG") { - builder.parse(&lvl); + builder.parse_filters(&lvl); } - builder.parse(pattern); + builder.parse_filters(pattern); let isatty = atty::is(atty::Stream::Stderr); let enable_color = isatty; diff --git a/core/executor/wasm/src/lib.rs b/core/executor/wasm/src/lib.rs index 294c21d146..842749dd5b 100644 --- a/core/executor/wasm/src/lib.rs +++ b/core/executor/wasm/src/lib.rs @@ -92,7 +92,7 @@ impl_stubs!( [sr25519_verify(&sig, &msg[..], &pubkey) as u8].to_vec() }, test_enumerated_trie_root => |_| { - enumerated_trie_root::(&[&b"zero"[..], &b"one"[..], &b"two"[..]]).to_vec() + enumerated_trie_root::(&[&b"zero"[..], &b"one"[..], &b"two"[..]]).as_ref().to_vec() }, test_sandbox => |code: &[u8]| { let ok = execute_sandboxed(code, &[]).is_ok(); diff --git a/core/peerset/src/lib.rs b/core/peerset/src/lib.rs index b801f47b58..570dcf5f86 100644 --- a/core/peerset/src/lib.rs +++ b/core/peerset/src/lib.rs @@ -22,7 +22,6 @@ mod slots; use std::collections::VecDeque; use futures::{prelude::*, sync::mpsc, try_ready}; use libp2p::PeerId; -use linked_hash_map::LinkedHashMap; use log::trace; use lru_cache::LruCache; use slots::{SlotType, SlotState, Slots}; diff --git a/core/sr-io/Cargo.toml b/core/sr-io/Cargo.toml index 68da47893f..645caf54b2 100644 --- a/core/sr-io/Cargo.toml +++ b/core/sr-io/Cargo.toml @@ -11,7 +11,7 @@ rustc_version = "0.2" [dependencies] rstd = { package = "sr-std", path = "../sr-std", default-features = false } primitives = { package = "substrate-primitives", path = "../primitives", default-features = false } -parity-codec = { version = "3.3", default-features = false } +codec = { package="parity-codec", version = "3.3", default-features = false } hash-db = { version = "0.12", default-features = false } libsecp256k1 = { version = "0.2.1", optional = true } tiny-keccak = { version = "1.4.2", optional = true } @@ -23,7 +23,7 @@ trie = { package = "substrate-trie", path = "../trie", optional = true } default = ["std"] std = [ "primitives/std", - "parity-codec/std", + "codec/std", "rstd/std", "hash-db/std", "trie", @@ -34,4 +34,4 @@ std = [ ] nightly = [] strict = [] -wasm-nice-panic-message = [] \ No newline at end of file +wasm-nice-panic-message = [] diff --git a/core/sr-io/src/lib.rs b/core/sr-io/src/lib.rs index 6a00e6ca27..5101d3b2c1 100644 --- a/core/sr-io/src/lib.rs +++ b/core/sr-io/src/lib.rs @@ -16,6 +16,8 @@ //! This is part of the Substrate runtime. +#![warn(missing_docs)] + #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), feature(lang_items))] #![cfg_attr(not(feature = "std"), feature(alloc_error_handler))] @@ -25,14 +27,231 @@ #![cfg_attr(feature = "std", doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")] #![cfg_attr(not(feature = "std"), doc = "Substrate's runtime standard library as compiled without Rust's standard library.")] +use hash_db::Hasher; +use rstd::vec::Vec; + +#[doc(hidden)] +pub use codec; + +pub use primitives::Blake2Hasher; + +/// Error verifying ECDSA signature pub enum EcdsaVerifyError { + /// Incorrect value of R or S BadRS, + /// Incorrect value of V BadV, + /// Invalid signature BadSignature, } -#[cfg(feature = "std")] -include!("../with_std.rs"); +/// Trait for things which can be printed. +pub trait Printable { + /// Print the object. + fn print(self); +} + +/// Converts a public trait definition into a private trait and set of public functions +/// that assume the trait is implemented for `()` for ease of calling. +macro_rules! export_api { + ( + $( #[$trait_attr:meta] )* + pub(crate) trait $trait_name:ident { + $( + $( #[$attr:meta] )* + fn $name:ident + $(< $( $g_name:ident $( : $g_ty:path )? ),+ >)? + ( $( $arg:ident : $arg_ty:ty ),* ) + $( -> $ret:ty )? + $( where $( $w_name:path : $w_ty:path ),+ )?; + )* + } + ) => { + $( #[$trait_attr] )* + pub(crate) trait $trait_name { + $( + $( #[$attr] )* + fn $name $(< $( $g_name $( : $g_ty )? ),+ >)? ( $($arg : $arg_ty ),* ) $( -> $ret )? + $( where $( $w_name : $w_ty ),+ )?; + )* + } + + $( + $( #[$attr] )* + pub fn $name $(< $( $g_name $( : $g_ty )? ),+ >)? ( $($arg : $arg_ty ),* ) $( -> $ret )? + $( where $( $w_name : $w_ty ),+ )? + { + #[allow(deprecated)] + <()>:: $name $(::< $( $g_name ),+ > )? ( $( $arg ),* ) + } + )* + } +} + +export_api! { + pub(crate) trait StorageApi { + /// Get `key` from storage and return a `Vec`, empty if there's a problem. + fn storage(key: &[u8]) -> Option>; + + /// Get `key` from child storage and return a `Vec`, empty if there's a problem. + fn child_storage(storage_key: &[u8], key: &[u8]) -> Option>; + + /// Get `key` from storage, placing the value into `value_out` (as much of it as possible) and return + /// the number of bytes that the entry in storage had beyond the offset or None if the storage entry + /// doesn't exist at all. Note that if the buffer is smaller than the storage entry length, the returned + /// number of bytes is not equal to the number of bytes written to the `value_out`. + fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option; + + /// Get `key` from child storage, placing the value into `value_out` (as much of it as possible) and return + /// the number of bytes that the entry in storage had beyond the offset or None if the storage entry + /// doesn't exist at all. Note that if the buffer is smaller than the storage entry length, the returned + /// number of bytes is not equal to the number of bytes written to the `value_out`. + fn read_child_storage(storage_key: &[u8], key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option; + + /// Set the storage of some particular key to Some value. + fn set_storage(key: &[u8], value: &[u8]); + + /// Set the child storage of some particular key to Some value. + fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]); + + /// Clear the storage of a key. + fn clear_storage(key: &[u8]); + + /// Clear the storage of a key. + fn clear_child_storage(storage_key: &[u8], key: &[u8]); + + /// Clear an entire child storage. + fn kill_child_storage(storage_key: &[u8]); + + /// Check whether a given `key` exists in storage. + fn exists_storage(key: &[u8]) -> bool; + + /// Check whether a given `key` exists in storage. + fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool; + + /// Clear the storage entries with a key that starts with the given prefix. + fn clear_prefix(prefix: &[u8]); + + /// "Commit" all existing operations and compute the resultant storage root. + fn storage_root() -> [u8; 32]; + + /// "Commit" all existing operations and compute the resultant child storage root. + fn child_storage_root(storage_key: &[u8]) -> Vec; + + /// "Commit" all existing operations and get the resultant storage change root. + fn storage_changes_root(parent_hash: [u8; 32], parent_num: u64) -> Option<[u8; 32]>; + + /// A trie root formed from the enumerated items. + /// TODO [#2382] remove (just use `ordered_trie_root` (NOTE currently not implemented for without_std)) + fn enumerated_trie_root(input: &[&[u8]]) -> H::Out + where + H: Hasher, + H: self::imp::HasherBounds, + H::Out: Ord + ; + /// A trie root formed from the iterated items. + fn trie_root(input: I) -> H::Out + where + I: IntoIterator, + A: AsRef<[u8]>, + A: Ord, + B: AsRef<[u8]>, + H: Hasher, + H: self::imp::HasherBounds, + H::Out: Ord + ; + + /// A trie root formed from the enumerated items. + fn ordered_trie_root(input: I) -> H::Out + where + I: IntoIterator, + A: AsRef<[u8]>, + H: Hasher, + H: self::imp::HasherBounds, + H::Out: Ord + ; + } +} + +export_api! { + pub(crate) trait OtherApi { + /// The current relay chain identifier. + fn chain_id() -> u64; + + /// Print a printable value. + fn print(value: T) + where + T: Printable, + T: Sized + ; + } +} + +export_api! { + pub(crate) trait CryptoApi { + /// Verify a ed25519 signature. + fn ed25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool; + + /// Verify an sr25519 signature. + fn sr25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool; + + /// Verify and recover a SECP256k1 ECDSA signature. + /// - `sig` is passed in RSV format. V should be either 0/1 or 27/28. + /// - returns `Err` if the signature is bad, otherwise the 64-byte pubkey (doesn't include the 0x04 prefix). + fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError>; + } +} + +export_api! { + pub(crate) trait HashingApi { + /// Conduct a 256-bit Keccak hash. + fn keccak_256(data: &[u8]) -> [u8; 32] ; + + /// Conduct a 128-bit Blake2 hash. + fn blake2_128(data: &[u8]) -> [u8; 16]; + + /// Conduct a 256-bit Blake2 hash. + fn blake2_256(data: &[u8]) -> [u8; 32]; + + /// Conduct four XX hashes to give a 256-bit result. + fn twox_256(data: &[u8]) -> [u8; 32]; + + /// Conduct two XX hashes to give a 128-bit result. + fn twox_128(data: &[u8]) -> [u8; 16]; + + /// Conduct two XX hashes to give a 64-bit result. + fn twox_64(data: &[u8]) -> [u8; 8]; + } +} + +export_api! { + pub(crate) trait OffchainApi { + /// Submit extrinsic from the runtime. + /// + /// Depending on the kind of extrinsic it will either be: + /// 1. scheduled to be included in the next produced block (inherent) + /// 2. added to the pool and propagated (transaction) + fn submit_extrinsic(data: &T); + } +} + +/// API trait that should cover all other APIs. +/// +/// Implement this to make sure you implement all APIs. +trait Api: StorageApi + OtherApi + CryptoApi + HashingApi + OffchainApi {} + +mod imp { + use super::*; + + #[cfg(feature = "std")] + include!("../with_std.rs"); + + #[cfg(not(feature = "std"))] + include!("../without_std.rs"); +} + +#[cfg(feature = "std")] +pub use self::imp::{StorageOverlay, ChildrenStorageOverlay, with_storage, with_externalities, TestExternalities}; #[cfg(not(feature = "std"))] -include!("../without_std.rs"); +pub use self::imp::ext::*; diff --git a/core/sr-io/with_std.rs b/core/sr-io/with_std.rs index 3148cf2842..d73ccf4b66 100644 --- a/core/sr-io/with_std.rs +++ b/core/sr-io/with_std.rs @@ -14,14 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -#[doc(hidden)] -pub use parity_codec as codec; -// re-export hashing functions. -pub use primitives::{ +use primitives::{ blake2_128, blake2_256, twox_128, twox_256, twox_64, ed25519, Blake2Hasher, sr25519, Pair }; -pub use tiny_keccak::keccak256 as keccak_256; // Switch to this after PoC-3 // pub use primitives::BlakeHasher; pub use substrate_state_machine::{ @@ -33,18 +29,15 @@ pub use substrate_state_machine::{ use environmental::environmental; use primitives::{hexdisplay::HexDisplay, H256}; -use hash_db::Hasher; #[cfg(feature = "std")] use std::collections::HashMap; environmental!(ext: trait Externalities); -/// A set of key value pairs for storage. -pub type StorageOverlay = HashMap, Vec>; - -/// A set of key value pairs for children storage; -pub type ChildrenStorageOverlay = HashMap, StorageOverlay>; +/// Additional bounds for `Hasher` trait for with_std. +pub trait HasherBounds {} +impl HasherBounds for T {} /// Returns a `ChildStorageKey` if the given `storage_key` slice is a valid storage /// key or panics otherwise. @@ -58,209 +51,217 @@ fn child_storage_key_or_panic(storage_key: &[u8]) -> ChildStorageKey Option> { - ext::with(|ext| ext.storage(key).map(|s| s.to_vec())) +impl StorageApi for () { + fn storage(key: &[u8]) -> Option> { + ext::with(|ext| ext.storage(key).map(|s| s.to_vec())) + .expect("storage cannot be called outside of an Externalities-provided environment.") + } + + fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option { + ext::with(|ext| ext.storage(key).map(|value| { + let value = &value[value_offset..]; + let written = std::cmp::min(value.len(), value_out.len()); + value_out[..written].copy_from_slice(&value[..written]); + value.len() + })).expect("read_storage cannot be called outside of an Externalities-provided environment.") + } + + fn child_storage(storage_key: &[u8], key: &[u8]) -> Option> { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.child_storage(storage_key, key).map(|s| s.to_vec()) + }) .expect("storage cannot be called outside of an Externalities-provided environment.") -} + } -/// Get `key` from child storage and return a `Vec`, empty if there's a problem. -pub fn child_storage(storage_key: &[u8], key: &[u8]) -> Option> { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.child_storage(storage_key, key).map(|s| s.to_vec()) - }) - .expect("storage cannot be called outside of an Externalities-provided environment.") -} + fn set_storage(key: &[u8], value: &[u8]) { + ext::with(|ext| + ext.set_storage(key.to_vec(), value.to_vec()) + ); + } -/// Get `key` from storage, placing the value into `value_out` (as much of it as possible) and return -/// the number of bytes that the entry in storage had beyond the offset or None if the storage entry -/// doesn't exist at all. Note that if the buffer is smaller than the storage entry length, the returned -/// number of bytes is not equal to the number of bytes written to the `value_out`. -pub fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option { - ext::with(|ext| ext.storage(key).map(|value| { - let value = &value[value_offset..]; - let written = ::std::cmp::min(value.len(), value_out.len()); - value_out[..written].copy_from_slice(&value[..written]); - value.len() - })).expect("read_storage cannot be called outside of an Externalities-provided environment.") -} + fn read_child_storage( + storage_key: &[u8], + key: &[u8], + value_out: &mut [u8], + value_offset: usize, + ) -> Option { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.child_storage(storage_key, key) + .map(|value| { + let value = &value[value_offset..]; + let written = std::cmp::min(value.len(), value_out.len()); + value_out[..written].copy_from_slice(&value[..written]); + value.len() + }) + }) + .expect("read_child_storage cannot be called outside of an Externalities-provided environment.") + } -/// Get `key` from child storage, placing the value into `value_out` (as much of it as possible) and return -/// the number of bytes that the entry in storage had beyond the offset or None if the storage entry -/// doesn't exist at all. Note that if the buffer is smaller than the storage entry length, the returned -/// number of bytes is not equal to the number of bytes written to the `value_out`. -pub fn read_child_storage( - storage_key: &[u8], - key: &[u8], - value_out: &mut [u8], - value_offset: usize, -) -> Option { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.child_storage(storage_key, key) - .map(|value| { - let value = &value[value_offset..]; - let written = ::std::cmp::min(value.len(), value_out.len()); - value_out[..written].copy_from_slice(&value[..written]); - value.len() - }) - }) - .expect("read_child_storage cannot be called outside of an Externalities-provided environment.") -} + fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]) { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.set_child_storage(storage_key, key.to_vec(), value.to_vec()) + }); + } -/// Set the storage of a key to some value. -pub fn set_storage(key: &[u8], value: &[u8]) { - ext::with(|ext| - ext.set_storage(key.to_vec(), value.to_vec()) - ); -} + fn clear_storage(key: &[u8]) { + ext::with(|ext| + ext.clear_storage(key) + ); + } -/// Set the child storage of a key to some value. -pub fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]) { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.set_child_storage(storage_key, key.to_vec(), value.to_vec()) - }); -} + fn clear_child_storage(storage_key: &[u8], key: &[u8]) { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.clear_child_storage(storage_key, key) + }); + } -/// Clear the storage of a key. -pub fn clear_storage(key: &[u8]) { - ext::with(|ext| - ext.clear_storage(key) - ); -} + fn kill_child_storage(storage_key: &[u8]) { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.kill_child_storage(storage_key) + }); + } -/// Clear the storage of a key. -pub fn clear_child_storage(storage_key: &[u8], key: &[u8]) { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.clear_child_storage(storage_key, key) - }); -} + fn exists_storage(key: &[u8]) -> bool { + ext::with(|ext| + ext.exists_storage(key) + ).unwrap_or(false) + } -/// Check whether a given `key` exists in storage. -pub fn exists_storage(key: &[u8]) -> bool { - ext::with(|ext| - ext.exists_storage(key) - ).unwrap_or(false) -} + fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.exists_child_storage(storage_key, key) + }).unwrap_or(false) + } -/// Check whether a given `key` exists in storage. -pub fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.exists_child_storage(storage_key, key) - }).unwrap_or(false) -} + fn clear_prefix(prefix: &[u8]) { + ext::with(|ext| + ext.clear_prefix(prefix) + ); + } -/// Clear the storage entries with a key that starts with the given prefix. -pub fn clear_prefix(prefix: &[u8]) { - ext::with(|ext| - ext.clear_prefix(prefix) - ); -} + fn storage_root() -> [u8; 32] { + ext::with(|ext| + ext.storage_root() + ).unwrap_or(H256::zero()).into() + } -/// Clear an entire child storage. -pub fn kill_child_storage(storage_key: &[u8]) { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.kill_child_storage(storage_key) - }); -} + fn child_storage_root(storage_key: &[u8]) -> Vec { + ext::with(|ext| { + let storage_key = child_storage_key_or_panic(storage_key); + ext.child_storage_root(storage_key) + }).expect("child_storage_root cannot be called outside of an Externalities-provided environment.") + } -/// The current relay chain identifier. -pub fn chain_id() -> u64 { - ext::with(|ext| - ext.chain_id() - ).unwrap_or(0) -} + fn storage_changes_root(parent_hash: [u8; 32], parent_num: u64) -> Option<[u8; 32]> { + ext::with(|ext| + ext.storage_changes_root(parent_hash.into(), parent_num).map(Into::into) + ).unwrap_or(None) + } -/// "Commit" all existing operations and compute the resultant storage root. -pub fn storage_root() -> H256 { - ext::with(|ext| - ext.storage_root() - ).unwrap_or(H256::zero()) -} + fn enumerated_trie_root(input: &[&[u8]]) -> H::Out + where + H: Hasher, + H::Out: Ord, + { + trie::ordered_trie_root::(input.iter()) + } -/// "Commit" all existing operations and compute the resultant child storage root. -pub fn child_storage_root(storage_key: &[u8]) -> Vec { - ext::with(|ext| { - let storage_key = child_storage_key_or_panic(storage_key); - ext.child_storage_root(storage_key) - }).expect("child_storage_root cannot be called outside of an Externalities-provided environment.") -} + fn trie_root(input: I) -> H::Out + where + I: IntoIterator, + A: AsRef<[u8]> + Ord, + B: AsRef<[u8]>, + H: Hasher, + H::Out: Ord, + { + trie::trie_root::(input) + } -/// "Commit" all existing operations and get the resultant storage change root. -pub fn storage_changes_root(parent_hash: [u8; 32], parent_num: u64) -> Option { - ext::with(|ext| - ext.storage_changes_root(parent_hash.into(), parent_num) - ).unwrap_or(None) + fn ordered_trie_root(input: I) -> H::Out + where + I: IntoIterator, + A: AsRef<[u8]>, + H: Hasher, + H::Out: Ord, + { + trie::ordered_trie_root::(input) + } } -/// A trie root formed from the enumerated items. -// TODO: remove (just use `ordered_trie_root`) -pub fn enumerated_trie_root(input: &[&[u8]]) -> H::Out -where - H: Hasher, - H::Out: Ord, -{ - trie::ordered_trie_root::(input.iter()) -} +impl OtherApi for () { + fn chain_id() -> u64 { + ext::with(|ext| + ext.chain_id() + ).unwrap_or(0) + } -/// A trie root formed from the iterated items. -pub fn trie_root(input: I) -> H::Out -where - I: IntoIterator, - A: AsRef<[u8]> + Ord, - B: AsRef<[u8]>, - H: Hasher, - ::Out: Ord, -{ - trie::trie_root::(input) + fn print(value: T) { + value.print() + } } -/// A trie root formed from the enumerated items. -pub fn ordered_trie_root(input: I) -> H::Out -where - I: IntoIterator + Iterator, - A: AsRef<[u8]>, - H: Hasher, - ::Out: Ord, -{ - trie::ordered_trie_root::(input) -} +impl CryptoApi for () { + fn ed25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { + ed25519::Pair::verify_weak(sig, msg, pubkey) + } -/// Verify a ed25519 signature. -pub fn ed25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { - ed25519::Pair::verify_weak(sig, msg, pubkey) -} + fn sr25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { + sr25519::Pair::verify_weak(sig, msg, pubkey) + } -/// Verify an sr25519 signature. -pub fn sr25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { - sr25519::Pair::verify_weak(sig, msg, pubkey) + fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> { + let rs = secp256k1::Signature::parse_slice(&sig[0..64]).map_err(|_| EcdsaVerifyError::BadRS)?; + let v = secp256k1::RecoveryId::parse(if sig[64] > 26 { sig[64] - 27 } else { sig[64] } as u8).map_err(|_| EcdsaVerifyError::BadV)?; + let pubkey = secp256k1::recover(&secp256k1::Message::parse(msg), &rs, &v).map_err(|_| EcdsaVerifyError::BadSignature)?; + let mut res = [0u8; 64]; + res.copy_from_slice(&pubkey.serialize()[1..65]); + Ok(res) + } } -/// Verify and recover a SECP256k1 ECDSA signature. -/// - `sig` is passed in RSV format. V should be either 0/1 or 27/28. -/// - returns `Err` if the signature is bad, otherwise the 64-byte pubkey (doesn't include the 0x04 prefix). -pub fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> { - let rs = secp256k1::Signature::parse_slice(&sig[0..64]).map_err(|_| EcdsaVerifyError::BadRS)?; - let v = secp256k1::RecoveryId::parse(if sig[64] > 26 { sig[64] - 27 } else { sig[64] } as u8).map_err(|_| EcdsaVerifyError::BadV)?; - let pubkey = secp256k1::recover(&secp256k1::Message::parse(msg), &rs, &v).map_err(|_| EcdsaVerifyError::BadSignature)?; - let mut res = [0u8; 64]; - res.copy_from_slice(&pubkey.serialize()[1..65]); - Ok(res) +impl HashingApi for () { + fn keccak_256(data: &[u8]) -> [u8; 32] { + tiny_keccak::keccak256(data) + } + + fn blake2_128(data: &[u8]) -> [u8; 16] { + blake2_128(data) + } + + fn blake2_256(data: &[u8]) -> [u8; 32] { + blake2_256(data) + } + + fn twox_256(data: &[u8]) -> [u8; 32] { + twox_256(data) + } + + fn twox_128(data: &[u8]) -> [u8; 16] { + twox_128(data) + } + + fn twox_64(data: &[u8]) -> [u8; 8] { + twox_64(data) + } } -/// Submit extrinsic. -pub fn submit_extrinsic(data: &T) { - ext::with(|ext| ext - .submit_extrinsic(codec::Encode::encode(data)) - .expect("submit_extrinsic can be called only in offchain worker context") - ).expect("submit_extrinsic cannot be called outside of an Externalities-provided environment.") +impl OffchainApi for () { + fn submit_extrinsic(data: &T) { + ext::with(|ext| ext + .submit_extrinsic(codec::Encode::encode(data)) + .expect("submit_extrinsic can be called only in offchain worker context") + ).expect("submit_extrinsic cannot be called outside of an Externalities-provided environment.") + } } +impl Api for () {} + /// Execute the given closure with global function available whose functionality routes into the /// externalities `ext`. Forwards the value that the closure returns. // NOTE: need a concrete hasher here due to limitations of the `environmental!` macro, otherwise a type param would have been fine I think. @@ -268,6 +269,12 @@ pub fn with_externalities R>(ext: &mut Externalities, Vec>; + +/// A set of key value pairs for children storage; +pub type ChildrenStorageOverlay = HashMap, StorageOverlay>; + /// Execute the given closure with global functions available whose functionality routes into /// externalities that draw from and populate `storage`. Forwards the value that the closure returns. pub fn with_storage R>(storage: &mut StorageOverlay, f: F) -> R { @@ -279,11 +286,6 @@ pub fn with_storage R>(storage: &mut StorageOverlay, f: F) -> r } -/// Trait for things which can be printed. -pub trait Printable { - fn print(self); -} - impl<'a> Printable for &'a [u8] { fn print(self) { println!("Runtime: {}", HexDisplay::from(&self)); @@ -302,11 +304,6 @@ impl Printable for u64 { } } -/// Print a printable value. -pub fn print(value: T) { - value.print(); -} - #[cfg(test)] mod std_tests { use super::*; diff --git a/core/sr-io/without_std.rs b/core/sr-io/without_std.rs index 66ad5541df..b60a3ded1f 100644 --- a/core/sr-io/without_std.rs +++ b/core/sr-io/without_std.rs @@ -14,15 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -#[doc(hidden)] -pub use parity_codec as codec; #[doc(hidden)] pub use rstd; pub use rstd::{mem, slice}; use core::{intrinsics, panic::PanicInfo}; use rstd::{vec::Vec, cell::Cell}; -use hash_db::Hasher; use primitives::Blake2Hasher; #[panic_handler] @@ -56,587 +53,584 @@ pub extern fn oom(_: ::core::alloc::Layout) -> ! { } } -/// The state of an exchangeable function. -#[derive(Clone, Copy)] -enum ExchangeableFunctionState { - Original, - Replaced, -} - -/// A function which implementation can be exchanged. -/// -/// Internally this works by swapping function pointers. -pub struct ExchangeableFunction(Cell<(T, ExchangeableFunctionState)>); +/// External (Host) APIs +pub mod ext { + use super::*; -impl ExchangeableFunction { - /// Create a new instance of `ExchangeableFunction`. - pub const fn new(impl_: T) -> Self { - Self(Cell::new((impl_, ExchangeableFunctionState::Original))) + /// The state of an exchangeable function. + #[derive(Clone, Copy)] + enum ExchangeableFunctionState { + /// Original function is present + Original, + /// The function has been replaced. + Replaced, } -} -impl ExchangeableFunction { - /// Replace the implementation with `new_impl`. - /// - /// # Panics - /// - /// Panics when trying to replace an already replaced implementation. - /// - /// # Returns + /// A function which implementation can be exchanged. /// - /// Returns the original implementation wrapped in [`RestoreImplementation`]. - pub fn replace_implementation(&'static self, new_impl: T) -> RestoreImplementation { - if let ExchangeableFunctionState::Replaced = self.0.get().1 { - panic!("Trying to replace an already replaced implementation!") + /// Internally this works by swapping function pointers. + pub struct ExchangeableFunction(Cell<(T, ExchangeableFunctionState)>); + + impl ExchangeableFunction { + /// Create a new instance of `ExchangeableFunction`. + pub const fn new(impl_: T) -> Self { + Self(Cell::new((impl_, ExchangeableFunctionState::Original))) } + } - let old = self.0.replace((new_impl, ExchangeableFunctionState::Replaced)); + impl ExchangeableFunction { + /// Replace the implementation with `new_impl`. + /// + /// # Panics + /// + /// Panics when trying to replace an already replaced implementation. + /// + /// # Returns + /// + /// Returns the original implementation wrapped in [`RestoreImplementation`]. + pub fn replace_implementation(&'static self, new_impl: T) -> RestoreImplementation { + if let ExchangeableFunctionState::Replaced = self.0.get().1 { + panic!("Trying to replace an already replaced implementation!") + } - RestoreImplementation(self, Some(old.0)) - } + let old = self.0.replace((new_impl, ExchangeableFunctionState::Replaced)); - /// Restore the original implementation. - fn restore_orig_implementation(&self, orig: T) { - self.0.set((orig, ExchangeableFunctionState::Original)); - } + RestoreImplementation(self, Some(old.0)) + } - /// Returns the internal function pointer. - pub fn get(&self) -> T { - self.0.get().0 + /// Restore the original implementation. + fn restore_orig_implementation(&self, orig: T) { + self.0.set((orig, ExchangeableFunctionState::Original)); + } + + /// Returns the internal function pointer. + pub fn get(&self) -> T { + self.0.get().0 + } } -} -// WASM does not support threads, so this is safe; qed. -unsafe impl Sync for ExchangeableFunction {} + // WASM does not support threads, so this is safe; qed. + unsafe impl Sync for ExchangeableFunction {} -/// Restores a function implementation on drop. -/// -/// Stores a static reference to the function object and the original implementation. -pub struct RestoreImplementation(&'static ExchangeableFunction, Option); + /// Restores a function implementation on drop. + /// + /// Stores a static reference to the function object and the original implementation. + pub struct RestoreImplementation(&'static ExchangeableFunction, Option); -impl Drop for RestoreImplementation { - fn drop(&mut self) { - self.0.restore_orig_implementation(self.1.take().expect("Value is only taken on drop; qed")); + impl Drop for RestoreImplementation { + fn drop(&mut self) { + self.0.restore_orig_implementation(self.1.take().expect("Value is only taken on drop; qed")); + } } -} -/// Declare extern functions -macro_rules! extern_functions { - ( - $( - $( #[$attr:meta] )* - fn $name:ident ( $( $arg:ident : $arg_ty:ty ),* ) $( -> $ret:ty )?; - )* - ) => { - $( - $( #[$attr] )* - #[allow(non_upper_case_globals)] - pub static $name: ExchangeableFunction $ret )?> = - ExchangeableFunction::new(extern_functions_host_impl::$name); - )* - - /// The exchangeable extern functions host implementations. - mod extern_functions_host_impl { + /// Ensures we use the right crypto when calling into native + pub trait ExternTrieCrypto: Hasher { + /// Calculate enumerated trie root. + fn enumerated_trie_root(values: &[&[u8]]) -> Self::Out; + } + + /// Additional bounds for Hasher trait for without_std. + pub trait HasherBounds: ExternTrieCrypto {} + impl HasherBounds for T {} + + // Ensures we use a Blake2_256-flavored Hasher when calling into native + impl ExternTrieCrypto for Blake2Hasher { + fn enumerated_trie_root(values: &[&[u8]]) -> Self::Out { + let lengths = values.iter().map(|v| (v.len() as u32).to_le()).collect::>(); + let values = values.iter().fold(Vec::new(), |mut acc, sl| { acc.extend_from_slice(sl); acc }); + let mut result: [u8; 32] = Default::default(); + unsafe { + ext_blake2_256_enumerated_trie_root.get()( + values.as_ptr(), + lengths.as_ptr(), + lengths.len() as u32, + result.as_mut_ptr() + ); + } + result.into() + } + } + + /// Declare extern functions + macro_rules! extern_functions { + ( $( - pub unsafe fn $name ( $( $arg : $arg_ty ),* ) $( -> $ret )? { - implementation::$name ( $( $arg ),* ) - } + $( #[$attr:meta] )* + fn $name:ident ( $( $arg:ident : $arg_ty:ty ),* ) $( -> $ret:ty )?; + )* + ) => { + $( + $( #[$attr] )* + #[allow(non_upper_case_globals)] + pub static $name: ExchangeableFunction $ret )?> = + ExchangeableFunction::new(extern_functions_host_impl::$name); )* - mod implementation { - extern "C" { - $( - pub fn $name ( $( $arg : $arg_ty ),* ) $( -> $ret )?; - )* + /// The exchangeable extern functions host implementations. + pub(crate) mod extern_functions_host_impl { + $( + pub unsafe fn $name ( $( $arg : $arg_ty ),* ) $( -> $ret )? { + implementation::$name ( $( $arg ),* ) + } + )* + + mod implementation { + extern "C" { + $( + pub fn $name ( $( $arg : $arg_ty ),* ) $( -> $ret )?; + )* + } } } + }; + } + + /// Host functions, provided by the executor. + /// A WebAssembly runtime module would "import" these to access the execution environment + /// (most importantly, storage) or perform heavy hash calculations. + /// See also "ext_" functions in sr-sandbox and sr-std + extern_functions! { + /// Host functions for printing, useful for debugging. + fn ext_print_utf8(utf8_data: *const u8, utf8_len: u32); + /// Print data as hex. + fn ext_print_hex(data: *const u8, len: u32); + /// Print a number + fn ext_print_num(value: u64); + + /// Set value for key in storage. + fn ext_set_storage(key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32); + /// Remove key and value from storage. + fn ext_clear_storage(key_data: *const u8, key_len: u32); + /// Checks if the given key exists in the storage. + /// + /// # Returns + /// + /// - `1` if the value exists. + /// - `0` if the value does not exists. + fn ext_exists_storage(key_data: *const u8, key_len: u32) -> u32; + /// Remove storage entries which key starts with given prefix. + fn ext_clear_prefix(prefix_data: *const u8, prefix_len: u32); + /// Gets the value of the given key from storage. + /// + /// The host allocates the memory for storing the value. + /// + /// # Returns + /// + /// - `0` if no value exists to the given key. `written_out` is set to `u32::max_value()`. + /// + /// - Otherwise, pointer to the value in memory. `written_out` contains the length of the value. + fn ext_get_allocated_storage(key_data: *const u8, key_len: u32, written_out: *mut u32) -> *mut u8; + /// Gets the value of the given key from storage. + /// + /// The value is written into `value` starting at `value_offset`. + /// + /// If the value length is greater than `value_len - value_offset`, the value is written partially. + /// + /// # Returns + /// + /// - `u32::max_value()` if the value does not exists. + /// + /// - Otherwise, the number of bytes written for value. + fn ext_get_storage_into(key_data: *const u8, key_len: u32, value_data: *mut u8, value_len: u32, value_offset: u32) -> u32; + /// Gets the trie root of the storage. + fn ext_storage_root(result: *mut u8); + /// Get the change trie root of the current storage overlay at a block with given parent. + /// + /// # Returns + /// + /// - `1` if the change trie root was found. + /// - `0` if the change trie root was not found. + fn ext_storage_changes_root(parent_hash_data: *const u8, parent_hash_len: u32, parent_num: u64, result: *mut u8) -> u32; + + /// A child storage function. + /// + /// See [`ext_set_storage`] for details. + /// + /// A child storage is used e.g. by a contract. + fn ext_set_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32); + /// A child storage function. + /// + /// See [`ext_clear_storage`] for details. + /// + /// A child storage is used e.g. by a contract. + fn ext_clear_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32); + /// A child storage function. + /// + /// See [`ext_exists_storage`] for details. + /// + /// A child storage is used e.g. by a contract. + fn ext_exists_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32) -> u32; + /// A child storage function. + /// + /// See [`ext_kill_storage`] for details. + /// + /// A child storage is used e.g. by a contract. + fn ext_kill_child_storage(storage_key_data: *const u8, storage_key_len: u32); + /// A child storage function. + /// + /// See [`ext_get_allocated_storage`] for details. + /// + /// A child storage is used e.g. by a contract. + fn ext_get_allocated_child_storage( + storage_key_data: *const u8, + storage_key_len: u32, + key_data: *const u8, + key_len: u32, + written_out: *mut u32 + ) -> *mut u8; + /// A child storage function. + /// + /// See [`ext_get_storage_into`] for details. + /// + /// A child storage is used e.g. by a contract. + fn ext_get_child_storage_into( + storage_key_data: *const u8, + storage_key_len: u32, + key_data: *const u8, + key_len: u32, + value_data: *mut u8, + value_len: u32, + value_offset: u32 + ) -> u32; + /// Commits all changes and calculates the child-storage root. + /// + /// A child storage is used e.g. by a contract. + /// + /// # Returns + /// + /// - The pointer to the result vector and `written_out` contains its length. + fn ext_child_storage_root(storage_key_data: *const u8, storage_key_len: u32, written_out: *mut u32) -> *mut u8; + + /// The current relay chain identifier. + fn ext_chain_id() -> u64; + + /// Calculate a blake2_256 merkle trie root. + fn ext_blake2_256_enumerated_trie_root(values_data: *const u8, lens_data: *const u32, lens_len: u32, result: *mut u8); + /// BLAKE2_128 hash + fn ext_blake2_128(data: *const u8, len: u32, out: *mut u8); + /// BLAKE2_256 hash + fn ext_blake2_256(data: *const u8, len: u32, out: *mut u8); + /// XX64 hash + fn ext_twox_64(data: *const u8, len: u32, out: *mut u8); + /// XX128 hash + fn ext_twox_128(data: *const u8, len: u32, out: *mut u8); + /// XX256 hash + fn ext_twox_256(data: *const u8, len: u32, out: *mut u8); + /// Keccak256 hash + fn ext_keccak_256(data: *const u8, len: u32, out: *mut u8); + /// Note: ext_ed25519_verify returns 0 if the signature is correct, nonzero otherwise. + fn ext_ed25519_verify(msg_data: *const u8, msg_len: u32, sig_data: *const u8, pubkey_data: *const u8) -> u32; + /// Note: ext_sr25519_verify returns 0 if the signature is correct, nonzero otherwise. + fn ext_sr25519_verify(msg_data: *const u8, msg_len: u32, sig_data: *const u8, pubkey_data: *const u8) -> u32; + /// Note: ext_secp256k1_ecdsa_recover returns 0 if the signature is correct, nonzero otherwise. + fn ext_secp256k1_ecdsa_recover(msg_data: *const u8, sig_data: *const u8, pubkey_data: *mut u8) -> u32; + + //================================ + // Offchain-worker Context + //================================ + + /// Submit extrinsic. + fn ext_submit_extrinsic(data: *const u8, len: u32); + } +} + +pub use self::ext::*; + +impl StorageApi for () { + fn storage(key: &[u8]) -> Option> { + let mut length: u32 = 0; + unsafe { + let ptr = ext_get_allocated_storage.get()(key.as_ptr(), key.len() as u32, &mut length); + if length == u32::max_value() { + None + } else { + // Invariants required by Vec::from_raw_parts are not formally fulfilled. + // We don't allocate via String/Vec, but use a custom allocator instead. + // See #300 for more details. + Some(>::from_raw_parts(ptr, length as usize, length as usize)) + } } - }; -} - -/// Host functions, provided by the executor. -/// A WebAssembly runtime module would "import" these to access the execution environment -/// (most importantly, storage) or perform heavy hash calculations. -/// See also "ext_" functions in sr-sandbox and sr-std -extern_functions! { - /// Host functions for printing, useful for debugging. - fn ext_print_utf8(utf8_data: *const u8, utf8_len: u32); - fn ext_print_hex(data: *const u8, len: u32); - fn ext_print_num(value: u64); - - /// Set value for key in storage. - fn ext_set_storage(key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32); - /// Remove key and value from storage. - fn ext_clear_storage(key_data: *const u8, key_len: u32); - /// Checks if the given key exists in the storage. - /// - /// # Returns - /// - /// - `1` if the value exists. - /// - `0` if the value does not exists. - fn ext_exists_storage(key_data: *const u8, key_len: u32) -> u32; - /// Remove storage entries which key starts with given prefix. - fn ext_clear_prefix(prefix_data: *const u8, prefix_len: u32); - /// Gets the value of the given key from storage. - /// - /// The host allocates the memory for storing the value. - /// - /// # Returns - /// - /// - `0` if no value exists to the given key. `written_out` is set to `u32::max_value()`. - /// - /// - Otherwise, pointer to the value in memory. `written_out` contains the length of the value. - fn ext_get_allocated_storage(key_data: *const u8, key_len: u32, written_out: *mut u32) -> *mut u8; - /// Gets the value of the given key from storage. - /// - /// The value is written into `value` starting at `value_offset`. - /// - /// If the value length is greater than `value_len - value_offset`, the value is written partially. - /// - /// # Returns - /// - /// - `u32::max_value()` if the value does not exists. - /// - /// - Otherwise, the number of bytes written for value. - fn ext_get_storage_into(key_data: *const u8, key_len: u32, value_data: *mut u8, value_len: u32, value_offset: u32) -> u32; - /// Gets the trie root of the storage. - fn ext_storage_root(result: *mut u8); - /// Get the change trie root of the current storage overlay at a block with given parent. - /// - /// # Returns - /// - /// - `1` if the change trie root was found. - /// - `0` if the change trie root was not found. - fn ext_storage_changes_root(parent_hash_data: *const u8, parent_hash_len: u32, parent_num: u64, result: *mut u8) -> u32; - - /// A child storage function. - /// - /// See [`ext_set_storage`] for details. - /// - /// A child storage is used e.g. by a contract. - fn ext_set_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32, value_data: *const u8, value_len: u32); - /// A child storage function. - /// - /// See [`ext_clear_storage`] for details. - /// - /// A child storage is used e.g. by a contract. - fn ext_clear_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32); - /// A child storage function. - /// - /// See [`ext_exists_storage`] for details. - /// - /// A child storage is used e.g. by a contract. - fn ext_exists_child_storage(storage_key_data: *const u8, storage_key_len: u32, key_data: *const u8, key_len: u32) -> u32; - /// A child storage function. - /// - /// See [`ext_kill_storage`] for details. - /// - /// A child storage is used e.g. by a contract. - fn ext_kill_child_storage(storage_key_data: *const u8, storage_key_len: u32); - /// A child storage function. - /// - /// See [`ext_get_allocated_storage`] for details. - /// - /// A child storage is used e.g. by a contract. - fn ext_get_allocated_child_storage( - storage_key_data: *const u8, - storage_key_len: u32, - key_data: *const u8, - key_len: u32, - written_out: *mut u32 - ) -> *mut u8; - /// A child storage function. - /// - /// See [`ext_get_storage_into`] for details. - /// - /// A child storage is used e.g. by a contract. - fn ext_get_child_storage_into( - storage_key_data: *const u8, - storage_key_len: u32, - key_data: *const u8, - key_len: u32, - value_data: *mut u8, - value_len: u32, - value_offset: u32 - ) -> u32; - /// Commits all changes and calculates the child-storage root. - /// - /// A child storage is used e.g. by a contract. - /// - /// # Returns - /// - /// - The pointer to the result vector and `written_out` contains its length. - fn ext_child_storage_root(storage_key_data: *const u8, storage_key_len: u32, written_out: *mut u32) -> *mut u8; - - /// The current relay chain identifier. - fn ext_chain_id() -> u64; - - /// Hash calculation and verification - fn ext_blake2_256_enumerated_trie_root(values_data: *const u8, lens_data: *const u32, lens_len: u32, result: *mut u8); - fn ext_blake2_128(data: *const u8, len: u32, out: *mut u8); - fn ext_blake2_256(data: *const u8, len: u32, out: *mut u8); - fn ext_twox_64(data: *const u8, len: u32, out: *mut u8); - fn ext_twox_128(data: *const u8, len: u32, out: *mut u8); - fn ext_twox_256(data: *const u8, len: u32, out: *mut u8); - fn ext_keccak_256(data: *const u8, len: u32, out: *mut u8); - /// Note: ext_ed25519_verify returns 0 if the signature is correct, nonzero otherwise. - fn ext_ed25519_verify(msg_data: *const u8, msg_len: u32, sig_data: *const u8, pubkey_data: *const u8) -> u32; - /// Note: ext_sr25519_verify returns 0 if the signature is correct, nonzero otherwise. - fn ext_sr25519_verify(msg_data: *const u8, msg_len: u32, sig_data: *const u8, pubkey_data: *const u8) -> u32; - /// Note: ext_secp256k1_ecdsa_recover returns 0 if the signature is correct, nonzero otherwise. - fn ext_secp256k1_ecdsa_recover(msg_data: *const u8, sig_data: *const u8, pubkey_data: *mut u8) -> u32; - - //================================ - // Offchain-worker Context - //================================ - - /// Submit extrinsic. - fn ext_submit_extrinsic(data: *const u8, len: u32); -} - -/// Ensures we use the right crypto when calling into native -pub trait ExternTrieCrypto { - fn enumerated_trie_root(values: &[&[u8]]) -> [u8; 32]; -} + } -// Ensures we use a Blake2_256-flavored Hasher when calling into native -impl ExternTrieCrypto for Blake2Hasher { - fn enumerated_trie_root(values: &[&[u8]]) -> [u8; 32] { - let lengths = values.iter().map(|v| (v.len() as u32).to_le()).collect::>(); - let values = values.iter().fold(Vec::new(), |mut acc, sl| { acc.extend_from_slice(sl); acc }); - let mut result: [u8; 32] = Default::default(); + fn child_storage(storage_key: &[u8], key: &[u8]) -> Option> { + let mut length: u32 = 0; unsafe { - ext_blake2_256_enumerated_trie_root.get()( - values.as_ptr(), - lengths.as_ptr(), - lengths.len() as u32, - result.as_mut_ptr() + let ptr = ext_get_allocated_child_storage.get()( + storage_key.as_ptr(), + storage_key.len() as u32, + key.as_ptr(), + key.len() as u32, + &mut length ); + if length == u32::max_value() { + None + } else { + // Invariants required by Vec::from_raw_parts are not formally fulfilled. + // We don't allocate via String/Vec, but use a custom allocator instead. + // See #300 for more details. + Some(>::from_raw_parts(ptr, length as usize, length as usize)) + } } - result } -} -/// Get `key` from storage and return a `Vec`, empty if there's a problem. -pub fn storage(key: &[u8]) -> Option> { - let mut length: u32 = 0; - unsafe { - let ptr = ext_get_allocated_storage.get()(key.as_ptr(), key.len() as u32, &mut length); - if length == u32::max_value() { - None - } else { - // Invariants required by Vec::from_raw_parts are not formally fulfilled. - // We don't allocate via String/Vec, but use a custom allocator instead. - // See #300 for more details. - Some(>::from_raw_parts(ptr, length as usize, length as usize)) + fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option { + unsafe { + match ext_get_storage_into.get()( + key.as_ptr(), + key.len() as u32, + value_out.as_mut_ptr(), + value_out.len() as u32, + value_offset as u32, + ) { + none if none == u32::max_value() => None, + length => Some(length as usize), + } } } -} -/// Get `key` from child storage and return a `Vec`, empty if there's a problem. -pub fn child_storage(storage_key: &[u8], key: &[u8]) -> Option> { - let mut length: u32 = 0; - unsafe { - let ptr = ext_get_allocated_child_storage.get()( - storage_key.as_ptr(), - storage_key.len() as u32, - key.as_ptr(), - key.len() as u32, - &mut length - ); - if length == u32::max_value() { - None - } else { - // Invariants required by Vec::from_raw_parts are not formally fulfilled. - // We don't allocate via String/Vec, but use a custom allocator instead. - // See #300 for more details. - Some(>::from_raw_parts(ptr, length as usize, length as usize)) + fn read_child_storage(storage_key: &[u8], key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option { + unsafe { + match ext_get_child_storage_into.get()( + storage_key.as_ptr(), storage_key.len() as u32, + key.as_ptr(), key.len() as u32, + value_out.as_mut_ptr(), value_out.len() as u32, + value_offset as u32 + ) { + none if none == u32::max_value() => None, + length => Some(length as usize), + } } } -} -/// Set the storage of some particular key to Some value. -pub fn set_storage(key: &[u8], value: &[u8]) { - unsafe { - ext_set_storage.get()( - key.as_ptr(), key.len() as u32, - value.as_ptr(), value.len() as u32 - ); + fn set_storage(key: &[u8], value: &[u8]) { + unsafe { + ext_set_storage.get()( + key.as_ptr(), key.len() as u32, + value.as_ptr(), value.len() as u32 + ); + } } -} -/// Set the child storage of some particular key to Some value. -pub fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]) { - unsafe { - ext_set_child_storage.get()( - storage_key.as_ptr(), storage_key.len() as u32, - key.as_ptr(), key.len() as u32, - value.as_ptr(), value.len() as u32 - ); + fn set_child_storage(storage_key: &[u8], key: &[u8], value: &[u8]) { + unsafe { + ext_set_child_storage.get()( + storage_key.as_ptr(), storage_key.len() as u32, + key.as_ptr(), key.len() as u32, + value.as_ptr(), value.len() as u32 + ); + } } -} -/// Clear the storage of some particular key. -pub fn clear_storage(key: &[u8]) { - unsafe { - ext_clear_storage.get()( - key.as_ptr(), key.len() as u32 - ); + fn clear_storage(key: &[u8]) { + unsafe { + ext_clear_storage.get()( + key.as_ptr(), key.len() as u32 + ); + } } -} -/// Clear the storage of some particular key. -pub fn clear_child_storage(storage_key: &[u8], key: &[u8]) { - unsafe { - ext_clear_child_storage.get()( - storage_key.as_ptr(), storage_key.len() as u32, - key.as_ptr(), key.len() as u32 - ); + fn clear_child_storage(storage_key: &[u8], key: &[u8]) { + unsafe { + ext_clear_child_storage.get()( + storage_key.as_ptr(), storage_key.len() as u32, + key.as_ptr(), key.len() as u32 + ); + } } -} -/// Determine whether a particular key exists in storage. -pub fn exists_storage(key: &[u8]) -> bool { - unsafe { - ext_exists_storage.get()( - key.as_ptr(), key.len() as u32 - ) != 0 + fn exists_storage(key: &[u8]) -> bool { + unsafe { + ext_exists_storage.get()( + key.as_ptr(), key.len() as u32 + ) != 0 + } } -} -/// Determine whether a particular key exists in storage. -pub fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool { - unsafe { - ext_exists_child_storage.get()( - storage_key.as_ptr(), storage_key.len() as u32, - key.as_ptr(), key.len() as u32 - ) != 0 + fn exists_child_storage(storage_key: &[u8], key: &[u8]) -> bool { + unsafe { + ext_exists_child_storage.get()( + storage_key.as_ptr(), storage_key.len() as u32, + key.as_ptr(), key.len() as u32 + ) != 0 + } } -} -/// Clear the storage entries key of which starts with the given prefix. -pub fn clear_prefix(prefix: &[u8]) { - unsafe { - ext_clear_prefix.get()( - prefix.as_ptr(), - prefix.len() as u32 - ); + fn clear_prefix(prefix: &[u8]) { + unsafe { + ext_clear_prefix.get()( + prefix.as_ptr(), + prefix.len() as u32 + ); + } } -} -/// Clear an entire child storage. -pub fn kill_child_storage(storage_key: &[u8]) { - unsafe { - ext_kill_child_storage.get()( - storage_key.as_ptr(), - storage_key.len() as u32 - ); + fn kill_child_storage(storage_key: &[u8]) { + unsafe { + ext_kill_child_storage.get()( + storage_key.as_ptr(), + storage_key.len() as u32 + ); + } } -} -/// Get `key` from storage, placing the value into `value_out` (as much as possible) and return -/// the number of bytes that the key in storage was beyond the offset. -pub fn read_storage(key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option { - unsafe { - match ext_get_storage_into.get()( - key.as_ptr(), - key.len() as u32, - value_out.as_mut_ptr(), - value_out.len() as u32, - value_offset as u32, - ) { - none if none == u32::max_value() => None, - length => Some(length as usize), + fn storage_root() -> [u8; 32] { + let mut result: [u8; 32] = Default::default(); + unsafe { + ext_storage_root.get()(result.as_mut_ptr()); } + result } -} -/// Get `key` from child storage, placing the value into `value_out` (as much as possible) and return -/// the number of bytes that the key in storage was beyond the offset. -pub fn read_child_storage(storage_key: &[u8], key: &[u8], value_out: &mut [u8], value_offset: usize) -> Option { - unsafe { - match ext_get_child_storage_into.get()( - storage_key.as_ptr(), storage_key.len() as u32, - key.as_ptr(), key.len() as u32, - value_out.as_mut_ptr(), value_out.len() as u32, - value_offset as u32 - ) { - none if none == u32::max_value() => None, - length => Some(length as usize), + fn child_storage_root(storage_key: &[u8]) -> Vec { + let mut length: u32 = 0; + unsafe { + let ptr = ext_child_storage_root.get()( + storage_key.as_ptr(), + storage_key.len() as u32, + &mut length + ); + // Invariants required by Vec::from_raw_parts are not formally fulfilled. + // We don't allocate via String/Vec, but use a custom allocator instead. + // See #300 for more details. + >::from_raw_parts(ptr, length as usize, length as usize) } } -} -/// The current storage's root. -pub fn storage_root() -> [u8; 32] { - let mut result: [u8; 32] = Default::default(); - unsafe { - ext_storage_root.get()(result.as_mut_ptr()); - } - result -} + fn storage_changes_root(parent_hash: [u8; 32], parent_num: u64) -> Option<[u8; 32]> { + let mut result: [u8; 32] = Default::default(); + let is_set = unsafe { + ext_storage_changes_root.get()(parent_hash.as_ptr(), parent_hash.len() as u32, parent_num, result.as_mut_ptr()) + }; -/// "Commit" all existing operations and compute the resultant child storage root. -pub fn child_storage_root(storage_key: &[u8]) -> Vec { - let mut length: u32 = 0; - unsafe { - let ptr = ext_child_storage_root.get()( - storage_key.as_ptr(), - storage_key.len() as u32, - &mut length - ); - // Invariants required by Vec::from_raw_parts are not formally fulfilled. - // We don't allocate via String/Vec, but use a custom allocator instead. - // See #300 for more details. - >::from_raw_parts(ptr, length as usize, length as usize) + if is_set != 0 { + Some(result) + } else { + None + } } -} - -/// The current storage' changes root. -pub fn storage_changes_root(parent_hash: [u8; 32], parent_num: u64) -> Option<[u8; 32]> { - let mut result: [u8; 32] = Default::default(); - let is_set = unsafe { - ext_storage_changes_root.get()(parent_hash.as_ptr(), parent_hash.len() as u32, parent_num, result.as_mut_ptr()) - }; - if is_set != 0 { - Some(result) - } else { - None + fn enumerated_trie_root(values: &[&[u8]]) -> H::Out { + H::enumerated_trie_root(values) } -} -/// A trie root calculated from enumerated values. -pub fn enumerated_trie_root(values: &[&[u8]]) -> [u8; 32] { - H::enumerated_trie_root(values) -} + fn trie_root< + H: Hasher + ExternTrieCrypto, + I: IntoIterator, + A: AsRef<[u8]> + Ord, + B: AsRef<[u8]>, + >(_input: I) -> H::Out { + unimplemented!() + } -/// A trie root formed from the iterated items. -pub fn trie_root< - H: Hasher + ExternTrieCrypto, - I: IntoIterator, - A: AsRef<[u8]> + Ord, - B: AsRef<[u8]>, ->(_input: I) -> [u8; 32] { - unimplemented!() + fn ordered_trie_root< + H: Hasher + ExternTrieCrypto, + I: IntoIterator, + A: AsRef<[u8]> + >(_input: I) -> H::Out { + unimplemented!() + } } -/// A trie root formed from the enumerated items. -pub fn ordered_trie_root< - H: Hasher + ExternTrieCrypto, - I: IntoIterator, - A: AsRef<[u8]> ->(_input: I) -> [u8; 32] { - unimplemented!() -} +impl OtherApi for () { + fn chain_id() -> u64 { + unsafe { + ext_chain_id.get()() + } + } -/// The current relay chain identifier. -pub fn chain_id() -> u64 { - unsafe { - ext_chain_id.get()() + fn print(value: T) { + value.print() } + } -/// Conduct a 256-bit Blake2 hash. -pub fn blake2_256(data: &[u8]) -> [u8; 32] { - let mut result: [u8; 32] = Default::default(); - unsafe { - ext_blake2_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); +impl HashingApi for () { + fn keccak_256(data: &[u8]) -> [u8; 32] { + let mut result: [u8; 32] = Default::default(); + unsafe { + ext_keccak_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result } - result -} -/// Conduct a 128-bit Blake2 hash. -pub fn blake2_128(data: &[u8]) -> [u8; 16] { - let mut result: [u8; 16] = Default::default(); - unsafe { - ext_blake2_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + fn blake2_128(data: &[u8]) -> [u8; 16] { + let mut result: [u8; 16] = Default::default(); + unsafe { + ext_blake2_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result } - result -} -/// Conduct a 256-bit Keccak hash. -pub fn keccak_256(data: &[u8]) -> [u8; 32] { - let mut result: [u8; 32] = Default::default(); - unsafe { - ext_keccak_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + fn blake2_256(data: &[u8]) -> [u8; 32] { + let mut result: [u8; 32] = Default::default(); + unsafe { + ext_blake2_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result } - result -} -/// Conduct four XX hashes to give a 256-bit result. -pub fn twox_256(data: &[u8]) -> [u8; 32] { - let mut result: [u8; 32] = Default::default(); - unsafe { - ext_twox_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + fn twox_256(data: &[u8]) -> [u8; 32] { + let mut result: [u8; 32] = Default::default(); + unsafe { + ext_twox_256.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result } - result -} -/// Conduct two XX hashes to give a 128-bit result. -pub fn twox_128(data: &[u8]) -> [u8; 16] { - let mut result: [u8; 16] = Default::default(); - unsafe { - ext_twox_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + fn twox_128(data: &[u8]) -> [u8; 16] { + let mut result: [u8; 16] = Default::default(); + unsafe { + ext_twox_128.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result } - result -} -/// Conduct two XX hashes to give a 64-bit result. -pub fn twox_64(data: &[u8]) -> [u8; 8] { - let mut result: [u8; 8] = Default::default(); - unsafe { - ext_twox_64.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + fn twox_64(data: &[u8]) -> [u8; 8] { + let mut result: [u8; 8] = Default::default(); + unsafe { + ext_twox_64.get()(data.as_ptr(), data.len() as u32, result.as_mut_ptr()); + } + result } - result } -/// Verify a ed25519 signature. -pub fn ed25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { - unsafe { - ext_ed25519_verify.get()(msg.as_ptr(), msg.len() as u32, sig.as_ptr(), pubkey.as_ref().as_ptr()) == 0 +impl CryptoApi for () { + fn ed25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { + unsafe { + ext_ed25519_verify.get()(msg.as_ptr(), msg.len() as u32, sig.as_ptr(), pubkey.as_ref().as_ptr()) == 0 + } } -} -/// Verify a sr25519 signature. -pub fn sr25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { - unsafe { - ext_sr25519_verify.get()(msg.as_ptr(), msg.len() as u32, sig.as_ptr(), pubkey.as_ref().as_ptr()) == 0 + fn sr25519_verify>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool { + unsafe { + ext_sr25519_verify.get()(msg.as_ptr(), msg.len() as u32, sig.as_ptr(), pubkey.as_ref().as_ptr()) == 0 + } } -} -/// Verify and recover a SECP256k1 ECDSA signature. -/// - `sig` is passed in RSV format. V should be either 0/1 or 27/28. -/// - returns `None` if the signature is bad, the 64-byte pubkey (doesn't include the 0x04 prefix). -pub fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> { - let mut pubkey = [0u8; 64]; - match unsafe { - ext_secp256k1_ecdsa_recover.get()(msg.as_ptr(), sig.as_ptr(), pubkey.as_mut_ptr()) - } { - 0 => Ok(pubkey), - 1 => Err(EcdsaVerifyError::BadRS), - 2 => Err(EcdsaVerifyError::BadV), - 3 => Err(EcdsaVerifyError::BadSignature), - _ => unreachable!("`ext_secp256k1_ecdsa_recover` only returns 0, 1, 2 or 3; qed"), + fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> { + let mut pubkey = [0u8; 64]; + match unsafe { + ext_secp256k1_ecdsa_recover.get()(msg.as_ptr(), sig.as_ptr(), pubkey.as_mut_ptr()) + } { + 0 => Ok(pubkey), + 1 => Err(EcdsaVerifyError::BadRS), + 2 => Err(EcdsaVerifyError::BadV), + 3 => Err(EcdsaVerifyError::BadSignature), + _ => unreachable!("`ext_secp256k1_ecdsa_recover` only returns 0, 1, 2 or 3; qed"), + } } } -/// Submit extrinsic from the runtime. -/// -/// Depending on the kind of extrinsic it will either be: -/// 1. scheduled to be included in the next produced block (inherent) -/// 2. added to the pool and propagated (transaction) -pub fn submit_extrinsic(data: &T) { - let encoded_data = codec::Encode::encode(data); - unsafe { - ext_submit_extrinsic.get()(encoded_data.as_ptr(), encoded_data.len() as u32) +impl OffchainApi for () { + fn submit_extrinsic(data: &T) { + let encoded_data = codec::Encode::encode(data); + unsafe { + ext_submit_extrinsic.get()(encoded_data.as_ptr(), encoded_data.len() as u32) + } } } -/// Trait for things which can be printed. -pub trait Printable { - fn print(self); -} +impl Api for () {} impl<'a> Printable for &'a [u8] { fn print(self) { @@ -659,8 +653,3 @@ impl Printable for u64 { unsafe { ext_print_num.get()(self); } } } - -/// Print a printable value. -pub fn print(value: T) { - value.print(); -} diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index b637940459..e8b4072b43 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -2232,7 +2232,6 @@ name = "srml-support" version = "1.0.0" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2280,7 +2279,6 @@ dependencies = [ name = "srml-system" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2488,7 +2486,6 @@ dependencies = [ name = "substrate-keyring" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2522,7 +2519,6 @@ dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "hash256-std-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2555,7 +2551,6 @@ version = "1.0.0" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2588,7 +2583,6 @@ name = "substrate-test-runtime" version = "1.0.0" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/node-template/runtime/wasm/Cargo.lock b/node-template/runtime/wasm/Cargo.lock index c430e34fb8..f061884222 100644 --- a/node-template/runtime/wasm/Cargo.lock +++ b/node-template/runtime/wasm/Cargo.lock @@ -2242,7 +2242,6 @@ dependencies = [ name = "srml-aura" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2259,7 +2258,6 @@ dependencies = [ name = "srml-balances" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2274,7 +2272,6 @@ dependencies = [ name = "srml-consensus" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2302,7 +2299,6 @@ dependencies = [ name = "srml-indices" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2329,7 +2325,6 @@ dependencies = [ name = "srml-session" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2345,7 +2340,6 @@ dependencies = [ name = "srml-staking" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2363,7 +2357,6 @@ dependencies = [ name = "srml-sudo" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2378,7 +2371,6 @@ name = "srml-support" version = "1.0.0" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2426,7 +2418,6 @@ dependencies = [ name = "srml-system" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2441,7 +2432,6 @@ dependencies = [ name = "srml-timestamp" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2648,7 +2638,6 @@ dependencies = [ name = "substrate-keyring" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2682,7 +2671,6 @@ dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "hash256-std-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2715,7 +2703,6 @@ version = "1.0.0" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index b765abd380..52bffacebd 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -59,7 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, spec_version: 66, - impl_version: 66, + impl_version: 67, apis: RUNTIME_API_VERSIONS, }; diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index b14c919bb3..bf68ab8f3f 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -1367,7 +1367,6 @@ dependencies = [ name = "node-runtime" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 1.0.0", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2286,7 +2285,6 @@ dependencies = [ name = "srml-aura" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2303,7 +2301,6 @@ dependencies = [ name = "srml-balances" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2318,7 +2315,6 @@ dependencies = [ name = "srml-consensus" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2368,7 +2364,6 @@ dependencies = [ name = "srml-democracy" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2396,7 +2391,6 @@ dependencies = [ name = "srml-finality-tracker" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2427,7 +2421,6 @@ dependencies = [ name = "srml-indices" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2454,7 +2447,6 @@ dependencies = [ name = "srml-session" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2470,7 +2462,6 @@ dependencies = [ name = "srml-staking" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2488,7 +2479,6 @@ dependencies = [ name = "srml-sudo" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2503,7 +2493,6 @@ name = "srml-support" version = "1.0.0" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2551,7 +2540,6 @@ dependencies = [ name = "srml-system" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2566,7 +2554,6 @@ dependencies = [ name = "srml-timestamp" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2580,7 +2567,6 @@ dependencies = [ name = "srml-treasury" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", @@ -2798,7 +2784,6 @@ dependencies = [ name = "substrate-keyring" version = "1.0.0" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 1.0.0", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2832,7 +2817,6 @@ dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "hash256-std-hasher 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2865,7 +2849,6 @@ version = "1.0.0" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -- GitLab From 2899be9eef8821eb1b601812c038c69d7a177f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 26 Apr 2019 14:09:13 +0200 Subject: [PATCH 014/229] Fix typos and markdown (#2388) * Fix typos * Align properly * Update core/consensus/slots/src/lib.rs Co-Authored-By: cmichi * Update core/network/src/test/mod.rs Co-Authored-By: cmichi * Update core/finality-grandpa/src/communication/mod.rs Co-Authored-By: cmichi * Update core/consensus/common/src/import_queue.rs Co-Authored-By: cmichi --- README.adoc | 4 ++-- core/cli/src/params.rs | 4 ++-- core/client/db/src/cache/list_cache.rs | 6 +++--- core/client/db/src/lib.rs | 2 +- core/client/src/light/blockchain.rs | 2 +- core/client/src/light/call_executor.rs | 4 ++-- core/consensus/common/src/import_queue.rs | 2 +- core/consensus/rhd/src/lib.rs | 2 +- core/consensus/slots/src/lib.rs | 2 +- core/finality-grandpa/src/communication/mod.rs | 2 +- core/keyring/src/ed25519.rs | 2 +- core/network-libp2p/src/custom_proto/handler.rs | 2 +- core/network/src/test/mod.rs | 2 +- core/sr-primitives/src/generic/mod.rs | 2 +- core/sr-primitives/src/generic/tests.rs | 2 +- core/sr-primitives/src/transaction_validity.rs | 2 +- core/state-machine/src/changes_trie/changes_iterator.rs | 2 +- core/state-machine/src/changes_trie/mod.rs | 2 +- core/state-machine/src/changes_trie/prune.rs | 4 ++-- core/transaction-pool/graph/src/base_pool.rs | 8 ++++---- core/transaction-pool/graph/src/error.rs | 2 +- core/transaction-pool/graph/src/pool.rs | 4 ++-- core/util/fork-tree/src/lib.rs | 2 +- srml/contract/src/gas.rs | 6 +++--- srml/contract/src/lib.rs | 4 ++-- srml/contract/src/wasm/env_def/macros.rs | 2 +- srml/contract/src/wasm/mod.rs | 4 ++-- srml/contract/src/wasm/prepare.rs | 2 +- srml/support/procedural/tools/derive/src/lib.rs | 2 +- srml/support/procedural/tools/src/lib.rs | 4 ++-- srml/system/src/lib.rs | 4 ++-- 31 files changed, 47 insertions(+), 47 deletions(-) diff --git a/README.adoc b/README.adoc index 71c512b820..038ccb1a64 100644 --- a/README.adoc +++ b/README.adoc @@ -229,8 +229,8 @@ Then build the code: [source, shell] ---- -./scripts/build.sh # Builds the WebAssembly binaries -cargo build # Builds all native code +./scripts/build.sh # Builds the WebAssembly binaries +cargo build # Builds all native code ---- You can run all the tests if you like: diff --git a/core/cli/src/params.rs b/core/cli/src/params.rs index 42d98bf7ed..4de8559bc6 100644 --- a/core/cli/src/params.rs +++ b/core/cli/src/params.rs @@ -20,7 +20,7 @@ use std::path::PathBuf; use structopt::{StructOpt, clap::{arg_enum, _clap_count_exprs, App, AppSettings, SubCommand, Arg}}; use client; -/// Auxialary macro to implement `GetLogFilter` for all types that have the `shared_params` field. +/// Auxiliary macro to implement `GetLogFilter` for all types that have the `shared_params` field. macro_rules! impl_get_log_filter { ( $type:ident ) => { impl $crate::GetLogFilter for $type { @@ -564,7 +564,7 @@ pub struct ImportBlocksCmd { impl_get_log_filter!(ImportBlocksCmd); -/// The `revert` command used revert the chain to a previos state. +/// The `revert` command used revert the chain to a previous state. #[derive(Debug, StructOpt, Clone)] pub struct RevertCmd { /// Number of blocks to revert. diff --git a/core/client/db/src/cache/list_cache.rs b/core/client/db/src/cache/list_cache.rs index 67e09b580d..fcce71a538 100644 --- a/core/client/db/src/cache/list_cache.rs +++ b/core/client/db/src/cache/list_cache.rs @@ -436,7 +436,7 @@ impl Fork { } } - /// Try to append NEW block to the fork. This method willonly 'work' (return true) when block + /// Try to append NEW block to the fork. This method will only 'work' (return true) when block /// is actually appended to the fork AND the best known block of the fork is known (i.e. some /// block has been already appended to this fork after last restart). pub fn try_append(&self, parent: &ComplexBlockId) -> bool { @@ -932,7 +932,7 @@ pub mod tests { assert!(tx.removed_entries().is_empty()); assert_eq!(*tx.updated_meta(), Some(Metadata { finalized: Some(correct_id(2)), unfinalized: vec![correct_id(3)] })); - // when inserting finalized entry AND there are no previous finalzed entries + // when inserting finalized entry AND there are no previous finalized entries let cache = ListCache::new(DummyStorage::new(), 1024, correct_id(2)); let mut tx = DummyTransaction::new(); assert_eq!(cache.on_block_insert(&mut tx, correct_id(2), correct_id(3), Some(3), true).unwrap(), @@ -1031,7 +1031,7 @@ pub mod tests { // when new block is appended to unfinalized fork cache.on_transaction_commit(CommitOperation::AppendNewBlock(0, correct_id(6))); assert_eq!(cache.unfinalized[0].best_block, Some(correct_id(6))); - // when new entry is appnded to unfinalized fork + // when new entry is appended to unfinalized fork cache.on_transaction_commit(CommitOperation::AppendNewEntry(0, Entry { valid_from: correct_id(7), value: Some(7) })); assert_eq!(cache.unfinalized[0].best_block, Some(correct_id(7))); assert_eq!(cache.unfinalized[0].head, Entry { valid_from: correct_id(7), value: Some(7) }); diff --git a/core/client/db/src/lib.rs b/core/client/db/src/lib.rs index e730c0888d..d17337a665 100644 --- a/core/client/db/src/lib.rs +++ b/core/client/db/src/lib.rs @@ -764,7 +764,7 @@ impl> Backend { Ok((*hash, number, false, true)) } - // performs forced canonicaliziation with a delay after importning a non-finalized block. + // performs forced canonicaliziation with a delay after importing a non-finalized block. fn force_delayed_canonicalize( &self, transaction: &mut DBTransaction, diff --git a/core/client/src/light/blockchain.rs b/core/client/src/light/blockchain.rs index b43247034f..c38d50303e 100644 --- a/core/client/src/light/blockchain.rs +++ b/core/client/src/light/blockchain.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Light client blockchin backend. Only stores headers and justifications of recent +//! Light client blockchain backend. Only stores headers and justifications of recent //! blocks. CHT roots are stored for headers of ancient blocks. use std::{sync::{Weak, Arc}, collections::HashMap}; diff --git a/core/client/src/light/call_executor.rs b/core/client/src/light/call_executor.rs index 6fcd2f4052..cbe179b605 100644 --- a/core/client/src/light/call_executor.rs +++ b/core/client/src/light/call_executor.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -//! Light client call exector. Executes methods on remote full nodes, fetching +//! Light client call executor. Executes methods on remote full nodes, fetching //! execution proof and checking it locally. use std::{collections::HashSet, sync::Arc, panic::UnwindSafe, result, marker::PhantomData}; @@ -406,7 +406,7 @@ pub fn prove_execution( /// Check remote contextual execution proof using given backend. /// /// Method is executed using passed header as environment' current block. -/// Proof shoul include both environment preparation proof and method execution proof. +/// Proof should include both environment preparation proof and method execution proof. pub fn check_execution_proof( executor: &E, request: &RemoteCallRequest
, diff --git a/core/consensus/common/src/import_queue.rs b/core/consensus/common/src/import_queue.rs index d1c5c69d02..160538966f 100644 --- a/core/consensus/common/src/import_queue.rs +++ b/core/consensus/common/src/import_queue.rs @@ -589,7 +589,7 @@ pub fn import_single_block>( match import_error(import_handle.check_block(hash, parent))? { BlockImportResult::ImportedUnknown { .. } => (), - r @ _ => return Ok(r), // Any other successfull result means that the block is already imported. + r => return Ok(r), // Any other successful result means that the block is already imported. } let (import_block, new_authorities) = verifier.verify(block_origin, header, justification, block.body) diff --git a/core/consensus/rhd/src/lib.rs b/core/consensus/rhd/src/lib.rs index cbdf95d987..0afe10ffce 100644 --- a/core/consensus/rhd/src/lib.rs +++ b/core/consensus/rhd/src/lib.rs @@ -613,7 +613,7 @@ impl BftService .map_or(true, |x| self.can_build_on_inner(header, x)) } - /// Get a reference to the underyling client. + /// Get a reference to the underlying client. pub fn client(&self) -> &I { &*self.client } fn can_build_on_inner(&self, header: &B::Header, live: &(B::Header, AgreementHandle)) -> bool { diff --git a/core/consensus/slots/src/lib.rs b/core/consensus/slots/src/lib.rs index 258e528f15..5f00990d0b 100644 --- a/core/consensus/slots/src/lib.rs +++ b/core/consensus/slots/src/lib.rs @@ -41,7 +41,7 @@ use codec::{Encode, Decode}; /// A worker that should be invoked at every new slot. pub trait SlotWorker { - /// The type fo the future that will be returned when a new slot is + /// The type of the future that will be returned when a new slot is /// triggered. type OnSlot: IntoFuture; diff --git a/core/finality-grandpa/src/communication/mod.rs b/core/finality-grandpa/src/communication/mod.rs index ec7ed330ac..395f820254 100644 --- a/core/finality-grandpa/src/communication/mod.rs +++ b/core/finality-grandpa/src/communication/mod.rs @@ -704,7 +704,7 @@ impl> Sink for CommitsOut { let topic = global_topic::(self.set_id.0); // the gossip validator needs to be made aware of the best commit-height we know of - // before gosipping + // before gossiping self.gossip_validator.note_commit_finalized( commit.target_number, |to, neighbor| self.network.send_message( diff --git a/core/keyring/src/ed25519.rs b/core/keyring/src/ed25519.rs index 96ade6167c..9c303b62bc 100644 --- a/core/keyring/src/ed25519.rs +++ b/core/keyring/src/ed25519.rs @@ -79,7 +79,7 @@ impl Keyring { .expect("static values are known good; qed") } - /// Returns an interator over all test accounts. + /// Returns an iterator over all test accounts. pub fn iter() -> impl Iterator { ::iter() } diff --git a/core/network-libp2p/src/custom_proto/handler.rs b/core/network-libp2p/src/custom_proto/handler.rs index 7c0ec61344..6794a9b12c 100644 --- a/core/network-libp2p/src/custom_proto/handler.rs +++ b/core/network-libp2p/src/custom_proto/handler.rs @@ -194,7 +194,7 @@ enum ProtocolState { }, /// We sometimes temporarily switch to this state during processing. If we are in this state - /// at the beginning of a method, that means something bad happend in the source code. + /// at the beginning of a method, that means something bad happened in the source code. Poisoned, } diff --git a/core/network/src/test/mod.rs b/core/network/src/test/mod.rs index 46636fa11f..5b375984b4 100644 --- a/core/network/src/test/mod.rs +++ b/core/network/src/test/mod.rs @@ -58,7 +58,7 @@ pub use test_client::TestClient; pub struct PassThroughVerifier(pub bool); #[cfg(any(test, feature = "test-helpers"))] -/// This Verifiyer accepts all data as valid +/// This `Verifier` accepts all data as valid. impl Verifier for PassThroughVerifier { fn verify( &self, diff --git a/core/sr-primitives/src/generic/mod.rs b/core/sr-primitives/src/generic/mod.rs index 47ce3cb251..b0f86f959f 100644 --- a/core/sr-primitives/src/generic/mod.rs +++ b/core/sr-primitives/src/generic/mod.rs @@ -52,7 +52,7 @@ fn encode_with_vec_prefix)>(encoder: F) -> Vec v.resize(reserve, 0); encoder(&mut v); - // need to prefix with the total length to ensure it's binary comptible with + // need to prefix with the total length to ensure it's binary compatible with // Vec. let mut length: Vec<()> = Vec::new(); length.resize(v.len() - reserve, ()); diff --git a/core/sr-primitives/src/generic/tests.rs b/core/sr-primitives/src/generic/tests.rs index 91fc8f3faf..b42c05ea4c 100644 --- a/core/sr-primitives/src/generic/tests.rs +++ b/core/sr-primitives/src/generic/tests.rs @@ -27,7 +27,7 @@ fn system_digest_item_encoding() { assert_eq!(encoded, vec![ // type = DigestItemType::AuthoritiesChange 1, - // number of items in athorities set + // number of items in authorities set 12, // authorities 10, 0, 0, 0, diff --git a/core/sr-primitives/src/transaction_validity.rs b/core/sr-primitives/src/transaction_validity.rs index 7cf3aa1d6d..d927bd74e4 100644 --- a/core/sr-primitives/src/transaction_validity.rs +++ b/core/sr-primitives/src/transaction_validity.rs @@ -49,7 +49,7 @@ pub enum TransactionValidity { requires: Vec, /// Provided tags /// - /// A list of tags this transaction provides. Successfuly importing the transaction + /// A list of tags this transaction provides. Successfully importing the transaction /// will enable other transactions that depend on (require) those tags to be included as well. /// Provided and requried tags allow Substrate to build a dependency graph of transactions /// and import them in the right (linear) order. diff --git a/core/state-machine/src/changes_trie/changes_iterator.rs b/core/state-machine/src/changes_trie/changes_iterator.rs index ad70117984..8d56e6c8ff 100644 --- a/core/state-machine/src/changes_trie/changes_iterator.rs +++ b/core/state-machine/src/changes_trie/changes_iterator.rs @@ -228,7 +228,7 @@ impl<'a, RS: 'a + RootsStorage, S: Storage, H: Hasher> DrilldownIteratorEs .ok_or_else(|| format!("Changes trie root for block {} is not found", block))?; // only return extrinsics for blocks before self.max - // most of blocks will be filtered out beore pushing to `self.blocks` + // most of blocks will be filtered out before pushing to `self.blocks` // here we just throwing away changes at digest blocks we're processing debug_assert!(block >= self.begin, "We shall not touch digests earlier than a range' begin"); if block <= self.end.number { diff --git a/core/state-machine/src/changes_trie/mod.rs b/core/state-machine/src/changes_trie/mod.rs index c29131cc0c..bce0609bbb 100644 --- a/core/state-machine/src/changes_trie/mod.rs +++ b/core/state-machine/src/changes_trie/mod.rs @@ -33,7 +33,7 @@ //! to the set of lower-level digest blocks. //! //! Changes trie only contains the top level storage changes. Sub-level changes -//! are propogated through its storage root on the top level storage. +//! are propagated through its storage root on the top level storage. mod build; mod build_iterator; diff --git a/core/state-machine/src/changes_trie/prune.rs b/core/state-machine/src/changes_trie/prune.rs index de872a3255..7a8654971a 100644 --- a/core/state-machine/src/changes_trie/prune.rs +++ b/core/state-machine/src/changes_trie/prune.rs @@ -41,9 +41,9 @@ pub fn oldest_non_pruned_trie( } } -/// Prune obslete changes tries. Puning happens at the same block, where highest +/// Prune obsolete changes tries. Pruning happens at the same block, where highest /// level digest is created. Pruning guarantees to save changes tries for last -/// `min_blocks_to_keep` blocks. We only prune changes tries at `max_digest_iterval` +/// `min_blocks_to_keep` blocks. We only prune changes tries at `max_digest_interval` /// ranges. /// Returns MemoryDB that contains all deleted changes tries nodes. pub fn prune, H: Hasher, F: FnMut(H::Out)>( diff --git a/core/transaction-pool/graph/src/base_pool.rs b/core/transaction-pool/graph/src/base_pool.rs index ad434e57d4..2b4b96839d 100644 --- a/core/transaction-pool/graph/src/base_pool.rs +++ b/core/transaction-pool/graph/src/base_pool.rs @@ -43,9 +43,9 @@ use crate::ready::ReadyTransactions; /// Successful import result. #[derive(Debug, PartialEq, Eq)] pub enum Imported { - /// Transaction was successfuly imported to Ready queue. + /// Transaction was successfully imported to Ready queue. Ready { - /// Hash of transaction that was successfuly imported. + /// Hash of transaction that was successfully imported. hash: Hash, /// Transactions that got promoted from the Future queue. promoted: Vec, @@ -54,9 +54,9 @@ pub enum Imported { /// Transactions removed from the Ready pool (replaced). removed: Vec>>, }, - /// Transaction was successfuly imported to Future queue. + /// Transaction was successfully imported to Future queue. Future { - /// Hash of transaction that was successfuly imported. + /// Hash of transaction that was successfully imported. hash: Hash, } } diff --git a/core/transaction-pool/graph/src/error.rs b/core/transaction-pool/graph/src/error.rs index 435ca922cd..bc2bc2c8c2 100644 --- a/core/transaction-pool/graph/src/error.rs +++ b/core/transaction-pool/graph/src/error.rs @@ -33,7 +33,7 @@ error_chain! { description("Runtime check for the transaction failed."), display("Invalid Transaction. Error Code: {}", e), } - /// The transaction is temporarily baned + /// The transaction is temporarily banned TemporarilyBanned { description("Transaction is temporarily banned from importing to the pool."), display("Temporarily Banned"), diff --git a/core/transaction-pool/graph/src/pool.rs b/core/transaction-pool/graph/src/pool.rs index 91ded26630..121e3ddf00 100644 --- a/core/transaction-pool/graph/src/pool.rs +++ b/core/transaction-pool/graph/src/pool.rs @@ -304,7 +304,7 @@ impl Pool { let hashes = status.pruned.iter().map(|tx| tx.hash.clone()).collect::>(); let results = self.submit_at(at, status.pruned.into_iter().map(|tx| tx.data.clone()))?; - // Collect the hashes of transactions that now became invalid (meaning that they are succesfuly pruned). + // Collect the hashes of transactions that now became invalid (meaning that they are succesfully pruned). let hashes = results.into_iter().enumerate().filter_map(|(idx, r)| match r.map_err(error::IntoPoolError::into_pool_error) { Err(Ok(err)) => match err.kind() { error::ErrorKind::InvalidTransaction(_) => Some(hashes[idx].clone()), @@ -333,7 +333,7 @@ impl Pool { /// /// Stale transactions are transaction beyond their longevity period. /// Note this function does not remove transactions that are already included in the chain. - /// See `prune_tags` ifyou want this. + /// See `prune_tags` if you want this. pub fn clear_stale(&self, at: &BlockId) -> Result<(), B::Error> { let block_number = self.api.block_id_to_number(at)? .ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())? diff --git a/core/util/fork-tree/src/lib.rs b/core/util/fork-tree/src/lib.rs index f194ac8915..cba5a1535b 100644 --- a/core/util/fork-tree/src/lib.rs +++ b/core/util/fork-tree/src/lib.rs @@ -22,7 +22,7 @@ use std::fmt; use parity_codec::{Decode, Encode}; -/// Error occured when interating with the tree. +/// Error occured when iterating with the tree. #[derive(Clone, Debug, PartialEq)] pub enum Error { /// Adding duplicate node to tree. diff --git a/srml/contract/src/gas.rs b/srml/contract/src/gas.rs index b7244169c4..f42b0919f3 100644 --- a/srml/contract/src/gas.rs +++ b/srml/contract/src/gas.rs @@ -255,7 +255,7 @@ pub fn refund_unused_gas( } } -/// A little handy utility for converting a value in balance units into approximitate value in gas units +/// A little handy utility for converting a value in balance units into approximate value in gas units /// at the given gas price. pub fn approx_gas_for_balance(gas_price: BalanceOf, balance: BalanceOf) -> T::Gas { let amount_in_gas: BalanceOf = balance / gas_price; @@ -316,7 +316,7 @@ mod tests { struct DoubleTokenMetadata { multiplier: u64, } - /// A simple token that charges for the given amount multipled to + /// A simple token that charges for the given amount multiplied to /// a multiplier taken from a given metadata. #[derive(Copy, Clone, PartialEq, Eq, Debug)] struct DoubleToken(u64); @@ -324,7 +324,7 @@ mod tests { impl Token for DoubleToken { type Metadata = DoubleTokenMetadata; fn calculate_amount(&self, metadata: &DoubleTokenMetadata) -> u64 { - // Probably you want to use saturating mul in producation code. + // Probably you want to use saturating mul in production code. self.0 * metadata.multiplier } } diff --git a/srml/contract/src/lib.rs b/srml/contract/src/lib.rs index a5fa62f7ec..e9b218e097 100644 --- a/srml/contract/src/lib.rs +++ b/srml/contract/src/lib.rs @@ -308,7 +308,7 @@ decl_module! { let result = ctx.call(dest, value, &mut gas_meter, &data, exec::EmptyOutputBuf::new()); if let Ok(_) = result { - // Commit all changes that made it thus far into the persistant storage. + // Commit all changes that made it thus far into the persistent storage. DirectAccountDb.commit(ctx.overlay.into_change_set()); // Then deposit all events produced. @@ -362,7 +362,7 @@ decl_module! { let result = ctx.instantiate(endowment, &mut gas_meter, &code_hash, &data); if let Ok(_) = result { - // Commit all changes that made it thus far into the persistant storage. + // Commit all changes that made it thus far into the persistent storage. DirectAccountDb.commit(ctx.overlay.into_change_set()); // Then deposit all events produced. diff --git a/srml/contract/src/wasm/env_def/macros.rs b/srml/contract/src/wasm/env_def/macros.rs index 0b112a8258..bfb42d19d0 100644 --- a/srml/contract/src/wasm/env_def/macros.rs +++ b/srml/contract/src/wasm/env_def/macros.rs @@ -167,7 +167,7 @@ macro_rules! register_func { /// will panic if called with unexpected arguments. /// /// It's up to the user of this macro to check signatures of wasm code to be executed -/// and reject the code if any imported function has a mismached signature. +/// and reject the code if any imported function has a mismatched signature. macro_rules! define_env { ( $init_name:ident , < E: $ext_ty:tt > , $( $name:ident ( $ctx:ident $( , $names:ident : $params:ty )* ) diff --git a/srml/contract/src/wasm/mod.rs b/srml/contract/src/wasm/mod.rs index 51db3b2e56..6aa7b73f52 100644 --- a/srml/contract/src/wasm/mod.rs +++ b/srml/contract/src/wasm/mod.rs @@ -155,8 +155,8 @@ impl<'a, T: Trait> crate::exec::Vm for WasmVm<'a, T> { Err(err @ sandbox::Error::Execution) => to_execution_result(runtime, Some(err)), Err(_err @ sandbox::Error::Module) => { // `Error::Module` is returned only if instantiation or linking failed (i.e. - // wasm bianry tried to import a function that is not provided by the host). - // This shouldn't happen because validation proccess ought to reject such binaries. + // wasm binary tried to import a function that is not provided by the host). + // This shouldn't happen because validation process ought to reject such binaries. // // Because panics are really undesirable in the runtime code, we treat this as // a trap for now. Eventually, we might want to revisit this. diff --git a/srml/contract/src/wasm/prepare.rs b/srml/contract/src/wasm/prepare.rs index 53883451b4..94a38ef588 100644 --- a/srml/contract/src/wasm/prepare.rs +++ b/srml/contract/src/wasm/prepare.rs @@ -318,7 +318,7 @@ pub fn prepare_contract( (initial, Some(maximum)) => MemoryDefinition { initial, maximum }, (_, None) => { // Maximum number of pages should be always declared. - // This isn't a hard requirement and can be treated as a maxiumum set + // This isn't a hard requirement and can be treated as a maximum set // to configured maximum. return Err("Maximum number of pages should be always declared."); } diff --git a/srml/support/procedural/tools/derive/src/lib.rs b/srml/support/procedural/tools/derive/src/lib.rs index 0e3fcb2247..4bf1a5f44c 100644 --- a/srml/support/procedural/tools/derive/src/lib.rs +++ b/srml/support/procedural/tools/derive/src/lib.rs @@ -58,7 +58,7 @@ pub(crate) fn fields_access( /// For enums: /// variant are tested in order of definition. /// Empty variant is always true. -/// Please use carefully, this will fully parse successfull variant twice. +/// Please use carefully, this will fully parse successful variant twice. #[proc_macro_derive(Parse)] pub fn derive_parse(input: TokenStream) -> TokenStream { let item = parse_macro_input!(input as syn::Item); diff --git a/srml/support/procedural/tools/src/lib.rs b/srml/support/procedural/tools/src/lib.rs index fd7dd41391..1b8a580773 100644 --- a/srml/support/procedural/tools/src/lib.rs +++ b/srml/support/procedural/tools/src/lib.rs @@ -71,8 +71,8 @@ pub fn generate_hidden_includes(unique_id: &str, def_crate: &str) -> TokenStream } } -// fn to remove white spaces arount string types -// (basically whitespaces arount tokens) +// fn to remove white spaces around string types +// (basically whitespaces around tokens) pub fn clean_type_string(input: &str) -> String { input .replace(" ::", "::") diff --git a/srml/system/src/lib.rs b/srml/system/src/lib.rs index 92e7b6e73e..e3d77438f9 100644 --- a/srml/system/src/lib.rs +++ b/srml/system/src/lib.rs @@ -372,7 +372,7 @@ pub fn ensure_inherent(o: OuterOrigin) -> Result<(), &'s } impl Module { - /// Gets the index of extrinsic that is currenty executing. + /// Gets the index of extrinsic that is currently executing. pub fn extrinsic_index() -> Option { storage::unhashed::get(well_known_keys::EXTRINSIC_INDEX) } @@ -462,7 +462,7 @@ impl Module { >::put(n); } - /// Sets the index of extrinsic that is currenty executing. + /// Sets the index of extrinsic that is currently executing. #[cfg(any(feature = "std", test))] pub fn set_extrinsic_index(extrinsic_index: u32) { storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &extrinsic_index) -- GitLab From fb6be1ad9e9b74e8171e75a15dac3579d1f30694 Mon Sep 17 00:00:00 2001 From: ddorgan Date: Fri, 26 Apr 2019 13:18:55 +0100 Subject: [PATCH 015/229] Use aws image for s3-docs upload (#2389) --- .gitlab-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91855c567c..e0fe1f6b4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -200,6 +200,7 @@ publish-s3-release: publish-s3-doc: stage: publish + image: parity/awscli:latest allow_failure: true dependencies: - build-rust-doc-release @@ -289,3 +290,23 @@ deploy-ue1-tag: environment: name: parity-prod-ue1 +.validator-deploy: &validator-deploy + stage: publish + dependencies: + - build-linux-release + image: parity/azure-ansible:v1 + allow_failure: true + when: manual + tags: + - linux-docker + +validator1: + <<: *validator-deploy + script: + - ansible-playbook -i scripts/ansible/inventory.ini -u gitlab scripts/ansible/alexander.yml -l validator1 + +validator2: + <<: *validator-deploy + script: + - ansible-playbook -i scripts/ansible/inventory.ini -u gitlab scripts/ansible/alexander.yml -l validator2 + -- GitLab From 3e8a5e0e3e174139a1c6db447bf6cae5f900000f Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 26 Apr 2019 19:01:55 +0200 Subject: [PATCH 016/229] Use trie_root instead of TrieDBMut to calculate default_child_trie_root (#2392) * Use trie_root instead of TrieDBMut to calculate default_child_trie_root * Fix no_std compile --- core/trie/src/lib.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/trie/src/lib.rs b/core/trie/src/lib.rs index e29402b63c..da6630e46d 100644 --- a/core/trie/src/lib.rs +++ b/core/trie/src/lib.rs @@ -158,11 +158,7 @@ pub fn is_child_trie_key_valid(storage_key: &[u8]) -> bool { /// Determine the default child trie root. pub fn default_child_trie_root(_storage_key: &[u8]) -> Vec { - let mut db = MemoryDB::default(); - let mut root = H::Out::default(); - let mut empty = TrieDBMut::::new(&mut db, &mut root); - empty.commit(); - empty.root().as_ref().to_vec() + trie_root::, Vec>(core::iter::empty()).as_ref().iter().cloned().collect() } /// Determine a child trie root given its ordered contents, closed form. H is the default hasher, but a generic @@ -377,6 +373,18 @@ mod tests { } } + #[test] + fn default_trie_root() { + let mut db = MemoryDB::default(); + let mut root = ::Out::default(); + let mut empty = TrieDBMut::::new(&mut db, &mut root); + empty.commit(); + let root1 = empty.root().as_ref().to_vec(); + let root2: Vec = trie_root::, Vec>(std::iter::empty()).as_ref().iter().cloned().collect(); + + assert_eq!(root1, root2); + } + #[test] fn empty_is_equivalent() { let input: Vec<(&[u8], &[u8])> = vec![]; -- GitLab From 4e141af70a62233022cf6a7b351ed95655583c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 27 Apr 2019 14:14:00 +0200 Subject: [PATCH 017/229] Read locks once and not 2 times (#2394) --- srml/balances/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/srml/balances/src/lib.rs b/srml/balances/src/lib.rs index 1e0521ca8c..7f2c1752a9 100644 --- a/srml/balances/src/lib.rs +++ b/srml/balances/src/lib.rs @@ -711,9 +711,14 @@ where if locks.is_empty() { return Ok(()) } + let now = >::block_number(); - if Self::locks(who).into_iter() - .all(|l| now >= l.until || new_balance >= l.amount || !l.reasons.contains(reason)) + if locks.into_iter() + .all(|l| + now >= l.until + || new_balance >= l.amount + || !l.reasons.contains(reason) + ) { Ok(()) } else { -- GitLab From 16bdbc6d27ac2890e659cf0d89eaa13ac0f807c4 Mon Sep 17 00:00:00 2001 From: thiolliere Date: Sat, 27 Apr 2019 16:33:21 +0200 Subject: [PATCH 018/229] decl_storage document hasher choice (#2387) * doc * fix * grammar and line wrapping * small changes to end * Update lib.rs * update after demi's review --- srml/support/procedural/src/lib.rs | 58 +++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/srml/support/procedural/src/lib.rs b/srml/support/procedural/src/lib.rs index 5db5c0bf60..aab39224c2 100644 --- a/srml/support/procedural/src/lib.rs +++ b/srml/support/procedural/src/lib.rs @@ -40,23 +40,47 @@ use proc_macro::TokenStream; /// } /// ``` /// -/// Declaration is set with this header `(pub) trait Store for Module as Example` -/// with `Store` a (pub) trait generated associating each storage to the `Module` and -/// `as Example` setting the prefix used for storages of this module. `Example` must be unique: -/// another module with same name and same inner storage item name will conflict. +/// Declaration is set with the header `(pub) trait Store for Module as Example`, +/// with `Store` a (pub) trait generated associating each storage item to the `Module` and +/// `as Example` setting the prefix used for storage items of this module. `Example` must be unique: +/// another module with the same name and the same inner storage item name will conflict. /// /// Basic storage consists of a name and a type; supported types are: /// /// * Value: `Foo: type`: Implements [StorageValue](../srml_support/storage/trait.StorageValue.html). -/// * Map: `Foo: map type => type`: implements [StorageMap](../srml_support/storage/trait.StorageMap.html) -/// * Linked map: `Foo: linked_map type => type`: Implements [StorageMap](../srml_support/storage/trait.StorageMap.html) -/// and [EnumarableStorageMap](../srml_support/storage/trait.EnumerableStorageMap.html). -/// * Double map: `Foo: double_map u32, $hash(u32) => u32;`: Implements `StorageDoubleMap` with `$hash` representing a -/// choice of hashing algorithms available in [`Hashable` trait](../srml_support/trait.Hashable.html). +/// * Map: `Foo: map hasher($hash) type => type`: Implements [StorageMap](../srml_support/storage/trait.StorageMap.html) +/// with `$hash` representing a choice of hashing algorithms available in the +/// [`Hashable` trait](../srml_support/trait.Hashable.html). /// -/// /!\ Be careful when choosing the hash function, malicious actors could craft second keys to lower the trie. +/// `hasher($hash)` is optional and its default is `blake2_256`. /// -/// And it can be extended as such: +/// /!\ Be careful with each key in the map that is inserted in the trie `$hash(module_name ++ storage_name ++ key)`. +/// If the keys are not trusted (e.g. can be set by a user), a cryptographic `hasher` such as +/// `blake2_256` must be used. Otherwise, other values in storage can be compromised. +/// +/// * Linked map: `Foo: linked_map hasher($hash) type => type`: Same as `Map` but also implements +/// [EnumarableStorageMap](../srml_support/storage/trait.EnumerableStorageMap.html). +/// +/// * Double map: `Foo: double_map hasher($hash) u32, $hash2(u32) => u32`: Implements `StorageDoubleMap` with +/// `$hash` and `$hash2` representing choices of hashing algorithms available in the +/// [`Hashable` trait](../srml_support/trait.Hashable.html). +/// +/// `hasher($hash)` is optional and its default is `blake2_256`. +/// +/// /!\ Be careful with each key pair in the double map that is inserted in the trie. +/// The final key is calculated as follows: +/// +/// ```nocompile +/// $hash(module_name ++ storage_name ++ first_key) ++ $hash2(second_key) +/// ``` +/// +/// If the first key is untrusted, a cryptographic `hasher` such as `blake2_256` must be used. +/// Otherwise, other values of all storage items can be compromised. +/// +/// If the second key is untrusted, a cryptographic `hasher` such as `blake2_256` must be used. +/// Otherwise, other items in storage with the same first key can be compromised. +/// +/// Basic storage can be extended as such: /// /// `#vis #name get(#getter) config(#field_name) build(#closure): #type = #default;` /// @@ -100,18 +124,18 @@ use proc_macro::TokenStream; /// /// This struct can be exposed as `Config` by the `decl_runtime!` macro. /// -/// ### Module with instances +/// ### Module with Instances /// -/// The `decl_storage!` macro supports building modules with instances with the following syntax: -/// (`DefaultInstance` type is optional) +/// The `decl_storage!` macro supports building modules with instances with the following syntax +/// (`DefaultInstance` type is optional): /// /// ```nocompile /// trait Store for Module, I: Instance=DefaultInstance> as Example {} /// ``` /// -/// Then the genesis config is generated with two generic parameter `GenesisConfig` -/// and storage items are now accessible using two generic parameters, e.g.: -/// `>::get()` or `Dummy::::get()` +/// Then the genesis config is generated with two generic parameters (i.e. `GenesisConfig`) +/// and storage items are accessible using two generic parameters, e.g.: +/// `>::get()` or `Dummy::::get()`. #[proc_macro] pub fn decl_storage(input: TokenStream) -> TokenStream { storage::transformation::decl_storage_impl(input) -- GitLab From 837ef91afb5d37604e30ca0aa5fbde305f27b53f Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 27 Apr 2019 16:33:42 +0200 Subject: [PATCH 019/229] Allow multiple substreams (#2379) * Allow multiple substreams * Update core/network-libp2p/src/custom_proto/handler.rs Co-Authored-By: tomaka --- .../src/custom_proto/handler.rs | 177 ++++++++++-------- 1 file changed, 94 insertions(+), 83 deletions(-) diff --git a/core/network-libp2p/src/custom_proto/handler.rs b/core/network-libp2p/src/custom_proto/handler.rs index 6794a9b12c..ee2ac22c5e 100644 --- a/core/network-libp2p/src/custom_proto/handler.rs +++ b/core/network-libp2p/src/custom_proto/handler.rs @@ -26,7 +26,7 @@ use libp2p::core::{ upgrade::{InboundUpgrade, OutboundUpgrade} }; use log::{debug, error}; -use smallvec::SmallVec; +use smallvec::{smallvec, SmallVec}; use std::{error, fmt, io, marker::PhantomData, mem, time::Duration, time::Instant}; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_timer::{Delay, clock::Clock}; @@ -73,13 +73,18 @@ use void::Void; /// `Disable` or an `Enable` message from the outer layer. At any time, the outer layer is free to /// toggle the handler between the disabled and enabled states. /// -/// When the handler is enabled for the first time, if it is the dialer of the connection, it tries -/// to open a substream. The substream negotiates either a protocol named `/substrate/xxx`, where -/// `xxx` is chosen by the user. +/// When the handler switches to "enabled", it opens a substream and negotiates the protocol named +/// `/substrate/xxx`, where `xxx` is chosen by the user and depends on the chain. /// -/// Then, we have one unique substream where bidirectional communications happen. If the remote -/// closes the substream, we consider that we are now disconnected. Re-enabling is performed by -/// re-opening the substream (even if we are not the dialer of the connection). +/// For backwards compatibility reasons, when we switch to "enabled" for the first time (while we +/// are still in "init" mode) and we are the connection listener, we don't open a substream. +/// +/// In order the handle the situation where both the remote and us get enabled at the same time, +/// we tolerate multiple substreams open at the same time. Messages are transmitted on an arbitrary +/// substream. The endpoints don't try to agree on a single substream. +/// +/// We consider that we are now "closed" if the remote closes all the existing substreams. +/// Re-opening it can then be performed by closing all active substream and re-opening one. /// pub struct CustomProtoHandlerProto { /// Configuration for the protocol upgrade to negotiate. @@ -169,11 +174,11 @@ enum ProtocolState { deadline: Delay, }, - /// Backwards-compatible mode. Contains the unique substream that is open. + /// Normal operating mode. Contains the substreams that are open. /// If we are in this state, we have sent a `CustomProtocolOpen` message to the outside. Normal { - /// The unique substream where bidirectional communications happen. - substream: RegisteredProtocolSubstream, + /// The substreams where bidirectional communications happen. + substreams: SmallVec<[RegisteredProtocolSubstream; 4]>, /// Contains substreams which are being shut down. shutdown: SmallVec<[RegisteredProtocolSubstream; 4]>, }, @@ -284,8 +289,7 @@ where }; self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); ProtocolState::Normal { - substream: incoming.into_iter().next() - .expect("We have a check above that incoming isn't empty; QED"), + substreams: incoming.into_iter().collect(), shutdown: SmallVec::new() } } @@ -319,9 +323,11 @@ where ProtocolState::Disabled { shutdown: SmallVec::new(), reenable: false } } - ProtocolState::Normal { mut substream, mut shutdown } => { - substream.shutdown(); - shutdown.push(substream); + ProtocolState::Normal { substreams, mut shutdown } => { + for mut substream in substreams { + substream.shutdown(); + shutdown.push(substream); + } let event = CustomProtoHandlerOut::CustomProtocolClosed { result: Ok(()) }; @@ -341,13 +347,12 @@ where #[must_use] fn poll_state(&mut self) -> Option, (), CustomProtoHandlerOut>> { - let return_value; - self.state = match mem::replace(&mut self.state, ProtocolState::Poisoned) { + match mem::replace(&mut self.state, ProtocolState::Poisoned) { ProtocolState::Poisoned => { error!(target: "sub-libp2p", "Handler with {:?} is in poisoned state", self.remote_peer_id); - return_value = None; - ProtocolState::Poisoned + self.state = ProtocolState::Poisoned; + None } ProtocolState::Init { substreams, mut init_deadline } => { @@ -361,8 +366,8 @@ where Err(_) => error!(target: "sub-libp2p", "Tokio timer has errored") } - return_value = None; - ProtocolState::Init { substreams, init_deadline } + self.state = ProtocolState::Init { substreams, init_deadline }; + None } ProtocolState::Opening { mut deadline } => { @@ -373,63 +378,74 @@ where is_severe: true, error: "Timeout when opening protocol".to_string().into(), }; - return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Opening { deadline } + self.state = ProtocolState::Opening { deadline }; + Some(ProtocolsHandlerEvent::Custom(event)) }, Ok(Async::NotReady) => { - return_value = None; - ProtocolState::Opening { deadline } + self.state = ProtocolState::Opening { deadline }; + None }, Err(_) => { error!(target: "sub-libp2p", "Tokio timer has errored"); deadline.reset(self.clock.now() + Duration::from_secs(60)); - return_value = None; - ProtocolState::Opening { deadline } + self.state = ProtocolState::Opening { deadline }; + None }, } } - ProtocolState::Normal { mut substream, shutdown } => { - match substream.poll() { - Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(message)))) => { - let event = CustomProtoHandlerOut::CustomMessage { - message - }; - return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Normal { substream, shutdown } - }, - Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { messages }))) => { - let event = CustomProtoHandlerOut::Clogged { - messages, - }; - return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Normal { substream, shutdown } - } - Ok(Async::NotReady) => { - return_value = None; - ProtocolState::Normal { substream, shutdown } - } - Ok(Async::Ready(None)) => { - let event = CustomProtoHandlerOut::CustomProtocolClosed { - result: Ok(()) - }; - return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Disabled { - shutdown: shutdown.into_iter().collect(), - reenable: true + ProtocolState::Normal { mut substreams, shutdown } => { + for n in (0..substreams.len()).rev() { + let mut substream = substreams.swap_remove(n); + match substream.poll() { + Ok(Async::NotReady) => substreams.push(substream), + Ok(Async::Ready(Some(RegisteredProtocolEvent::Message(message)))) => { + let event = CustomProtoHandlerOut::CustomMessage { + message + }; + substreams.push(substream); + self.state = ProtocolState::Normal { substreams, shutdown }; + return Some(ProtocolsHandlerEvent::Custom(event)); + }, + Ok(Async::Ready(Some(RegisteredProtocolEvent::Clogged { messages }))) => { + let event = CustomProtoHandlerOut::Clogged { + messages, + }; + substreams.push(substream); + self.state = ProtocolState::Normal { substreams, shutdown }; + return Some(ProtocolsHandlerEvent::Custom(event)); } - } - Err(err) => { - let event = CustomProtoHandlerOut::CustomProtocolClosed { - result: Err(err), - }; - return_value = Some(ProtocolsHandlerEvent::Custom(event)); - ProtocolState::Disabled { - shutdown: shutdown.into_iter().collect(), - reenable: true + Ok(Async::Ready(None)) => { + let event = CustomProtoHandlerOut::CustomProtocolClosed { + result: Ok(()) + }; + substreams.push(substream); + self.state = ProtocolState::Disabled { + shutdown: shutdown.into_iter().collect(), + reenable: true + }; + return Some(ProtocolsHandlerEvent::Custom(event)); + } + Err(err) => { + if substreams.is_empty() { + let event = CustomProtoHandlerOut::CustomProtocolClosed { + result: Err(err), + }; + self.state = ProtocolState::Disabled { + shutdown: shutdown.into_iter().collect(), + reenable: true + }; + return Some(ProtocolsHandlerEvent::Custom(event)); + } else { + debug!(target: "sub-libp2p", "Error on extra substream: {:?}", err); + } } } } + + // This code is reached is none if and only if none of the substreams are in a ready state. + self.state = ProtocolState::Normal { substreams, shutdown }; + None } ProtocolState::Disabled { mut shutdown, reenable } => { @@ -437,21 +453,19 @@ where // If `reenable` is `true`, that means we should open the substreams system again // after all the substreams are closed. if reenable && shutdown.is_empty() { - return_value = Some(ProtocolsHandlerEvent::OutboundSubstreamRequest { + self.state = ProtocolState::Opening { + deadline: Delay::new(self.clock.now() + Duration::from_secs(60)) + }; + Some(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol: SubstreamProtocol::new(self.protocol.clone()), info: (), - }); - ProtocolState::Opening { - deadline: Delay::new(self.clock.now() + Duration::from_secs(60)) - } + }) } else { - return_value = None; - ProtocolState::Disabled { shutdown, reenable } + self.state = ProtocolState::Disabled { shutdown, reenable }; + None } } - }; - - return_value + } } /// Called by `inject_fully_negotiated_inbound` and `inject_fully_negotiated_outbound`. @@ -481,17 +495,14 @@ where }; self.events_queue.push(ProtocolsHandlerEvent::Custom(event)); ProtocolState::Normal { - substream, + substreams: smallvec![substream], shutdown: SmallVec::new() } } - ProtocolState::Normal { substream: existing, mut shutdown } => { - debug!(target: "sub-libp2p", "Received extra substream after having already one \ - open in backwards-compatibility mode with {:?}", self.remote_peer_id); - substream.shutdown(); - shutdown.push(substream); - ProtocolState::Normal { substream: existing, shutdown } + ProtocolState::Normal { substreams: mut existing, shutdown } => { + existing.push(substream); + ProtocolState::Normal { substreams: existing, shutdown } } ProtocolState::Disabled { mut shutdown, .. } => { @@ -505,8 +516,8 @@ where /// Sends a message to the remote. fn send_message(&mut self, message: TMessage) { match self.state { - ProtocolState::Normal { ref mut substream, .. } => - substream.send_message(message), + ProtocolState::Normal { ref mut substreams, .. } => + substreams[0].send_message(message), _ => debug!(target: "sub-libp2p", "Tried to send message over closed protocol \ with {:?}", self.remote_peer_id) -- GitLab From 7d523bad168fe6867fdd6130e77ab749c38b9101 Mon Sep 17 00:00:00 2001 From: TriplEight Date: Sat, 27 Apr 2019 20:02:02 +0200 Subject: [PATCH 020/229] image name was changed, pipeline will fail (#2397) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0fe1f6b4e..a8141ee79e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -226,7 +226,7 @@ publish-s3-doc: stage: deploy when: manual retry: 1 - image: parity/kubectl-helm:$HELM_VERSION + image: parity/kubetools:latest <<: *build-only tags: # this is the runner that is used to deploy it -- GitLab From 7de91ae202bae7831240156a7da12d7cd1a3451b Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Mon, 29 Apr 2019 08:18:21 +0200 Subject: [PATCH 021/229] More detailed instructions for Windows Setup (#2398) --- README.adoc | 81 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/README.adoc b/README.adoc index 038ccb1a64..03d81dcf41 100644 --- a/README.adoc +++ b/README.adoc @@ -173,11 +173,13 @@ You can distribute `mychain.json` so that everyone can synchronize and (dependin If you'd actually like to hack on Substrate, you can just grab the source code and build it. Ensure you have Rust and the support software installed: +==== Linux and Mac + +For Unix-based operating systems, you should run the following commands: + [source, shell] ---- curl https://sh.rustup.rs -sSf | sh -# on Windows download and run rustup-init.exe -# from https://rustup.rs instead rustup update nightly rustup target add wasm32-unknown-unknown --toolchain nightly @@ -195,27 +197,60 @@ sudo apt install cmake pkg-config libssl-dev git clang libclang-dev [source, shell] brew install cmake pkg-config openssl git llvm - - Windows (PowerShell): -+ -[source, shell] ----- -# Install LLVM -# Download and install the Pre Build Windows binaries -# of LLVM from http://releases.llvm.org/download.html - -# Install OpenSSL (through vcpkg) -mkdir \Tools -cd \Tools -git clone https://github.com/Microsoft/vcpkg.git -cd vcpkg -.\bootstrap-vcpkg.bat -.\vcpkg.exe install openssl:x64-windows-static - -$env:OPENSSL_DIR = 'C:\Tools\vcpkg\installed\x64-windows-static' -$env:OPENSSL_STATIC = 'Yes' -[System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User) -[System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User) ----- +To finish installation of Substrate, jump down to <>. + +==== Windows + +If you are trying to set up Substrate on Windows, you should do the following: + +1. First, you will need to download and install "Build Tools for Visual Studio:" + + * You can get it at this link: https://aka.ms/buildtools + * Run the installation file: `vs_buildtools.exe` + * Please ensure the Windows 10 SDK component is included when installing the Visual C++ Build Tools. + * image:https://i.imgur.com/zayVLmu.png[image] + * Restart your computer. + +2. Next, you need to install Rust: + + * Detailed instructions are provided by the https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows[Rust Book]. + * Download from: https://www.rust-lang.org/tools/install + * Run the installation file: `rustup-init.exe` + > Note that it should not prompt you to install vs_buildtools since you did it in step 1. + * Choose "Default Installation." + * To get started, you need Cargo's bin directory (%USERPROFILE%\.cargo\bin) in your PATH environment variable. Future applications will automatically have the correct environment, but you may need to restart your current shell. + +3. Then, you will need to run some commands in CMD to set up your Wasm Build Environment: + + rustup update nightly + rustup update stable + rustup target add wasm32-unknown-unknown --toolchain nightly + +4. Next, you install wasm-gc, which is used to slim down Wasm files: + + cargo install --git https://github.com/alexcrichton/wasm-gc --force + +5. Then, you need to install LLVM: https://releases.llvm.org/download.html + +6. Next, you need to install OpenSSL, which we will do with `vcpkg`: + + mkdir \Tools + cd \Tools + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + .\bootstrap-vcpkg.bat + .\vcpkg.exe install openssl:x64-windows-static + +7. After, you need to add OpenSSL to your System Variables: + + $env:OPENSSL_DIR = 'C:\Tools\vcpkg\installed\x64-windows-static' + $env:OPENSSL_STATIC = 'Yes' + [System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User) + [System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User) + +8. Finally, you need to install `cmake`: https://cmake.org/download/ + +==== Shared Steps Then, grab the Substrate source code: -- GitLab From 25d21add1b8502c6fa3ee099cf73284bd4372e3d Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 29 Apr 2019 09:40:08 +0200 Subject: [PATCH 022/229] refactor: Remove duplicate line. Show on separate lines to fix formatting (#2402) --- srml/example/src/lib.rs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/srml/example/src/lib.rs b/srml/example/src/lib.rs index d1ff7cc634..6960d635ed 100644 --- a/srml/example/src/lib.rs +++ b/srml/example/src/lib.rs @@ -24,12 +24,19 @@ //! //! ### Documentation Guidelines: //! -//! +//! +//! //!