Generalised Transaction Queue API (#741)

* First effort

* API versioning

* Introduce validate_transaction

* Introduce the API plus fixes.

* Docs

* Typo

* Add longevity parameter to transaction validity info.
This commit is contained in:
Gav Wood
2018-09-17 18:43:59 +02:00
committed by GitHub
parent 263786df05
commit f10d8e177d
52 changed files with 263 additions and 143 deletions
+40 -39
View File
@@ -1443,6 +1443,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",
@@ -1471,7 +1472,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",
@@ -1489,7 +1490,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",
@@ -1527,7 +1528,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)",
@@ -1544,7 +1545,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)",
@@ -1605,7 +1606,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",
@@ -1687,7 +1688,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)",
@@ -2327,7 +2328,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",
@@ -2343,7 +2344,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)",
@@ -2358,7 +2359,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",
@@ -2378,7 +2379,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)",
@@ -2390,7 +2391,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)",
@@ -2409,7 +2410,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)",
@@ -2426,7 +2427,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)",
@@ -2448,7 +2449,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)",
@@ -2470,7 +2471,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)",
@@ -2490,7 +2491,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)",
@@ -2508,7 +2509,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)",
@@ -2526,7 +2527,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)",
@@ -2547,7 +2548,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)",
@@ -2572,7 +2573,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)",
@@ -2589,7 +2590,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)",
@@ -2606,7 +2607,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",
@@ -2623,7 +2624,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)",
@@ -2677,7 +2678,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",
@@ -2730,7 +2731,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)",
@@ -2758,7 +2759,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",
@@ -2780,7 +2781,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)",
@@ -2802,7 +2803,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)",
@@ -2841,14 +2842,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",
@@ -2867,7 +2868,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)",
@@ -2917,7 +2918,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)",
@@ -2945,7 +2946,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)",
@@ -2991,7 +2992,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)",
@@ -3019,7 +3020,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",
@@ -3035,7 +3036,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)",
@@ -3062,7 +3063,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",
@@ -3080,7 +3081,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)",
@@ -3929,7 +3930,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"
+1 -1
View File
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[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" }
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[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" }
+5 -5
View File
@@ -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"
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
parity-codec = { version = "~1.0", default_features = false }
parity-codec = { version = "1.1", default_features = false }
[features]
default = ["std"]
+1 -1
View File
@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[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 }
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[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 }
+1 -1
View File
@@ -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" }
+1
View File
@@ -202,6 +202,7 @@ fn should_return_runtime_version() {
authoring_version: 1,
spec_version: 1,
impl_version: 1,
apis: (&[][..]).into()
}
);
}
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -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 }
+1
View File
@@ -58,6 +58,7 @@ pub mod testing;
pub mod traits;
pub mod generic;
pub mod bft;
pub mod transaction_validity;
use traits::{Verify, Lazy};
@@ -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 <http://www.gnu.org/licenses/>.
//! 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<u8>;
/// 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<TransactionTag>, Vec<TransactionTag>, TransactionLongevity),
Unknown,
}
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[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 }
+25 -13
View File
@@ -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)
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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]
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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" }
+1 -1
View File
@@ -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 }
+1
View File
@@ -67,6 +67,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 1,
spec_version: 1,
impl_version: 1,
apis: apis_vec!([]),
};
fn version() -> RuntimeVersion {
+10 -10
View File
@@ -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"
+1 -1
View File
@@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[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 }
+1
View File
@@ -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" }
+21 -8
View File
@@ -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<Timestamp>;
// 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<Index>;
/// Get the account id of an address at a block.
fn lookup(&self, at: &BlockId, address: Address) -> Result<Option<AccountId>>;
/// Validate a transaction and determine its dependencies.
fn validate_transaction(&self, at: &BlockId, transaction: UncheckedExtrinsic) -> Result<TransactionValidity>;
/// 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<bool>;
@@ -138,18 +145,24 @@ where
self.call_api_at(at, "lookup_address", &address)
}
fn build_block(&self, at: &BlockId, inherent_data: InherentData) -> Result<Self::BlockBuilder> {
let mut block_builder = self.new_block_at(at)?;
for inherent in self.inherent_extrinsics(at, inherent_data)? {
block_builder.push(inherent)?;
}
fn validate_transaction(&self, at: &BlockId, tx: UncheckedExtrinsic) -> Result<TransactionValidity> {
self.call_api_at(at, "validate_transaction", &tx)
}
fn build_block(&self, at: &BlockId, inherent_data: InherentData) -> Result<Self::BlockBuilder> {
let runtime_version = self.runtime_version_at(at)?;
let mut block_builder = self.new_block_at(at)?;
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<Vec<UncheckedExtrinsic>> {
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)
}
}
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -6,7 +6,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[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 }
+1 -1
View File
@@ -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" }
+9 -4
View File
@@ -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<UncheckedExtrinsic> {
fn inherent_extrinsics(data: InherentData) -> Vec<UncheckedExtrinsic> {
let make_inherent = |function| UncheckedExtrinsic {
signature: Default::default(),
function,
+24 -23
View File
@@ -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"
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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 }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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 }
+3 -2
View File
@@ -7,7 +7,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
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",
+47 -1
View File
@@ -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 = <system::Module<System>>::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)]
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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 }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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 }
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
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 }