diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 7f8f7bd555f2d5636f7bbb8ad2c02064b5e6a09f..a1b630d428bf905ff2b1362b79ba7c22e162a865 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -1267,9 +1267,25 @@ dependencies = [ "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "jsonrpc-client-transports" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.29 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "websocket 0.22.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "jsonrpc-core" -version = "10.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1279,11 +1295,20 @@ dependencies = [ "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "jsonrpc-core-client" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "jsonrpc-client-transports 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "jsonrpc-derive" -version = "10.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1291,36 +1316,37 @@ dependencies = [ [[package]] name = "jsonrpc-http-server" -version = "10.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hyper 0.12.29 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-server-utils 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-server-utils 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-pubsub" -version = "10.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-server-utils" -version = "10.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1331,16 +1357,15 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "10.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-server-utils 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-server-utils 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-ws 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ws 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1832,6 +1857,14 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lock_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.3.9" @@ -2097,6 +2130,19 @@ dependencies = [ "substrate-serializer 2.0.0", ] +[[package]] +name = "node-rpc-client" +version = "2.0.0" +dependencies = [ + "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.29 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core-client 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "node-primitives 2.0.0", + "substrate-rpc 2.0.0", +] + [[package]] name = "node-runtime" version = "2.0.0" @@ -2383,23 +2429,6 @@ dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parity-ws" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" version = "0.5.5" @@ -2427,6 +2456,16 @@ dependencies = [ "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.2.14" @@ -2462,6 +2501,21 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "paste" version = "0.1.5" @@ -2952,6 +3006,11 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scopeguard" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "security-framework" version = "0.3.1" @@ -4316,9 +4375,10 @@ dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-derive 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core-client 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-derive 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-pubsub 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4344,9 +4404,9 @@ dependencies = [ name = "substrate-rpc-servers" version = "2.0.0" dependencies = [ - "jsonrpc-http-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-ws-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-http-server 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-pubsub 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-ws-server 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 2.0.0", @@ -5032,7 +5092,7 @@ name = "twox-hash" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5429,6 +5489,23 @@ dependencies = [ "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ws" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -5643,12 +5720,14 @@ dependencies = [ "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "9987e7c13a91d9cf0efe59cca48a3a7a70e2b11695d5a4640f85ae71e28f5e73" -"checksum jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15eef5f8b6bef5ac5f7440a957ff95d036e2f98706947741bfc93d1976db4c" -"checksum jsonrpc-derive 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2dae61ca8a3b047fb11309b00661bc56837085bd07e46f907b9c562c0b03e68" -"checksum jsonrpc-http-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11d2a00824306155b8ef57fe957f31b8cd8ad24262f15cf911d84dcf9a3f206d" -"checksum jsonrpc-pubsub 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37fce55133ee264d0ab42bd862efcd45ae1d062cda599f4cc12ccc4be3195f2a" -"checksum jsonrpc-server-utils 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9527f01ef25f251d64082cbefc0c6d6f367349afe6848ef908a674e06b2bdd3" -"checksum jsonrpc-ws-server 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3889012aa638a2f18eb1a879f46fc8b34e7e1423cbff3247cd1531de0d51084b" +"checksum jsonrpc-client-transports 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0245e08f98d627a579cdee6a2138d05ab64f6093efbcdeec50805d121ee13c0c" +"checksum jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "288dca7f9713710a29e485076b9340156cb701edb46a881f5d0c31aa4f5b9143" +"checksum jsonrpc-core-client 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05e499e393aaa97cf5ff3a7444549c94a6d27e70be1c300b865187d722f1b426" +"checksum jsonrpc-derive 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b65eafb36286a4251c9a1d4cdf4e9a7cf8fa4f7bf991383e42f0cf26908767" +"checksum jsonrpc-http-server 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea8b3996f19dc6dd90d928c81d30b3ce9535840487734290da9fae3b3185db5d" +"checksum jsonrpc-pubsub 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fcdd238ecccde73faea93760b068f3fe3ca84caeb6b5414c2aabd4f008dad418" +"checksum jsonrpc-server-utils 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "036a53ffa47533dcccf1e1bb16abb0f45ef9a2dc9a63654d2d2cd199b80ad33e" +"checksum jsonrpc-ws-server 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "977ea40f077c027553e4112d750114b9e5cc7bcf5642512838abc2a9b322bd23" "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum keccak-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "af672553b2abac1c86c29fd62c79880638b6abc91d96db4aa42a5baab2bc1ca9" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -5684,6 +5763,7 @@ dependencies = [ "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" @@ -5726,13 +5806,14 @@ dependencies = [ "checksum parity-multihash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05d6a68e07ab34a9e87bd8dd4936f6bb5be21e4f6dbcdbaf04d8e854eba0af01" "checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" -"checksum parity-ws 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2fec5048fba72a2e01baeb0d08089db79aead4b57e2443df172fb1840075a233" "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" "checksum paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4a4a1c555c6505821f9d58b8779d0f630a6b7e4e1be24ba718610acf01fa79" "checksum paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26e796e623b8b257215f27e6c80a5478856cae305f5b59810ff9acdaa34570e6" "checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" @@ -5790,6 +5871,7 @@ dependencies = [ "checksum schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339" "checksum schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eff518f9bed3d803a0d002af0ab96339b0ebbedde3bec98a684986134b7a39" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum security-framework 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eee63d0f4a9ec776eeb30e220f0bc1e092c3ad744b2a379e3993070364d3adc2" "checksum security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9636f8989cbf61385ae4824b98c1aaa54c994d7d8b41f11c601ed799f0549a56" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" @@ -5920,6 +6002,7 @@ dependencies = [ "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" +"checksum ws 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91ea61b83ce033c43c06c52ddc7532f465c0153281610d44c58b74083aee1a" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538" "checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index 3ccbb1c26d96871edc7f324bb51580fc766a3f41..5710d08aff8789fdedd8210477251b9eaefeb7fd 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -82,6 +82,7 @@ members = [ "node/executor", "node/primitives", "node/runtime", + "node/rpc-client", "node-template", "subkey", "test-utils/chain-spec-builder", diff --git a/substrate/core/rpc-servers/Cargo.toml b/substrate/core/rpc-servers/Cargo.toml index 41cfb6aeea15f6a6de3720254ebf88b986621059..bca094b572d5f1d6ed6f5a143f8eaa27d1168bed 100644 --- a/substrate/core/rpc-servers/Cargo.toml +++ b/substrate/core/rpc-servers/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Parity Technologies <admin@parity.io>"] edition = "2018" [dependencies] -http = { package = "jsonrpc-http-server", version = "10.0.1" } -pubsub = { package = "jsonrpc-pubsub", version = "10.0.1" } -ws = { package = "jsonrpc-ws-server", version = "10.0.1" } +http = { package = "jsonrpc-http-server", version = "12.0.0" } +pubsub = { package = "jsonrpc-pubsub", version = "12.0.0" } +ws = { package = "jsonrpc-ws-server", version = "12.0.0" } log = "0.4" serde = "1.0" substrate-rpc = { path = "../rpc" } diff --git a/substrate/core/rpc-servers/src/lib.rs b/substrate/core/rpc-servers/src/lib.rs index 2c0672ac9c4da786c1f3cc20af53f4a20afd1bc7..adf560ce5a6375eeee780ecace7ef6c42908959a 100644 --- a/substrate/core/rpc-servers/src/lib.rs +++ b/substrate/core/rpc-servers/src/lib.rs @@ -89,9 +89,9 @@ pub fn start_ws( .allowed_origins(map_cors(cors)) .start(addr) .map_err(|err| match err { - ws::Error(ws::ErrorKind::Io(io), _) => io, - ws::Error(ws::ErrorKind::ConnectionClosed, _) => io::ErrorKind::BrokenPipe.into(), - ws::Error(e, _) => { + ws::Error::Io(io) => io, + ws::Error::ConnectionClosed => io::ErrorKind::BrokenPipe.into(), + e => { error!("{}", e); io::ErrorKind::Other.into() } diff --git a/substrate/core/rpc/Cargo.toml b/substrate/core/rpc/Cargo.toml index d69d7e17be9cd8bfeefbe27ba28d24d78a2eb961..a7337858d858cfc8d4e5b432dc80520e2a5b14f7 100644 --- a/substrate/core/rpc/Cargo.toml +++ b/substrate/core/rpc/Cargo.toml @@ -6,9 +6,10 @@ edition = "2018" [dependencies] derive_more = "0.14.0" -jsonrpc-core = "10.0.1" -jsonrpc-pubsub = "10.0.1" -jsonrpc-derive = "10.0.2" +jsonrpc-core = "12.0.0" +jsonrpc-core-client = "12.0.0" +jsonrpc-pubsub = "12.0.0" +jsonrpc-derive = "12.0.0" log = "0.4" parking_lot = "0.7.1" parity-codec = "3.3" diff --git a/substrate/core/rpc/src/author/hash.rs b/substrate/core/rpc/src/author/hash.rs index 96addf8ebcde87eaf3d353d32db48423a694ea52..a01e26de3c94b27c269c6dc6e65dbc780ac5cc05 100644 --- a/substrate/core/rpc/src/author/hash.rs +++ b/substrate/core/rpc/src/author/hash.rs @@ -14,13 +14,15 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see <http://www.gnu.org/licenses/>. +//! Extrinsic helpers for author RPC module. + use primitives::Bytes; -use serde::Deserialize; +use serde::{Serialize, Deserialize}; /// RPC Extrinsic or hash /// /// Allows to refer to extrinsic either by its raw representation or its hash. -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum ExtrinsicOrHash<Hash> { /// The hash of the extrinsic. diff --git a/substrate/core/rpc/src/author/mod.rs b/substrate/core/rpc/src/author/mod.rs index 4e3bc96ca9a96b5b0f08cdf3f724b4e9fe11786d..5594984d0ea7f016461f49b507e8d65b783a1f50 100644 --- a/substrate/core/rpc/src/author/mod.rs +++ b/substrate/core/rpc/src/author/mod.rs @@ -16,6 +16,12 @@ //! Substrate block-author/full-node API. +pub mod error; +pub mod hash; + +#[cfg(test)] +mod tests; + use std::sync::Arc; use client::{self, Client}; @@ -27,6 +33,7 @@ use log::warn; use parity_codec::{Encode, Decode}; use primitives::{Bytes, Blake2Hasher, H256}; use runtime_primitives::{generic, traits}; +use self::error::Result; use transaction_pool::{ txpool::{ ChainApi as PoolChainApi, @@ -38,13 +45,7 @@ use transaction_pool::{ }, }; -pub mod error; -mod hash; - -#[cfg(test)] -mod tests; - -use self::error::Result; +pub use self::gen_client::Client as AuthorClient; /// Substrate authoring RPC API #[rpc] diff --git a/substrate/core/rpc/src/chain/error.rs b/substrate/core/rpc/src/chain/error.rs index ffd94f464904bd9b8edc7eeb8d213ea2e81fc419..ad63af9add0510731df2083916551555b4df105a 100644 --- a/substrate/core/rpc/src/chain/error.rs +++ b/substrate/core/rpc/src/chain/error.rs @@ -14,6 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see <http://www.gnu.org/licenses/>. + +//! Error helpers for Chain RPC module. + use client; use crate::rpc; use crate::errors; diff --git a/substrate/core/rpc/src/chain/mod.rs b/substrate/core/rpc/src/chain/mod.rs index 90c833e3fd330ae70e59c5b4f00f436101c14594..3594ed48e3aaf990919131c3779c096c400cb779 100644 --- a/substrate/core/rpc/src/chain/mod.rs +++ b/substrate/core/rpc/src/chain/mod.rs @@ -16,27 +16,28 @@ //! Substrate blockchain API. +pub mod error; +pub mod number; + +#[cfg(test)] +mod tests; + use std::sync::Arc; -use log::warn; use client::{self, Client, BlockchainEvents}; +use crate::rpc::Result as RpcResult; +use crate::rpc::futures::{stream, Future, Sink, Stream}; +use crate::subscriptions::Subscriptions; use jsonrpc_derive::rpc; use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; +use log::warn; use primitives::{H256, Blake2Hasher}; -use crate::rpc::Result as RpcResult; -use crate::rpc::futures::{stream, Future, Sink, Stream}; use runtime_primitives::generic::{BlockId, SignedBlock}; use runtime_primitives::traits::{Block as BlockT, Header, NumberFor}; - -use crate::subscriptions::Subscriptions; - -mod error; -#[cfg(test)] -mod tests; -mod number; - use self::error::Result; +pub use self::gen_client::Client as ChainClient; + /// Substrate blockchain API #[rpc] pub trait ChainApi<Number, Hash, Header, SignedBlock> { diff --git a/substrate/core/rpc/src/chain/number.rs b/substrate/core/rpc/src/chain/number.rs index f927d51f1499221b83d4ffcf820b2fe50f2913af..df796d5e6d9911c2f952dc344cd69b23eef0a3b9 100644 --- a/substrate/core/rpc/src/chain/number.rs +++ b/substrate/core/rpc/src/chain/number.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see <http://www.gnu.org/licenses/>. -use serde::Deserialize; +//! Chain RPC Block number type. + +use serde::{Serialize, Deserialize}; use std::{convert::TryFrom, fmt::Debug}; use primitives::U256; @@ -25,7 +27,7 @@ use primitives::U256; /// or we attempt to parse given hex value. /// We do that for consistency with the returned type, default generic header /// serializes block number as hex to avoid overflows in JavaScript. -#[derive(Deserialize)] +#[derive(Serialize, Deserialize)] #[serde(untagged)] pub enum NumberOrHex<Number> { /// The original header number type of block. diff --git a/substrate/core/rpc/src/state/error.rs b/substrate/core/rpc/src/state/error.rs index 30b3315b7bae04e075dcf53054936e5b62a8ab6c..4b9d30b36b2043ef130492db91eb74004d12aba5 100644 --- a/substrate/core/rpc/src/state/error.rs +++ b/substrate/core/rpc/src/state/error.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see <http://www.gnu.org/licenses/>. +//! State RPC errors. + use client; use crate::rpc; use crate::errors; @@ -29,8 +31,11 @@ pub enum Error { /// Provided block range couldn't be resolved to a list of blocks. #[display(fmt = "Cannot resolve a block range ['{:?}' ... '{:?}]. {}", from, to, details)] InvalidBlockRange { + /// Beginning of the block range. from: String, + /// End of the block range. to: String, + /// Details of the error message. details: String, }, } diff --git a/substrate/core/rpc/src/state/mod.rs b/substrate/core/rpc/src/state/mod.rs index ebb45d6b5f5285e0cc25e5e7375a326ec67d8f8d..e52d318d9f09887ce5f1c81e0a8374331bda83f0 100644 --- a/substrate/core/rpc/src/state/mod.rs +++ b/substrate/core/rpc/src/state/mod.rs @@ -16,36 +16,37 @@ //! Substrate state API. +pub mod error; + +#[cfg(test)] +mod tests; + use std::{ collections::{BTreeMap, HashMap}, ops::Range, sync::Arc, }; -use log::{warn, trace}; use client::{self, Client, CallExecutor, BlockchainEvents, runtime_api::Metadata}; +use crate::rpc::Result as RpcResult; +use crate::rpc::futures::{stream, Future, Sink, Stream}; +use crate::subscriptions::Subscriptions; use jsonrpc_derive::rpc; use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId}; -use primitives::{H256, Blake2Hasher, Bytes}; +use log::{warn, trace}; use primitives::hexdisplay::HexDisplay; use primitives::storage::{self, StorageKey, StorageData, StorageChangeSet}; -use crate::rpc::Result as RpcResult; -use crate::rpc::futures::{stream, Future, Sink, Stream}; +use primitives::{H256, Blake2Hasher, Bytes}; use runtime_primitives::generic::BlockId; use runtime_primitives::traits::{ Block as BlockT, Header, ProvideRuntimeApi, NumberFor, SaturatedConversion }; use runtime_version::RuntimeVersion; +use self::error::Result; use state_machine::{self, ExecutionStrategy}; -use crate::subscriptions::Subscriptions; - -mod error; -#[cfg(test)] -mod tests; - -use self::error::Result; +pub use self::gen_client::Client as StateClient; /// Substrate state API #[rpc] diff --git a/substrate/core/rpc/src/system/helpers.rs b/substrate/core/rpc/src/system/helpers.rs index 82c7773b5b919ed152559a857f4288b8cbe6672d..00e2ba9f408b7658ccb45a10d62642bbfed1209c 100644 --- a/substrate/core/rpc/src/system/helpers.rs +++ b/substrate/core/rpc/src/system/helpers.rs @@ -17,7 +17,7 @@ //! Substrate system API helpers. use std::fmt; -use serde::Serialize; +use serde::{Serialize, Deserialize}; use serde_json::{Value, map::Map}; /// Node properties @@ -37,7 +37,7 @@ pub struct SystemInfo { } /// Health struct returned by the RPC -#[derive(Debug, PartialEq, Serialize)] +#[derive(Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Health { /// Number of connected peers @@ -51,7 +51,7 @@ pub struct Health { } /// Network Peer information -#[derive(Debug, PartialEq, Serialize)] +#[derive(Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PeerInfo<Hash, Number> { /// Peer ID diff --git a/substrate/core/rpc/src/system/mod.rs b/substrate/core/rpc/src/system/mod.rs index 46cbc99fabd610b5681d2f68b0364f042ef8bb34..8aac02b77d69923d115fa219d0c3101e9519a59c 100644 --- a/substrate/core/rpc/src/system/mod.rs +++ b/substrate/core/rpc/src/system/mod.rs @@ -17,8 +17,8 @@ //! Substrate system API. pub mod error; +pub mod helpers; -mod helpers; #[cfg(test)] mod tests; @@ -30,6 +30,8 @@ use runtime_primitives::traits::{self, Header as HeaderT}; use self::error::Result; pub use self::helpers::{Properties, SystemInfo, Health, PeerInfo}; +pub use self::gen_client::Client as SystemClient; + /// Substrate system RPC API #[rpc] pub trait SystemApi<Hash, Number> { diff --git a/substrate/core/sr-version/src/lib.rs b/substrate/core/sr-version/src/lib.rs index 071b8934040609c4ef6d1fcd9556039064b66e74..179146cc8464d110cb0fab6d4cc53a0c63e0bc9d 100644 --- a/substrate/core/sr-version/src/lib.rs +++ b/substrate/core/sr-version/src/lib.rs @@ -19,7 +19,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] -use serde::Serialize; +use serde::{Serialize, Deserialize}; #[cfg(feature = "std")] use std::fmt; #[cfg(feature = "std")] @@ -63,7 +63,7 @@ macro_rules! create_apis_vec { /// In particular: bug fixes should result in an increment of `spec_version` and possibly `authoring_version`, /// absolutely not `impl_version` since they change the semantics of the runtime. #[derive(Clone, PartialEq, Eq, Encode)] -#[cfg_attr(feature = "std", derive(Debug, Serialize, Decode))] +#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize, Decode))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] pub struct RuntimeVersion { /// Identifies the different Substrate runtimes. There'll be at least polkadot and node. diff --git a/substrate/node/rpc-client/Cargo.toml b/substrate/node/rpc-client/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..ea255808e463e47d2f6c0d3bdf15044b0b827815 --- /dev/null +++ b/substrate/node/rpc-client/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "node-rpc-client" +version = "2.0.0" +authors = ["Parity Technologies <admin@parity.io>"] +edition = "2018" + +[dependencies] +env_logger = "0.6" +futures = "0.1.26" +hyper = "0.12" +jsonrpc-core-client = { version = "12.0.0", features = ["http", "ws"] } +log = "0.4" +node-primitives = { path = "../primitives" } +substrate-rpc = { path = "../../core/rpc", version = "2.0.0" } diff --git a/substrate/node/rpc-client/src/main.rs b/substrate/node/rpc-client/src/main.rs new file mode 100644 index 0000000000000000000000000000000000000000..fe057bcbeaf4236661d5109513138a93a7e894f7 --- /dev/null +++ b/substrate/node/rpc-client/src/main.rs @@ -0,0 +1,70 @@ +// Copyright 2019 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/>. + +#![warn(missing_docs)] + +//! Example substrate RPC client code. +//! +//! This module shows how you can write a Rust RPC client that connects to a running +//! substrate node and use staticly typed RPC wrappers. + +use futures::Future; +use hyper::rt; +use node_primitives::Hash; +use substrate_rpc::author::{ + AuthorClient, + hash::ExtrinsicOrHash, +}; +use jsonrpc_core_client::{ + transports::http, + RpcError, +}; + +fn main() { + env_logger::init(); + + rt::run(rt::lazy(|| { + let uri = "http://localhost:9933"; + + http::connect(uri) + .and_then(|client: AuthorClient<Hash, Hash>| { + remove_all_extrinsics(client) + }) + .map_err(|e| { + println!("Error: {:?}", e); + }) + })) +} + +/// Remove all pending extrinsics from the node. +/// +/// The example code takes `AuthorClient` and first: +/// 1. Calls the `pending_extrinsics` method to get all extrinsics in the pool. +/// 2. Then calls `remove_extrinsic` passing the obtained raw extrinsics. +/// +/// As the resul of running the code the entire content of the transaction pool is going +/// to be removed and the extrinsics are going to be temporarily banned. +fn remove_all_extrinsics(client: AuthorClient<Hash, Hash>) -> impl Future<Item=(), Error=RpcError> { + client.pending_extrinsics() + .and_then(move |pending| { + client.remove_extrinsic( + pending.into_iter().map(|tx| ExtrinsicOrHash::Extrinsic(tx.into())).collect() + ) + }) + .map(|removed| { + println!("Removed extrinsics: {:?}", removed); + }) +} diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index c31c6b41ccd1d12ad0e6fe8e50ace36459c39482..bad1fb9def3cf4980115742d8cce5f78dd141083 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -59,7 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, spec_version: 91, - impl_version: 92, + impl_version: 93, apis: RUNTIME_API_VERSIONS, };