diff --git a/Cargo.lock b/Cargo.lock
index d9bfc404090c0..f12014a220ef9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -92,11 +92,6 @@ dependencies = [
"xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "arbitrary"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
[[package]]
name = "arc-swap"
version = "0.3.11"
@@ -1279,16 +1274,6 @@ dependencies = [
"hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "honggfuzz"
-version = "0.5.45"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "arbitrary 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "http"
version = "0.1.18"
@@ -1412,7 +1397,7 @@ dependencies = [
[[package]]
name = "impl-serde"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2191,15 +2176,6 @@ dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "memmap"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "memoffset"
version = "0.5.1"
@@ -2535,7 +2511,7 @@ dependencies = [
"substrate-offchain-primitives 2.0.0",
"substrate-primitives 2.0.0",
"substrate-session 2.0.0",
- "substrate-wasm-builder-runner 1.0.3",
+ "substrate-wasm-builder-runner 1.0.4",
]
[[package]]
@@ -2596,7 +2572,7 @@ dependencies = [
"substrate-offchain-primitives 2.0.0",
"substrate-primitives 2.0.0",
"substrate-session 2.0.0",
- "substrate-wasm-builder-runner 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "substrate-wasm-builder-runner 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3034,7 +3010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fixed-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"impl-codec 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "impl-serde 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"uint 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3876,17 +3852,7 @@ dependencies = [
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-std 2.0.0",
-]
-
-[[package]]
-name = "sr-arithmetic-fuzzer"
-version = "2.0.0"
-dependencies = [
- "honggfuzz 0.5.45 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "primitive-types 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "sr-arithmetic 2.0.0",
+ "substrate-debug-derive 2.0.0",
]
[[package]]
@@ -3895,6 +3861,7 @@ version = "2.0.0"
dependencies = [
"hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libsecp256k1 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-std 2.0.0",
@@ -3957,7 +3924,7 @@ dependencies = [
name = "sr-version"
version = "2.0.0"
dependencies = [
- "impl-serde 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-primitives 2.0.0",
@@ -4137,6 +4104,7 @@ version = "2.0.0"
dependencies = [
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
+ "sr-primitives 2.0.0",
"sr-std 2.0.0",
"substrate-client 2.0.0",
]
@@ -4451,6 +4419,7 @@ version = "2.0.0"
dependencies = [
"bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"impl-trait-for-tuples 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5123,6 +5092,15 @@ dependencies = [
"substrate-primitives 2.0.0",
]
+[[package]]
+name = "substrate-debug-derive"
+version = "2.0.0"
+dependencies = [
+ "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "substrate-executor"
version = "2.0.0"
@@ -5316,6 +5294,7 @@ dependencies = [
"hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5328,6 +5307,7 @@ dependencies = [
"substrate-primitives 2.0.0",
"substrate-test-runtime-client 2.0.0",
"substrate-transaction-pool 2.0.0",
+ "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -5384,7 +5364,7 @@ dependencies = [
"hash256-std-hasher 0.15.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.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "impl-serde 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5400,6 +5380,7 @@ dependencies = [
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-std 2.0.0",
"substrate-bip39 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "substrate-debug-derive 2.0.0",
"substrate-externalities 2.0.0",
"substrate-primitives-storage 2.0.0",
"substrate-serializer 2.0.0",
@@ -5413,9 +5394,10 @@ dependencies = [
name = "substrate-primitives-storage"
version = "2.0.0"
dependencies = [
- "impl-serde 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-std 2.0.0",
+ "substrate-debug-derive 2.0.0",
]
[[package]]
@@ -5502,7 +5484,7 @@ dependencies = [
"sr-sandbox 2.0.0",
"sr-std 2.0.0",
"substrate-primitives 2.0.0",
- "substrate-wasm-builder-runner 1.0.3",
+ "substrate-wasm-builder-runner 1.0.4",
]
[[package]]
@@ -5690,7 +5672,7 @@ dependencies = [
"substrate-state-machine 2.0.0",
"substrate-test-runtime-client 2.0.0",
"substrate-trie 2.0.0",
- "substrate-wasm-builder-runner 1.0.3",
+ "substrate-wasm-builder-runner 1.0.4",
"trie-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -5759,7 +5741,7 @@ dependencies = [
[[package]]
name = "substrate-wasm-builder"
-version = "1.0.7"
+version = "1.0.8"
dependencies = [
"build-helper 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cargo_metadata 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5772,11 +5754,11 @@ dependencies = [
[[package]]
name = "substrate-wasm-builder-runner"
-version = "1.0.3"
+version = "1.0.4"
[[package]]
name = "substrate-wasm-builder-runner"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -5906,6 +5888,14 @@ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "threadpool"
+version = "1.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "time"
version = "0.1.42"
@@ -6782,7 +6772,6 @@ dependencies = [
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
"checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d"
-"checksum arbitrary 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "64cf76cb6e2222ed0ea86b2b0ee2f71c96ec6edd5af42e84d59160e91b836ec4"
"checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841"
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
@@ -6920,7 +6909,6 @@ dependencies = [
"checksum hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695"
"checksum hmac-drbg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe727d41d2eec0a6574d887914347e5ff96a3b87177817e2a9820c5c87fecc2"
"checksum hmac-drbg 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b"
-"checksum honggfuzz 0.5.45 (registry+https://github.com/rust-lang/crates.io-index)" = "24c27b4aa3049d6d10d8e33d52c9d03ca9aec18f8a449b246f8c4a5b0c10fb34"
"checksum http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "372bcb56f939e449117fb0869c2e8fd8753a8223d92a172c6e808cf123a5b6e4"
"checksum http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d"
"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
@@ -6931,7 +6919,7 @@ dependencies = [
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
"checksum impl-codec 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3fa0086251524c50fd53b32e7b05eb6d79e2f97221eaf0c53c0ca9c3096f21d3"
-"checksum impl-serde 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bbb1ea6188aca47a0eaeeb330d8a82f16cd500f30b897062d23922568727333a"
+"checksum impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a263dc95daa6c3788c8f7133d86dc2ad89ec5a0c56167f9e3441c5f7f33358c4"
"checksum impl-trait-for-tuples 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6947b372790f8948f439bb6aaa6baabdf80be1a207a477ff072f83fb793e428f"
"checksum indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a61202fbe46c4a951e9404a720a0180bcf3212c750d735cb5c4ba4dc551299f3"
"checksum integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea155abb3ba6f382a75f1418988c05fe82959ed9ce727de427f9cfd425b0c903"
@@ -6997,7 +6985,6 @@ dependencies = [
"checksum malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
-"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
"checksum memory-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ef49315991403ba5fa225a70399df5e115f57b274cb0b1b4bcd6e734fa5bd783"
"checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882"
@@ -7161,7 +7148,7 @@ dependencies = [
"checksum strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1c33039533f051704951680f1adfd468fd37ac46816ded0d9ee068e60f05f"
"checksum strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47cd23f5c7dee395a00fa20135e2ec0fffcdfa151c56182966d7a3261343432e"
"checksum substrate-bip39 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3be511be555a3633e71739a79e4ddff6a6aaa6579fa6114182a51d72c3eb93c5"
-"checksum substrate-wasm-builder-runner 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af21b27fad38b212c1919f700cb0def33c88cde14d22e0d1b17d4521f4eb8b40"
+"checksum substrate-wasm-builder-runner 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bd48273fe9d7f92c1f7d6c1c537bb01c8068f925b47ad2cd8367e11dc32f8550"
"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
"checksum subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab3af2eb31c42e8f0ccf43548232556c42737e01a96db6e1777b0be108e79799"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
@@ -7176,6 +7163,7 @@ dependencies = [
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
+"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c1c5676413eaeb1ea35300a0224416f57abc3bd251657e0fafc12c47ff98c060"
"checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2"
diff --git a/Cargo.toml b/Cargo.toml
index 9d01fabc1e373..8d3d04c4d0595 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,7 +54,6 @@ members = [
"core/session",
"core/sr-api-macros",
"core/sr-arithmetic",
- "core/sr-arithmetic/fuzzer",
"core/sr-io",
"core/sr-primitives",
"core/sr-staking-primitives",
diff --git a/core/application-crypto/src/lib.rs b/core/application-crypto/src/lib.rs
index e3366a461a064..16eda53238340 100644
--- a/core/application-crypto/src/lib.rs
+++ b/core/application-crypto/src/lib.rs
@@ -21,7 +21,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[doc(hidden)]
-pub use primitives::{self, crypto::{CryptoType, Public, Derive, IsWrappedBy, Wraps}};
+pub use primitives::{self, crypto::{CryptoType, Public, Derive, IsWrappedBy, Wraps}, RuntimeDebug};
#[doc(hidden)]
#[cfg(feature = "std")]
pub use primitives::crypto::{SecretStringError, DeriveJunction, Ss58Codec, Pair};
@@ -139,10 +139,12 @@ macro_rules! app_crypto {
$crate::wrap!{
/// A generic `AppPublic` wrapper type over $public crypto; this has no specific App.
#[derive(
- Clone, Default, Eq, PartialEq, Ord, PartialOrd, $crate::codec::Encode,
+ Clone, Default, Eq, PartialEq, Ord, PartialOrd,
+ $crate::codec::Encode,
$crate::codec::Decode,
+ $crate::RuntimeDebug,
)]
- #[cfg_attr(feature = "std", derive(Debug, Hash))]
+ #[cfg_attr(feature = "std", derive(Hash))]
pub struct Public($public);
}
@@ -239,8 +241,12 @@ macro_rules! app_crypto {
$crate::wrap! {
/// A generic `AppPublic` wrapper type over $public crypto; this has no specific App.
- #[derive(Clone, Default, Eq, PartialEq, $crate::codec::Encode, $crate::codec::Decode)]
- #[cfg_attr(feature = "std", derive(Debug, Hash))]
+ #[derive(Clone, Default, Eq, PartialEq,
+ $crate::codec::Encode,
+ $crate::codec::Decode,
+ $crate::RuntimeDebug,
+ )]
+ #[cfg_attr(feature = "std", derive(Hash))]
pub struct Signature($sig);
}
diff --git a/core/application-crypto/src/traits.rs b/core/application-crypto/src/traits.rs
index aad076bd90012..49d3a44aee3d1 100644
--- a/core/application-crypto/src/traits.rs
+++ b/core/application-crypto/src/traits.rs
@@ -14,10 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see .
-use primitives::crypto::{KeyTypeId, CryptoType, IsWrappedBy, Public};
#[cfg(feature = "std")]
use primitives::crypto::Pair;
+
use codec::Codec;
+use primitives::crypto::{KeyTypeId, CryptoType, IsWrappedBy, Public};
+use rstd::fmt::Debug;
/// An application-specific key.
pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone {
@@ -38,23 +40,25 @@ pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone {
const ID: KeyTypeId;
}
-/// Type which implements Debug and Hash in std, not when no-std (std variant).
+/// Type which implements Hash in std, not when no-std (std variant).
#[cfg(feature = "std")]
-pub trait MaybeDebugHash: std::fmt::Debug + std::hash::Hash {}
+pub trait MaybeHash: std::hash::Hash {}
#[cfg(feature = "std")]
-impl MaybeDebugHash for T {}
+impl MaybeHash for T {}
-/// Type which implements Debug and Hash in std, not when no-std (no-std variant).
+/// Type which implements Hash in std, not when no-std (no-std variant).
#[cfg(not(feature = "std"))]
-pub trait MaybeDebugHash {}
+pub trait MaybeHash {}
#[cfg(not(feature = "std"))]
-impl MaybeDebugHash for T {}
+impl MaybeHash for T {}
/// A application's public key.
-pub trait AppPublic: AppKey + Public + Ord + PartialOrd + Eq + PartialEq + MaybeDebugHash + codec::Codec {
+pub trait AppPublic:
+ AppKey + Public + Ord + PartialOrd + Eq + PartialEq + Debug + MaybeHash + codec::Codec
+{
/// The wrapped type which is just a plain instance of `Public`.
type Generic:
- IsWrappedBy + Public + Ord + PartialOrd + Eq + PartialEq + MaybeDebugHash + codec::Codec;
+ IsWrappedBy + Public + Ord + PartialOrd + Eq + PartialEq + Debug + MaybeHash + codec::Codec;
}
/// A application's key pair.
@@ -65,15 +69,15 @@ pub trait AppPair: AppKey + Pair::Public> {
}
/// A application's signature.
-pub trait AppSignature: AppKey + Eq + PartialEq + MaybeDebugHash {
+pub trait AppSignature: AppKey + Eq + PartialEq + Debug + MaybeHash {
/// The wrapped type which is just a plain instance of `Signature`.
- type Generic: IsWrappedBy + Eq + PartialEq + MaybeDebugHash;
+ type Generic: IsWrappedBy + Eq + PartialEq + Debug + MaybeHash;
}
/// A runtime interface for a public key.
pub trait RuntimePublic: Sized {
/// The signature that will be generated when signing with the corresponding private key.
- type Signature: Codec + MaybeDebugHash + Eq + PartialEq + Clone;
+ type Signature: Codec + Debug + MaybeHash + Eq + PartialEq + Clone;
/// Returns all public keys for the given key type in the keystore.
fn all(key_type: KeyTypeId) -> crate::Vec;
@@ -101,7 +105,7 @@ pub trait RuntimeAppPublic: Sized {
const ID: KeyTypeId;
/// The signature that will be generated when signing with the corresponding private key.
- type Signature: Codec + MaybeDebugHash + Eq + PartialEq + Clone;
+ type Signature: Codec + Debug + MaybeHash + Eq + PartialEq + Clone;
/// Returns all public keys for this application in the keystore.
fn all() -> crate::Vec;
diff --git a/core/authority-discovery/primitives/src/lib.rs b/core/authority-discovery/primitives/src/lib.rs
index 13da4de020466..7c56dc6ca4ca6 100644
--- a/core/authority-discovery/primitives/src/lib.rs
+++ b/core/authority-discovery/primitives/src/lib.rs
@@ -20,12 +20,13 @@
use client::decl_runtime_apis;
use rstd::vec::Vec;
+use sr_primitives::RuntimeDebug;
-#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone)]
-#[cfg_attr(feature = "std", derive(Debug, Hash))]
+#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone, RuntimeDebug)]
+#[cfg_attr(feature = "std", derive(Hash))]
pub struct Signature(pub Vec);
-#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone)]
-#[cfg_attr(feature = "std", derive(Debug, Hash))]
+#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone, RuntimeDebug)]
+#[cfg_attr(feature = "std", derive(Hash))]
pub struct AuthorityId(pub Vec);
decl_runtime_apis! {
diff --git a/core/cli/src/lib.rs b/core/cli/src/lib.rs
index e891f90dc26d4..51363445dc97a 100644
--- a/core/cli/src/lib.rs
+++ b/core/cli/src/lib.rs
@@ -675,13 +675,6 @@ where
config.database_path = db_path(&base_path, config.chain_spec.id());
config.database_cache_size = cli.database_cache_size;
config.state_cache_size = cli.state_cache_size;
- config.pruning = match cli.pruning {
- Some(ref s) if s == "archive" => PruningMode::ArchiveAll,
- None => PruningMode::default(),
- Some(s) => PruningMode::keep_blocks(s.parse()
- .map_err(|_| error::Error::Input("Invalid pruning mode specified".to_string()))?
- ),
- };
let is_dev = cli.shared_params.dev;
@@ -694,6 +687,28 @@ where
service::Roles::FULL
};
+ // by default we disable pruning if the node is an authority (i.e.
+ // `ArchiveAll`), otherwise we keep state for the last 256 blocks. if the
+ // node is an authority and pruning is enabled explicitly, then we error
+ // unless `unsafe_pruning` is set.
+ config.pruning = match cli.pruning {
+ Some(ref s) if s == "archive" => PruningMode::ArchiveAll,
+ None if role == service::Roles::AUTHORITY => PruningMode::ArchiveAll,
+ None => PruningMode::default(),
+ Some(s) => {
+ if role == service::Roles::AUTHORITY && !cli.unsafe_pruning {
+ return Err(error::Error::Input(
+ "Validators should run with state pruning disabled (i.e. archive). \
+ You can ignore this check with `--unsafe-pruning`.".to_string()
+ ));
+ }
+
+ PruningMode::keep_blocks(s.parse()
+ .map_err(|_| error::Error::Input("Invalid pruning mode specified".to_string()))?
+ )
+ },
+ };
+
config.wasm_method = cli.wasm_method.into();
let exec = cli.execution_strategies;
@@ -788,7 +803,7 @@ where
G: RuntimeGenesis,
E: ChainSpecExtension,
{
- if spec.boot_nodes().is_empty() {
+ if spec.boot_nodes().is_empty() && !cli.disable_default_bootnode {
let base_path = base_path(&cli.shared_params, version);
let storage_path = network_path(&base_path, spec.id());
let node_key = node_key_config(cli.node_key_params, &Some(storage_path))?;
diff --git a/core/cli/src/params.rs b/core/cli/src/params.rs
index b949b336de542..ae1c856622735 100644
--- a/core/cli/src/params.rs
+++ b/core/cli/src/params.rs
@@ -366,12 +366,22 @@ pub struct RunCmd {
#[structopt(long = "rpc-cors", value_name = "ORIGINS", parse(try_from_str = parse_cors))]
pub rpc_cors: Option,
- /// Specify the pruning mode, a number of blocks to keep or 'archive'.
+ /// Specify the state pruning mode, a number of blocks to keep or 'archive'.
///
- /// Default is 256.
+ /// Default is to keep all block states if the node is running as a
+ /// validator (i.e. 'archive'), otherwise state is only kept for the last
+ /// 256 blocks.
#[structopt(long = "pruning", value_name = "PRUNING_MODE")]
pub pruning: Option,
+ /// Force start with unsafe pruning settings.
+ ///
+ /// When running as a validator it is highly recommended to disable state
+ /// pruning (i.e. 'archive') which is the default. The node will refuse to
+ /// start as a validator if pruning is enabled unless this option is set.
+ #[structopt(long = "unsafe-pruning")]
+ pub unsafe_pruning: bool,
+
/// The human-readable name for this node.
///
/// The node name will be reported to the telemetry server, if enabled.
@@ -604,6 +614,13 @@ pub struct BuildSpecCmd {
#[structopt(long = "raw")]
pub raw: bool,
+ /// Disable adding the default bootnode to the specification.
+ ///
+ /// By default the `/ip4/127.0.0.1/tcp/30333/p2p/NODE_PEER_ID` bootnode is added to the
+ /// specification when no bootnode exists.
+ #[structopt(long = "disable-default-bootnode")]
+ pub disable_default_bootnode: bool,
+
#[allow(missing_docs)]
#[structopt(flatten)]
pub shared_params: SharedParams,
@@ -753,7 +770,7 @@ impl StructOpt for CoreParams where
)
).subcommand(
BuildSpecCmd::augment_clap(SubCommand::with_name("build-spec"))
- .about("Build a spec.json file, outputing to stdout.")
+ .about("Build a spec.json file, outputting to stdout.")
)
.subcommand(
ExportBlocksCmd::augment_clap(SubCommand::with_name("export-blocks"))
diff --git a/core/consensus/babe/primitives/src/digest.rs b/core/consensus/babe/primitives/src/digest.rs
index ff62ae29c5293..95dd247810782 100644
--- a/core/consensus/babe/primitives/src/digest.rs
+++ b/core/consensus/babe/primitives/src/digest.rs
@@ -195,8 +195,7 @@ impl Decode for BabePreDigest {
/// Information about the next epoch. This is broadcast in the first block
/// of the epoch.
-#[derive(Decode, Encode, Default, PartialEq, Eq, Clone)]
-#[cfg_attr(any(feature = "std", test), derive(Debug))]
+#[derive(Decode, Encode, Default, PartialEq, Eq, Clone, sr_primitives::RuntimeDebug)]
pub struct NextEpochDescriptor {
/// The authorities.
pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>,
diff --git a/core/consensus/babe/primitives/src/lib.rs b/core/consensus/babe/primitives/src/lib.rs
index 1293b7c8baa00..c464e797d8d58 100644
--- a/core/consensus/babe/primitives/src/lib.rs
+++ b/core/consensus/babe/primitives/src/lib.rs
@@ -23,7 +23,7 @@ mod digest;
use codec::{Encode, Decode};
use rstd::vec::Vec;
-use sr_primitives::ConsensusEngineId;
+use sr_primitives::{ConsensusEngineId, RuntimeDebug};
use substrate_client::decl_runtime_apis;
#[cfg(feature = "std")]
@@ -79,8 +79,7 @@ pub type BabeAuthorityWeight = u64;
pub type BabeBlockWeight = u32;
/// BABE epoch information
-#[derive(Decode, Encode, Default, PartialEq, Eq, Clone)]
-#[cfg_attr(any(feature = "std", test), derive(Debug))]
+#[derive(Decode, Encode, Default, PartialEq, Eq, Clone, RuntimeDebug)]
pub struct Epoch {
/// The epoch index
pub epoch_index: u64,
@@ -127,8 +126,7 @@ pub enum ConsensusLog {
}
/// Configuration data used by the BABE consensus engine.
-#[derive(Clone, PartialEq, Eq, Encode, Decode)]
-#[cfg_attr(any(feature = "std", test), derive(Debug))]
+#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)]
pub struct BabeConfiguration {
/// The slot duration in milliseconds for BABE. Currently, only
/// the value provided by this type at genesis will be used.
diff --git a/core/executor/runtime-test/Cargo.toml b/core/executor/runtime-test/Cargo.toml
index 153c5c9a1f49f..72041218bf9f2 100644
--- a/core/executor/runtime-test/Cargo.toml
+++ b/core/executor/runtime-test/Cargo.toml
@@ -13,7 +13,7 @@ primitives = { package = "substrate-primitives", path = "../../primitives", def
sr-primitives = { package = "sr-primitives", path = "../../sr-primitives", default-features = false }
[build-dependencies]
-wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2", path = "../../utils/wasm-builder-runner" }
+wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.4", path = "../../utils/wasm-builder-runner" }
[features]
default = [ "std" ]
diff --git a/core/executor/runtime-test/build.rs b/core/executor/runtime-test/build.rs
index 136dc793986b5..68e5205f0c7a8 100644
--- a/core/executor/runtime-test/build.rs
+++ b/core/executor/runtime-test/build.rs
@@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../utils/wasm-builder",
- version: "1.0.7",
+ version: "1.0.8",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
diff --git a/core/executor/src/host_interface.rs b/core/executor/src/host_interface.rs
index 7c99415f6c752..e6386ff1acc4b 100644
--- a/core/executor/src/host_interface.rs
+++ b/core/executor/src/host_interface.rs
@@ -151,6 +151,22 @@ impl_wasm_host_interface! {
Ok(())
}
+ ext_log(
+ level: u32,
+ target_data: Pointer,
+ target_len: WordSize,
+ message_data: Pointer,
+ message_len: WordSize,
+ ) {
+ let target = context.read_memory(target_data, target_len)
+ .map_err(|_| "Invalid attempt to determine target in ext_log")?;
+ let message = context.read_memory(message_data, message_len)
+ .map_err(|_| "Invalid attempt to determine message in ext_log")?;
+
+ runtime_io::log(level.into(), &target, &message);
+ Ok(())
+ }
+
ext_set_storage(
key_data: Pointer,
key_len: WordSize,
diff --git a/core/finality-grandpa/primitives/src/lib.rs b/core/finality-grandpa/primitives/src/lib.rs
index a439953899cc7..27139bbeeffa8 100644
--- a/core/finality-grandpa/primitives/src/lib.rs
+++ b/core/finality-grandpa/primitives/src/lib.rs
@@ -24,7 +24,7 @@ extern crate alloc;
#[cfg(feature = "std")]
use serde::Serialize;
use codec::{Encode, Decode, Codec};
-use sr_primitives::ConsensusEngineId;
+use sr_primitives::{ConsensusEngineId, RuntimeDebug};
use client::decl_runtime_apis;
use rstd::vec::Vec;
@@ -59,8 +59,8 @@ pub type SetId = u64;
pub type RoundNumber = u64;
/// A scheduled change of authority set.
-#[cfg_attr(feature = "std", derive(Debug, Serialize))]
-#[derive(Clone, Eq, PartialEq, Encode, Decode)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)]
pub struct ScheduledChange {
/// The new authorities after the change, along with their respective weights.
pub next_authorities: Vec<(AuthorityId, AuthorityWeight)>,
@@ -69,8 +69,8 @@ pub struct ScheduledChange {
}
/// An consensus log item for GRANDPA.
-#[cfg_attr(feature = "std", derive(Serialize, Debug))]
-#[derive(Decode, Encode, PartialEq, Eq, Clone)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Decode, Encode, PartialEq, Eq, Clone, RuntimeDebug)]
pub enum ConsensusLog {
/// Schedule an authority set change.
///
diff --git a/core/finality-grandpa/src/communication/mod.rs b/core/finality-grandpa/src/communication/mod.rs
index ba7bdce336258..f2a4dee21e9b3 100644
--- a/core/finality-grandpa/src/communication/mod.rs
+++ b/core/finality-grandpa/src/communication/mod.rs
@@ -31,6 +31,7 @@ use std::sync::Arc;
use futures::prelude::*;
use futures::sync::{oneshot, mpsc};
+use futures03::stream::{StreamExt, TryStreamExt};
use grandpa::Message::{Prevote, Precommit, PrimaryPropose};
use grandpa::{voter, voter_set::VoterSet};
use log::{debug, trace};
@@ -100,7 +101,7 @@ mod benefit {
/// Intended to be a lightweight handle such as an `Arc`.
pub trait Network: Clone + Send + 'static {
/// A stream of input messages for a topic.
- type In: Stream- ;
+ type In: Stream
- ;
/// Get a stream of messages for a specific gossip topic.
fn messages_for(&self, topic: Block::Hash) -> Self::In;
@@ -145,7 +146,9 @@ impl Network for Arc> where
S: network::specialization::NetworkSpecialization,
H: network::ExHashT,
{
- type In = NetworkStream;
+ type In = NetworkStream<
+ Box + Send + 'static>,
+ >;
fn messages_for(&self, topic: B::Hash) -> Self::In {
// Given that one can only communicate with the Substrate network via the `NetworkService` via message-passing,
@@ -159,7 +162,11 @@ impl Network for Arc> where
// waiting for the oneshot to resolve and from there on acting like a normal message channel.
let (tx, rx) = oneshot::channel();
self.with_gossip(move |gossip, _| {
- let inner_rx = gossip.messages_for(GRANDPA_ENGINE_ID, topic);
+ let inner_rx: Box + Send> = Box::new(gossip
+ .messages_for(GRANDPA_ENGINE_ID, topic)
+ .map(|x| Ok(x))
+ .compat()
+ );
let _ = tx.send(inner_rx);
});
NetworkStream::PollingOneshot(rx)
@@ -220,13 +227,16 @@ impl Network for Arc> where
///
/// `NetworkStream` combines the two steps into one, requiring a consumer to only poll `NetworkStream` to retrieve
/// messages directly.
-pub enum NetworkStream {
- PollingOneshot(oneshot::Receiver>),
- PollingTopicNotifications(mpsc::UnboundedReceiver),
+pub enum NetworkStream {
+ PollingOneshot(oneshot::Receiver),
+ PollingTopicNotifications(R),
}
-impl Stream for NetworkStream {
- type Item = network_gossip::TopicNotification;
+impl Stream for NetworkStream
+where
+ R: Stream
- ,
+{
+ type Item = R::Item;
type Error = ();
fn poll(&mut self) -> Poll