diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 7dfdee6590..2956ffe63d 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -69,6 +69,15 @@ dependencies = [ "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bigint" version = "4.2.0" @@ -96,6 +105,15 @@ name = "byteorder" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bytes" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cc" version = "1.0.3" @@ -214,6 +232,11 @@ dependencies = [ "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.2.1" @@ -230,6 +253,32 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "futures" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-cpupool" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "globset" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hashdb" version = "0.1.1" @@ -247,6 +296,43 @@ dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "httparse" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hyper" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "isatty" version = "0.1.5" @@ -262,6 +348,64 @@ name = "itoa" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "jsonrpc-core" +version = "8.0.0" +source = "git+https://github.com/paritytech/jsonrpc.git#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jsonrpc-http-server" +version = "8.0.0" +source = "git+https://github.com/paritytech/jsonrpc.git#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966" +dependencies = [ + "hyper 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jsonrpc-macros" +version = "8.0.0" +source = "git+https://github.com/paritytech/jsonrpc.git#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966" +dependencies = [ + "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jsonrpc-pubsub" +version = "8.0.0" +source = "git+https://github.com/paritytech/jsonrpc.git#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966" +dependencies = [ + "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jsonrpc-server-utils" +version = "8.0.0" +source = "git+https://github.com/paritytech/jsonrpc.git#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966" +dependencies = [ + "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "keccak-hash" version = "0.1.0" @@ -281,11 +425,21 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lazy_static" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazycell" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.33" @@ -318,6 +472,55 @@ dependencies = [ "rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "mime" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "net2" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.12" @@ -328,6 +531,14 @@ name = "num-traits" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "num_cpus" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "odds" version = "0.2.25" @@ -380,6 +591,11 @@ dependencies = [ "triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "plain_hasher" version = "0.1.0" @@ -392,6 +608,7 @@ dependencies = [ name = "polkadot" version = "0.1.0" dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "polkadot-cli 0.1.0", ] @@ -401,7 +618,21 @@ version = "0.1.0" dependencies = [ "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "polkadot-client 0.1.0", + "polkadot-contracts 0.1.0", + "polkadot-primitives 0.1.0", + "polkadot-rpc-servers 0.1.0", +] + +[[package]] +name = "polkadot-client" +version = "0.1.0" +dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "polkadot-primitives 0.1.0", + "polkadot-state-machine 0.1.0", ] [[package]] @@ -432,6 +663,29 @@ dependencies = [ "uint 0.1.0 (git+https://github.com/paritytech/primitives.git)", ] +[[package]] +name = "polkadot-rpc" +version = "0.1.0" +dependencies = [ + "assert_matches 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "polkadot-client 0.1.0", + "polkadot-contracts 0.1.0", + "polkadot-primitives 0.1.0", + "polkadot-state-machine 0.1.0", +] + +[[package]] +name = "polkadot-rpc-servers" +version = "0.1.0" +dependencies = [ + "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "polkadot-rpc 0.1.0", +] + [[package]] name = "polkadot-serializer" version = "0.1.0" @@ -505,6 +759,14 @@ name = "regex-syntax" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "relay" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rlp" version = "0.2.1" @@ -527,6 +789,14 @@ name = "rustc-hex" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc_version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc_version" version = "0.2.1" @@ -535,6 +805,21 @@ dependencies = [ "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "safemem" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "scoped-tls" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "semver" version = "0.6.0" @@ -583,6 +868,21 @@ dependencies = [ "serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slab" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slab" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "smallvec" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "smallvec" version = "0.4.4" @@ -616,6 +916,11 @@ dependencies = [ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "take" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "termion" version = "1.5.1" @@ -659,6 +964,56 @@ name = "tiny-keccak" version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "tokio-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-proto" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-service" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "triehash" version = "0.1.0" @@ -679,6 +1034,14 @@ dependencies = [ "rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicase" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "unicode-width" version = "0.1.4" @@ -722,6 +1085,15 @@ name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "yaml-rust" version = "0.3.5" @@ -735,10 +1107,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21e50800ec991574876040fff8ee46b136a53e985286fbe6a3bdfe6421b78860" "checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983" "checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661" +"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9" "checksum bigint 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5442186ef6560f30f1ee4b9c1e4c87a35a6879d3644550cc248ec2b955eb5fcd" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" +"checksum bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d828f97b58cc5de3e40c421d0cf2132d6b2da4ee0e11b8632fa838f0f9333ad6" "checksum cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b13a57efd6b30ecd6598ebdb302cca617930b5470647570468a65d12ef9719" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b8c532887f1a292d17de05ae858a8fe50a301e196f9ef0ddb7ccd0d1d00f180" @@ -753,26 +1127,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ethcore-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3977c772cd6c5c22e1c7cfa208e4c3b746bd6c3a6c8eeec0999a6b2103015ad5" "checksum ethcore-logger 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fd5813e49546030be7d134e775088d56b8ff4ab60617b90e93d4f0513da4c5b" "checksum fixed-hash 0.1.0 (git+https://github.com/paritytech/primitives.git)" = "" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c0581a4e363262e52b87f59ee2afe3415361c6ec35e665924eb08afe8ff159" "checksum fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82" +"checksum futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "118b49cac82e04121117cbd3121ede3147e885627d82c4546b87c702debb90c1" +"checksum futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e86f49cc0d92fe1b97a5980ec32d56208272cbb00f15044ea9e2799dde766fdf" +"checksum globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90d069fe6beb9be359ef505650b3f73228c5591a3c4b1f32be2f4f44459ffa3a" "checksum hashdb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d97be07c358c5b461268b4ce60304024c5fa5acfd4bd8cd743639f0252003cf5" "checksum heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "54fab2624374e5137ae4df13bf32b0b269cb804df42d13a51221bbd431d1a237" +"checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07" +"checksum hyper 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b45eac8b696d59491b079bd04fcb0f3488c0f6ed62dcb36bcfea8a543e9cdc3" +"checksum iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6e8b9c2247fcf6c6a1151f1156932be5606c9fd6f55a2d7f9fc1cb29386b2f7" "checksum isatty 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "00c9301a947a2eaee7ce2556b80285dcc89558d07088962e6e8b9c25730f9dc6" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" +"checksum jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" +"checksum jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" +"checksum jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" +"checksum jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" +"checksum jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" "checksum keccak-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f300c1f149cd9ca5214eed24f6e713a597517420fb8b15499824aa916259ec1" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9e5e58fa1a4c3b915a561a78a22ee0cac6ab97dca2504428bc1cb074375f8d5" +"checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b" "checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memorydb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "013b7e4c5e10c764936ebc6bd3662d8e3c92292d267bf6a42ef3f5cad9c793ee" +"checksum mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e00e17be181010a91dbfefb01660b17311059dc8c7f48b9017677721e732bd" +"checksum mio 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0e8411968194c7b139e9105bc4ae7db0bae232af087147e72f0616ebf5fdb9cb" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" +"checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d" "checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot_core 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f610cb9664da38e417ea3225f23051f589851999535290e077939838ab7a595" "checksum patricia-trie 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1e2f638d79aba5c4a71a4f373df6e3cd702250a53b7f0ed4da1e2a7be9737ae" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum plain_hasher 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83ae80873992f511142c07d0ec6c44de5636628fdb7e204abd655932ea79d995" "checksum pretty_assertions 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94b6bbc8a323d89a019c4cdde21850522fb8405e97add70827177fc2f86c1495" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" @@ -781,28 +1175,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" +"checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5" "checksum rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "babe6fce20c0ca9b1582998734c4569082d0ad08e43772a1c6c40aef4f106ef9" "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" "checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" +"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9743a7670d88d5d52950408ecdb7c71d8986251ab604d4689dd2ca25c9bca69" +"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" +"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d" +"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "0c9cab69e16835717c9b8bd13c29f92b6aa34fe32ce2866b1ab481cf2da8442a" "checksum serde_derive 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3bdafe3e71710131a919735916caa5b18c2754ad0d33d8ae5d586ccc804a403e" "checksum serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32f1926285523b2db55df263d2aa4eb69ddcfa7a7eade6430323637866b513ab" "checksum serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e4586746d1974a030c48919731ecffd0ed28d0c40749d0d18d43b3a7d6c9b20e" +"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" +"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" +"checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013" "checksum smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ee4f357e8cd37bf8822e1b964e96fd39e2cb5a0424f8aaa284ccaccc2162411c" "checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +"checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" "checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" "checksum tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52d12ad79e4063e0cb0ca5efa202ed7244b6ce4d25f4d3abe410b2a66128292" +"checksum tokio-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "c843a027f7c1df5f81e7734a0df3f67bf329411781ebf36393ce67beef6071e3" +"checksum tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "514aae203178929dbf03318ad7c683126672d4d96eccb77b29603d33c9e25743" +"checksum tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fbb47ae81353c63c487030659494b295f6cb6576242f907f203473b191b0389" +"checksum tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" "checksum triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9291c7f0fae44858b5e087dd462afb382354120003778f1695b44aab98c7abd7" "checksum uint 0.1.0 (git+https://github.com/paritytech/primitives.git)" = "" +"checksum unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e01da42520092d0cd2d6ac3ae69eb21a22ad43ff195676b86f8c37f487d6b80" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" @@ -811,4 +1219,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index f99dfd8ee5..84e987c436 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -1,15 +1,19 @@ [package] name = "polkadot" version = "0.1.0" -authors = ["Parity Team "] +authors = ["Parity Technologies "] [dependencies] +error-chain = "0.11" polkadot-cli = { path = "cli", version = "0.1" } [workspace] members = [ + "client", "contracts", "primitives", + "rpc", + "rpc_servers", "serializer", "state_machine", "validator", diff --git a/substrate/cli/Cargo.toml b/substrate/cli/Cargo.toml index 73de9ec2b0..f19977785f 100644 --- a/substrate/cli/Cargo.toml +++ b/substrate/cli/Cargo.toml @@ -1,10 +1,15 @@ [package] name = "polkadot-cli" version = "0.1.0" -authors = ["Parity Team "] +authors = ["Parity Technologies "] description = "Polkadot node implementation in Rust." [dependencies] clap = { version = "2.27", features = ["yaml"] } env_logger = "0.4" +error-chain = "0.11" log = "0.3" +polkadot-client = { path = "../client", version = "0.1" } +polkadot-contracts = { path = "../contracts", version = "0.1" } +polkadot-primitives = { path = "../primitives", version = "0.1" } +polkadot-rpc-servers = { path = "../rpc_servers", version = "0.1" } diff --git a/substrate/cli/src/error.rs b/substrate/cli/src/error.rs new file mode 100644 index 0000000000..c4e8cbcc5e --- /dev/null +++ b/substrate/cli/src/error.rs @@ -0,0 +1,24 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Initialization errors. + +error_chain! { + foreign_links { + Io(::std::io::Error) #[doc="IO error"]; + Cli(::clap::Error) #[doc="CLI error"]; + } +} diff --git a/substrate/cli/src/lib.rs b/substrate/cli/src/lib.rs index 5094e8ca00..e1086f8d6c 100644 --- a/substrate/cli/src/lib.rs +++ b/substrate/cli/src/lib.rs @@ -19,34 +19,65 @@ #![warn(missing_docs)] extern crate env_logger; +extern crate polkadot_client as client; +extern crate polkadot_contracts as contracts; +extern crate polkadot_primitives as primitives; +extern crate polkadot_rpc_servers as rpc; #[macro_use] extern crate clap; #[macro_use] +extern crate error_chain; +#[macro_use] extern crate log; -/// Parse command line arguments and start the node. -pub fn main() { - let yaml = load_yaml!("./cli.yml"); - let matches = clap::App::from_yaml(yaml).get_matches(); +pub mod error; +/// Parse command line arguments and start the node. +/// +/// IANA unassigned port ranges that we could use: +/// 6717-6766 Unassigned +/// 8504-8553 Unassigned +/// 9556-9591 Unassigned +/// 9803-9874 Unassigned +/// 9926-9949 Unassigned +pub fn run(args: I) -> error::Result<()> where + I: IntoIterator, + T: Into + Clone, +{ + let yaml = load_yaml!("./cli.yml"); + let matches = clap::App::from_yaml(yaml).get_matches_from_safe(args)?; + + // TODO [ToDr] Split paremeters parsing from actual execution. let log_pattern = matches.value_of("log").unwrap_or(""); init_logger(log_pattern); + // Create client + let blockchain = DummyBlockchain; + let executor = contracts::executor(); + let client = client::Client::new(blockchain, executor); + + let address = "127.0.0.1:9933".parse().unwrap(); + let handler = rpc::rpc_handler(client); + let server = rpc::start_http(&address, handler)?; + if let Some(_) = matches.subcommand_matches("collator") { info!("Starting collator."); - return; + server.wait(); + return Ok(()); } if let Some(_) = matches.subcommand_matches("validator") { info!("Starting validator."); - return; + server.wait(); + return Ok(()); } println!("No command given.\n"); let _ = clap::App::from_yaml(yaml).print_long_help(); -} + Ok(()) +} fn init_logger(pattern: &str) { let mut builder = env_logger::LogBuilder::new(); @@ -64,3 +95,18 @@ fn init_logger(pattern: &str) { builder.init().expect("Logger initialized only once."); } + +#[derive(Debug, Default)] +struct DummyBlockchain; + +impl client::Blockchain for DummyBlockchain { + type Error = (); + + fn latest_hash(&self) -> Result { + Ok(0.into()) + } + + fn header(&self, _hash: &primitives::block::HeaderHash) -> Result, Self::Error> { + Ok(None) + } +} diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml new file mode 100644 index 0000000000..2142732b5d --- /dev/null +++ b/substrate/client/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "polkadot-client" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +error-chain = "0.11" +polkadot-primitives = { path = "../primitives", version = "0.1" } +polkadot-state-machine = { path = "../state_machine", version = "0.1" } diff --git a/substrate/client/src/error.rs b/substrate/client/src/error.rs new file mode 100644 index 0000000000..b24b4753b1 --- /dev/null +++ b/substrate/client/src/error.rs @@ -0,0 +1,49 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Polkadot client possible errors. + +use primitives::block; +use state_machine; + +error_chain! { + errors { + /// Backend error. + Backend { + description("Unrecoverable backend error"), + display("Backend error"), + } + + /// Unknown block. + UnknownBlock(h: block::HeaderHash) { + description("unknown block"), + display("UnknownBlock: {}", h), + } + + /// Execution error. + Execution(e: Box) { + description("execution error"), + display("Execution: {}", e), + } + } +} + +// TODO [ToDr] Temporary, state_machine::Error should be a regular error not Box. +impl From> for Error { + fn from(e: Box) -> Self { + ErrorKind::Execution(e).into() + } +} diff --git a/substrate/client/src/lib.rs b/substrate/client/src/lib.rs new file mode 100644 index 0000000000..642dab79e2 --- /dev/null +++ b/substrate/client/src/lib.rs @@ -0,0 +1,96 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Polkadot Client + +#![warn(missing_docs)] + +extern crate polkadot_primitives as primitives; +extern crate polkadot_state_machine as state_machine; + +#[macro_use] +extern crate error_chain; + +pub mod error; + +use primitives::{block, Address, H256}; +use primitives::contract::{CallData, OutData, StorageData}; +use state_machine::backend::Backend; + +use self::error::ResultExt; + +/// Blockchain access +pub trait Blockchain { + /// Error Type + type Error; + + /// Returns the hash of latest block. + fn latest_hash(&self) -> Result; + + /// Given a hash return a header + fn header(&self, hash: &block::HeaderHash) -> Result, Self::Error>; +} + +/// Polkadot Client +#[derive(Debug)] +pub struct Client { + blockchain: B, + executor: E, +} + +impl Client { + /// Creates new Polkadot Client with given blockchain and code executor. + pub fn new(blockchain: B, executor: E) -> Self { + Client { + blockchain, + executor, + } + } +} + +impl Client where + B: Blockchain, + E: state_machine::CodeExecutor, +{ + + fn state_at(&self, _hash: &block::HeaderHash) -> error::Result { + // TODO [ToDr] Actually retrieve the state. + Ok(state_machine::backend::InMemory::default()) + } + + /// Return single storage entry of contract under given address in state in a block of given hash. + pub fn storage(&self, hash: &block::HeaderHash, address: &Address, key: &H256) -> error::Result { + self.state_at(hash)? + .storage(address, key) + .map(|x| StorageData(x.to_vec())) + .chain_err(|| error::ErrorKind::Backend) + } + + /// Execute a call to a contract on top of state in a block of given hash. + pub fn call(&self, hash: &block::HeaderHash, address: &Address, method: &str, call_data: &CallData) -> error::Result { + let state = self.state_at(hash)?; + let mut changes = state_machine::OverlayedChanges::default(); + + Ok(state_machine::execute( + &state, + &mut changes, + &self.executor, + address, + method, + call_data, + )?) + } +} diff --git a/substrate/contracts/Cargo.toml b/substrate/contracts/Cargo.toml index 2c23cdb896..84d52c87f8 100644 --- a/substrate/contracts/Cargo.toml +++ b/substrate/contracts/Cargo.toml @@ -1,13 +1,15 @@ [package] name = "polkadot-contracts" version = "0.1.0" -authors = ["Parity Team "] +authors = ["Parity Technologies "] [dependencies] -assert_matches = "1.1" error-chain = "0.11" polkadot-primitives = { path = "../primitives", version = "0.1" } polkadot-serializer = { path = "../serializer", version = "0.1" } polkadot-state-machine = { path = "../state_machine" , version = "0.1" } serde = "1.0" serde_derive = "1.0" + +[dev-dependencies] +assert_matches = "1.1" diff --git a/substrate/contracts/src/error.rs b/substrate/contracts/src/error.rs index 6280953e45..04e3144ed6 100644 --- a/substrate/contracts/src/error.rs +++ b/substrate/contracts/src/error.rs @@ -16,14 +16,12 @@ //! Rust executor possible errors. -#![allow(missing_docs)] - use serializer; use state_machine; error_chain! { foreign_links { - InvalidData(serializer::Error); + InvalidData(serializer::Error) #[doc = "Unserializable Data"]; } errors { diff --git a/substrate/contracts/src/executor.rs b/substrate/contracts/src/executor.rs index ec617cfb54..dde20b4257 100644 --- a/substrate/contracts/src/executor.rs +++ b/substrate/contracts/src/executor.rs @@ -18,7 +18,7 @@ use primitives::contract::{CallData, OutData}; use serializer::{from_slice as de, to_vec as ser}; -use state_machine::{StaticExternalities, Externalities, Executor}; +use state_machine::{StaticExternalities, Externalities, CodeExecutor}; use error::{Error, ErrorKind, Result}; use auth; @@ -42,7 +42,7 @@ impl RustExecutor { const VALIDATOR_SET: u8 = 3; } -impl Executor for RustExecutor { +impl CodeExecutor for RustExecutor { type Error = Error; fn call_static>( diff --git a/substrate/contracts/src/lib.rs b/substrate/contracts/src/lib.rs index cacfc54dd6..6226edf4fc 100644 --- a/substrate/contracts/src/lib.rs +++ b/substrate/contracts/src/lib.rs @@ -42,6 +42,6 @@ pub mod error; pub mod executor; /// Creates new RustExecutor for contracts. -pub fn new() -> executor::RustExecutor { +pub fn executor() -> executor::RustExecutor { executor::RustExecutor::default() } diff --git a/substrate/primitives/Cargo.toml b/substrate/primitives/Cargo.toml index 709a8d0566..f31afccf5b 100644 --- a/substrate/primitives/Cargo.toml +++ b/substrate/primitives/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "polkadot-primitives" version = "0.1.0" -authors = ["Parity Team "] +authors = ["Parity Technologies "] [dependencies] crunchy = "0.1" diff --git a/substrate/primitives/src/block.rs b/substrate/primitives/src/block.rs index 41844b5d73..fd6eba123a 100644 --- a/substrate/primitives/src/block.rs +++ b/substrate/primitives/src/block.rs @@ -49,7 +49,6 @@ pub struct Body { pub para_blocks: Vec, } - #[cfg(test)] mod tests { use super::*; diff --git a/substrate/primitives/src/contract.rs b/substrate/primitives/src/contract.rs index 36d22c4ea0..33504d1b03 100644 --- a/substrate/primitives/src/contract.rs +++ b/substrate/primitives/src/contract.rs @@ -25,3 +25,7 @@ pub struct CallData(#[serde(with="bytes")] pub Vec); /// Contract output data. #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct OutData(#[serde(with="bytes")] pub Vec); + +/// Contract storage entry data. +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct StorageData(#[serde(with="bytes")] pub Vec); diff --git a/substrate/primitives/src/lib.rs b/substrate/primitives/src/lib.rs index b3e4c36be9..c1e0b6aadf 100644 --- a/substrate/primitives/src/lib.rs +++ b/substrate/primitives/src/lib.rs @@ -49,6 +49,8 @@ pub mod validator; /// Alias to 160-bit hash when used in the context of an account address. pub type Address = hash::H160; +pub use self::hash::{H160, H256}; +pub use self::uint::{U256, U512}; /// A hash function. pub fn hash(data: &[u8]) -> hash::H256 { diff --git a/substrate/rpc/Cargo.toml b/substrate/rpc/Cargo.toml new file mode 100644 index 0000000000..fb9a835834 --- /dev/null +++ b/substrate/rpc/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "polkadot-rpc" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +error-chain = "0.11" +jsonrpc-core = { git="https://github.com/paritytech/jsonrpc.git" } +jsonrpc-macros = { git="https://github.com/paritytech/jsonrpc.git" } +polkadot-client = { path = "../client", version = "0.1" } +polkadot-primitives = { path = "../primitives", version = "0.1" } +polkadot-state-machine = { path = "../state_machine", version = "0.1" } + +[dev-dependencies] +assert_matches = "1.1" +polkadot-contracts = { path = "../contracts", version = "0.1" } diff --git a/substrate/rpc/src/chain/error.rs b/substrate/rpc/src/chain/error.rs new file mode 100644 index 0000000000..a838f30787 --- /dev/null +++ b/substrate/rpc/src/chain/error.rs @@ -0,0 +1,40 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +use rpc; + +error_chain! { + errors { + /// Not implemented yet + Unimplemented { + description("not yet implemented"), + display("Method Not Implemented"), + } + } +} + +impl From for rpc::Error { + fn from(e: Error) -> Self { + match e { + Error(ErrorKind::Unimplemented, _) => rpc::Error { + code: rpc::ErrorCode::ServerError(-1), + message: "Not implemented yet".into(), + data: None, + }, + _ => rpc::Error::internal_error(), + } + } +} diff --git a/substrate/rpc/src/chain/mod.rs b/substrate/rpc/src/chain/mod.rs new file mode 100644 index 0000000000..86b00795ec --- /dev/null +++ b/substrate/rpc/src/chain/mod.rs @@ -0,0 +1,45 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Polkadot blockchain API. + +use primitives::block; +use client; + +mod error; + +#[cfg(test)] +mod tests; + +use self::error::{Result, ResultExt}; + +build_rpc_trait! { + /// Polkadot blockchain API + pub trait ChainApi { + /// Get header of a relay chain block. + #[rpc(name = "chain_getHeader")] + fn header(&self, block::HeaderHash) -> Result>; + } +} + +impl ChainApi for B where + B: client::Blockchain + Send + Sync + 'static, + B::Error: ::std::error::Error + Send, +{ + fn header(&self, hash: block::HeaderHash) -> Result> { + self.header(&hash).chain_err(|| "Blockchain error") + } +} diff --git a/substrate/rpc/src/chain/tests.rs b/substrate/rpc/src/chain/tests.rs new file mode 100644 index 0000000000..03cee36651 --- /dev/null +++ b/substrate/rpc/src/chain/tests.rs @@ -0,0 +1,39 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +use super::*; + +use test_helpers::Blockchain; + +#[test] +fn should_return_header() { + let state = Blockchain::default(); + + assert_matches!( + ChainApi::header(&state, 0.into()), + Ok(Some(ref x)) if x == &block::Header { + parent_hash: 0.into(), + state_root: 0.into(), + timestamp: 0, + number: 0, + } + ); + + assert_matches!( + ChainApi::header(&state, 5.into()), + Ok(None) + ); +} diff --git a/substrate/rpc/src/lib.rs b/substrate/rpc/src/lib.rs new file mode 100644 index 0000000000..762514f7b0 --- /dev/null +++ b/substrate/rpc/src/lib.rs @@ -0,0 +1,41 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Polkadot RPC interfaces. + +#![warn(missing_docs)] + +extern crate jsonrpc_core as rpc; +extern crate polkadot_client as client; +extern crate polkadot_primitives as primitives; +extern crate polkadot_state_machine as state_machine; + +#[macro_use] +extern crate error_chain; +#[macro_use] +extern crate jsonrpc_macros; + +#[cfg(test)] +extern crate polkadot_contracts; +#[cfg(test)] +#[macro_use] +extern crate assert_matches; + +pub mod chain; +pub mod state; + +#[cfg(test)] +mod test_helpers; diff --git a/substrate/rpc/src/state/error.rs b/substrate/rpc/src/state/error.rs new file mode 100644 index 0000000000..827ac9e8ca --- /dev/null +++ b/substrate/rpc/src/state/error.rs @@ -0,0 +1,45 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +use client; +use rpc; + +error_chain! { + links { + Client(client::error::Error, client::error::ErrorKind) #[doc = "Client error"]; + } + + errors { + /// Not implemented yet + Unimplemented { + description("not implemented yet"), + display("Method Not Implemented"), + } + } +} + +impl From for rpc::Error { + fn from(e: Error) -> Self { + match e { + Error(ErrorKind::Unimplemented, _) => rpc::Error { + code: rpc::ErrorCode::ServerError(-1), + message: "Not implemented yet".into(), + data: None, + }, + _ => rpc::Error::internal_error(), + } + } +} diff --git a/substrate/rpc/src/state/mod.rs b/substrate/rpc/src/state/mod.rs new file mode 100644 index 0000000000..3ba8758bd4 --- /dev/null +++ b/substrate/rpc/src/state/mod.rs @@ -0,0 +1,55 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Polkadot state API. + +mod error; + +#[cfg(test)] +mod tests; + +use client::{self, Client}; +use primitives::{block, Address, H256}; +use primitives::contract::{CallData, OutData, StorageData}; +use state_machine; + +use self::error::Result; + +build_rpc_trait! { + /// Polkadot state API + pub trait StateApi { + /// Returns a storage entry. + #[rpc(name = "state_getStorage")] + fn storage(&self, Address, H256, block::HeaderHash) -> Result; + + /// Call a contract. + #[rpc(name = "state_call")] + fn call(&self, Address, String, CallData, block::HeaderHash) -> Result; + } +} + +impl StateApi for Client where + B: client::Blockchain + Send + Sync + 'static, + E: state_machine::CodeExecutor + Send + Sync + 'static, +{ + fn storage(&self, address: Address, key: H256, block: block::HeaderHash) -> Result { + Ok(self.storage(&block, &address, &key)?) + } + + fn call(&self, address: Address, method: String, data: CallData, block: block::HeaderHash) -> Result { + Ok(self.call(&block, &address, &method, &data)?) + } +} diff --git a/substrate/rpc/src/state/tests.rs b/substrate/rpc/src/state/tests.rs new file mode 100644 index 0000000000..d3e7493786 --- /dev/null +++ b/substrate/rpc/src/state/tests.rs @@ -0,0 +1,42 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +use super::*; +use polkadot_contracts as contracts; + +use self::error::{Error, ErrorKind}; +use test_helpers::Blockchain; + +#[test] +fn should_return_storage() { + let client = Client::new(Blockchain::default(), contracts::executor()); + + assert_matches!( + StateApi::storage(&client, 5.into(), 10.into(), 0.into()), + Ok(ref x) if x.0.is_empty() + ) +} + +#[test] +fn should_call_contract() { + // TODO [ToDr] Fix test after we are able to mock state. + let client = Client::new(Blockchain::default(), contracts::executor()); + + assert_matches!( + StateApi::call(&client, 1.into(), "balanceOf".into(), CallData(vec![1,2,3]), 0.into()), + Err(Error(ErrorKind::Client(client::error::ErrorKind::Execution(_)), _)) + ) +} diff --git a/substrate/rpc/src/test_helpers.rs b/substrate/rpc/src/test_helpers.rs new file mode 100644 index 0000000000..3866d657f4 --- /dev/null +++ b/substrate/rpc/src/test_helpers.rs @@ -0,0 +1,44 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +use client; +use primitives::block; + +/// Temporary dummy blockchain implementation for tests. +#[derive(Debug, Default)] +pub struct Blockchain; + +impl client::Blockchain for Blockchain { + type Error = ::std::io::Error; + + fn latest_hash(&self) -> Result { + Ok(0.into()) + } + + fn header(&self, hash: &block::HeaderHash) -> Result, Self::Error> { + Ok(if hash != &0.into() { + None + } else { + Some(block::Header { + number: 0, + parent_hash: 0.into(), + state_root: 0.into(), + timestamp: 0, + }) + }) + } +} + diff --git a/substrate/rpc_servers/Cargo.toml b/substrate/rpc_servers/Cargo.toml new file mode 100644 index 0000000000..d47b4d94a1 --- /dev/null +++ b/substrate/rpc_servers/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "polkadot-rpc-servers" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +polkadot-rpc = { path = "../rpc", version = "0.1" } +jsonrpc-core = { git="https://github.com/paritytech/jsonrpc.git" } +jsonrpc-http-server = { git="https://github.com/paritytech/jsonrpc.git" } diff --git a/substrate/rpc_servers/src/lib.rs b/substrate/rpc_servers/src/lib.rs new file mode 100644 index 0000000000..2bc78a06f2 --- /dev/null +++ b/substrate/rpc_servers/src/lib.rs @@ -0,0 +1,46 @@ +// Copyright 2017 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! Polkadot RPC servers. + +#[warn(missing_docs)] + +extern crate polkadot_rpc as apis; + +extern crate jsonrpc_core as rpc; +extern crate jsonrpc_http_server as http; + +use std::io; + +/// Construct rpc `IoHandler` +pub fn rpc_handler(state: S) -> rpc::IoHandler where + S: apis::state::StateApi, +{ + let mut io = rpc::IoHandler::new(); + io.extend_with(state.to_delegate()); + io +} + +/// Start HTTP server listening on given address. +pub fn start_http( + addr: &std::net::SocketAddr, + io: rpc::IoHandler, +) -> io::Result { + http::ServerBuilder::new(io) + .threads(4) + .rest_api(http::RestApi::Unsecure) + .start_http(addr) +} diff --git a/substrate/serializer/Cargo.toml b/substrate/serializer/Cargo.toml index 34db3dfb76..5b98496560 100644 --- a/substrate/serializer/Cargo.toml +++ b/substrate/serializer/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "polkadot-serializer" version = "0.1.0" -authors = ["Parity Team "] +authors = ["Parity Technologies "] [dependencies] serde = "1.0" diff --git a/substrate/src/main.rs b/substrate/src/main.rs index 0f3ab21a69..50ff18462e 100644 --- a/substrate/src/main.rs +++ b/substrate/src/main.rs @@ -18,8 +18,13 @@ #![warn(missing_docs)] -extern crate polkadot_cli; +extern crate polkadot_cli as cli; -fn main() { - polkadot_cli::main(); +#[macro_use] +extern crate error_chain; + +quick_main!(run); + +fn run() -> cli::error::Result<()> { + cli::run(::std::env::args()) } diff --git a/substrate/state_machine/src/backend.rs b/substrate/state_machine/src/backend.rs index f513ed2451..c7f694712e 100644 --- a/substrate/state_machine/src/backend.rs +++ b/substrate/state_machine/src/backend.rs @@ -16,7 +16,7 @@ //! State machine backends. These manage the code and storage of contracts. -use std::fmt; +use std::{error, fmt}; use primitives::Address; use primitives::hash::H256; @@ -60,6 +60,10 @@ impl fmt::Display for Void { } } +impl error::Error for Void { + fn description(&self) -> &str { "unreachable error" } +} + /// In-memory backend. Fully recomputes tries on each commit but useful for /// tests. #[derive(Default)] diff --git a/substrate/state_machine/src/ext.rs b/substrate/state_machine/src/ext.rs index 1820e6a091..455fc4d22e 100644 --- a/substrate/state_machine/src/ext.rs +++ b/substrate/state_machine/src/ext.rs @@ -16,13 +16,13 @@ //! Conrete externalities implementation. -use std::fmt; +use std::{error, fmt}; use backend::Backend; use primitives::Address; use primitives::contract::{CallData, OutData}; use primitives::hash::H256; -use {Externalities, Executor, StaticExternalities, OverlayedChanges}; +use {Externalities, CodeExecutor, StaticExternalities, OverlayedChanges}; /// Errors that can occur when interacting with the externalities. #[derive(Debug, Copy, Clone)] @@ -42,6 +42,15 @@ impl fmt::Display for Error { } } +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::Backend(..) => "backend error", + Error::Executor(..) => "executor error", + } + } +} + /// Wraps a read-only backend, call executor, and current overlayed changes. pub struct Ext<'a, B: 'a, E: 'a> { /// The overlayed changes to write to. @@ -55,7 +64,7 @@ pub struct Ext<'a, B: 'a, E: 'a> { } impl<'a, B: 'a, E: 'a> StaticExternalities for Ext<'a, B, E> - where B: Backend, E: Executor + where B: Backend, E: CodeExecutor { type Error = Error; @@ -89,7 +98,7 @@ impl<'a, B: 'a, E: 'a> StaticExternalities for Ext<'a, B, E> } impl<'a, B: 'a, E: 'a> Externalities for Ext<'a, B, E> - where B: Backend, E: Executor + where B: Backend, E: CodeExecutor { fn set_storage(&mut self, key: H256, value: Vec) { self.overlay.set_storage(self.local, key, value); @@ -130,7 +139,7 @@ struct StaticExt<'a, B: 'a, E: 'a> { } impl<'a, B: 'a, E: 'a> StaticExternalities for StaticExt<'a, B, E> - where B: Backend, E: Executor + where B: Backend, E: CodeExecutor { type Error = Error; diff --git a/substrate/state_machine/src/lib.rs b/substrate/state_machine/src/lib.rs index a97861170f..9eb6039fa3 100644 --- a/substrate/state_machine/src/lib.rs +++ b/substrate/state_machine/src/lib.rs @@ -162,7 +162,7 @@ pub trait Error: 'static + fmt::Debug + fmt::Display + Send {} impl Error for E where E: 'static + fmt::Debug + fmt::Display + Send {} /// Externalities: pinned to specific active address. -pub trait Externalities: StaticExternalities { +pub trait Externalities: StaticExternalities { /// Read storage of current contract being called. fn storage(&self, key: &H256) -> Result<&[u8], Self::Error> { StaticExternalities::storage(self, key) @@ -181,7 +181,7 @@ pub trait Externalities: StaticExternalities { } /// Static externalities: used only for read-only requests. -pub trait StaticExternalities { +pub trait StaticExternalities { /// Externalities error type. type Error: Error; @@ -193,7 +193,7 @@ pub trait StaticExternalities { } /// Contract code executor. -pub trait Executor: Sized { +pub trait CodeExecutor: Sized { /// Error type for contract execution. type Error: Error; @@ -220,7 +220,7 @@ pub trait Executor: Sized { /// Execute a call using the given state backend, overlayed changes, and call executor. /// /// On an error, no prospective changes are written to the overlay. -pub fn execute( +pub fn execute( backend: &B, overlay: &mut OverlayedChanges, exec: &Exec, diff --git a/substrate/validator/Cargo.toml b/substrate/validator/Cargo.toml index 00b0d14c89..39096165d5 100644 --- a/substrate/validator/Cargo.toml +++ b/substrate/validator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "polkadot-validator" version = "0.1.0" -authors = ["Parity Team "] +authors = ["Parity Technologies "] [dependencies] error-chain = "0.11"