From aa3adbb80fc46f0acc004ca465998aa2abf651cf Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 14 Sep 2018 11:37:38 +0200 Subject: [PATCH 1/7] First effort --- Cargo.lock | 129 ++++++++++++++++-------------- core/bft/Cargo.toml | 2 +- core/client/Cargo.toml | 2 +- core/client/db/Cargo.toml | 2 +- core/executor/Cargo.toml | 2 +- core/extrinsic-pool/Cargo.toml | 2 +- core/metadata/Cargo.toml | 2 +- core/misbehavior-check/Cargo.toml | 2 +- core/network/Cargo.toml | 2 +- core/primitives/Cargo.toml | 2 +- core/rpc/Cargo.toml | 2 +- core/service/Cargo.toml | 2 +- core/sr-io/Cargo.toml | 2 +- core/sr-primitives/Cargo.toml | 2 +- core/sr-sandbox/Cargo.toml | 2 +- core/sr-version/Cargo.toml | 2 +- core/sr-version/src/lib.rs | 30 ++++--- core/state-db/Cargo.toml | 2 +- core/state-machine/Cargo.toml | 2 +- core/test-client/Cargo.toml | 2 +- core/test-runtime/Cargo.toml | 2 +- core/test-runtime/src/lib.rs | 1 + core/test-runtime/wasm/Cargo.lock | 38 +++++---- core/test-runtime/wasm/Cargo.toml | 2 +- node/consensus/Cargo.toml | 2 +- node/executor/Cargo.toml | 2 +- node/primitives/Cargo.toml | 2 +- node/runtime/Cargo.toml | 2 +- node/runtime/src/lib.rs | 1 + node/runtime/wasm/Cargo.lock | 82 ++++++++++--------- node/runtime/wasm/Cargo.toml | 2 +- node/transaction-pool/Cargo.toml | 2 +- srml/balances/Cargo.toml | 2 +- srml/consensus/Cargo.toml | 2 +- srml/contract/Cargo.toml | 2 +- srml/council/Cargo.toml | 2 +- srml/democracy/Cargo.toml | 2 +- srml/example/Cargo.toml | 2 +- srml/executive/Cargo.toml | 2 +- srml/session/Cargo.toml | 2 +- srml/staking/Cargo.toml | 2 +- srml/support/Cargo.toml | 2 +- srml/system/Cargo.toml | 2 +- srml/timestamp/Cargo.toml | 2 +- srml/treasury/Cargo.toml | 2 +- 45 files changed, 191 insertions(+), 168 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c1bf75e3a5aa0..8d9c2d39ab48f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -444,7 +444,8 @@ dependencies = [ [[package]] name = "environmental" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "error-chain" @@ -1444,7 +1445,7 @@ dependencies = [ "node-primitives 0.1.0", "node-runtime 0.1.0", "node-transaction-pool 0.1.0", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -1462,7 +1463,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 0.1.0", "node-runtime 0.1.0", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "srml-balances 0.1.0", @@ -1500,8 +1501,8 @@ dependencies = [ name = "node-primitives" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1518,8 +1519,8 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 0.1.0", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1579,7 +1580,7 @@ dependencies = [ "node-api 0.1.0", "node-primitives 0.1.0", "node-runtime 0.1.0", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-client 0.1.0", @@ -1661,16 +1662,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-codec" -version = "0.1.0" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-codec-derive" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-codec 0.1.0", "proc-macro2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2293,9 +2295,9 @@ dependencies = [ name = "sr-io" version = "0.1.0" dependencies = [ - "environmental 0.1.0", + "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -2311,8 +2313,8 @@ dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2326,7 +2328,7 @@ name = "sr-sandbox" version = "0.1.0" dependencies = [ "assert_matches 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-std 0.1.0", @@ -2346,8 +2348,8 @@ dependencies = [ name = "sr-version" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -2358,8 +2360,8 @@ name = "srml-balances" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2377,8 +2379,8 @@ name = "srml-consensus" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -2394,7 +2396,7 @@ name = "srml-contract" version = "0.1.0" dependencies = [ "assert_matches 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2416,8 +2418,8 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2438,8 +2440,8 @@ name = "srml-democracy" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2458,8 +2460,8 @@ name = "srml-example" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -2476,8 +2478,8 @@ name = "srml-executive" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -2494,8 +2496,8 @@ name = "srml-session" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2515,8 +2517,8 @@ name = "srml-staking" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2539,8 +2541,8 @@ name = "srml-support" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2556,8 +2558,8 @@ name = "srml-system" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2573,7 +2575,7 @@ name = "srml-timestamp" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -2590,8 +2592,8 @@ name = "srml-treasury" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -2644,7 +2646,7 @@ dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -2697,7 +2699,7 @@ dependencies = [ "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2725,8 +2727,8 @@ dependencies = [ "kvdb-rocksdb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-client 0.1.0", @@ -2747,7 +2749,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2769,7 +2771,7 @@ dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2808,14 +2810,14 @@ dependencies = [ name = "substrate-metadata" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-misbehavior-check" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", @@ -2834,8 +2836,8 @@ dependencies = [ "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -2884,8 +2886,8 @@ dependencies = [ "hashdb 0.2.1 (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.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2912,7 +2914,7 @@ dependencies = [ "jsonrpc-macros 8.0.1 (git+https://github.com/paritytech/jsonrpc.git)", "jsonrpc-pubsub 8.0.1 (git+https://github.com/paritytech/jsonrpc.git)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2958,7 +2960,7 @@ dependencies = [ "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2986,8 +2988,8 @@ version = "0.1.0" dependencies = [ "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", ] @@ -3002,7 +3004,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3029,7 +3031,7 @@ name = "substrate-test-client" version = "0.1.0" dependencies = [ "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "srml-support 0.1.0", @@ -3047,8 +3049,8 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -3794,6 +3796,7 @@ dependencies = [ "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" +"checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "" "checksum ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a93a43ce2e9f09071449da36bfa7a1b20b950ee344b6904ff23de493b03b386" @@ -3895,6 +3898,8 @@ dependencies = [ "checksum openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)" = "d8abc04833dcedef24221a91852931df2f63e3369ae003134e70aff3645775cc" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" +"checksum parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bee4edfcfa19892f7178cb299a659866015dc131459865a1d808269cf7e7eb9e" +"checksum parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eda64d782c342261aea4ca047a609f9bd92d5f9dafabe6b5a396caf5c7b8827" "checksum parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1117f6574377d21309bfa1f7d69ff734120685d92b02c3f362b122585758840" "checksum parity-rocksdb 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cd55d2d6d6000ec99f021cf52c9acc7d2a402e14f95ced4c5de230696fabe00b" "checksum parity-rocksdb-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ae07d4bfb2759541957c19f471996b807fc09ef3a5bdce14409b57f038de49f" diff --git a/core/bft/Cargo.toml b/core/bft/Cargo.toml index ff2dd36603a00..d95092e289afa 100644 --- a/core/bft/Cargo.toml +++ b/core/bft/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] futures = "0.1.17" -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-primitives = { path = "../primitives" } sr-primitives = { path = "../sr-primitives" } sr-version = { path = "../sr-version" } diff --git a/core/client/Cargo.toml b/core/client/Cargo.toml index d9637eeb647a6..5728f359fa54f 100644 --- a/core/client/Cargo.toml +++ b/core/client/Cargo.toml @@ -14,7 +14,7 @@ futures = "0.1.17" slog = "^2" heapsize = "0.4" substrate-bft = { path = "../bft" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-executor = { path = "../executor" } substrate-primitives = { path = "../primitives" } sr-io = { path = "../sr-io" } diff --git a/core/client/db/Cargo.toml b/core/client/db/Cargo.toml index 874cb0c4030a5..cd027bfbdf1fe 100644 --- a/core/client/db/Cargo.toml +++ b/core/client/db/Cargo.toml @@ -14,7 +14,7 @@ substrate-primitives = { path = "../../../core/primitives" } sr-primitives = { path = "../../../core/sr-primitives" } substrate-client = { path = "../../../core/client" } substrate-state-machine = { path = "../../../core/state-machine" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } parity-codec-derive = { version = "~1.0" } substrate-executor = { path = "../../../core/executor" } substrate-state-db = { path = "../../../core/state-db" } diff --git a/core/executor/Cargo.toml b/core/executor/Cargo.toml index 87a9efc7590c1..ae770724b6943 100644 --- a/core/executor/Cargo.toml +++ b/core/executor/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] error-chain = "0.12" -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } sr-io = { path = "../sr-io" } substrate-primitives = { path = "../primitives" } substrate-serializer = { path = "../serializer" } diff --git a/core/extrinsic-pool/Cargo.toml b/core/extrinsic-pool/Cargo.toml index fed64a7b9ca31..427fd96463d7c 100644 --- a/core/extrinsic-pool/Cargo.toml +++ b/core/extrinsic-pool/Cargo.toml @@ -16,4 +16,4 @@ sr-primitives = { path = "../../core/sr-primitives" } [dev-dependencies] substrate-test-client = { path = "../../core/test-client" } substrate-keyring = { path = "../../core/keyring" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } diff --git a/core/metadata/Cargo.toml b/core/metadata/Cargo.toml index b50780addadbd..2bba98100e9a6 100644 --- a/core/metadata/Cargo.toml +++ b/core/metadata/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } [features] default = ["std"] diff --git a/core/misbehavior-check/Cargo.toml b/core/misbehavior-check/Cargo.toml index e48507e994661..faa87a4b88281 100644 --- a/core/misbehavior-check/Cargo.toml +++ b/core/misbehavior-check/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -parity-codec = { version = "~1.0", default-features = false } +parity-codec = { version = "1.1", default-features = false } substrate-primitives = { path = "../primitives", default-features = false } sr-primitives = { path = "../sr-primitives", default-features = false } sr-io = { path = "../sr-io", default-features = false } diff --git a/core/network/Cargo.toml b/core/network/Cargo.toml index 164f4f22bef9b..912c9f43a5a1c 100644 --- a/core/network/Cargo.toml +++ b/core/network/Cargo.toml @@ -18,7 +18,7 @@ rustc-hex = "1.0" substrate-primitives = { path = "../../core/primitives" } substrate-client = { path = "../../core/client" } sr-primitives = { path = "../../core/sr-primitives" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } parity-codec-derive = { version = "~1.0" } substrate-network-libp2p = { path = "../../core/network-libp2p" } diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 1acbd2673b634..963b390430a22 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] [dependencies] crunchy = "0.1" sr-std = { path = "../sr-std", default_features = false } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } elastic-array = {version = "0.10", optional = true } fixed-hash = { version = "0.2.2", default_features = false } diff --git a/core/rpc/Cargo.toml b/core/rpc/Cargo.toml index 89fa3349c7c56..d9fec2e4e257c 100644 --- a/core/rpc/Cargo.toml +++ b/core/rpc/Cargo.toml @@ -10,7 +10,7 @@ jsonrpc-macros = { git="https://github.com/paritytech/jsonrpc.git" } jsonrpc-pubsub = { git="https://github.com/paritytech/jsonrpc.git" } log = "0.3" parking_lot = "0.4" -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-client = { path = "../client" } substrate-executor = { path = "../executor" } substrate-extrinsic-pool = { path = "../extrinsic-pool" } diff --git a/core/service/Cargo.toml b/core/service/Cargo.toml index d96a88655db4e..189b3c0b18a4c 100644 --- a/core/service/Cargo.toml +++ b/core/service/Cargo.toml @@ -23,7 +23,7 @@ substrate-primitives = { path = "../../core/primitives" } substrate-network = { path = "../../core/network" } substrate-client = { path = "../../core/client" } substrate-client-db = { path = "../../core/client/db" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-executor = { path = "../../core/executor" } substrate-extrinsic-pool = { path = "../../core/extrinsic-pool" } substrate-rpc = { path = "../../core/rpc" } diff --git a/core/sr-io/Cargo.toml b/core/sr-io/Cargo.toml index 9744afcf0db3a..4254e9ef119b1 100644 --- a/core/sr-io/Cargo.toml +++ b/core/sr-io/Cargo.toml @@ -12,7 +12,7 @@ sr-std = { path = "../sr-std", default_features = false } environmental = { version = "~1.0", optional = true } substrate-state-machine = { path = "../state-machine", optional = true } substrate-primitives = { path = "../primitives", default_features = false } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } triehash = { version = "0.2", optional = true } hashdb = { version = "0.2", default_features = false } rlp = { version = "0.2", optional = true, default_features = false } diff --git a/core/sr-primitives/Cargo.toml b/core/sr-primitives/Cargo.toml index 86b283498abba..7659daa197b65 100644 --- a/core/sr-primitives/Cargo.toml +++ b/core/sr-primitives/Cargo.toml @@ -8,7 +8,7 @@ num-traits = { version = "0.2", default_features = false } integer-sqrt = { git = "https://github.com/paritytech/integer-sqrt-rs.git", branch = "master" } serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../primitives", default_features = false } sr-std = { path = "../sr-std", default_features = false } diff --git a/core/sr-sandbox/Cargo.toml b/core/sr-sandbox/Cargo.toml index cbb293d0deeae..b22e212a1a335 100755 --- a/core/sr-sandbox/Cargo.toml +++ b/core/sr-sandbox/Cargo.toml @@ -12,7 +12,7 @@ wasmi = { version = "0.4", optional = true } substrate-primitives = { path = "../primitives", default_features = false } sr-std = { path = "../sr-std", default_features = false } sr-io = { path = "../sr-io", default_features = false } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } [dev-dependencies] wabt = "0.4" diff --git a/core/sr-version/Cargo.toml b/core/sr-version/Cargo.toml index e00f983418494..0122af6924331 100644 --- a/core/sr-version/Cargo.toml +++ b/core/sr-version/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] [dependencies] serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } sr-std = { path = "../sr-std", default_features = false } diff --git a/core/sr-version/src/lib.rs b/core/sr-version/src/lib.rs index 2a66e0a794b39..c69b81d18769d 100644 --- a/core/sr-version/src/lib.rs +++ b/core/sr-version/src/lib.rs @@ -42,6 +42,11 @@ pub type VersionString = ::std::borrow::Cow<'static, str>; #[cfg(not(feature = "std"))] pub type VersionString = &'static str; +#[cfg(feature = "std")] +pub type ApisVec = ::std::borrow::Cow<'static, [(VersionString, u32)]>; +#[cfg(not(feature = "std"))] +pub type ApisVec = &'static [(VersionString, u32)]; + #[cfg(feature = "std")] #[macro_export] macro_rules! ver_str { @@ -54,6 +59,11 @@ macro_rules! ver_str { ( $y:expr ) => {{ $y }} } +#[macro_export] +macro_rules! apis_vec { + ( $y:expr ) => { ver_str!(&$y[..]) } +} + /// Runtime version. /// This should not be thought of as classic Semver (major/minor/tiny). /// This triplet have different semantics and mis-interpretation could cause problems. @@ -90,20 +100,9 @@ pub struct RuntimeVersion { /// Non-consensus-breaking optimisations are about the only changes that could be made which /// would result in only the `impl_version` changing. pub impl_version: u32, -} -// TODO: remove this after PoC-2 -#[cfg(feature = "std")] -impl Default for RuntimeVersion { - fn default() -> RuntimeVersion { - RuntimeVersion { - spec_name: ver_str!("polkadot"), - impl_name: ver_str!("parity-polkadot"), - authoring_version: 0, - spec_version: 0, - impl_version: 0, - } - } + /// List of supported API "features" along with their versions. + pub apis: ApisVec, } #[cfg(feature = "std")] @@ -127,4 +126,9 @@ impl RuntimeVersion { self.authoring_version == other.authoring_version && self.spec_name == other.spec_name } + + /// Check if this version supports a particular API. + pub fn has_api(&self, api: VersionString, version: u32) -> bool { + self.apis.iter().any(|&(ref s, v)| &api == s && version == v) + } } diff --git a/core/state-db/Cargo.toml b/core/state-db/Cargo.toml index e39b4926c45e0..c0a8dd617872f 100644 --- a/core/state-db/Cargo.toml +++ b/core/state-db/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] parking_lot = "0.5" log = "0.4" substrate-primitives = { path = "../../core/primitives" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } parity-codec-derive = { version = "~1.0" } [dev-dependencies] diff --git a/core/state-machine/Cargo.toml b/core/state-machine/Cargo.toml index ff72282ebbe31..d4fca19be6cf5 100644 --- a/core/state-machine/Cargo.toml +++ b/core/state-machine/Cargo.toml @@ -17,5 +17,5 @@ triehash = "0.2" rlp = "0.2.4" substrate-primitives = { path = "../primitives", version = "0.1.0" } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } diff --git a/core/test-client/Cargo.toml b/core/test-client/Cargo.toml index d2b4e8d0b9d52..7814178f81abe 100644 --- a/core/test-client/Cargo.toml +++ b/core/test-client/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] rhododendron = "0.3" substrate-bft = { path = "../bft" } substrate-client = { path = "../client" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-executor = { path = "../executor" } substrate-keyring = { path = "../../core/keyring" } substrate-primitives = { path = "../primitives" } diff --git a/core/test-runtime/Cargo.toml b/core/test-runtime/Cargo.toml index 0ef53bbd9dce9..a0d047ce54dd9 100644 --- a/core/test-runtime/Cargo.toml +++ b/core/test-runtime/Cargo.toml @@ -8,7 +8,7 @@ log = { version = "0.3", optional = true } hex-literal = { version = "0.1.0", optional = true } serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default-features = false } +parity-codec = { version = "1.1", default-features = false } parity-codec-derive = { version = "~1.0", default-features = false } substrate-keyring = { path = "../keyring", optional = true } substrate-primitives = { path = "../primitives", default-features = false } diff --git a/core/test-runtime/src/lib.rs b/core/test-runtime/src/lib.rs index 2418ad34001dd..cbd4bb74419ef 100644 --- a/core/test-runtime/src/lib.rs +++ b/core/test-runtime/src/lib.rs @@ -67,6 +67,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 1, + apis: apis_vec!([("node-authoring", 1)]), }; fn version() -> RuntimeVersion { diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index 4c22f9f1318ff..dbb3dc7876f8e 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -86,7 +86,8 @@ dependencies = [ [[package]] name = "environmental" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ethbloom" @@ -280,14 +281,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-codec" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-codec-derive" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -497,9 +500,9 @@ dependencies = [ name = "sr-io" version = "0.1.0" dependencies = [ - "environmental 0.1.0", + "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -515,8 +518,8 @@ dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -535,8 +538,8 @@ dependencies = [ name = "sr-version" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -547,7 +550,7 @@ name = "srml-support" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -565,7 +568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "substrate-metadata" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -580,8 +583,8 @@ dependencies = [ "fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -606,7 +609,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -620,8 +623,8 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -743,6 +746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb" +"checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" "checksum ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a93a43ce2e9f09071449da36bfa7a1b20b950ee344b6904ff23de493b03b386" "checksum ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35b3c5a18bc5e73a32a110ac743ec04b02bbbcd3b71d3118d40a6113d509378a" "checksum ethereum-types-serialize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ac59a21a9ce98e188f3dace9eb67a6c4a3c67ec7fbc7218cb827852679dc002" @@ -769,6 +773,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" +"checksum parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9260216bbb7acdbb72dfb6bcb63245ef5bde9a8fb7706fe641e1caf1e7ae460f" +"checksum parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eda64d782c342261aea4ca047a609f9bd92d5f9dafabe6b5a396caf5c7b8827" "checksum parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1c91199d14bd5b78ecade323d4a891d094799749c1b9e82d9c590c2e2849a40" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" diff --git a/core/test-runtime/wasm/Cargo.toml b/core/test-runtime/wasm/Cargo.toml index 77ac31bded695..c5b452ab8b1b3 100644 --- a/core/test-runtime/wasm/Cargo.toml +++ b/core/test-runtime/wasm/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] [dependencies] log = { version = "0.3", optional = true } hex-literal = { version = "0.1.0", optional = true } -parity-codec = { version = "~1.0", default-features = false } +parity-codec = { version = "1.1", default-features = false } parity-codec-derive = { version = "~1.0", default-features = false } substrate-primitives = { path = "../../primitives", default-features = false } sr-std = { path = "../../sr-std", default-features = false } diff --git a/node/consensus/Cargo.toml b/node/consensus/Cargo.toml index ee51ab3bac8cf..8910d68b31c7f 100644 --- a/node/consensus/Cargo.toml +++ b/node/consensus/Cargo.toml @@ -16,7 +16,7 @@ node-primitives = { path = "../primitives" } node-runtime = { path = "../runtime" } node-transaction-pool = { path = "../transaction-pool" } substrate-bft = { path = "../../core/bft" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-primitives = { path = "../../core/primitives" } substrate-client = { path = "../../core/client" } sr-primitives = { path = "../../core/sr-primitives" } diff --git a/node/executor/Cargo.toml b/node/executor/Cargo.toml index bbc2c9682018d..4e80ce69e2754 100644 --- a/node/executor/Cargo.toml +++ b/node/executor/Cargo.toml @@ -7,7 +7,7 @@ description = "Substrate node implementation in Rust." [dependencies] hex-literal = "0.1" triehash = "0.2" -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } sr-io = { path = "../../core/sr-io" } substrate-state-machine = { path = "../../core/state-machine" } substrate-executor = { path = "../../core/executor" } diff --git a/node/primitives/Cargo.toml b/node/primitives/Cargo.toml index ec5ef9cf56630..aa82f9126a31e 100644 --- a/node/primitives/Cargo.toml +++ b/node/primitives/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] [dependencies] serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } diff --git a/node/runtime/Cargo.toml b/node/runtime/Cargo.toml index 4eaaa84fe3470..a99bae2e0b532 100644 --- a/node/runtime/Cargo.toml +++ b/node/runtime/Cargo.toml @@ -10,7 +10,7 @@ log = { version = "0.3", optional = true } serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } parity-codec-derive = { version = "~1.0" } sr-std = { path = "../../core/sr-std" } sr-io = { path = "../../core/sr-io" } diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index 75578ef2b09ce..52365a607c033 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -93,6 +93,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 0, + apis: apis_vec!([(ver_str!("node-authoring"), 1)]), }; impl system::Trait for Runtime { diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index 3cc27b56897d9..d060de7274bb0 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -86,7 +86,8 @@ dependencies = [ [[package]] name = "environmental" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ethbloom" @@ -251,8 +252,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "node-primitives" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -266,8 +267,8 @@ version = "0.1.0" dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "node-primitives 0.1.0", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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)", "sr-io 0.1.0", "sr-primitives 0.1.0", @@ -321,14 +322,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-codec" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-codec-derive" -version = "0.1.0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -556,9 +559,9 @@ dependencies = [ name = "sr-io" version = "0.1.0" dependencies = [ - "environmental 0.1.0", + "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -574,8 +577,8 @@ dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -587,7 +590,7 @@ dependencies = [ name = "sr-sandbox" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-std 0.1.0", @@ -606,8 +609,8 @@ dependencies = [ name = "sr-version" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -618,8 +621,8 @@ name = "srml-balances" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -637,8 +640,8 @@ name = "srml-consensus" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -653,7 +656,7 @@ dependencies = [ name = "srml-contract" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -674,8 +677,8 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -696,8 +699,8 @@ name = "srml-democracy" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -716,7 +719,7 @@ name = "srml-executive" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -731,8 +734,8 @@ name = "srml-session" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -752,8 +755,8 @@ name = "srml-staking" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -776,7 +779,7 @@ name = "srml-support" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -790,8 +793,8 @@ name = "srml-system" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -807,7 +810,7 @@ name = "srml-timestamp" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -824,8 +827,8 @@ name = "srml-treasury" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -855,7 +858,7 @@ dependencies = [ name = "substrate-metadata" version = "0.1.0" dependencies = [ - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -870,8 +873,8 @@ dependencies = [ "fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", - "parity-codec-derive 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -896,7 +899,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 0.1.0", + "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1017,6 +1020,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb" +"checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" "checksum ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a93a43ce2e9f09071449da36bfa7a1b20b950ee344b6904ff23de493b03b386" "checksum ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35b3c5a18bc5e73a32a110ac743ec04b02bbbcd3b71d3118d40a6113d509378a" "checksum ethereum-types-serialize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ac59a21a9ce98e188f3dace9eb67a6c4a3c67ec7fbc7218cb827852679dc002" @@ -1043,6 +1047,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" +"checksum parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9260216bbb7acdbb72dfb6bcb63245ef5bde9a8fb7706fe641e1caf1e7ae460f" +"checksum parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eda64d782c342261aea4ca047a609f9bd92d5f9dafabe6b5a396caf5c7b8827" "checksum parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1c91199d14bd5b78ecade323d4a891d094799749c1b9e82d9c590c2e2849a40" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" diff --git a/node/runtime/wasm/Cargo.toml b/node/runtime/wasm/Cargo.toml index dcaa828777846..44a7f3ae0603e 100644 --- a/node/runtime/wasm/Cargo.toml +++ b/node/runtime/wasm/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] integer-sqrt = { git = "https://github.com/paritytech/integer-sqrt-rs.git", branch = "master" } safe-mix = { version = "1.0", default_features = false} parity-codec-derive = { version = "~1.0" } -parity-codec = { version = "~1.0", default-features = false } +parity-codec = { version = "1.1", default-features = false } substrate-primitives = { path = "../../../core/primitives", default-features = false } sr-std = { path = "../../../core/sr-std", default-features = false } sr-io = { path = "../../../core/sr-io", default-features = false } diff --git a/node/transaction-pool/Cargo.toml b/node/transaction-pool/Cargo.toml index d369519f56d81..1d410994f5456 100644 --- a/node/transaction-pool/Cargo.toml +++ b/node/transaction-pool/Cargo.toml @@ -11,7 +11,7 @@ node-api = { path = "../api" } node-primitives = { path = "../primitives" } node-runtime = { path = "../runtime" } substrate-client = { path = "../../core/client" } -parity-codec = { version = "~1.0" } +parity-codec = { version = "1.1" } substrate-keyring = { path = "../../core/keyring" } substrate-extrinsic-pool = { path = "../../core/extrinsic-pool" } substrate-primitives = { path = "../../core/primitives" } diff --git a/srml/balances/Cargo.toml b/srml/balances/Cargo.toml index 1e34b2a85651b..7f96db65463ee 100644 --- a/srml/balances/Cargo.toml +++ b/srml/balances/Cargo.toml @@ -8,7 +8,7 @@ hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-keyring = { path = "../../core/keyring", optional = true } substrate-primitives = { path = "../../core/primitives", default_features = false } diff --git a/srml/consensus/Cargo.toml b/srml/consensus/Cargo.toml index 874be42e59fd5..ae737a065b992 100644 --- a/srml/consensus/Cargo.toml +++ b/srml/consensus/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } diff --git a/srml/contract/Cargo.toml b/srml/contract/Cargo.toml index 60a24a689e591..b0463d2c862ab 100644 --- a/srml/contract/Cargo.toml +++ b/srml/contract/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } pwasm-utils = { version = "0.3", default_features = false } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-wasm = { version = "0.31", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-primitives = { path = "../../core/sr-primitives", default_features = false } diff --git a/srml/council/Cargo.toml b/srml/council/Cargo.toml index a79e8515775ef..82b2b1c268939 100644 --- a/srml/council/Cargo.toml +++ b/srml/council/Cargo.toml @@ -9,7 +9,7 @@ integer-sqrt = { git = "https://github.com/paritytech/integer-sqrt-rs.git", bran serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-keyring = { path = "../../core/keyring", optional = true } substrate-primitives = { path = "../../core/primitives", default_features = false } diff --git a/srml/democracy/Cargo.toml b/srml/democracy/Cargo.toml index 512737696916a..4c85acebf6265 100644 --- a/srml/democracy/Cargo.toml +++ b/srml/democracy/Cargo.toml @@ -8,7 +8,7 @@ hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } diff --git a/srml/example/Cargo.toml b/srml/example/Cargo.toml index 80c50895a262e..86924d758796d 100644 --- a/srml/example/Cargo.toml +++ b/srml/example/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } diff --git a/srml/executive/Cargo.toml b/srml/executive/Cargo.toml index df74518abf8cd..d12ad2a023cdc 100644 --- a/srml/executive/Cargo.toml +++ b/srml/executive/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } sr-io = { path = "../../core/sr-io", default_features = false } sr-primitives = { path = "../../core/sr-primitives", default_features = false } diff --git a/srml/session/Cargo.toml b/srml/session/Cargo.toml index e0d7729d14836..510ddd190efd7 100644 --- a/srml/session/Cargo.toml +++ b/srml/session/Cargo.toml @@ -10,7 +10,7 @@ serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} substrate-keyring = { path = "../../core/keyring", optional = true } substrate-primitives = { path = "../../core/primitives", default_features = false } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } sr-io = { path = "../../core/sr-io", default_features = false } diff --git a/srml/staking/Cargo.toml b/srml/staking/Cargo.toml index 91868ab32260c..1d23e3659aecd 100644 --- a/srml/staking/Cargo.toml +++ b/srml/staking/Cargo.toml @@ -8,7 +8,7 @@ hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-keyring = { path = "../../core/keyring", optional = true } substrate-primitives = { path = "../../core/primitives", default_features = false } diff --git a/srml/support/Cargo.toml b/srml/support/Cargo.toml index 1677b12dd3d5c..66f171790d395 100644 --- a/srml/support/Cargo.toml +++ b/srml/support/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] hex-literal = { version = "0.1.0", optional = true } serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } substrate-metadata = { path = "../../core/metadata", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } diff --git a/srml/system/Cargo.toml b/srml/system/Cargo.toml index a4c1810d7e8a9..42a2be0200d85 100644 --- a/srml/system/Cargo.toml +++ b/srml/system/Cargo.toml @@ -8,7 +8,7 @@ hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } safe-mix = { version = "1.0", default_features = false} -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } diff --git a/srml/timestamp/Cargo.toml b/srml/timestamp/Cargo.toml index 246d3f9853a46..4035badf800f1 100644 --- a/srml/timestamp/Cargo.toml +++ b/srml/timestamp/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } sr-io = { path = "../../core/sr-io", default_features = false } diff --git a/srml/treasury/Cargo.toml b/srml/treasury/Cargo.toml index a15a2c40de9e7..a61821cfdff7b 100644 --- a/srml/treasury/Cargo.toml +++ b/srml/treasury/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Parity Technologies "] hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } -parity-codec = { version = "~1.0", default_features = false } +parity-codec = { version = "1.1", default_features = false } parity-codec-derive = { version = "~1.0", default_features = false } substrate-primitives = { path = "../../core/primitives", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } From 94ded0ded771957f27e533b78903c5430fa921eb Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 14 Sep 2018 12:57:50 +0200 Subject: [PATCH 2/7] API versioning --- core/executor/wasm/Cargo.lock | 10 +++---- core/rpc/src/chain/tests.rs | 1 + core/sr-version/src/lib.rs | 10 ++++--- core/test-runtime/src/lib.rs | 4 +-- core/test-runtime/wasm/Cargo.lock | 20 +++++++------- node/runtime/src/lib.rs | 6 ++-- node/runtime/wasm/Cargo.lock | 46 +++++++++++++++---------------- 7 files changed, 51 insertions(+), 46 deletions(-) diff --git a/core/executor/wasm/Cargo.lock b/core/executor/wasm/Cargo.lock index 70b4bf3d9337d..fc89bcf025448 100644 --- a/core/executor/wasm/Cargo.lock +++ b/core/executor/wasm/Cargo.lock @@ -33,7 +33,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-codec" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -118,7 +118,7 @@ name = "sr-io" version = "0.1.0" dependencies = [ "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", "substrate-primitives 0.1.0", @@ -128,7 +128,7 @@ dependencies = [ name = "sr-sandbox" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-std 0.1.0", @@ -150,7 +150,7 @@ dependencies = [ "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -191,7 +191,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d5ec8112f00ea8a483e04748a85522184418fd1cf02890b626d8fc28683f7de" "checksum hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1c71fc577cde89b3345d5f2880fecaf462a32e96c619f431279bdaf1ba5ddb1" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" -"checksum parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9260216bbb7acdbb72dfb6bcb63245ef5bde9a8fb7706fe641e1caf1e7ae460f" +"checksum parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bee4edfcfa19892f7178cb299a659866015dc131459865a1d808269cf7e7eb9e" "checksum parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eda64d782c342261aea4ca047a609f9bd92d5f9dafabe6b5a396caf5c7b8827" "checksum plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95fa6386b1d34aaf0adb9b7dd2885dbe7c34190e6263785e5a7ec2b19044a90f" "checksum proc-macro2 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "cccdc7557a98fe98453030f077df7f3a042052fae465bb61d2c2c41435cfd9b6" diff --git a/core/rpc/src/chain/tests.rs b/core/rpc/src/chain/tests.rs index def410532cd25..6a08f4a09b92a 100644 --- a/core/rpc/src/chain/tests.rs +++ b/core/rpc/src/chain/tests.rs @@ -202,6 +202,7 @@ fn should_return_runtime_version() { authoring_version: 1, spec_version: 1, impl_version: 1, + apis: (&[][..]).into() } ); } diff --git a/core/sr-version/src/lib.rs b/core/sr-version/src/lib.rs index c69b81d18769d..c8dab940690d0 100644 --- a/core/sr-version/src/lib.rs +++ b/core/sr-version/src/lib.rs @@ -42,10 +42,12 @@ pub type VersionString = ::std::borrow::Cow<'static, str>; #[cfg(not(feature = "std"))] pub type VersionString = &'static str; +pub type ApiId = [u8; 8]; + #[cfg(feature = "std")] -pub type ApisVec = ::std::borrow::Cow<'static, [(VersionString, u32)]>; +pub type ApisVec = ::std::borrow::Cow<'static, [(ApiId, u32)]>; #[cfg(not(feature = "std"))] -pub type ApisVec = &'static [(VersionString, u32)]; +pub type ApisVec = &'static [(ApiId, u32)]; #[cfg(feature = "std")] #[macro_export] @@ -61,7 +63,7 @@ macro_rules! ver_str { #[macro_export] macro_rules! apis_vec { - ( $y:expr ) => { ver_str!(&$y[..]) } + ( $y:expr ) => { ver_str!(& $y) } } /// Runtime version. @@ -128,7 +130,7 @@ impl RuntimeVersion { } /// Check if this version supports a particular API. - pub fn has_api(&self, api: VersionString, version: u32) -> bool { + pub fn has_api(&self, api: ApiId, version: u32) -> bool { self.apis.iter().any(|&(ref s, v)| &api == s && version == v) } } diff --git a/core/test-runtime/src/lib.rs b/core/test-runtime/src/lib.rs index cbd4bb74419ef..4bf599dd88bba 100644 --- a/core/test-runtime/src/lib.rs +++ b/core/test-runtime/src/lib.rs @@ -67,11 +67,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 1, - apis: apis_vec!([("node-authoring", 1)]), + apis: apis_vec!([]), }; fn version() -> RuntimeVersion { - VERSION + VERSION.clone() } /// Calls in transactions. diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index dbb3dc7876f8e..77df335a47796 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -281,7 +281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-codec" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -502,7 +502,7 @@ version = "0.1.0" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -518,7 +518,7 @@ dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -538,7 +538,7 @@ dependencies = [ name = "sr-version" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -550,7 +550,7 @@ name = "srml-support" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -568,7 +568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "substrate-metadata" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -583,7 +583,7 @@ dependencies = [ "fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -609,7 +609,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -623,7 +623,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", @@ -773,7 +773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" -"checksum parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9260216bbb7acdbb72dfb6bcb63245ef5bde9a8fb7706fe641e1caf1e7ae460f" +"checksum parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bee4edfcfa19892f7178cb299a659866015dc131459865a1d808269cf7e7eb9e" "checksum parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eda64d782c342261aea4ca047a609f9bd92d5f9dafabe6b5a396caf5c7b8827" "checksum parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1c91199d14bd5b78ecade323d4a891d094799749c1b9e82d9c590c2e2849a40" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index 52365a607c033..f5700bea7a433 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -66,7 +66,7 @@ use codec::{Encode, Decode, Input}; use node_primitives::{AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, SessionKey, Signature, InherentData}; use runtime_primitives::generic; use runtime_primitives::traits::{Convert, BlakeTwo256, DigestItem}; -use version::RuntimeVersion; +use version::{RuntimeVersion, ApiId}; use council::{motions as council_motions, voting as council_voting}; #[cfg(any(feature = "std", test))] @@ -86,6 +86,8 @@ const NOTE_OFFLINE_POSITION: u32 = 1; /// Runtime type used to collate and parameterize the various modules. pub struct Runtime; +const NODEAUTH: ApiId = *b"nodeauth"; + /// Runtime version. pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: ver_str!("node"), @@ -93,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 0, - apis: apis_vec!([(ver_str!("node-authoring"), 1)]), + apis: apis_vec!([(NODEAUTH, 1)]), }; impl system::Trait for Runtime { diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index d060de7274bb0..65dc09ce50917 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -252,7 +252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "node-primitives" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -267,7 +267,7 @@ version = "0.1.0" dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "node-primitives 0.1.0", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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)", "sr-io 0.1.0", @@ -322,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-codec" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -561,7 +561,7 @@ version = "0.1.0" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -577,7 +577,7 @@ dependencies = [ "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -590,7 +590,7 @@ dependencies = [ name = "sr-sandbox" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-std 0.1.0", @@ -609,7 +609,7 @@ dependencies = [ name = "sr-version" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,7 +621,7 @@ name = "srml-balances" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -640,7 +640,7 @@ name = "srml-consensus" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -656,7 +656,7 @@ dependencies = [ name = "srml-contract" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -677,7 +677,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -699,7 +699,7 @@ name = "srml-democracy" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -719,7 +719,7 @@ name = "srml-executive" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -734,7 +734,7 @@ name = "srml-session" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -755,7 +755,7 @@ name = "srml-staking" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -779,7 +779,7 @@ name = "srml-support" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -793,7 +793,7 @@ name = "srml-system" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.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.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -810,7 +810,7 @@ name = "srml-timestamp" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", @@ -827,7 +827,7 @@ name = "srml-treasury" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", @@ -858,7 +858,7 @@ dependencies = [ name = "substrate-metadata" version = "0.1.0" dependencies = [ - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -873,7 +873,7 @@ dependencies = [ "fixed-hash 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashdb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -899,7 +899,7 @@ dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memorydb 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1047,7 +1047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c" -"checksum parity-codec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9260216bbb7acdbb72dfb6bcb63245ef5bde9a8fb7706fe641e1caf1e7ae460f" +"checksum parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bee4edfcfa19892f7178cb299a659866015dc131459865a1d808269cf7e7eb9e" "checksum parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eda64d782c342261aea4ca047a609f9bd92d5f9dafabe6b5a396caf5c7b8827" "checksum parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1c91199d14bd5b78ecade323d4a891d094799749c1b9e82d9c590c2e2849a40" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" From a40a8a70231d070276f395f8eff54d591a6a32fd Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 14 Sep 2018 13:53:54 +0200 Subject: [PATCH 3/7] Introduce validate_transaction --- node/runtime/src/lib.rs | 3 +- node/runtime/wasm/Cargo.lock | 1 + srml/executive/Cargo.toml | 3 +- srml/executive/src/lib.rs | 54 ++++++++++++++++++++++++++++++++++-- 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index f5700bea7a433..a5c652bfc7247 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -345,7 +345,8 @@ pub mod api { timestamp => |()| super::Timestamp::get(), random_seed => |()| super::System::random_seed(), account_nonce => |account| super::System::account_nonce(&account), - lookup_address => |address| super::Balances::lookup_address(address) + lookup_address => |address| super::Balances::lookup_address(address), + validate_transaction => |tx| super::Executive::validate_transaction(tx) ); } diff --git a/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index 65dc09ce50917..956fd4f3cbeaa 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -720,6 +720,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", diff --git a/srml/executive/Cargo.toml b/srml/executive/Cargo.toml index d12ad2a023cdc..f59c95a52de8f 100644 --- a/srml/executive/Cargo.toml +++ b/srml/executive/Cargo.toml @@ -8,6 +8,7 @@ hex-literal = "0.1.0" serde = { version = "1.0", default_features = false } serde_derive = { version = "1.0", optional = true } parity-codec = { version = "1.1", default_features = false } +parity-codec-derive = { version = "~1.0", default_features = false } sr-std = { path = "../../core/sr-std", default_features = false } sr-io = { path = "../../core/sr-io", default_features = false } sr-primitives = { path = "../../core/sr-primitives", default_features = false } @@ -15,7 +16,6 @@ srml-support = { path = "../support", default_features = false } srml-system = { path = "../system", default_features = false } [dev-dependencies] -parity-codec-derive = { version = "~1.0" } substrate-primitives = { path = "../../core/primitives" } srml-balances = { path = "../balances" } @@ -27,6 +27,7 @@ std = [ "serde/std", "serde_derive", "parity-codec/std", + "parity-codec-derive/std", "sr-primitives/std", "sr-io/std", "srml-system/std", diff --git a/srml/executive/src/lib.rs b/srml/executive/src/lib.rs index f469e5971b264..da6e898b221d1 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -24,13 +24,13 @@ extern crate serde; #[macro_use] extern crate serde_derive; -#[cfg(test)] #[macro_use] extern crate parity_codec_derive; #[cfg_attr(test, macro_use)] extern crate srml_support as runtime_support; +#[macro_use] extern crate sr_std as rstd; extern crate sr_io as runtime_io; extern crate parity_codec as codec; @@ -51,7 +51,7 @@ use rstd::prelude::*; use rstd::marker::PhantomData; use rstd::result; use primitives::traits::{self, Header, Zero, One, Checkable, Applyable, CheckEqual, OnFinalise, - MakePayment, Hash}; + MakePayment, Hash, As}; use runtime_support::Dispatchable; use codec::{Codec, Encode}; use system::extrinsics_root; @@ -71,6 +71,19 @@ mod internal { } } +/// Priority for a transaction. Additive. Higher is better. +pub type TransactionPriority = u64; +/// Tag for a transaction. No two transactions with the same tag should be placed on-chain. +pub type TransactionTag = Vec; + +/// Information on a transaction's validity and, if valid, on how it relates to other transactions. +#[derive(Clone, PartialEq, Eq, Encode, Decode)] +pub enum TransactionValidity { + Invalid, + Valid(TransactionPriority, Vec, Vec), + Unknown, +} + pub struct Executive< System, Block, @@ -213,6 +226,43 @@ impl< header.state_root().check_equal(&storage_root); assert!(header.state_root() == &storage_root, "Storage root must match that calculated."); } + + /// Check a given transaction for validity. This doesn't execute any + /// side-effects; it merely checks whether the transaction would panic if it were included or not. + /// + /// Changed made to the storage should be discarded. + pub fn validate_transaction(uxt: Block::Extrinsic) -> TransactionValidity { + let encoded_len = uxt.encode().len(); + + // TODO: should be TransactionValidity::Unknown when it doesn't know the lookup. + let xt = if let Ok(xt) = uxt.check_with(Lookup::lookup) { xt } else { return TransactionValidity::Invalid }; + + if let Some(sender) = xt.sender() { + // pay any fees. + if Payment::make_payment(sender, encoded_len).is_err() { + return TransactionValidity::Invalid + } + + // check index + let mut expected_index = >::account_nonce(sender); + if xt.index() < &expected_index { + return TransactionValidity::Invalid + } + if *xt.index() > expected_index + As::sa(256) { + return TransactionValidity::Unknown + } + + let mut deps = Vec::new(); + while expected_index < *xt.index() { + deps.push((sender, expected_index).encode()); + expected_index = expected_index + One::one(); + } + + TransactionValidity::Valid(0u64, deps, vec![(sender, *xt.index()).encode()]) + } else { + return TransactionValidity::Invalid + } + } } #[cfg(test)] From 54a88be6b1e2f03c96b16f441e122e5dae17a4ba Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 14 Sep 2018 16:35:57 +0200 Subject: [PATCH 4/7] Introduce the API plus fixes. --- Cargo.lock | 1 + core/sr-primitives/src/lib.rs | 1 + .../sr-primitives/src/transaction_validity.rs | 33 +++++++++++++++++++ core/test-runtime/src/lib.rs | 2 +- node/api/Cargo.toml | 1 + node/api/src/lib.rs | 25 ++++++++++---- node/runtime/src/lib.rs | 9 ++--- srml/executive/src/lib.rs | 31 ++++++++--------- 8 files changed, 74 insertions(+), 29 deletions(-) create mode 100644 core/sr-primitives/src/transaction_validity.rs diff --git a/Cargo.lock b/Cargo.lock index 8d9c2d39ab48f..59bf3e40b8ed2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1417,6 +1417,7 @@ version = "0.1.0" dependencies = [ "node-primitives 0.1.0", "node-runtime 0.1.0", + "sr-primitives 0.1.0", "substrate-client 0.1.0", "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", diff --git a/core/sr-primitives/src/lib.rs b/core/sr-primitives/src/lib.rs index c0d1133d415df..3913086f23e86 100644 --- a/core/sr-primitives/src/lib.rs +++ b/core/sr-primitives/src/lib.rs @@ -58,6 +58,7 @@ pub mod testing; pub mod traits; pub mod generic; pub mod bft; +pub mod transaction_validity; use traits::{Verify, Lazy}; diff --git a/core/sr-primitives/src/transaction_validity.rs b/core/sr-primitives/src/transaction_validity.rs new file mode 100644 index 0000000000000..e61f34fcc5e7b --- /dev/null +++ b/core/sr-primitives/src/transaction_validity.rs @@ -0,0 +1,33 @@ +// Copyright 2017 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 . + +//! Transaction validity interface. + +use rstd::prelude::*; + +/// Priority for a transaction. Additive. Higher is better. +pub type TransactionPriority = u64; + +/// Tag for a transaction. No two transactions with the same tag should be placed on-chain. +pub type TransactionTag = Vec; + +/// Information on a transaction's validity and, if valid, on how it relates to other transactions. +#[derive(Clone, PartialEq, Eq, Encode, Decode)] +pub enum TransactionValidity { + Invalid, + Valid(TransactionPriority, Vec, Vec), + Unknown, +} diff --git a/core/test-runtime/src/lib.rs b/core/test-runtime/src/lib.rs index 4bf599dd88bba..98bfdb057a630 100644 --- a/core/test-runtime/src/lib.rs +++ b/core/test-runtime/src/lib.rs @@ -71,7 +71,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { }; fn version() -> RuntimeVersion { - VERSION.clone() + VERSION } /// Calls in transactions. diff --git a/node/api/Cargo.toml b/node/api/Cargo.toml index 5a0cee1387772..d7771a66d2cfd 100644 --- a/node/api/Cargo.toml +++ b/node/api/Cargo.toml @@ -8,6 +8,7 @@ node-runtime = { path = "../runtime" } node-primitives = { path = "../primitives" } substrate-client = { path = "../../core/client" } substrate-primitives = { path = "../../core/primitives" } +sr-primitives = { path = "../../core/sr-primitives" } [dev-dependencies] substrate-keyring = { path = "../../core/keyring" } diff --git a/node/api/src/lib.rs b/node/api/src/lib.rs index 233d82aac2bdb..aee45ac81dc6e 100644 --- a/node/api/src/lib.rs +++ b/node/api/src/lib.rs @@ -22,6 +22,7 @@ extern crate node_primitives as primitives; extern crate node_runtime as runtime; extern crate substrate_client as client; +extern crate sr_primitives; extern crate substrate_primitives; pub use client::error::{Error, ErrorKind, Result}; @@ -31,8 +32,9 @@ use client::block_builder::BlockBuilder as ClientBlockBuilder; use client::{Client, CallExecutor}; use primitives::{ AccountId, Block, BlockId, Hash, Index, InherentData, - SessionKey, Timestamp, UncheckedExtrinsic, + SessionKey, Timestamp, UncheckedExtrinsic }; +use sr_primitives::transaction_validity::TransactionValidity; use substrate_primitives::{Blake2Hasher, RlpCodec}; /// Build new blocks. @@ -63,12 +65,17 @@ pub trait Api { /// Get the timestamp registered at a block. fn timestamp(&self, at: &BlockId) -> Result; + // TODO: remove in favour of validate_transaction + /// Get the nonce (né index) of an account at a block. fn index(&self, at: &BlockId, account: AccountId) -> Result; /// Get the account id of an address at a block. fn lookup(&self, at: &BlockId, address: Address) -> Result>; + /// Validate a transaction and determine its dependencies. + fn validate_transaction(&self, at: &BlockId, transaction: UncheckedExtrinsic) -> Result; + /// Evaluate a block. Returns true if the block is good, false if it is known to be bad, /// and an error if we can't evaluate for some reason. fn evaluate_block(&self, at: &BlockId, block: Block) -> Result; @@ -138,18 +145,24 @@ where self.call_api_at(at, "lookup_address", &address) } + fn validate_transaction(&self, at: &BlockId, tx: UncheckedExtrinsic) -> Result { + self.call_api_at(at, "validate_transaction", &tx) + } + fn build_block(&self, at: &BlockId, inherent_data: InherentData) -> Result { + let runtime_version = self.runtime_version_at(at)?; + let mut block_builder = self.new_block_at(at)?; - for inherent in self.inherent_extrinsics(at, inherent_data)? { - block_builder.push(inherent)?; + if runtime_version.has_api(*b"inherent", 1) { + for inherent in self.inherent_extrinsics(at, inherent_data)? { + block_builder.push(inherent)?; + } } - Ok(block_builder) } fn inherent_extrinsics(&self, at: &BlockId, inherent_data: InherentData) -> Result> { - let runtime_version = self.runtime_version_at(at)?; - self.call_api_at(at, "inherent_extrinsics", &(inherent_data, runtime_version.spec_version)) + self.call_api_at(at, "inherent_extrinsics", &inherent_data) } } diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index a5c652bfc7247..7ae582ee596bf 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -86,7 +86,8 @@ const NOTE_OFFLINE_POSITION: u32 = 1; /// Runtime type used to collate and parameterize the various modules. pub struct Runtime; -const NODEAUTH: ApiId = *b"nodeauth"; +const INHERENT: ApiId = *b"inherent"; +const VALIDATX: ApiId = *b"validatx"; /// Runtime version. pub const VERSION: RuntimeVersion = RuntimeVersion { @@ -95,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 0, - apis: apis_vec!([(NODEAUTH, 1)]), + apis: apis_vec!([(INHERENT, 1), (VALIDATX, 1)]), }; impl system::Trait for Runtime { @@ -339,7 +340,7 @@ pub mod api { apply_extrinsic => |extrinsic| super::Executive::apply_extrinsic(extrinsic), execute_block => |block| super::Executive::execute_block(block), finalise_block => |()| super::Executive::finalise_block(), - inherent_extrinsics => |(inherent, spec_version)| super::inherent_extrinsics(inherent, spec_version), + inherent_extrinsics => |inherent| super::inherent_extrinsics(inherent), validator_count => |()| super::Session::validator_count(), validators => |()| super::Session::validators(), timestamp => |()| super::Timestamp::get(), @@ -351,7 +352,7 @@ pub mod api { } /// Produces the list of inherent extrinsics. -fn inherent_extrinsics(data: InherentData, _spec_version: u32) -> Vec { +fn inherent_extrinsics(data: InherentData) -> Vec { let make_inherent = |function| UncheckedExtrinsic { signature: Default::default(), function, diff --git a/srml/executive/src/lib.rs b/srml/executive/src/lib.rs index da6e898b221d1..52f3333cf7dc2 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -24,13 +24,14 @@ extern crate serde; #[macro_use] extern crate serde_derive; +#[cfg(test)] #[macro_use] extern crate parity_codec_derive; #[cfg_attr(test, macro_use)] extern crate srml_support as runtime_support; -#[macro_use] +#[cfg_attr(not(feature = "std"), macro_use)] extern crate sr_std as rstd; extern crate sr_io as runtime_io; extern crate parity_codec as codec; @@ -55,7 +56,7 @@ use primitives::traits::{self, Header, Zero, One, Checkable, Applyable, CheckEqu use runtime_support::Dispatchable; use codec::{Codec, Encode}; use system::extrinsics_root; -use primitives::{ApplyOutcome, ApplyError}; +use primitives::{ApplyOutcome, ApplyError, transaction_validity::TransactionValidity}; mod internal { pub enum ApplyError { @@ -71,19 +72,6 @@ mod internal { } } -/// Priority for a transaction. Additive. Higher is better. -pub type TransactionPriority = u64; -/// Tag for a transaction. No two transactions with the same tag should be placed on-chain. -pub type TransactionTag = Vec; - -/// Information on a transaction's validity and, if valid, on how it relates to other transactions. -#[derive(Clone, PartialEq, Eq, Encode, Decode)] -pub enum TransactionValidity { - Invalid, - Valid(TransactionPriority, Vec, Vec), - Unknown, -} - pub struct Executive< System, Block, @@ -234,8 +222,15 @@ impl< pub fn validate_transaction(uxt: Block::Extrinsic) -> TransactionValidity { let encoded_len = uxt.encode().len(); - // TODO: should be TransactionValidity::Unknown when it doesn't know the lookup. - let xt = if let Ok(xt) = uxt.check_with(Lookup::lookup) { xt } else { return TransactionValidity::Invalid }; + let xt = match uxt.check_with(Lookup::lookup) { + // Checks out. Carry on. + Ok(xt) => xt, + // An unknown account index implies that the transaction may yet become valid. + Err("invalid account index") => return TransactionValidity::Unknown, + // Technically a bad signature could also imply an out-of-date account index, but + // that's more of an edge case. + Err(_) => return TransactionValidity::Invalid, + }; if let Some(sender) = xt.sender() { // pay any fees. @@ -258,7 +253,7 @@ impl< expected_index = expected_index + One::one(); } - TransactionValidity::Valid(0u64, deps, vec![(sender, *xt.index()).encode()]) + TransactionValidity::Valid(encoded_len as u64, deps, vec![(sender, *xt.index()).encode()]) } else { return TransactionValidity::Invalid } From 8c5915c22193d9088b5f47e8503a1ff3399af51d Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 14 Sep 2018 16:48:11 +0200 Subject: [PATCH 5/7] Docs --- core/sr-version/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/sr-version/src/lib.rs b/core/sr-version/src/lib.rs index c8dab940690d0..1a008ef5d6063 100644 --- a/core/sr-version/src/lib.rs +++ b/core/sr-version/src/lib.rs @@ -42,10 +42,15 @@ pub type VersionString = ::std::borrow::Cow<'static, str>; #[cfg(not(feature = "std"))] pub type VersionString = &'static str; +/// The identity of a particular API interface that the runtime might provide. pub type ApiId = [u8; 8]; +/// A vector of pairs of `ApiId` and a `u32` for version. For `"std"` builds, this +/// is a `Cow`. #[cfg(feature = "std")] pub type ApisVec = ::std::borrow::Cow<'static, [(ApiId, u32)]>; +/// A vector of pairs of `ApiId` and a `u32` for version. For `"no-std"` builds, this +/// is just a reference. #[cfg(not(feature = "std"))] pub type ApisVec = &'static [(ApiId, u32)]; @@ -61,6 +66,7 @@ macro_rules! ver_str { ( $y:expr ) => {{ $y }} } +/// Create a vector of Api declarations. #[macro_export] macro_rules! apis_vec { ( $y:expr ) => { ver_str!(& $y) } From 36627945423f604202ab7ee4312580756fd5716f Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 14 Sep 2018 16:49:51 +0200 Subject: [PATCH 6/7] Typo --- srml/executive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srml/executive/src/lib.rs b/srml/executive/src/lib.rs index 52f3333cf7dc2..264fa6ac700fa 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -218,7 +218,7 @@ impl< /// Check a given transaction for validity. This doesn't execute any /// side-effects; it merely checks whether the transaction would panic if it were included or not. /// - /// Changed made to the storage should be discarded. + /// Changes made to the storage should be discarded. pub fn validate_transaction(uxt: Block::Extrinsic) -> TransactionValidity { let encoded_len = uxt.encode().len(); From fc913d98f70e501bf2b6679ee6b0de5ad4d60925 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 17 Sep 2018 12:20:06 +0200 Subject: [PATCH 7/7] Add longevity parameter to transaction validity info. --- core/sr-primitives/src/transaction_validity.rs | 6 +++++- srml/executive/src/lib.rs | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/sr-primitives/src/transaction_validity.rs b/core/sr-primitives/src/transaction_validity.rs index e61f34fcc5e7b..92bbe0d851c97 100644 --- a/core/sr-primitives/src/transaction_validity.rs +++ b/core/sr-primitives/src/transaction_validity.rs @@ -21,6 +21,10 @@ use rstd::prelude::*; /// Priority for a transaction. Additive. Higher is better. pub type TransactionPriority = u64; +/// Minimum number of blocks a transaction will remain valid for. +/// `TransactionLongevity::max_value()` means "forever". +pub type TransactionLongevity = u64; + /// Tag for a transaction. No two transactions with the same tag should be placed on-chain. pub type TransactionTag = Vec; @@ -28,6 +32,6 @@ pub type TransactionTag = Vec; #[derive(Clone, PartialEq, Eq, Encode, Decode)] pub enum TransactionValidity { Invalid, - Valid(TransactionPriority, Vec, Vec), + Valid(TransactionPriority, Vec, Vec, TransactionLongevity), Unknown, } diff --git a/srml/executive/src/lib.rs b/srml/executive/src/lib.rs index 264fa6ac700fa..263fdb7f76097 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -56,7 +56,8 @@ use primitives::traits::{self, Header, Zero, One, Checkable, Applyable, CheckEqu use runtime_support::Dispatchable; use codec::{Codec, Encode}; use system::extrinsics_root; -use primitives::{ApplyOutcome, ApplyError, transaction_validity::TransactionValidity}; +use primitives::{ApplyOutcome, ApplyError}; +use primitives::transaction_validity::{TransactionValidity, TransactionPriority, TransactionLongevity}; mod internal { pub enum ApplyError { @@ -253,7 +254,7 @@ impl< expected_index = expected_index + One::one(); } - TransactionValidity::Valid(encoded_len as u64, deps, vec![(sender, *xt.index()).encode()]) + TransactionValidity::Valid(encoded_len as TransactionPriority, deps, vec![(sender, *xt.index()).encode()], TransactionLongevity::max_value()) } else { return TransactionValidity::Invalid }