diff --git a/Cargo.lock b/Cargo.lock index 59c8980d14457..2402c4a21cdfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1435,6 +1435,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", @@ -1463,7 +1464,7 @@ dependencies = [ "node-primitives 0.1.0", "node-runtime 0.1.0", "node-transaction-pool 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)", "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", @@ -1481,7 +1482,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 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)", "sr-io 0.1.0", "sr-primitives 0.1.0", "srml-balances 0.1.0", @@ -1519,7 +1520,7 @@ dependencies = [ 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)", "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)", @@ -1536,7 +1537,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", @@ -1597,7 +1598,7 @@ dependencies = [ "node-api 0.1.0", "node-primitives 0.1.0", "node-runtime 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)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "substrate-client 0.1.0", @@ -1679,7 +1680,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)", @@ -2314,7 +2315,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", @@ -2330,7 +2331,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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2345,7 +2346,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 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", @@ -2365,7 +2366,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.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,7 +2378,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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2396,7 +2397,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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2413,7 +2414,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 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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2435,7 +2436,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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2457,7 +2458,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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2477,7 +2478,7 @@ name = "srml-example" 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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2495,7 +2496,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)", "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)", @@ -2513,7 +2514,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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2534,7 +2535,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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2559,7 +2560,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mashup 0.1.7 (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)", "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)", @@ -2576,7 +2577,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.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2593,7 +2594,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.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", @@ -2610,7 +2611,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.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2664,7 +2665,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 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)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -2717,7 +2718,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 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)", @@ -2745,7 +2746,7 @@ 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 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)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", @@ -2767,7 +2768,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 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.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)", @@ -2789,7 +2790,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 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)", "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)", @@ -2828,14 +2829,14 @@ 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]] name = "substrate-misbehavior-check" 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)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", @@ -2854,7 +2855,7 @@ 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 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)", "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)", @@ -2904,7 +2905,7 @@ 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 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)", @@ -2932,7 +2933,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 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)", "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)", @@ -2978,7 +2979,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 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)", "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)", @@ -3006,7 +3007,7 @@ 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 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)", "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", @@ -3022,7 +3023,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)", @@ -3049,7 +3050,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 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)", "rhododendron 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "srml-support 0.1.0", @@ -3067,7 +3068,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)", "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)", @@ -3918,7 +3919,7 @@ 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.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-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" 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/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/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/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/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-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..92bbe0d851c97 --- /dev/null +++ b/core/sr-primitives/src/transaction_validity.rs @@ -0,0 +1,37 @@ +// 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; + +/// 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; + +/// 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, TransactionLongevity), + Unknown, +} 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..1a008ef5d6063 100644 --- a/core/sr-version/src/lib.rs +++ b/core/sr-version/src/lib.rs @@ -42,6 +42,18 @@ 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)]; + #[cfg(feature = "std")] #[macro_export] macro_rules! ver_str { @@ -54,6 +66,12 @@ macro_rules! ver_str { ( $y:expr ) => {{ $y }} } +/// Create a vector of Api declarations. +#[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 +108,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 +134,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: ApiId, 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..98bfdb057a630 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!([]), }; fn version() -> RuntimeVersion { diff --git a/core/test-runtime/wasm/Cargo.lock b/core/test-runtime/wasm/Cargo.lock index db42eb9780b0c..a2e0d2cca88be 100644 --- a/core/test-runtime/wasm/Cargo.lock +++ b/core/test-runtime/wasm/Cargo.lock @@ -299,7 +299,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)", @@ -520,7 +520,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", @@ -536,7 +536,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)", @@ -556,7 +556,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)", @@ -568,8 +568,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 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mashup 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "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", @@ -587,7 +587,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]] @@ -602,7 +602,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)", @@ -628,7 +628,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)", @@ -642,7 +642,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", @@ -794,7 +794,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/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/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/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 7bb8116b78bcf..a164ba24c536b 100644 --- a/node/runtime/Cargo.toml +++ b/node/runtime/Cargo.toml @@ -9,7 +9,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" } +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 ef6370672fb70..553340a3bc231 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -68,7 +68,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))] @@ -82,6 +82,9 @@ pub use checked_block::CheckedBlock; const TIMESTAMP_SET_POSITION: u32 = 0; const NOTE_OFFLINE_POSITION: u32 = 1; +const INHERENT: ApiId = *b"inherent"; +const VALIDATX: ApiId = *b"validatx"; + /// Runtime version. pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: ver_str!("node"), @@ -89,6 +92,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 0, + apis: apis_vec!([(INHERENT, 1), (VALIDATX, 1)]), }; impl system::Trait for Runtime { @@ -225,18 +229,19 @@ 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(), 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) ); } /// 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/node/runtime/wasm/Cargo.lock b/node/runtime/wasm/Cargo.lock index 51fb8d1e78e9c..ecbfd049dadda 100644 --- a/node/runtime/wasm/Cargo.lock +++ b/node/runtime/wasm/Cargo.lock @@ -270,7 +270,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)", @@ -285,7 +285,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", @@ -340,7 +340,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)", @@ -579,7 +579,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", @@ -595,7 +595,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)", @@ -608,7 +608,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", @@ -627,7 +627,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)", @@ -639,7 +639,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)", @@ -658,7 +658,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)", @@ -674,7 +674,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)", @@ -695,7 +695,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)", @@ -717,7 +717,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)", @@ -737,7 +737,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 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)", "sr-io 0.1.0", @@ -752,7 +753,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)", @@ -773,7 +774,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)", @@ -798,7 +799,7 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mashup 0.1.7 (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", @@ -812,7 +813,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)", @@ -829,7 +830,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", @@ -846,7 +847,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)", @@ -877,7 +878,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]] @@ -892,7 +893,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)", @@ -918,7 +919,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)", @@ -1068,7 +1069,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/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..f59c95a52de8f 100644 --- a/srml/executive/Cargo.toml +++ b/srml/executive/Cargo.toml @@ -7,7 +7,8 @@ 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 } 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..263fdb7f76097 100644 --- a/srml/executive/src/lib.rs +++ b/srml/executive/src/lib.rs @@ -31,6 +31,7 @@ extern crate parity_codec_derive; #[cfg_attr(test, macro_use)] extern crate srml_support as runtime_support; +#[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; @@ -51,11 +52,12 @@ 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; use primitives::{ApplyOutcome, ApplyError}; +use primitives::transaction_validity::{TransactionValidity, TransactionPriority, TransactionLongevity}; mod internal { pub enum ApplyError { @@ -213,6 +215,50 @@ 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. + /// + /// Changes made to the storage should be discarded. + pub fn validate_transaction(uxt: Block::Extrinsic) -> TransactionValidity { + let encoded_len = uxt.encode().len(); + + 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. + 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(encoded_len as TransactionPriority, deps, vec![(sender, *xt.index()).encode()], TransactionLongevity::max_value()) + } else { + return TransactionValidity::Invalid + } + } } #[cfg(test)] 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 89f09abcd8e80..785a7e68c817d 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 }