Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
293af330
Unverified
Commit
293af330
authored
Aug 29, 2018
by
Arkadiy Paronyan
Committed by
GitHub
Aug 29, 2018
Browse files
Merge pull request #6 from paritytech/a-ext-pool
More generic extrinsic pool
parents
d12426b6
26949a0b
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
293af330
...
...
@@ -451,7 +451,7 @@ dependencies = [
[[package]]
name = "ed25519"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -491,7 +491,7 @@ dependencies = [
[[package]]
name = "environmental"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
[[package]]
name = "error-chain"
...
...
@@ -1915,7 +1915,6 @@ dependencies = [
"polkadot-transaction-pool 0.1.0",
"slog 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-codec 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-network 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-runtime-io 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -1999,7 +1998,7 @@ dependencies = [
[[package]]
name = "pwasm-alloc"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"pwasm-libc 0.1.0 (git+https://github.com/paritytech/substrate)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2008,7 +2007,7 @@ dependencies = [
[[package]]
name = "pwasm-libc"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
[[package]]
name = "quick-error"
...
...
@@ -2508,7 +2507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "substrate-bft"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2527,7 +2526,7 @@ dependencies = [
[[package]]
name = "substrate-cli"
version = "0.3.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2545,7 +2544,6 @@ dependencies = [
"regex 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-extrinsic-pool 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-network 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-network-libp2p 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-runtime-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -2559,7 +2557,7 @@ dependencies = [
[[package]]
name = "substrate-client"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2589,7 +2587,7 @@ dependencies = [
[[package]]
name = "substrate-client-db"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hashdb 0.2.1 (git+https://github.com/paritytech/parity-common.git)",
"kvdb 0.1.0 (git+https://github.com/paritytech/parity-common.git)",
...
...
@@ -2611,7 +2609,7 @@ dependencies = [
[[package]]
name = "substrate-codec"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
...
...
@@ -2619,7 +2617,7 @@ dependencies = [
[[package]]
name = "substrate-codec-derive"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"proc-macro2 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2629,7 +2627,7 @@ dependencies = [
[[package]]
name = "substrate-executor"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"byteorder 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -2655,7 +2653,7 @@ dependencies = [
[[package]]
name = "substrate-extrinsic-pool"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2663,13 +2661,14 @@ dependencies = [
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"substrate-runtime-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
"transaction-pool 1.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "substrate-keyring"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2679,7 +2678,7 @@ dependencies = [
[[package]]
name = "substrate-keystore"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2695,7 +2694,7 @@ dependencies = [
[[package]]
name = "substrate-network"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -2717,7 +2716,7 @@ dependencies = [
[[package]]
name = "substrate-network-libp2p"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2740,7 +2739,7 @@ dependencies = [
[[package]]
name = "substrate-primitives"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2766,7 +2765,7 @@ dependencies = [
[[package]]
name = "substrate-rpc"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.2 (git+https://github.com/paritytech/jsonrpc.git)",
...
...
@@ -2788,7 +2787,7 @@ dependencies = [
[[package]]
name = "substrate-rpc-servers"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"jsonrpc-core 8.0.2 (git+https://github.com/paritytech/jsonrpc.git)",
"jsonrpc-http-server 8.0.1 (git+https://github.com/paritytech/jsonrpc.git)",
...
...
@@ -2803,7 +2802,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-consensus"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2820,7 +2819,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-council"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
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)",
...
...
@@ -2844,7 +2843,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-democracy"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2866,7 +2865,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-executive"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2882,7 +2881,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-io"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
"environmental 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -2897,7 +2896,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-primitives"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
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)",
...
...
@@ -2915,7 +2914,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-sandbox"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"substrate-codec 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -2928,7 +2927,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-session"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2949,7 +2948,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-staking"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2972,7 +2971,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-std"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"pwasm-alloc 0.1.0 (git+https://github.com/paritytech/substrate)",
"pwasm-libc 0.1.0 (git+https://github.com/paritytech/substrate)",
...
...
@@ -2982,7 +2981,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-support"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"ed25519 0.1.0 (git+https://github.com/paritytech/substrate)",
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -2997,7 +2996,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-system"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -3014,7 +3013,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-timestamp"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -3032,7 +3031,7 @@ dependencies = [
[[package]]
name = "substrate-runtime-version"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -3045,7 +3044,7 @@ dependencies = [
[[package]]
name = "substrate-serializer"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"serde 1.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -3054,7 +3053,7 @@ dependencies = [
[[package]]
name = "substrate-service"
version = "0.3.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -3086,7 +3085,7 @@ dependencies = [
[[package]]
name = "substrate-state-db"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -3098,7 +3097,7 @@ dependencies = [
[[package]]
name = "substrate-state-machine"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"byteorder 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hashdb 0.2.1 (git+https://github.com/paritytech/parity-common.git)",
...
...
@@ -3116,7 +3115,7 @@ dependencies = [
[[package]]
name = "substrate-telemetry"
version = "0.3.0"
source = "git+https://github.com/paritytech/substrate#f
3709852138d0bd2348d7e13505777c7acb7551e
"
source = "git+https://github.com/paritytech/substrate#f
a1392a80371818f2ca6069f9c1e6445d42ea467
"
dependencies = [
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
consensus/src/lib.rs
View file @
293af330
...
...
@@ -231,7 +231,10 @@ fn make_group_info(roster: DutyRoster, authorities: &[AuthorityId], local_id: Au
}
/// Polkadot proposer factory.
pub
struct
ProposerFactory
<
C
,
N
,
P
>
{
pub
struct
ProposerFactory
<
C
,
N
,
P
>
where
P
:
PolkadotApi
+
Send
+
Sync
+
'static
{
/// The client instance.
pub
client
:
Arc
<
P
>
,
/// The transaction pool.
...
...
@@ -407,7 +410,7 @@ struct LocalDuty {
}
/// The Polkadot proposer logic.
pub
struct
Proposer
<
C
:
PolkadotApi
>
{
pub
struct
Proposer
<
C
:
PolkadotApi
+
Send
+
Sync
>
{
client
:
Arc
<
C
>
,
dynamic_inclusion
:
DynamicInclusion
,
local_key
:
Arc
<
ed25519
::
Pair
>
,
...
...
@@ -587,10 +590,10 @@ impl<C> bft::Proposer<Block> for Proposer<C>
let
local_id
=
self
.local_key
.public
()
.0
.into
();
let
mut
next_index
=
{
let
cur_index
=
self
.transaction_pool
.cull_and_get_pending
(
BlockId
::
hash
(
self
.parent_hash
),
|
pending
|
pending
.filter
(|
tx
|
tx
.sender
()
.map
(|
s
|
s
==
local_id
)
.unwrap_or
(
false
))
let
cur_index
=
self
.transaction_pool
.cull_and_get_pending
(
&
BlockId
::
hash
(
self
.parent_hash
),
|
pending
|
pending
.filter
(|
tx
|
tx
.
verified
.
sender
()
.map
(|
s
|
s
==
local_id
)
.unwrap_or
(
false
))
.last
()
.map
(|
tx
|
Ok
(
tx
.index
()))
.map
(|
tx
|
Ok
(
tx
.
verified
.
index
()))
.unwrap_or_else
(||
self
.client
.index
(
&
self
.parent_id
,
local_id
))
);
...
...
@@ -636,9 +639,8 @@ impl<C> bft::Proposer<Block> for Proposer<C>
index
:
extrinsic
.index
,
function
:
extrinsic
.function
,
};
let
uxt
=
UncheckedExtrinsic
::
new
(
extrinsic
,
signature
);
self
.transaction_pool
.import_unchecked_extrinsic
(
BlockId
::
hash
(
self
.parent_hash
),
uxt
)
let
uxt
:
Vec
<
u8
>
=
Decode
::
decode
(
&
mut
UncheckedExtrinsic
::
new
(
extrinsic
,
signature
)
.encode
()
.as_slice
())
.expect
(
"Encoded extrinsic is valid"
);
self
.transaction_pool
.submit_one
(
&
BlockId
::
hash
(
self
.parent_hash
),
uxt
)
.expect
(
"locally signed extrinsic is valid; qed"
);
}
}
...
...
@@ -720,7 +722,7 @@ impl ProposalTiming {
}
/// Future which resolves upon the creation of a proposal.
pub
struct
CreateProposal
<
C
:
PolkadotApi
>
{
pub
struct
CreateProposal
<
C
:
PolkadotApi
+
Send
+
Sync
>
{
parent_hash
:
Hash
,
parent_number
:
BlockNumber
,
parent_id
:
BlockId
,
...
...
@@ -732,7 +734,7 @@ pub struct CreateProposal<C: PolkadotApi> {
offline
:
SharedOfflineTracker
,
}
impl
<
C
>
CreateProposal
<
C
>
where
C
:
PolkadotApi
{
impl
<
C
>
CreateProposal
<
C
>
where
C
:
PolkadotApi
+
Send
+
Sync
{
fn
propose_with
(
&
self
,
candidates
:
Vec
<
CandidateReceipt
>
)
->
Result
<
Block
,
Error
>
{
use
polkadot_api
::
BlockBuilder
;
use
runtime_primitives
::
traits
::{
Hash
as
HashT
,
BlakeTwo256
};
...
...
@@ -767,18 +769,18 @@ impl<C> CreateProposal<C> where C: PolkadotApi {
{
let
mut
unqueue_invalid
=
Vec
::
new
();
let
result
=
self
.transaction_pool
.cull_and_get_pending
(
BlockId
::
hash
(
self
.parent_hash
),
|
pending_iterator
|
{
let
result
=
self
.transaction_pool
.cull_and_get_pending
(
&
BlockId
::
hash
(
self
.parent_hash
),
|
pending_iterator
|
{
let
mut
pending_size
=
0
;
for
pending
in
pending_iterator
{
if
pending_size
+
pending
.encoded_size
()
>=
MAX_TRANSACTIONS_SIZE
{
break
}
if
pending_size
+
pending
.
verified
.
encoded_size
()
>=
MAX_TRANSACTIONS_SIZE
{
break
}
match
block_builder
.push_extrinsic
(
pending
.
p
ri
mitive_extrinsic
())
{
match
block_builder
.push_extrinsic
(
pending
.
o
ri
ginal
.clone
())
{
Ok
(())
=>
{
pending_size
+=
pending
.encoded_size
();
pending_size
+=
pending
.
verified
.
encoded_size
();
}
Err
(
e
)
=>
{
trace!
(
target
:
"transaction-pool"
,
"Invalid transaction: {}"
,
e
);
unqueue_invalid
.push
(
pending
.hash
()
.clone
());
unqueue_invalid
.push
(
pending
.
verified
.
hash
()
.clone
());
}
}
}
...
...
@@ -819,7 +821,7 @@ impl<C> CreateProposal<C> where C: PolkadotApi {
}
}
impl
<
C
>
Future
for
CreateProposal
<
C
>
where
C
:
PolkadotApi
{
impl
<
C
>
Future
for
CreateProposal
<
C
>
where
C
:
PolkadotApi
+
Send
+
Sync
{
type
Item
=
Block
;
type
Error
=
Error
;
...
...
consensus/src/service.rs
View file @
293af330
...
...
@@ -227,7 +227,6 @@ impl Service {
let
last_agreement
=
s
.last_agreement
();
let
can_build_upon
=
last_agreement
.map_or
(
true
,
|
x
|
!
x
.live
||
x
.parent_hash
!=
hash
);
if
hash
==
prev_best
&&
can_build_upon
{
debug!
(
"Starting consensus round after a timeout"
);
start_bft
(
best_block
,
s
.clone
());
...
...
network/src/lib.rs
View file @
293af330
...
...
@@ -73,7 +73,7 @@ pub const DOT_PROTOCOL_ID: ::substrate_network::ProtocolId = *b"dot";
type
FullStatus
=
GenericFullStatus
<
Block
>
;
/// Specialization of the network service for the polkadot protocol.
pub
type
NetworkService
=
::
substrate_network
::
Service
<
Block
,
PolkadotProtocol
>
;
pub
type
NetworkService
=
::
substrate_network
::
Service
<
Block
,
PolkadotProtocol
,
Hash
>
;
/// Status of a Polkadot node.
#[derive(Debug,
PartialEq,
Eq,
Clone,
Encode,
Decode)]
...
...
service/Cargo.toml
View file @
293af330
...
...
@@ -24,6 +24,5 @@ substrate-runtime-io = { git = "https://github.com/paritytech/substrate" }
substrate-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
}
substrate-network
=
{
git
=
"https://github.com/paritytech/substrate"
}
substrate-client
=
{
git
=
"https://github.com/paritytech/substrate"
}
substrate-codec
=
{
git
=
"https://github.com/paritytech/substrate"
}
substrate-service
=
{
git
=
"https://github.com/paritytech/substrate"
}
substrate-telemetry
=
{
git
=
"https://github.com/paritytech/substrate"
}
service/src/lib.rs
View file @
293af330
...
...
@@ -29,7 +29,6 @@ extern crate polkadot_transaction_pool as transaction_pool;
extern
crate
polkadot_network
;
extern
crate
substrate_primitives
as
primitives
;
extern
crate
substrate_network
as
network
;
extern
crate
substrate_codec
as
codec
;
extern
crate
substrate_client
as
client
;
extern
crate
substrate_service
as
service
;
extern
crate
tokio
;
...
...
@@ -42,14 +41,12 @@ extern crate hex_literal;
pub
mod
chain_spec
;
use
std
::
sync
::
Arc
;
use
std
::
collections
::
HashMap
;
use
codec
::{
Encode
,
Decode
};
use
tokio
::
prelude
::{
Stream
,
Future
};
use
transaction_pool
::
TransactionPool
;
use
polkadot_api
::{
PolkadotApi
,
light
::
RemotePolkadotApiWrapper
};
use
polkadot_primitives
::{
parachain
,
AccountId
,
Block
,
BlockId
,
Hash
};
use
polkadot_runtime
::
GenesisConfig
;
use
client
::
Client
;
use
client
::
{
Client
,
BlockchainEvents
}
;
use
polkadot_network
::{
PolkadotProtocol
,
consensus
::
ConsensusNetwork
};
use
tokio
::
runtime
::
TaskExecutor
;
use
service
::
FactoryFullConfiguration
;
...
...
@@ -63,7 +60,7 @@ pub use client::ExecutionStrategy;
pub
type
ChainSpec
=
service
::
ChainSpec
<
GenesisConfig
>
;
/// Polkadot client type for specialised `Components`.
pub
type
ComponentClient
<
C
>
=
Client
<<
C
as
Components
>
::
Backend
,
<
C
as
Components
>
::
Executor
,
Block
>
;
pub
type
NetworkService
=
network
::
Service
<
Block
,
<
Factory
as
service
::
ServiceFactory
>
::
NetworkProtocol
>
;
pub
type
NetworkService
=
network
::
Service
<
Block
,
<
Factory
as
service
::
ServiceFactory
>
::
NetworkProtocol
,
Hash
>
;
/// A collection of type to generalise Polkadot specific components over full / light client.
pub
trait
Components
:
service
::
Components
{
...
...
@@ -106,16 +103,11 @@ pub struct Factory;
impl
service
::
ServiceFactory
for
Factory
{
type
Block
=
Block
;
type
ExtrinsicHash
=
Hash
;
type
NetworkProtocol
=
PolkadotProtocol
;
type
RuntimeDispatch
=
polkadot_executor
::
Executor
;
type
FullExtrinsicPool
=
TransactionPoolAdapter
<
service
::
FullBackend
<
Self
>
,
service
::
FullExecutor
<
Self
>
,
service
::
FullClient
<
Self
>
>
;
type
LightExtrinsicPool
=
TransactionPoolAdapter
<
service
::
LightBackend
<
Self
>
,
service
::
LightExecutor
<
Self
>
,
type
FullExtrinsicPoolApi
=
transaction_pool
::
ChainApi
<
service
::
FullClient
<
Self
>>
;
type
LightExtrinsicPoolApi
=
transaction_pool
::
ChainApi
<
RemotePolkadotApiWrapper
<
service
::
LightBackend
<
Self
>
,
service
::
LightExecutor
<
Self
>>
>
;
type
Genesis
=
GenesisConfig
;
...
...
@@ -124,25 +116,17 @@ impl service::ServiceFactory for Factory {
const
NETWORK_PROTOCOL_ID
:
network
::
ProtocolId
=
::
polkadot_network
::
DOT_PROTOCOL_ID
;
fn
build_full_extrinsic_pool
(
config
:
ExtrinsicPoolOptions
,
client
:
Arc
<
service
::
FullClient
<
Self
>>
)
->
Result
<
Self
::
FullExtrinsicPool
,
Error
>
->
Result
<
TransactionPool
<
service
::
FullClient
<
Self
>>
,
Error
>
{
let
api
=
client
.clone
();
Ok
(
TransactionPoolAdapter
{
pool
:
Arc
::
new
(
TransactionPool
::
new
(
config
,
api
)),
client
:
client
,
imports_external_transactions
:
true
,
})
Ok
(
TransactionPool
::
new
(
config
,
transaction_pool
::
ChainApi
::
new
(
api
)))
}
fn
build_light_extrinsic_pool
(
config
:
ExtrinsicPoolOptions
,
client
:
Arc
<
service
::
LightClient
<
Self
>>
)
->
Result
<
Self
::
LightExtrinsicPool
,
Error
>
->
Result
<
TransactionPool
<
RemotePolkadotApiWrapper
<
service
::
LightBackend
<
Self
>
,
service
::
LightExecutor
<
Self
>>>
,
Error
>
{
let
api
=
Arc
::
new
(
RemotePolkadotApiWrapper
(
client
.clone
()));
Ok
(
TransactionPoolAdapter
{
pool
:
Arc
::
new
(
TransactionPool
::
new
(
config
,
api
)),
client
:
client
,
imports_external_transactions
:
false
,
})
Ok
(
TransactionPool
::
new
(
config
,
transaction_pool
::
ChainApi
::
new
(
api
)))
}
fn
build_network_protocol
(
config
:
&
Configuration
)
...
...
@@ -182,8 +166,18 @@ impl <C: Components> Service<C> {
pub
fn
new_light
(
config
:
Configuration
,
executor
:
TaskExecutor
)
->
Result
<
Service
<
LightComponents
<
Factory
>>
,
Error
>
{
let
service
=
service
::
Service
::
<
LightComponents
<
Factory
>>
::
new
(
config
,
executor
)
?
;
let
service
=
service
::
Service
::
<
LightComponents
<
Factory
>>
::
new
(
config
,
executor
.clone
()
)
?
;
let
api
=
Arc
::
new
(
RemotePolkadotApiWrapper
(
service
.client
()));
let
pool
=
service
.extrinsic_pool
();
let
events
=
service
.client
()
.import_notification_stream
()
.for_each
(
move
|
notification
|
{
// re-verify all transactions without the sender.
pool
.retry_verification
(
&
BlockId
::
hash
(
notification
.hash
),
None
)
.map_err
(|
e
|
warn!
(
"Error re-verifying transactions: {:?}"
,
e
))
?
;
Ok
(())
})
.then
(|
_
|
Ok
(()));
executor
.spawn
(
events
);
Ok
(
Service
{
client
:
service
.client
(),
network
:
service
.network
(),
...
...
@@ -212,7 +206,16 @@ pub fn new_full(config: Configuration, executor: TaskExecutor)
let
is_validator
=
(
config
.roles
&
Roles
::
AUTHORITY
)
==
Roles
::
AUTHORITY
;
let
service
=
service
::
Service
::
<
FullComponents
<
Factory
>>
::
new
(
config
,
executor
.clone
())
?
;
let
pool
=
service
.extrinsic_pool
();
let
events
=
service
.client
()
.import_notification_stream
()
.for_each
(
move
|
notification
|
{
// re-verify all transactions without the sender.
pool
.retry_verification
(
&
BlockId
::
hash
(
notification
.hash
),
None
)
.map_err
(|
e
|
warn!
(
"Error re-verifying transactions: {:?}"
,
e
))
?
;
Ok
(())
})
.then
(|
_
|
Ok
(()));
executor
.spawn
(
events
);
// Spin consensus service if configured
let
consensus
=
if
is_validator
{
// Load the first available key
...
...
@@ -261,103 +264,3 @@ impl<C: Components> ::std::ops::Deref for Service<C> {
&
self
.inner
}
}
/// Transaction pool adapter.
pub
struct
TransactionPoolAdapter
<
B
,
E
,
A
>
where
A
:
Send
+
Sync
,
E
:
Send
+
Sync
{
imports_external_transactions
:
bool
,
pool
:
Arc
<
TransactionPool
<
A
>>
,
client
:
Arc
<
Client
<
B
,
E
,
Block
>>
,
}
impl
<
B
,
E
,
A
>
TransactionPoolAdapter
<
B
,
E
,
A
>
where
A
:
Send
+
Sync
,
B
:
client
::
backend
::
Backend
<
Block
,
KeccakHasher
,
RlpCodec
>
+
Send
+
Sync
,
E
:
client
::
CallExecutor
<
Block
,
KeccakHasher
,
RlpCodec
>
+
Send
+
Sync
,
{
fn
best_block_id
(
&
self
)
->
Option
<
BlockId
>
{
self
.client
.info
()
.map
(|
info
|
BlockId
::
hash
(
info
.chain.best_hash
))
.map_err
(|
e
|
{
debug!
(
"Error getting best block: {:?}"
,
e
);
})
.ok
()
}
}
impl
<
B
,
E
,
A
>
network
::
TransactionPool
<
Block
>
for
TransactionPoolAdapter
<
B
,
E
,
A
>
where
B
:
client
::
backend
::
Backend
<
Block
,
KeccakHasher
,
RlpCodec
>
+
Send
+
Sync
,
E
:
client
::
CallExecutor
<
Block
,
KeccakHasher
,
RlpCodec
>
+
Send
+
Sync
,
A
:
polkadot_api
::
PolkadotApi
+
Send
+
Sync
,
{
fn
transactions
(
&
self
)
->
Vec
<
(
Hash
,
Vec
<
u8
>
)
>
{
let
best_block_id
=
match
self
.best_block_id
()
{
Some
(
id
)
=>
id
,
None
=>
return
vec!
[],
};
self
.pool
.cull_and_get_pending
(
best_block_id
,
|
pending
|
pending
.map
(|
t
|
{
let
hash
=
t
.hash
()
.clone
();
(
hash
,
t
.primitive_extrinsic
())
})
.collect
()
)
.unwrap_or_else
(|
e
|
{
warn!
(
"Error retrieving pending set: {}"
,
e
);
vec!
[]
})
}
fn
import
(
&
self
,
transaction
:
&
Vec
<
u8
>
)
->
Option
<
Hash
>
{
if
!
self
.imports_external_transactions
{
return
None
;
}