* Porting json

* Dapps

* Rpc & Ethstore

* New ethabi

* Last bunch of fixes

* Fixing last test

* Removing build script

* Adding ethcore-ipc-tests back

* Fixing grumbles

* Fixing blockchain tests (inference regression?)
This commit is contained in:
Tomasz Drwięga 2017-02-13 16:38:47 +01:00 committed by Nikolay Volf
parent a2c6cd8f7b
commit f1e99ea2e4
68 changed files with 683 additions and 2480 deletions

222
Cargo.lock generated
View File

@ -14,7 +14,6 @@ dependencies = [
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
"ethcore-io 1.6.0", "ethcore-io 1.6.0",
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0",
"ethcore-ipc-hypervisor 1.2.0", "ethcore-ipc-hypervisor 1.2.0",
"ethcore-ipc-nano 1.6.0", "ethcore-ipc-nano 1.6.0",
"ethcore-ipc-tests 0.1.0", "ethcore-ipc-tests 0.1.0",
@ -42,10 +41,9 @@ dependencies = [
"rpassword 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rpc-cli 1.4.0", "rpc-cli 1.4.0",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -298,11 +296,6 @@ dependencies = [
"strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "dtoa"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "0.4.0" version = "0.4.0"
@ -344,14 +337,13 @@ dependencies = [
[[package]] [[package]]
name = "ethabi" name = "ethabi"
version = "0.2.2" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -375,7 +367,7 @@ dependencies = [
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.6.0", "ethash 1.6.0",
"ethcore-bloom-journal 0.1.0", "ethcore-bloom-journal 0.1.0",
"ethcore-devtools 1.6.0", "ethcore-devtools 1.6.0",
@ -390,7 +382,6 @@ dependencies = [
"ethstore 0.1.0", "ethstore 0.1.0",
"evmjit 1.6.0", "evmjit 1.6.0",
"hardware-wallet 1.6.0", "hardware-wallet 1.6.0",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -449,9 +440,9 @@ dependencies = [
"parity-ui 1.6.0", "parity-ui 1.6.0",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -621,9 +612,9 @@ dependencies = [
"rlp 0.1.0", "rlp 0.1.0",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -721,9 +712,9 @@ version = "0.1.0"
dependencies = [ dependencies = [
"ethcore-util 1.6.0", "ethcore-util 1.6.0",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -758,9 +749,9 @@ dependencies = [
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1011,7 +1002,6 @@ dependencies = [
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
"ethcore-util 1.6.0", "ethcore-util 1.6.0",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1033,11 +1023,6 @@ dependencies = [
"either 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "itoa"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.3.0" version = "0.3.0"
@ -1046,20 +1031,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "jsonrpc-core" name = "jsonrpc-core"
version = "5.1.0" version = "5.1.0"
source = "git+https://github.com/ethcore/jsonrpc.git#d179ce34d8da8ea1cd67e93a5b4cb1e30f48c156" source = "git+https://github.com/ethcore/jsonrpc.git#cac47f72090c3db78e83d56d333ada52a22dd3a9"
dependencies = [ dependencies = [
"futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "jsonrpc-http-server" name = "jsonrpc-http-server"
version = "7.0.0" version = "7.0.0"
source = "git+https://github.com/ethcore/jsonrpc.git#d179ce34d8da8ea1cd67e93a5b4cb1e30f48c156" source = "git+https://github.com/ethcore/jsonrpc.git#cac47f72090c3db78e83d56d333ada52a22dd3a9"
dependencies = [ dependencies = [
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
"jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)",
@ -1071,7 +1056,7 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-ipc-server" name = "jsonrpc-ipc-server"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/ethcore/jsonrpc.git#d179ce34d8da8ea1cd67e93a5b4cb1e30f48c156" source = "git+https://github.com/ethcore/jsonrpc.git#cac47f72090c3db78e83d56d333ada52a22dd3a9"
dependencies = [ dependencies = [
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1087,23 +1072,23 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-macros" name = "jsonrpc-macros"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/ethcore/jsonrpc.git#d179ce34d8da8ea1cd67e93a5b4cb1e30f48c156" source = "git+https://github.com/ethcore/jsonrpc.git#cac47f72090c3db78e83d56d333ada52a22dd3a9"
dependencies = [ dependencies = [
"jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "jsonrpc-tcp-server" name = "jsonrpc-tcp-server"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/ethcore/jsonrpc.git#d179ce34d8da8ea1cd67e93a5b4cb1e30f48c156" source = "git+https://github.com/ethcore/jsonrpc.git#cac47f72090c3db78e83d56d333ada52a22dd3a9"
dependencies = [ dependencies = [
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-proto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-proto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1565,7 +1550,7 @@ dependencies = [
name = "parity-hash-fetch" name = "parity-hash-fetch"
version = "1.6.0" version = "1.6.0"
dependencies = [ dependencies = [
"ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-util 1.6.0", "ethcore-util 1.6.0",
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1594,12 +1579,10 @@ dependencies = [
"ethcore-util 1.6.0", "ethcore-util 1.6.0",
"futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ws 0.5.3 (git+https://github.com/ethcore/ws-rs.git?branch=mio-upstream-stable)", "ws 0.5.3 (git+https://github.com/ethcore/ws-rs.git?branch=mio-upstream-stable)",
@ -1633,7 +1616,7 @@ dependencies = [
name = "parity-updater" name = "parity-updater"
version = "1.6.0" version = "1.6.0"
dependencies = [ dependencies = [
"ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.6.0", "ethcore 1.6.0",
"ethcore-ipc 1.6.0", "ethcore-ipc 1.6.0",
"ethcore-ipc-codegen 1.6.0", "ethcore-ipc-codegen 1.6.0",
@ -1828,8 +1811,8 @@ dependencies = [
"hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2013,54 +1996,36 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "0.8.19" version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_codegen"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen_internals 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "serde_codegen_internals" name = "serde_codegen_internals"
version = "0.11.1" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"syn 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen_internals 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "0.8.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"dtoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "dtoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2070,7 +2035,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"dtoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "dtoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2161,11 +2126,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "syn" name = "syn"
version = "0.10.3" version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"quote 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2176,36 +2141,6 @@ dependencies = [
"syntex_syntax 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "syntex"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"syntex_errors 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syntex_errors"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_pos 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syntex_pos"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "syntex_syntax" name = "syntex_syntax"
version = "0.33.0" version = "0.33.0"
@ -2219,21 +2154,6 @@ dependencies = [
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "syntex_syntax"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_errors 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_pos 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "table" name = "table"
version = "0.1.0" version = "0.1.0"
@ -2265,15 +2185,6 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "term"
version = "0.4.4"
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)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "termios" name = "termios"
version = "0.2.2" version = "0.2.2"
@ -2410,6 +2321,11 @@ name = "unicode-xid"
version = "0.0.3" version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "url" name = "url"
version = "1.2.0" version = "1.2.0"
@ -2560,13 +2476,12 @@ dependencies = [
"checksum daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "271ec51b7e0bee92f0d04601422c73eb76ececf197026711c97ad25038a010cf" "checksum daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "271ec51b7e0bee92f0d04601422c73eb76ececf197026711c97ad25038a010cf"
"checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf" "checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf"
"checksum docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4cc0acb4ce0828c6a5a11d47baa432fe885881c27428c3a4e473e454ffe57a76" "checksum docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4cc0acb4ce0828c6a5a11d47baa432fe885881c27428c3a4e473e454ffe57a76"
"checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d"
"checksum dtoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5edd69c67b2f8e0911629b7e6b8a34cb3956613cd7c6e6414966dee349c2db4f" "checksum dtoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5edd69c67b2f8e0911629b7e6b8a34cb3956613cd7c6e6414966dee349c2db4f"
"checksum either 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2b503c86dad62aaf414ecf2b8c527439abedb3f8d812537f0b12bfd6f32a91" "checksum either 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2b503c86dad62aaf414ecf2b8c527439abedb3f8d812537f0b12bfd6f32a91"
"checksum elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)" = "<none>" "checksum elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)" = "<none>"
"checksum env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aba65b63ffcc17ffacd6cf5aa843da7c5a25e3bd4bbe0b7def8b214e411250e5" "checksum env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aba65b63ffcc17ffacd6cf5aa843da7c5a25e3bd4bbe0b7def8b214e411250e5"
"checksum eth-secp256k1 0.5.6 (git+https://github.com/ethcore/rust-secp256k1)" = "<none>" "checksum eth-secp256k1 0.5.6 (git+https://github.com/ethcore/rust-secp256k1)" = "<none>"
"checksum ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0c53453517f620847be51943db329276ae52f2e210cfc659e81182864be2f" "checksum ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d8f6cc4c1acd005f48e1d17b06a461adac8fb6eeeb331fbf19a0e656fba91cd"
"checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa"
"checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb"
"checksum futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bad0a2ac64b227fdc10c254051ae5af542cf19c9328704fd4092f7914196897" "checksum futures 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bad0a2ac64b227fdc10c254051ae5af542cf19c9328704fd4092f7914196897"
@ -2587,7 +2502,6 @@ dependencies = [
"checksum igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c8c12b1795b8b168f577c45fa10379b3814dcb11b7ab702406001f0d63f40484" "checksum igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c8c12b1795b8b168f577c45fa10379b3814dcb11b7ab702406001f0d63f40484"
"checksum isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7408a548dc0e406b7912d9f84c261cc533c1866e047644a811c133c56041ac0c" "checksum isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7408a548dc0e406b7912d9f84c261cc533c1866e047644a811c133c56041ac0c"
"checksum itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d95557e7ba6b71377b0f2c3b3ae96c53f1b75a926a6901a500f557a370af730a" "checksum itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d95557e7ba6b71377b0f2c3b3ae96c53f1b75a926a6901a500f557a370af730a"
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
"checksum itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91fd9dc2c587067de817fec4ad355e3818c3d893a78cab32a0a474c7a15bb8d5" "checksum itoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91fd9dc2c587067de817fec4ad355e3818c3d893a78cab32a0a474c7a15bb8d5"
"checksum jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-core 5.1.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
"checksum jsonrpc-http-server 7.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>" "checksum jsonrpc-http-server 7.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
@ -2684,12 +2598,10 @@ dependencies = [
"checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f" "checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f"
"checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5" "checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5"
"checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9" "checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9"
"checksum serde 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)" = "58a19c0871c298847e6b68318484685cd51fa5478c0c905095647540031356e5" "checksum serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0ae9a3c8b07c09dbe43022486d55a18c629a0618d2241e49829aaef9b6d862f9"
"checksum serde 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4d8f810025e9d09c4eaa49c16eaf878f34a947889e878cd7d3b5bef3197cc119" "checksum serde_codegen_internals 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3172bf2940b975c0e4f6ab42a511c0a4407d4f46ccef87a9d3615db5c26fa96"
"checksum serde_codegen 0.8.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ce29a6ae259579707650ec292199b5fed2c0b8e2a4bdc994452d24d1bcf2242a" "checksum serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ecc6e0379ca933ece58302d2d3034443f06fbf38fd535857c1dc516195cbc3bf"
"checksum serde_codegen_internals 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "59933a62554548c690d2673c5164f0c4a46be7c5731edfd94b0ecb1048940732" "checksum serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cf37ce931677e98b4fa5e6469aaa3ab4b6228309ea33b1b22d3ec055adfc4515"
"checksum serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3f7d3c184d35801fb8b32b46a7d58d57dbcc150b0eb2b46a1eb79645e8ecfd5b"
"checksum serde_json 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fea48f4d4df4e620e3c81fd2bf28c93dd0d266361a76bac4f254b71f0e13f3cd"
"checksum serde_urlencoded 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a81f15da4b9780e1524697f73b09076b6e42298ef673bead9ca8f848b334ef84" "checksum serde_urlencoded 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a81f15da4b9780e1524697f73b09076b6e42298ef673bead9ca8f848b334ef84"
"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" "checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c"
"checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d" "checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d"
@ -2705,18 +2617,13 @@ dependencies = [
"checksum spmc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93bdab61c1a413e591c4d17388ffa859eaff2df27f1e13a5ec8b716700605adf" "checksum spmc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93bdab61c1a413e591c4d17388ffa859eaff2df27f1e13a5ec8b716700605adf"
"checksum stable-heap 0.1.0 (git+https://github.com/carllerche/stable-heap?rev=3c5cd1ca47)" = "<none>" "checksum stable-heap 0.1.0 (git+https://github.com/carllerche/stable-heap?rev=3c5cd1ca47)" = "<none>"
"checksum strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4d73a2c36a4d095ed1a6df5cbeac159863173447f7a82b3f4757426844ab825" "checksum strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4d73a2c36a4d095ed1a6df5cbeac159863173447f7a82b3f4757426844ab825"
"checksum syn 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94e7d81ecd16d39f16193af05b8d5a0111b9d8d2f3f78f31760f327a247da777" "checksum syn 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f94368aae82bb29656c98443a7026ca931a659e8d19dcdc41d6e273054e820"
"checksum syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393b6dd0889df2b064beeea954cfda6bc2571604ac460deeae0fed55a53988af" "checksum syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393b6dd0889df2b064beeea954cfda6bc2571604ac460deeae0fed55a53988af"
"checksum syntex 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bd253b0d7d787723a33384d426f0ebec7f8edccfaeb2022d0177162bb134da0"
"checksum syntex_errors 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84822a1178204a191239ad844599f8c85c128cf9f4173397def4eb46b55b0aa1"
"checksum syntex_pos 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a43abded5057c75bac8555e46ec913ce502efb418267b1ab8e9783897470c7db"
"checksum syntex_syntax 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44bded3cabafc65c90b663b1071bd2d198a9ab7515e6ce729e4570aaf53c407e" "checksum syntex_syntax 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44bded3cabafc65c90b663b1071bd2d198a9ab7515e6ce729e4570aaf53c407e"
"checksum syntex_syntax 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef781e4b60f03431f1b5b59843546ce60ae029a787770cf8e0969ac1fd063a5"
"checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5" "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5"
"checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" "checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe"
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
"checksum term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f2077e54d38055cf1ca0fd7933a2e00cd3ec8f6fed352b2a377f06dcdaaf3281" "checksum term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f2077e54d38055cf1ca0fd7933a2e00cd3ec8f6fed352b2a377f06dcdaaf3281"
"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a"
"checksum termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a" "checksum termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a"
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
"checksum thread_local 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0694f51610ef7cfac7a1b81de7f1602ee5356e76541bcd62c40e71933338cab1" "checksum thread_local 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0694f51610ef7cfac7a1b81de7f1602ee5356e76541bcd62c40e71933338cab1"
@ -2734,6 +2641,7 @@ dependencies = [
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f" "checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172" "checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172"
"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" "checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
"checksum url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afe9ec54bc4db14bc8744b7fed060d785ac756791450959b2248443319d5b119" "checksum url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afe9ec54bc4db14bc8744b7fed060d785ac756791450959b2248443319d5b119"
"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"

View File

@ -4,12 +4,6 @@ name = "parity"
version = "1.6.0" version = "1.6.0"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[build-dependencies]
rustc_version = "0.1"
ethcore-ipc-codegen = { path = "ipc/codegen" }
ethcore-ipc-tests = { path = "ipc/tests" }
[dependencies] [dependencies]
log = "0.3" log = "0.3"
@ -26,8 +20,8 @@ lazy_static = "0.2"
regex = "0.1" regex = "0.1"
isatty = "0.1" isatty = "0.1"
toml = "0.2" toml = "0.2"
serde = "0.8" serde = "0.9"
serde_json = "0.8" serde_json = "0.9"
app_dirs = "1.1.1" app_dirs = "1.1.1"
fdlimit = "0.1" fdlimit = "0.1"
hyper = { version = "0.9", default-features = false } hyper = { version = "0.9", default-features = false }
@ -55,6 +49,9 @@ parity-reactor = { path = "util/reactor" }
ethcore-dapps = { path = "dapps", optional = true } ethcore-dapps = { path = "dapps", optional = true }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}
[dev-dependencies]
ethcore-ipc-tests = { path = "ipc/tests" }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = "0.2" winapi = "0.2"

View File

@ -1,25 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
extern crate rustc_version;
use rustc_version::{version_meta, Channel};
fn main() {
if let Channel::Nightly = version_meta().channel {
println!("cargo:rustc-cfg=nightly");
}
}

View File

@ -4,7 +4,6 @@ name = "ethcore-dapps"
version = "1.6.0" version = "1.6.0"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[lib] [lib]
@ -19,15 +18,15 @@ hyper = { default-features = false, git = "https://github.com/ethcore/hyper" }
unicase = "1.3" unicase = "1.3"
url = "1.0" url = "1.0"
rustc-serialize = "0.3" rustc-serialize = "0.3"
serde = "0.8" serde = "0.9"
serde_json = "0.8" serde_json = "0.9"
serde_derive = "0.9"
linked-hash-map = "0.3" linked-hash-map = "0.3"
parity-dapps-glue = "1.4" parity-dapps-glue = "1.4"
base32 = "0.3" base32 = "0.3"
mime = "0.2" mime = "0.2"
mime_guess = "1.6.1" mime_guess = "1.6.1"
time = "0.1.35" time = "0.1.35"
serde_macros = { version = "0.8", optional = true }
zip = { version = "0.1", default-features = false } zip = { version = "0.1", default-features = false }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
ethcore-rpc = { path = "../rpc" } ethcore-rpc = { path = "../rpc" }
@ -39,12 +38,7 @@ parity-reactor = { path = "../util/reactor" }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}
[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
[features] [features]
default = ["serde_codegen"]
nightly = ["serde_macros"]
dev = ["clippy", "ethcore-rpc/dev", "ethcore-util/dev"] dev = ["clippy", "ethcore-rpc/dev", "ethcore-util/dev"]
ui = ["parity-ui/no-precompiled-js"] ui = ["parity-ui/no-precompiled-js"]

View File

@ -1,41 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
#[cfg(not(feature = "serde_macros"))]
mod inner {
extern crate serde_codegen;
use std::env;
use std::path::Path;
pub fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let src = Path::new("./src/api/types.rs.in");
let dst = Path::new(&out_dir).join("types.rs");
serde_codegen::expand(&src, &dst).unwrap();
}
}
#[cfg(feature = "serde_macros")]
mod inner {
pub fn main() {}
}
fn main() {
inner::main();
}

View File

@ -16,9 +16,6 @@
//! REST API //! REST API
#![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))]
#![cfg_attr(feature="nightly", plugin(serde_macros, clippy))]
mod api; mod api;
mod response; mod response;
mod types; mod types;

View File

@ -14,8 +14,51 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
#[cfg(feature = "serde_macros")] use endpoint::EndpointInfo;
include!("types.rs.in");
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct App {
pub id: String,
pub name: String,
pub description: String,
pub version: String,
pub author: String,
#[serde(rename="iconUrl")]
pub icon_url: String,
}
impl App {
/// Creates `App` instance from `EndpointInfo` and `id`.
pub fn from_info(id: &str, info: &EndpointInfo) -> Self {
App {
id: id.to_owned(),
name: info.name.to_owned(),
description: info.description.to_owned(),
version: info.version.to_owned(),
author: info.author.to_owned(),
icon_url: info.icon_url.to_owned(),
}
}
}
impl Into<EndpointInfo> for App {
fn into(self) -> EndpointInfo {
EndpointInfo {
name: self.name,
description: self.description,
version: self.version,
author: self.author,
icon_url: self.icon_url,
}
}
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ApiError {
pub code: String,
pub title: String,
pub detail: String,
}
#[cfg(not(feature = "serde_macros"))]
include!(concat!(env!("OUT_DIR"), "/types.rs"));

View File

@ -1,64 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
use endpoint::EndpointInfo;
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct App {
pub id: String,
pub name: String,
pub description: String,
pub version: String,
pub author: String,
#[serde(rename="iconUrl")]
pub icon_url: String,
}
impl App {
/// Creates `App` instance from `EndpointInfo` and `id`.
pub fn from_info(id: &str, info: &EndpointInfo) -> Self {
App {
id: id.to_owned(),
name: info.name.to_owned(),
description: info.description.to_owned(),
version: info.version.to_owned(),
author: info.author.to_owned(),
icon_url: info.icon_url.to_owned(),
}
}
}
impl Into<EndpointInfo> for App {
fn into(self) -> EndpointInfo {
EndpointInfo {
name: self.name,
description: self.description,
version: self.version,
author: self.author,
icon_url: self.icon_url,
}
}
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ApiError {
pub code: String,
pub title: String,
pub detail: String,
}

View File

@ -15,8 +15,8 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Ethcore Webapplications for Parity //! Ethcore Webapplications for Parity
//!
#![warn(missing_docs)] #![warn(missing_docs)]
#![cfg_attr(feature="nightly", feature(plugin))]
#![cfg_attr(feature="nightly", plugin(clippy))] #![cfg_attr(feature="nightly", plugin(clippy))]
extern crate base32; extern crate base32;
@ -45,6 +45,8 @@ extern crate parity_reactor;
extern crate log; extern crate log;
#[macro_use] #[macro_use]
extern crate mime; extern crate mime;
#[macro_use]
extern crate serde_derive;
#[cfg(test)] #[cfg(test)]
extern crate ethcore_devtools as devtools; extern crate ethcore_devtools as devtools;

View File

@ -14,7 +14,6 @@ build = "build.rs"
log = "0.3" log = "0.3"
env_logger = "0.3" env_logger = "0.3"
rustc-serialize = "0.3" rustc-serialize = "0.3"
heapsize = "0.3"
rust-crypto = "0.2.34" rust-crypto = "0.2.34"
num_cpus = "0.2" num_cpus = "0.2"
crossbeam = "0.2.9" crossbeam = "0.2.9"
@ -27,6 +26,8 @@ rand = "0.3"
byteorder = "1.0" byteorder = "1.0"
transient-hashmap = "0.1" transient-hashmap = "0.1"
linked-hash-map = "0.3.0" linked-hash-map = "0.3.0"
lru-cache = "0.1.0"
ethabi = "1.0.0"
evmjit = { path = "../evmjit", optional = true } evmjit = { path = "../evmjit", optional = true }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}
ethash = { path = "../ethash" } ethash = { path = "../ethash" }
@ -40,10 +41,8 @@ ethkey = { path = "../ethkey" }
ethcore-ipc-nano = { path = "../ipc/nano" } ethcore-ipc-nano = { path = "../ipc/nano" }
rlp = { path = "../util/rlp" } rlp = { path = "../util/rlp" }
ethcore-stratum = { path = "../stratum" } ethcore-stratum = { path = "../stratum" }
lru-cache = "0.1.0"
ethcore-bloom-journal = { path = "../util/bloom" } ethcore-bloom-journal = { path = "../util/bloom" }
hardware-wallet = { path = "../hw" } hardware-wallet = { path = "../hw" }
ethabi = "0.2.2"
[dependencies.hyper] [dependencies.hyper]
git = "https://github.com/ethcore/hyper" git = "https://github.com/ethcore/hyper"

View File

@ -1337,6 +1337,7 @@ mod tests {
use transaction::{Transaction, Action}; use transaction::{Transaction, Action};
use log_entry::{LogEntry, LocalizedLogEntry}; use log_entry::{LogEntry, LocalizedLogEntry};
use ethkey::Secret; use ethkey::Secret;
use header::BlockNumber;
fn new_db(path: &str) -> Arc<Database> { fn new_db(path: &str) -> Arc<Database> {
Arc::new(Database::open(&DatabaseConfig::with_columns(::db::NUM_COLUMNS), path).unwrap()) Arc::new(Database::open(&DatabaseConfig::with_columns(::db::NUM_COLUMNS), path).unwrap())
@ -2020,14 +2021,14 @@ mod tests {
let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5); let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5);
let blocks_b2 = bc.blocks_with_bloom(&bloom_b2, 0, 5); let blocks_b2 = bc.blocks_with_bloom(&bloom_b2, 0, 5);
assert_eq!(blocks_b1, vec![]); assert_eq!(blocks_b1, Vec::<BlockNumber>::new());
assert_eq!(blocks_b2, vec![]); assert_eq!(blocks_b2, Vec::<BlockNumber>::new());
insert_block(&db, &bc, &b1, vec![]); insert_block(&db, &bc, &b1, vec![]);
let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5); let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5);
let blocks_b2 = bc.blocks_with_bloom(&bloom_b2, 0, 5); let blocks_b2 = bc.blocks_with_bloom(&bloom_b2, 0, 5);
assert_eq!(blocks_b1, vec![1]); assert_eq!(blocks_b1, vec![1]);
assert_eq!(blocks_b2, vec![]); assert_eq!(blocks_b2, Vec::<BlockNumber>::new());
insert_block(&db, &bc, &b2, vec![]); insert_block(&db, &bc, &b2, vec![]);
let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5); let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5);
@ -2042,15 +2043,15 @@ mod tests {
let blocks_ba = bc.blocks_with_bloom(&bloom_ba, 0, 5); let blocks_ba = bc.blocks_with_bloom(&bloom_ba, 0, 5);
assert_eq!(blocks_b1, vec![1]); assert_eq!(blocks_b1, vec![1]);
assert_eq!(blocks_b2, vec![2]); assert_eq!(blocks_b2, vec![2]);
assert_eq!(blocks_ba, vec![]); assert_eq!(blocks_ba, Vec::<BlockNumber>::new());
// fork has happend // fork has happend
insert_block(&db, &bc, &b2a, vec![]); insert_block(&db, &bc, &b2a, vec![]);
let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5); let blocks_b1 = bc.blocks_with_bloom(&bloom_b1, 0, 5);
let blocks_b2 = bc.blocks_with_bloom(&bloom_b2, 0, 5); let blocks_b2 = bc.blocks_with_bloom(&bloom_b2, 0, 5);
let blocks_ba = bc.blocks_with_bloom(&bloom_ba, 0, 5); let blocks_ba = bc.blocks_with_bloom(&bloom_ba, 0, 5);
assert_eq!(blocks_b1, vec![]); assert_eq!(blocks_b1, Vec::<BlockNumber>::new());
assert_eq!(blocks_b2, vec![]); assert_eq!(blocks_b2, Vec::<BlockNumber>::new());
assert_eq!(blocks_ba, vec![1, 2]); assert_eq!(blocks_ba, vec![1, 2]);
// fork back // fork back

View File

@ -114,8 +114,6 @@ extern crate ethcore_util as util;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
#[macro_use] #[macro_use]
extern crate heapsize;
#[macro_use]
extern crate ethcore_ipc as ipc; extern crate ethcore_ipc as ipc;
#[cfg(feature = "jit" )] #[cfg(feature = "jit" )]

View File

@ -2,16 +2,15 @@
name = "ethstore" name = "ethstore"
version = "0.1.0" version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[dependencies] [dependencies]
log = "0.3" log = "0.3"
libc = "0.2.11" libc = "0.2.11"
rand = "0.3.14" rand = "0.3.14"
ethkey = { path = "../ethkey" } ethkey = { path = "../ethkey" }
serde = "0.8" serde = "0.9"
serde_json = "0.8" serde_json = "0.9"
serde_macros = { version = "0.8", optional = true } serde_derive = "0.9"
rustc-serialize = "0.3" rustc-serialize = "0.3"
rust-crypto = "0.2.36" rust-crypto = "0.2.36"
tiny-keccak = "1.0" tiny-keccak = "1.0"
@ -25,14 +24,12 @@ ethcore-util = { path = "../util" }
smallvec = "0.3.1" smallvec = "0.3.1"
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
[features] [features]
default = ["serde_codegen"]
nightly = ["serde_macros"]
cli = ["docopt"] cli = ["docopt"]
[lib]
[[bin]] [[bin]]
name = "ethstore" name = "ethstore"
path = "src/bin/main.rs"
doc = false doc = false

View File

@ -1,41 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
#[cfg(not(feature = "serde_macros"))]
mod inner {
extern crate serde_codegen;
use std::env;
use std::path::Path;
pub fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let src = Path::new("src/json/mod.rs.in");
let dst = Path::new(&out_dir).join("mod.rs");
serde_codegen::expand(&src, &dst).unwrap();
}
}
#[cfg(feature = "serde_macros")]
mod inner {
pub fn main() {}
}
fn main() {
inner::main();
}

View File

@ -1,5 +1,22 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
use std::{ops, str}; use std::{ops, str};
use serde::{Deserialize, Deserializer, Error, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::Error;
use rustc_serialize::hex::{ToHex, FromHex, FromHexError}; use rustc_serialize::hex::{ToHex, FromHex, FromHexError};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -14,7 +31,7 @@ impl ops::Deref for Bytes {
} }
impl Deserialize for Bytes { impl Deserialize for Bytes {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer where D: Deserializer
{ {
let s = String::deserialize(deserializer)?; let s = String::deserialize(deserializer)?;
@ -24,7 +41,7 @@ impl Deserialize for Bytes {
} }
impl Serialize for Bytes { impl Serialize for Bytes {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
serializer.serialize_str(&self.0.to_hex()) serializer.serialize_str(&self.0.to_hex())
} }

View File

@ -14,8 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error as SerdeError}; use std::fmt;
use serde::de::Visitor; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::de::{Visitor, Error as SerdeError};
use super::{Error, H128}; use super::{Error, H128};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -24,7 +25,7 @@ pub enum CipherSer {
} }
impl Serialize for CipherSer { impl Serialize for CipherSer {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
CipherSer::Aes128Ctr => serializer.serialize_str("aes-128-ctr"), CipherSer::Aes128Ctr => serializer.serialize_str("aes-128-ctr"),
@ -33,7 +34,7 @@ impl Serialize for CipherSer {
} }
impl Deserialize for CipherSer { impl Deserialize for CipherSer {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(CipherSerVisitor) deserializer.deserialize(CipherSerVisitor)
} }
@ -44,14 +45,18 @@ struct CipherSerVisitor;
impl Visitor for CipherSerVisitor { impl Visitor for CipherSerVisitor {
type Value = CipherSer; type Value = CipherSer;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: SerdeError { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid cipher identifier")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
match value { match value {
"aes-128-ctr" => Ok(CipherSer::Aes128Ctr), "aes-128-ctr" => Ok(CipherSer::Aes128Ctr),
_ => Err(SerdeError::custom(Error::UnsupportedCipher)) _ => Err(SerdeError::custom(Error::UnsupportedCipher))
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: SerdeError { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }
@ -67,7 +72,7 @@ pub enum CipherSerParams {
} }
impl Serialize for CipherSerParams { impl Serialize for CipherSerParams {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
CipherSerParams::Aes128Ctr(ref params) => params.serialize(serializer), CipherSerParams::Aes128Ctr(ref params) => params.serialize(serializer),
@ -76,7 +81,7 @@ impl Serialize for CipherSerParams {
} }
impl Deserialize for CipherSerParams { impl Deserialize for CipherSerParams {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
Aes128Ctr::deserialize(deserializer) Aes128Ctr::deserialize(deserializer)
.map(CipherSerParams::Aes128Ctr) .map(CipherSerParams::Aes128Ctr)

View File

@ -14,8 +14,10 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Deserialize, Deserializer, Serialize, Serializer, Error}; use std::fmt;
use serde::de::{Visitor, MapVisitor}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::ser::SerializeStruct;
use serde::de::{Visitor, MapVisitor, Error};
use super::{Cipher, CipherSer, CipherSerParams, Kdf, KdfSer, KdfSerParams, H256, Bytes}; use super::{Cipher, CipherSer, CipherSerParams, Kdf, KdfSer, KdfSerParams, H256, Bytes};
pub type CipherText = Bytes; pub type CipherText = Bytes;
@ -38,7 +40,7 @@ enum CryptoField {
} }
impl Deserialize for CryptoField { impl Deserialize for CryptoField {
fn deserialize<D>(deserializer: &mut D) -> Result<CryptoField, D::Error> fn deserialize<D>(deserializer: D) -> Result<CryptoField, D::Error>
where D: Deserializer where D: Deserializer
{ {
deserializer.deserialize(CryptoFieldVisitor) deserializer.deserialize(CryptoFieldVisitor)
@ -50,7 +52,11 @@ struct CryptoFieldVisitor;
impl Visitor for CryptoFieldVisitor { impl Visitor for CryptoFieldVisitor {
type Value = CryptoField; type Value = CryptoField;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid crypto struct description")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
where E: Error where E: Error
{ {
match value { match value {
@ -66,7 +72,7 @@ impl Visitor for CryptoFieldVisitor {
} }
impl Deserialize for Crypto { impl Deserialize for Crypto {
fn deserialize<D>(deserializer: &mut D) -> Result<Crypto, D::Error> fn deserialize<D>(deserializer: D) -> Result<Crypto, D::Error>
where D: Deserializer where D: Deserializer
{ {
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"]; static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
@ -79,7 +85,11 @@ struct CryptoVisitor;
impl Visitor for CryptoVisitor { impl Visitor for CryptoVisitor {
type Value = Crypto; type Value = Crypto;
fn visit_map<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error> fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid vault crypto object")
}
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor where V: MapVisitor
{ {
let mut cipher = None; let mut cipher = None;
@ -103,30 +113,28 @@ impl Visitor for CryptoVisitor {
let cipher = match (cipher, cipherparams) { let cipher = match (cipher, cipherparams) {
(Some(CipherSer::Aes128Ctr), Some(CipherSerParams::Aes128Ctr(params))) => Cipher::Aes128Ctr(params), (Some(CipherSer::Aes128Ctr), Some(CipherSerParams::Aes128Ctr(params))) => Cipher::Aes128Ctr(params),
(None, _) => return Err(Error::missing_field("cipher")), (None, _) => return Err(V::Error::missing_field("cipher")),
(Some(_), None) => return Err(Error::missing_field("cipherparams")), (Some(_), None) => return Err(V::Error::missing_field("cipherparams")),
}; };
let ciphertext = match ciphertext { let ciphertext = match ciphertext {
Some(ciphertext) => ciphertext, Some(ciphertext) => ciphertext,
None => visitor.missing_field("ciphertext")?, None => return Err(V::Error::missing_field("ciphertext")),
}; };
let kdf = match (kdf, kdfparams) { let kdf = match (kdf, kdfparams) {
(Some(KdfSer::Pbkdf2), Some(KdfSerParams::Pbkdf2(params))) => Kdf::Pbkdf2(params), (Some(KdfSer::Pbkdf2), Some(KdfSerParams::Pbkdf2(params))) => Kdf::Pbkdf2(params),
(Some(KdfSer::Scrypt), Some(KdfSerParams::Scrypt(params))) => Kdf::Scrypt(params), (Some(KdfSer::Scrypt), Some(KdfSerParams::Scrypt(params))) => Kdf::Scrypt(params),
(Some(_), Some(_)) => return Err(Error::custom("Invalid cipherparams")), (Some(_), Some(_)) => return Err(V::Error::custom("Invalid cipherparams")),
(None, _) => return Err(Error::missing_field("kdf")), (None, _) => return Err(V::Error::missing_field("kdf")),
(Some(_), None) => return Err(Error::missing_field("kdfparams")), (Some(_), None) => return Err(V::Error::missing_field("kdfparams")),
}; };
let mac = match mac { let mac = match mac {
Some(mac) => mac, Some(mac) => mac,
None => visitor.missing_field("mac")?, None => return Err(V::Error::missing_field("mac")),
}; };
visitor.end()?;
let result = Crypto { let result = Crypto {
cipher: cipher, cipher: cipher,
ciphertext: ciphertext, ciphertext: ciphertext,
@ -139,29 +147,29 @@ impl Visitor for CryptoVisitor {
} }
impl Serialize for Crypto { impl Serialize for Crypto {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
let mut state = serializer.serialize_struct("Crypto", 6)?; let mut crypto = serializer.serialize_struct("Crypto", 6)?;
match self.cipher { match self.cipher {
Cipher::Aes128Ctr(ref params) => { Cipher::Aes128Ctr(ref params) => {
serializer.serialize_struct_elt(&mut state, "cipher", &CipherSer::Aes128Ctr)?; crypto.serialize_field("cipher", &CipherSer::Aes128Ctr)?;
serializer.serialize_struct_elt(&mut state, "cipherparams", params)?; crypto.serialize_field("cipherparams", params)?;
}, },
} }
serializer.serialize_struct_elt(&mut state, "ciphertext", &self.ciphertext)?; crypto.serialize_field("ciphertext", &self.ciphertext)?;
match self.kdf { match self.kdf {
Kdf::Pbkdf2(ref params) => { Kdf::Pbkdf2(ref params) => {
serializer.serialize_struct_elt(&mut state, "kdf", &KdfSer::Pbkdf2)?; crypto.serialize_field("kdf", &KdfSer::Pbkdf2)?;
serializer.serialize_struct_elt(&mut state, "kdfparams", params)?; crypto.serialize_field("kdfparams", params)?;
}, },
Kdf::Scrypt(ref params) => { Kdf::Scrypt(ref params) => {
serializer.serialize_struct_elt(&mut state, "kdf", &KdfSer::Scrypt)?; crypto.serialize_field("kdf", &KdfSer::Scrypt)?;
serializer.serialize_struct_elt(&mut state, "kdfparams", params)?; crypto.serialize_field("kdfparams", params)?;
}, },
} }
serializer.serialize_struct_elt(&mut state, "mac", &self.mac)?; crypto.serialize_field("mac", &self.mac)?;
serializer.serialize_struct_end(state) crypto.end()
} }
} }

View File

@ -16,8 +16,8 @@
use std::{ops, fmt, str}; use std::{ops, fmt, str};
use rustc_serialize::hex::{FromHex, ToHex}; use rustc_serialize::hex::{FromHex, ToHex};
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error as SerdeError}; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::de::Visitor; use serde::de::{Visitor, Error as SerdeError};
use super::Error; use super::Error;
macro_rules! impl_hash { macro_rules! impl_hash {
@ -48,25 +48,29 @@ macro_rules! impl_hash {
} }
impl Serialize for $name { impl Serialize for $name {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
serializer.serialize_str(&self.0.to_hex()) serializer.serialize_str(&self.0.to_hex())
} }
} }
impl Deserialize for $name { impl Deserialize for $name {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
struct HashVisitor; struct HashVisitor;
impl Visitor for HashVisitor { impl Visitor for HashVisitor {
type Value = $name; type Value = $name;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: SerdeError { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a hex-encoded {}", stringify!($name))
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
value.parse().map_err(SerdeError::custom) value.parse().map_err(SerdeError::custom)
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: SerdeError { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }
@ -92,7 +96,7 @@ macro_rules! impl_hash {
impl From<&'static str> for $name { impl From<&'static str> for $name {
fn from(s: &'static str) -> Self { fn from(s: &'static str) -> Self {
s.parse().expect(&format!("invalid string literal for {}: '{}'", stringify!(Self), s)) s.parse().expect(&format!("invalid string literal for {}: '{}'", stringify!($name), s))
} }
} }

View File

@ -17,8 +17,8 @@
//! Universaly unique identifier. //! Universaly unique identifier.
use std::{fmt, str}; use std::{fmt, str};
use rustc_serialize::hex::{ToHex, FromHex}; use rustc_serialize::hex::{ToHex, FromHex};
use serde::{Deserialize, Serialize, Deserializer, Serializer, Error as SerdeError}; use serde::{Deserialize, Serialize, Deserializer, Serializer};
use serde::de::Visitor; use serde::de::{Visitor, Error as SerdeError};
use super::Error; use super::Error;
/// Universaly unique identifier. /// Universaly unique identifier.
@ -101,7 +101,7 @@ impl From<&'static str> for Uuid {
} }
impl Serialize for Uuid { impl Serialize for Uuid {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
let s: String = self.into(); let s: String = self.into();
serializer.serialize_str(&s) serializer.serialize_str(&s)
@ -109,7 +109,7 @@ impl Serialize for Uuid {
} }
impl Deserialize for Uuid { impl Deserialize for Uuid {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(UuidVisitor) deserializer.deserialize(UuidVisitor)
} }
@ -120,11 +120,15 @@ struct UuidVisitor;
impl Visitor for UuidVisitor { impl Visitor for UuidVisitor {
type Value = Uuid; type Value = Uuid;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: SerdeError { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid hex-encoded UUID")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
value.parse().map_err(SerdeError::custom) value.parse().map_err(SerdeError::custom)
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: SerdeError { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error as SerdeError}; use std::fmt;
use serde::de::Visitor; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde_json::{Value, value}; use serde::de::{Visitor, Error as SerdeError};
use super::{Error, H256}; use super::{Error, H256};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -26,7 +26,7 @@ pub enum KdfSer {
} }
impl Serialize for KdfSer { impl Serialize for KdfSer {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
KdfSer::Pbkdf2 => serializer.serialize_str("pbkdf2"), KdfSer::Pbkdf2 => serializer.serialize_str("pbkdf2"),
@ -36,7 +36,7 @@ impl Serialize for KdfSer {
} }
impl Deserialize for KdfSer { impl Deserialize for KdfSer {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(KdfSerVisitor) deserializer.deserialize(KdfSerVisitor)
} }
@ -47,7 +47,11 @@ struct KdfSerVisitor;
impl Visitor for KdfSerVisitor { impl Visitor for KdfSerVisitor {
type Value = KdfSer; type Value = KdfSer;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: SerdeError { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a kdf algorithm identifier")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
match value { match value {
"pbkdf2" => Ok(KdfSer::Pbkdf2), "pbkdf2" => Ok(KdfSer::Pbkdf2),
"scrypt" => Ok(KdfSer::Scrypt), "scrypt" => Ok(KdfSer::Scrypt),
@ -55,7 +59,7 @@ impl Visitor for KdfSerVisitor {
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: SerdeError { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }
@ -66,7 +70,7 @@ pub enum Prf {
} }
impl Serialize for Prf { impl Serialize for Prf {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
Prf::HmacSha256 => serializer.serialize_str("hmac-sha256"), Prf::HmacSha256 => serializer.serialize_str("hmac-sha256"),
@ -75,7 +79,7 @@ impl Serialize for Prf {
} }
impl Deserialize for Prf { impl Deserialize for Prf {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(PrfVisitor) deserializer.deserialize(PrfVisitor)
} }
@ -86,14 +90,18 @@ struct PrfVisitor;
impl Visitor for PrfVisitor { impl Visitor for PrfVisitor {
type Value = Prf; type Value = Prf;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: SerdeError { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a prf algorithm identifier")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
match value { match value {
"hmac-sha256" => Ok(Prf::HmacSha256), "hmac-sha256" => Ok(Prf::HmacSha256),
_ => Err(SerdeError::custom(Error::InvalidPrf)), _ => Err(SerdeError::custom(Error::InvalidPrf)),
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: SerdeError { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }
@ -122,7 +130,7 @@ pub enum KdfSerParams {
} }
impl Serialize for KdfSerParams { impl Serialize for KdfSerParams {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
KdfSerParams::Pbkdf2(ref params) => params.serialize(serializer), KdfSerParams::Pbkdf2(ref params) => params.serialize(serializer),
@ -132,13 +140,15 @@ impl Serialize for KdfSerParams {
} }
impl Deserialize for KdfSerParams { impl Deserialize for KdfSerParams {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
let v = Value::deserialize(deserializer)?; use serde_json::{Value, from_value};
Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(KdfSerParams::Pbkdf2) let v: Value = Deserialize::deserialize(deserializer)?;
.or_else(|_| Deserialize::deserialize(&mut value::Deserializer::new(v)).map(KdfSerParams::Scrypt))
.map_err(|e| D::Error::custom(format!("{}", e))) from_value(v.clone()).map(KdfSerParams::Pbkdf2)
.or_else(|_| from_value(v).map(KdfSerParams::Scrypt))
.map_err(|_| D::Error::custom("Invalid KDF algorithm"))
} }
} }

View File

@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::fmt;
use std::io::{Read, Write}; use std::io::{Read, Write};
use serde::{Deserialize, Deserializer, Error}; use serde::{Deserialize, Deserializer};
use serde::de::{Visitor, MapVisitor}; use serde::de::{Error, Visitor, MapVisitor};
use serde_json; use serde_json;
use super::{Uuid, Version, Crypto, H160}; use super::{Uuid, Version, Crypto, H160};
@ -40,7 +41,7 @@ enum KeyFileField {
} }
impl Deserialize for KeyFileField { impl Deserialize for KeyFileField {
fn deserialize<D>(deserializer: &mut D) -> Result<KeyFileField, D::Error> fn deserialize<D>(deserializer: D) -> Result<KeyFileField, D::Error>
where D: Deserializer where D: Deserializer
{ {
deserializer.deserialize(KeyFileFieldVisitor) deserializer.deserialize(KeyFileFieldVisitor)
@ -52,7 +53,11 @@ struct KeyFileFieldVisitor;
impl Visitor for KeyFileFieldVisitor { impl Visitor for KeyFileFieldVisitor {
type Value = KeyFileField; type Value = KeyFileField;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid key file field")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
where E: Error where E: Error
{ {
match value { match value {
@ -69,7 +74,7 @@ impl Visitor for KeyFileFieldVisitor {
} }
impl Deserialize for KeyFile { impl Deserialize for KeyFile {
fn deserialize<D>(deserializer: &mut D) -> Result<KeyFile, D::Error> fn deserialize<D>(deserializer: D) -> Result<KeyFile, D::Error>
where D: Deserializer where D: Deserializer
{ {
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"]; static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
@ -77,12 +82,27 @@ impl Deserialize for KeyFile {
} }
} }
struct KeyFileVisitor;
fn none_if_empty<T>(v: Option<serde_json::Value>) -> Option<T> where
T: Deserialize,
{
v.and_then(|v| if v.is_null() {
None
} else {
serde_json::from_value(v).ok()
})
}
struct KeyFileVisitor;
impl Visitor for KeyFileVisitor { impl Visitor for KeyFileVisitor {
type Value = KeyFile; type Value = KeyFile;
fn visit_map<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error> fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid key object")
}
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor where V: MapVisitor
{ {
let mut id = None; let mut id = None;
@ -98,34 +118,32 @@ impl Visitor for KeyFileVisitor {
Some(KeyFileField::Version) => { version = Some(visitor.visit_value()?); } Some(KeyFileField::Version) => { version = Some(visitor.visit_value()?); }
Some(KeyFileField::Crypto) => { crypto = Some(visitor.visit_value()?); } Some(KeyFileField::Crypto) => { crypto = Some(visitor.visit_value()?); }
Some(KeyFileField::Address) => { address = Some(visitor.visit_value()?); } Some(KeyFileField::Address) => { address = Some(visitor.visit_value()?); }
Some(KeyFileField::Name) => { name = visitor.visit_value().ok(); } // ignore anyhing that is not a string to be permissive. Some(KeyFileField::Name) => { name = none_if_empty(visitor.visit_value().ok()) }
Some(KeyFileField::Meta) => { meta = visitor.visit_value().ok(); } // ignore anyhing that is not a string to be permissive. Some(KeyFileField::Meta) => { meta = none_if_empty(visitor.visit_value().ok()) }
None => { break; } None => { break; }
} }
} }
let id = match id { let id = match id {
Some(id) => id, Some(id) => id,
None => visitor.missing_field("id")?, None => return Err(V::Error::missing_field("id")),
}; };
let version = match version { let version = match version {
Some(version) => version, Some(version) => version,
None => visitor.missing_field("version")?, None => return Err(V::Error::missing_field("version")),
}; };
let crypto = match crypto { let crypto = match crypto {
Some(crypto) => crypto, Some(crypto) => crypto,
None => visitor.missing_field("crypto")?, None => return Err(V::Error::missing_field("crypto")),
}; };
let address = match address { let address = match address {
Some(address) => address, Some(address) => address,
None => visitor.missing_field("address")?, None => return Err(V::Error::missing_field("address")),
}; };
visitor.end()?;
let result = KeyFile { let result = KeyFile {
id: id, id: id,
version: version, version: version,

View File

@ -16,9 +16,28 @@
//! Contract interface specification. //! Contract interface specification.
#[cfg(feature = "serde_macros")] mod bytes;
include!("mod.rs.in"); mod cipher;
mod crypto;
#[cfg(not(feature = "serde_macros"))] mod error;
include!(concat!(env!("OUT_DIR"), "/mod.rs")); mod hash;
mod id;
mod kdf;
mod key_file;
mod presale;
mod vault_file;
mod vault_key_file;
mod version;
pub use self::bytes::Bytes;
pub use self::cipher::{Cipher, CipherSer, CipherSerParams, Aes128Ctr};
pub use self::crypto::{Crypto, CipherText};
pub use self::error::Error;
pub use self::hash::{H128, H160, H256};
pub use self::id::Uuid;
pub use self::kdf::{Kdf, KdfSer, Prf, Pbkdf2, Scrypt, KdfSerParams};
pub use self::key_file::KeyFile;
pub use self::presale::{PresaleWallet, Encseed};
pub use self::vault_file::VaultFile;
pub use self::vault_key_file::{VaultKeyFile, VaultKeyMeta, insert_vault_name_to_json_meta, remove_vault_name_from_json_meta};
pub use self::version::Version;

View File

@ -1,26 +0,0 @@
mod bytes;
mod cipher;
mod crypto;
mod error;
mod hash;
mod id;
mod kdf;
mod key_file;
mod presale;
mod vault_file;
mod vault_key_file;
mod version;
pub use self::bytes::Bytes;
pub use self::cipher::{Cipher, CipherSer, CipherSerParams, Aes128Ctr};
pub use self::crypto::{Crypto, CipherText};
pub use self::error::Error;
pub use self::hash::{H128, H160, H256};
pub use self::id::Uuid;
pub use self::kdf::{Kdf, KdfSer, Prf, Pbkdf2, Scrypt, KdfSerParams};
pub use self::key_file::KeyFile;
pub use self::presale::{PresaleWallet, Encseed};
pub use self::vault_file::VaultFile;
pub use self::vault_key_file::{VaultKeyFile, VaultKeyMeta, insert_vault_name_to_json_meta, remove_vault_name_from_json_meta};
pub use self::version::Version;

View File

@ -15,13 +15,11 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::io::{Read, Write}; use std::io::{Read, Write};
use serde::{Deserialize, Deserializer, Error};
use serde::de::{Visitor, MapVisitor};
use serde_json; use serde_json;
use super::Crypto; use super::Crypto;
/// Vault meta file /// Vault meta file
#[derive(Debug, PartialEq, Serialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct VaultFile { pub struct VaultFile {
/// Vault password, encrypted with vault password /// Vault password, encrypted with vault password
pub crypto: Crypto, pub crypto: Crypto,
@ -29,79 +27,6 @@ pub struct VaultFile {
pub meta: Option<String>, pub meta: Option<String>,
} }
enum VaultFileField {
Crypto,
Meta,
}
impl Deserialize for VaultFileField {
fn deserialize<D>(deserializer: &mut D) -> Result<VaultFileField, D::Error>
where D: Deserializer
{
deserializer.deserialize(VaultFileFieldVisitor)
}
}
struct VaultFileFieldVisitor;
impl Visitor for VaultFileFieldVisitor {
type Value = VaultFileField;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E>
where E: Error
{
match value {
"crypto" => Ok(VaultFileField::Crypto),
"meta" => Ok(VaultFileField::Meta),
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
}
}
}
impl Deserialize for VaultFile {
fn deserialize<D>(deserializer: &mut D) -> Result<VaultFile, D::Error>
where D: Deserializer
{
static FIELDS: &'static [&'static str] = &["crypto", "meta"];
deserializer.deserialize_struct("VaultFile", FIELDS, VaultFileVisitor)
}
}
struct VaultFileVisitor;
impl Visitor for VaultFileVisitor {
type Value = VaultFile;
fn visit_map<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor
{
let mut crypto = None;
let mut meta = None;
loop {
match visitor.visit_key()? {
Some(VaultFileField::Crypto) => { crypto = Some(visitor.visit_value()?); },
Some(VaultFileField::Meta) => { meta = visitor.visit_value().ok(); }, // meta is optional
None => { break; },
}
}
let crypto = match crypto {
Some(crypto) => crypto,
None => visitor.missing_field("crypto")?,
};
visitor.end()?;
let result = VaultFile {
crypto: crypto,
meta: meta,
};
Ok(result)
}
}
impl VaultFile { impl VaultFile {
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read { pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read {
serde_json::from_reader(reader) serde_json::from_reader(reader)

View File

@ -15,8 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::io::{Read, Write}; use std::io::{Read, Write};
use serde::{Deserialize, Deserializer, Error}; use serde::de::Error;
use serde::de::{Visitor, MapVisitor};
use serde_json; use serde_json;
use serde_json::value::Value; use serde_json::value::Value;
use serde_json::error; use serde_json::error;
@ -26,7 +25,7 @@ use super::{Uuid, Version, Crypto, H160};
const VAULT_NAME_META_KEY: &'static str = "vault"; const VAULT_NAME_META_KEY: &'static str = "vault";
/// Key file as stored in vaults /// Key file as stored in vaults
#[derive(Debug, PartialEq, Serialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct VaultKeyFile { pub struct VaultKeyFile {
/// Key id /// Key id
pub id: Uuid, pub id: Uuid,
@ -39,7 +38,7 @@ pub struct VaultKeyFile {
} }
/// Data, stored in `VaultKeyFile::metacrypto` /// Data, stored in `VaultKeyFile::metacrypto`
#[derive(Debug, PartialEq, Serialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct VaultKeyMeta { pub struct VaultKeyMeta {
/// Key address /// Key address
pub address: H160, pub address: H160,
@ -81,182 +80,6 @@ pub fn remove_vault_name_from_json_meta(meta: &str) -> Result<String, error::Err
} }
} }
enum VaultKeyFileField {
Id,
Version,
Crypto,
MetaCrypto,
}
enum VaultKeyMetaField {
Address,
Name,
Meta,
}
impl Deserialize for VaultKeyFileField {
fn deserialize<D>(deserializer: &mut D) -> Result<VaultKeyFileField, D::Error>
where D: Deserializer
{
deserializer.deserialize(VaultKeyFileFieldVisitor)
}
}
struct VaultKeyFileFieldVisitor;
impl Visitor for VaultKeyFileFieldVisitor {
type Value = VaultKeyFileField;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E>
where E: Error
{
match value {
"id" => Ok(VaultKeyFileField::Id),
"version" => Ok(VaultKeyFileField::Version),
"crypto" => Ok(VaultKeyFileField::Crypto),
"metacrypto" => Ok(VaultKeyFileField::MetaCrypto),
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
}
}
}
impl Deserialize for VaultKeyFile {
fn deserialize<D>(deserializer: &mut D) -> Result<VaultKeyFile, D::Error>
where D: Deserializer
{
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "metacrypto"];
deserializer.deserialize_struct("VaultKeyFile", FIELDS, VaultKeyFileVisitor)
}
}
struct VaultKeyFileVisitor;
impl Visitor for VaultKeyFileVisitor {
type Value = VaultKeyFile;
fn visit_map<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor
{
let mut id = None;
let mut version = None;
let mut crypto = None;
let mut metacrypto = None;
loop {
match visitor.visit_key()? {
Some(VaultKeyFileField::Id) => { id = Some(visitor.visit_value()?); }
Some(VaultKeyFileField::Version) => { version = Some(visitor.visit_value()?); }
Some(VaultKeyFileField::Crypto) => { crypto = Some(visitor.visit_value()?); }
Some(VaultKeyFileField::MetaCrypto) => { metacrypto = Some(visitor.visit_value()?); }
None => { break; }
}
}
let id = match id {
Some(id) => id,
None => visitor.missing_field("id")?,
};
let version = match version {
Some(version) => version,
None => visitor.missing_field("version")?,
};
let crypto = match crypto {
Some(crypto) => crypto,
None => visitor.missing_field("crypto")?,
};
let metacrypto = match metacrypto {
Some(metacrypto) => metacrypto,
None => visitor.missing_field("metacrypto")?,
};
visitor.end()?;
let result = VaultKeyFile {
id: id,
version: version,
crypto: crypto,
metacrypto: metacrypto,
};
Ok(result)
}
}
impl Deserialize for VaultKeyMetaField {
fn deserialize<D>(deserializer: &mut D) -> Result<VaultKeyMetaField, D::Error>
where D: Deserializer
{
deserializer.deserialize(VaultKeyMetaFieldVisitor)
}
}
struct VaultKeyMetaFieldVisitor;
impl Visitor for VaultKeyMetaFieldVisitor {
type Value = VaultKeyMetaField;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E>
where E: Error
{
match value {
"address" => Ok(VaultKeyMetaField::Address),
"name" => Ok(VaultKeyMetaField::Name),
"meta" => Ok(VaultKeyMetaField::Meta),
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
}
}
}
impl Deserialize for VaultKeyMeta {
fn deserialize<D>(deserializer: &mut D) -> Result<VaultKeyMeta, D::Error>
where D: Deserializer
{
static FIELDS: &'static [&'static str] = &["address", "name", "meta"];
deserializer.deserialize_struct("VaultKeyMeta", FIELDS, VaultKeyMetaVisitor)
}
}
struct VaultKeyMetaVisitor;
impl Visitor for VaultKeyMetaVisitor {
type Value = VaultKeyMeta;
fn visit_map<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: MapVisitor
{
let mut address = None;
let mut name = None;
let mut meta = None;
loop {
match visitor.visit_key()? {
Some(VaultKeyMetaField::Address) => { address = Some(visitor.visit_value()?); }
Some(VaultKeyMetaField::Name) => { name = Some(visitor.visit_value()?); }
Some(VaultKeyMetaField::Meta) => { meta = Some(visitor.visit_value()?); }
None => { break; }
}
}
let address = match address {
Some(address) => address,
None => visitor.missing_field("address")?,
};
visitor.end()?;
let result = VaultKeyMeta {
address: address,
name: name,
meta: meta,
};
Ok(result)
}
}
impl VaultKeyFile { impl VaultKeyFile {
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read { pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read {
serde_json::from_reader(reader) serde_json::from_reader(reader)

View File

@ -14,8 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error as SerdeError}; use std::fmt;
use serde::de::Visitor; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::de::{Error as SerdeError, Visitor};
use super::Error; use super::Error;
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -24,7 +25,7 @@ pub enum Version {
} }
impl Serialize for Version { impl Serialize for Version {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
Version::V3 => serializer.serialize_u64(3) Version::V3 => serializer.serialize_u64(3)
@ -33,7 +34,7 @@ impl Serialize for Version {
} }
impl Deserialize for Version { impl Deserialize for Version {
fn deserialize<D>(deserializer: &mut D) -> Result<Version, D::Error> fn deserialize<D>(deserializer: D) -> Result<Version, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(VersionVisitor) deserializer.deserialize(VersionVisitor)
} }
@ -44,7 +45,11 @@ struct VersionVisitor;
impl Visitor for VersionVisitor { impl Visitor for VersionVisitor {
type Value = Version; type Value = Version;
fn visit_u64<E>(&mut self, value: u64) -> Result<Self::Value, E> where E: SerdeError { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a valid key version identifier")
}
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E> where E: SerdeError {
match value { match value {
3 => Ok(Version::V3), 3 => Ok(Version::V3),
_ => Err(SerdeError::custom(Error::UnsupportedVersion)) _ => Err(SerdeError::custom(Error::UnsupportedVersion))

View File

@ -14,9 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
#![cfg_attr(feature="nightly", feature(custom_derive, plugin))]
#![cfg_attr(feature="nightly", plugin(serde_macros))]
extern crate libc; extern crate libc;
extern crate itertools; extern crate itertools;
extern crate smallvec; extern crate smallvec;
@ -37,9 +34,10 @@ extern crate ethcore_util as util;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
#[macro_use]
extern crate serde_derive;
pub mod dir; pub mod dir;
pub mod ethkey; pub mod ethkey;

1268
evmbin/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ version = "1.6.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
ethabi = "0.2.2" ethabi = "1.0.0"
futures = "0.1" futures = "0.1"
log = "0.3" log = "0.3"
mime = "0.2" mime = "0.2"

View File

@ -10,7 +10,6 @@ build = "build.rs"
ethcore-ipc-codegen = { path = "../ipc/codegen" } ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies] [dependencies]
log = "0.3"
semver = "0.5" semver = "0.5"
ethcore-ipc = { path = "../ipc/rpc" } ethcore-ipc = { path = "../ipc/rpc" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }

View File

@ -16,11 +16,10 @@
//! Updater for Parity executables //! Updater for Parity executables
#[macro_use] extern crate log;
extern crate semver; extern crate semver;
extern crate ethcore_util as util; extern crate ethcore_util as util;
extern crate ethcore_ipc as ipc; extern crate ethcore_ipc as ipc;
mod types; mod types;
pub use types::*; pub use types::*;

View File

@ -29,7 +29,6 @@ extern crate quasi;
extern crate syntex; extern crate syntex;
#[cfg(feature = "with-syntex")] #[cfg(feature = "with-syntex")]
#[macro_use]
extern crate syntex_syntax as syntax; extern crate syntex_syntax as syntax;
#[cfg(not(feature = "with-syntex"))] #[cfg(not(feature = "with-syntex"))]

View File

@ -2,19 +2,12 @@
name = "ethjson" name = "ethjson"
version = "0.1.0" version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[dependencies] [dependencies]
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
rustc-serialize = "0.3" rustc-serialize = "0.3"
serde = "0.8" serde = "0.9"
serde_json = "0.8" serde_json = "0.9"
serde_macros = { version = "0.8", optional = true } serde_derive = "0.9"
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}
[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
[features]
default = ["serde_codegen"]
nightly = ["serde_macros"]

View File

@ -1,41 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
#[cfg(not(feature = "serde_macros"))]
mod inner {
extern crate serde_codegen;
use std::env;
use std::path::Path;
pub fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let src = Path::new("src/lib.rs.in");
let dst = Path::new(&out_dir).join("lib.rs");
serde_codegen::expand(&src, &dst).unwrap();
}
}
#[cfg(feature = "serde_macros")]
mod inner {
pub fn main() {}
}
fn main() {
inner::main();
}

View File

@ -16,11 +16,12 @@
//! Lenient bytes json deserialization for test json files. //! Lenient bytes json deserialization for test json files.
use std::fmt;
use std::str::FromStr; use std::str::FromStr;
use std::ops::Deref; use std::ops::Deref;
use rustc_serialize::hex::FromHex; use rustc_serialize::hex::FromHex;
use serde::{Deserialize, Deserializer, Error}; use serde::{Deserialize, Deserializer};
use serde::de::Visitor; use serde::de::{Error, Visitor};
/// Lenient bytes json deserialization for test json files. /// Lenient bytes json deserialization for test json files.
#[derive(Default, Debug, PartialEq, Eq, Clone, PartialOrd, Ord)] #[derive(Default, Debug, PartialEq, Eq, Clone, PartialOrd, Ord)]
@ -67,7 +68,7 @@ impl FromStr for Bytes {
} }
impl Deserialize for Bytes { impl Deserialize for Bytes {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(BytesVisitor) deserializer.deserialize(BytesVisitor)
} }
@ -78,11 +79,15 @@ struct BytesVisitor;
impl Visitor for BytesVisitor { impl Visitor for BytesVisitor {
type Value = Bytes; type Value = Bytes;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a hex encoded string of bytes")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
Bytes::from_str(value).map_err(Error::custom) Bytes::from_str(value).map_err(Error::custom)
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -17,8 +17,9 @@
//! Lenient hash json deserialization for test json files. //! Lenient hash json deserialization for test json files.
use std::str::FromStr; use std::str::FromStr;
use serde::{Deserialize, Deserializer, Serialize, Serializer, Error}; use std::fmt;
use serde::de::Visitor; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::{Error, Visitor};
use rustc_serialize::hex::ToHex; use rustc_serialize::hex::ToHex;
use util::hash::{H64 as Hash64, H160 as Hash160, H256 as Hash256, H520 as Hash520, H2048 as Hash2048}; use util::hash::{H64 as Hash64, H160 as Hash160, H256 as Hash256, H520 as Hash520, H2048 as Hash2048};
@ -42,7 +43,7 @@ macro_rules! impl_hash {
} }
impl Deserialize for $name { impl Deserialize for $name {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
struct HashVisitor; struct HashVisitor;
@ -50,7 +51,11 @@ macro_rules! impl_hash {
impl Visitor for HashVisitor { impl Visitor for HashVisitor {
type Value = $name; type Value = $name;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a 0x-prefixed hex-encoded hash")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
let value = match value.len() { let value = match value.len() {
0 => $inner::from(0), 0 => $inner::from(0),
2 if value == "0x" => $inner::from(0), 2 if value == "0x" => $inner::from(0),
@ -65,7 +70,7 @@ macro_rules! impl_hash {
Ok($name(value)) Ok($name(value))
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }
@ -75,7 +80,7 @@ macro_rules! impl_hash {
} }
impl Serialize for $name { impl Serialize for $name {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
let mut hex = "0x".to_owned(); let mut hex = "0x".to_owned();
hex.push_str(&self.0.to_hex()); hex.push_str(&self.0.to_hex());
serializer.serialize_str(&hex) serializer.serialize_str(&hex)

View File

@ -14,15 +14,20 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Json deserialization module. extern crate rustc_serialize;
extern crate serde;
#![warn(missing_docs)] extern crate serde_json;
#![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))] extern crate ethcore_util as util;
#![cfg_attr(feature="nightly", plugin(serde_macros, clippy))] #[macro_use] extern crate serde_derive;
#[cfg(feature = "serde_macros")]
include!("lib.rs.in");
#[cfg(not(feature = "serde_macros"))]
include!(concat!(env!("OUT_DIR"), "/lib.rs"));
pub mod hash;
pub mod uint;
pub mod bytes;
pub mod blockchain;
pub mod spec;
pub mod trie;
pub mod vm;
pub mod maybe;
pub mod state;
pub mod transaction;
pub mod misc;

View File

@ -1,32 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
extern crate rustc_serialize;
extern crate serde;
extern crate serde_json;
extern crate ethcore_util as util;
pub mod hash;
pub mod uint;
pub mod bytes;
pub mod blockchain;
pub mod spec;
pub mod trie;
pub mod vm;
pub mod maybe;
pub mod state;
pub mod transaction;
pub mod misc;

View File

@ -1,11 +1,11 @@
//! Deserializer of empty string values into optionals. //! Deserializer of empty string values into optionals.
use std::fmt;
use std::marker::PhantomData; use std::marker::PhantomData;
use serde::{Deserialize, Deserializer, Error}; use serde::{Deserialize, Deserializer};
use serde::de::Visitor; use serde::de::{Error, Visitor};
use serde_json::Value; use serde::de::value::ValueDeserializer;
use serde_json::value;
/// Deserializer of empty string values into optionals. /// Deserializer of empty string values into optionals.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -17,7 +17,7 @@ pub enum MaybeEmpty<T> {
} }
impl<T> Deserialize for MaybeEmpty<T> where T: Deserialize { impl<T> Deserialize for MaybeEmpty<T> where T: Deserialize {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(MaybeEmptyVisitor::new()) deserializer.deserialize(MaybeEmptyVisitor::new())
} }
@ -38,16 +38,19 @@ impl<T> MaybeEmptyVisitor<T> {
impl<T> Visitor for MaybeEmptyVisitor<T> where T: Deserialize { impl<T> Visitor for MaybeEmptyVisitor<T> where T: Deserialize {
type Value = MaybeEmpty<T>; type Value = MaybeEmpty<T>;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "an empty string or string-encoded type")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
self.visit_string(value.to_owned()) self.visit_string(value.to_owned())
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
match value.is_empty() { match value.is_empty() {
true => Ok(MaybeEmpty::None), true => Ok(MaybeEmpty::None),
false => { false => {
let value = Value::String(value); T::deserialize(value.into_deserializer()).map(MaybeEmpty::Some)
T::deserialize(&mut value::Deserializer::new(value)).map(MaybeEmpty::Some).map_err(|_| Error::custom("failed"))
} }
} }
} }

View File

@ -16,11 +16,12 @@
//! Trie test input deserialization. //! Trie test input deserialization.
use std::fmt;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::str::FromStr; use std::str::FromStr;
use bytes::Bytes; use bytes::Bytes;
use serde::{Deserialize, Deserializer, Error}; use serde::{Deserialize, Deserializer};
use serde::de::{Visitor, MapVisitor, SeqVisitor}; use serde::de::{Error as ErrorTrait, Visitor, MapVisitor, SeqVisitor};
/// Trie test input. /// Trie test input.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -30,7 +31,7 @@ pub struct Input {
} }
impl Deserialize for Input { impl Deserialize for Input {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer where D: Deserializer
{ {
deserializer.deserialize(InputVisitor) deserializer.deserialize(InputVisitor)
@ -42,20 +43,24 @@ struct InputVisitor;
impl Visitor for InputVisitor { impl Visitor for InputVisitor {
type Value = Input; type Value = Input;
fn visit_map<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error> where V: MapVisitor { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a map of bytes into bytes")
}
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error> where V: MapVisitor {
let mut result = BTreeMap::new(); let mut result = BTreeMap::new();
loop { loop {
let key_str: Option<String> = visitor.visit_key()?; let key_str: Option<String> = visitor.visit_key()?;
let key = match key_str { let key = match key_str {
Some(ref k) if k.starts_with("0x") => Bytes::from_str(k).map_err(Error::custom)?, Some(ref k) if k.starts_with("0x") => Bytes::from_str(k).map_err(V::Error::custom)?,
Some(k) => Bytes::new(k.into_bytes()), Some(k) => Bytes::new(k.into_bytes()),
None => { break; } None => { break; }
}; };
let val_str: Option<String> = visitor.visit_value()?; let val_str: Option<String> = visitor.visit_value()?;
let val = match val_str { let val = match val_str {
Some(ref v) if v.starts_with("0x") => Some(Bytes::from_str(v).map_err(Error::custom)?), Some(ref v) if v.starts_with("0x") => Some(Bytes::from_str(v).map_err(V::Error::custom)?),
Some(v) => Some(Bytes::new(v.into_bytes())), Some(v) => Some(Bytes::new(v.into_bytes())),
None => None, None => None,
}; };
@ -63,8 +68,6 @@ impl Visitor for InputVisitor {
result.insert(key, val); result.insert(key, val);
} }
visitor.end()?;
let input = Input { let input = Input {
data: result data: result
}; };
@ -72,7 +75,7 @@ impl Visitor for InputVisitor {
Ok(input) Ok(input)
} }
fn visit_seq<V>(&mut self, mut visitor: V) -> Result<Self::Value, V::Error> where V: SeqVisitor { fn visit_seq<V>(self, mut visitor: V) -> Result<Self::Value, V::Error> where V: SeqVisitor {
let mut result = BTreeMap::new(); let mut result = BTreeMap::new();
loop { loop {
@ -83,20 +86,20 @@ impl Visitor for InputVisitor {
}; };
if keyval.len() != 2 { if keyval.len() != 2 {
return Err(Error::custom("Invalid key value pair.")); return Err(V::Error::custom("Invalid key value pair."));
} }
let ref key_str: Option<String> = keyval[0]; let ref key_str: Option<String> = keyval[0];
let ref val_str: Option<String> = keyval[1]; let ref val_str: Option<String> = keyval[1];
let key = match *key_str { let key = match *key_str {
Some(ref k) if k.starts_with("0x") => Bytes::from_str(k).map_err(Error::custom)?, Some(ref k) if k.starts_with("0x") => Bytes::from_str(k).map_err(V::Error::custom)?,
Some(ref k) => Bytes::new(k.clone().into_bytes()), Some(ref k) => Bytes::new(k.clone().into_bytes()),
None => { break; } None => { break; }
}; };
let val = match *val_str { let val = match *val_str {
Some(ref v) if v.starts_with("0x") => Some(Bytes::from_str(v).map_err(Error::custom)?), Some(ref v) if v.starts_with("0x") => Some(Bytes::from_str(v).map_err(V::Error::custom)?),
Some(ref v) => Some(Bytes::new(v.clone().into_bytes())), Some(ref v) => Some(Bytes::new(v.clone().into_bytes())),
None => None, None => None,
}; };
@ -104,8 +107,6 @@ impl Visitor for InputVisitor {
result.insert(key, val); result.insert(key, val);
} }
visitor.end()?;
let input = Input { let input = Input {
data: result data: result
}; };

View File

@ -16,9 +16,10 @@
//! Lenient uint json deserialization for test json files. //! Lenient uint json deserialization for test json files.
use std::fmt;
use std::str::FromStr; use std::str::FromStr;
use serde::{Deserialize, Deserializer, Error}; use serde::{Deserialize, Deserializer};
use serde::de::Visitor; use serde::de::{Error, Visitor};
use util::{U256, Uint as U}; use util::{U256, Uint as U};
/// Lenient uint json deserialization for test json files. /// Lenient uint json deserialization for test json files.
@ -50,7 +51,7 @@ impl Into<u8> for Uint {
} }
impl Deserialize for Uint { impl Deserialize for Uint {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(UintVisitor) deserializer.deserialize(UintVisitor)
} }
@ -61,11 +62,15 @@ struct UintVisitor;
impl Visitor for UintVisitor { impl Visitor for UintVisitor {
type Value = Uint; type Value = Uint;
fn visit_u64<E>(&mut self, value: u64) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a hex encoded uint")
}
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E> where E: Error {
Ok(Uint(U256::from(value))) Ok(Uint(U256::from(value)))
} }
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
let value = match value.len() { let value = match value.len() {
0 => U256::from(0), 0 => U256::from(0),
2 if value.starts_with("0x") => U256::from(0), 2 if value.starts_with("0x") => U256::from(0),
@ -80,7 +85,7 @@ impl Visitor for UintVisitor {
Ok(Uint(value)) Ok(Uint(value))
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -17,7 +17,6 @@
//! Logger for parity executables //! Logger for parity executables
extern crate ethcore_util as util; extern crate ethcore_util as util;
#[macro_use]
extern crate log as rlog; extern crate log as rlog;
extern crate isatty; extern crate isatty;
extern crate regex; extern crate regex;

View File

@ -22,59 +22,52 @@
#![cfg_attr(feature="dev", allow(useless_format))] #![cfg_attr(feature="dev", allow(useless_format))]
#![cfg_attr(feature="dev", allow(match_bool))] #![cfg_attr(feature="dev", allow(match_bool))]
extern crate docopt; extern crate ansi_term;
extern crate num_cpus; extern crate app_dirs;
extern crate rustc_serialize;
extern crate ethcore_devtools as devtools;
extern crate ethcore;
extern crate ethsync;
extern crate env_logger;
extern crate ethcore_logger;
extern crate ctrlc; extern crate ctrlc;
extern crate docopt;
extern crate env_logger;
extern crate fdlimit; extern crate fdlimit;
extern crate time; extern crate hyper; // for price_info.rs
extern crate isatty;
extern crate jsonrpc_core;
extern crate num_cpus;
extern crate number_prefix; extern crate number_prefix;
extern crate regex;
extern crate rlp;
extern crate rpassword; extern crate rpassword;
extern crate rustc_serialize;
extern crate semver; extern crate semver;
extern crate ethcore_io as io;
extern crate ethcore_ipc as ipc;
extern crate ethcore_ipc_nano as nanoipc;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate jsonrpc_core; extern crate time;
extern crate rlp;
extern crate ethcore_light as light;
extern crate parity_hash_fetch as hash_fetch;
extern crate ethcore_ipc_hypervisor as hypervisor;
extern crate ethcore_rpc;
extern crate ethcore_signer;
extern crate parity_updater as updater;
extern crate ansi_term;
extern crate regex;
extern crate isatty;
extern crate toml; extern crate toml;
extern crate app_dirs;
extern crate parity_reactor;
#[macro_use] extern crate ethcore;
extern crate ethcore_devtools as devtools;
extern crate ethcore_io as io;
extern crate ethcore_ipc as ipc;
extern crate ethcore_ipc_hypervisor as hypervisor;
extern crate ethcore_ipc_nano as nanoipc;
extern crate ethcore_light as light;
extern crate ethcore_logger;
extern crate ethcore_rpc;
extern crate ethcore_signer;
extern crate ethcore_util as util; extern crate ethcore_util as util;
#[macro_use] extern crate ethsync;
extern crate log as rlog; extern crate parity_hash_fetch as hash_fetch;
#[macro_use] extern crate parity_reactor;
extern crate hyper; // for price_info.rs extern crate parity_updater as updater;
#[macro_use] extern crate rpc_cli;
extern crate lazy_static;
#[cfg(feature="stratum")] #[cfg(feature="stratum")]
extern crate ethcore_stratum; extern crate ethcore_stratum;
#[cfg(feature = "dapps")] #[cfg(feature = "dapps")]
extern crate ethcore_dapps; extern crate ethcore_dapps;
extern crate rpc_cli;
#[macro_use]
extern crate log as rlog;
macro_rules! dependency { macro_rules! dependency {
($dep_ty:ident, $url:expr) => { ($dep_ty:ident, $url:expr) => {
@ -88,32 +81,33 @@ macro_rules! dependency {
} }
} }
mod cache;
mod upgrade;
mod rpc;
mod dapps;
mod informant;
mod cli;
mod configuration;
mod migration;
mod signer;
mod rpc_apis;
mod url;
mod helpers;
mod params;
mod deprecated;
mod dir;
mod modules;
mod account; mod account;
mod blockchain; mod blockchain;
mod cache;
mod cli;
mod configuration;
mod dapps;
mod deprecated;
mod dir;
mod helpers;
mod informant;
mod migration;
mod modules;
mod params;
mod presale; mod presale;
mod snapshot; mod rpc;
mod rpc_apis;
mod run; mod run;
#[cfg(feature="ipc")] mod signer;
mod sync; mod snapshot;
mod upgrade;
mod url;
mod user_defaults;
#[cfg(feature="ipc")] #[cfg(feature="ipc")]
mod boot; mod boot;
mod user_defaults; #[cfg(feature="ipc")]
mod sync;
#[cfg(feature="stratum")] #[cfg(feature="stratum")]
mod stratum; mod stratum;
@ -211,7 +205,7 @@ fn latest_exe_path() -> Option<PathBuf> {
fn global_cleanup() { fn global_cleanup() {
extern "system" { pub fn WSACleanup() -> i32; } extern "system" { pub fn WSACleanup() -> i32; }
// We need to cleanup all sockets before spawning another Parity process. This makes shure everything is cleaned up. // We need to cleanup all sockets before spawning another Parity process. This makes shure everything is cleaned up.
// The loop is required because of internal refernce counter for winsock dll. We don't know how many crates we use do // The loop is required because of internal refernce counter for winsock dll. We don't know how many crates we use do
// initialize it. There's at least 2 now. // initialize it. There's at least 2 now.
for _ in 0.. 10 { for _ in 0.. 10 {
unsafe { WSACleanup(); } unsafe { WSACleanup(); }

View File

@ -14,13 +14,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::fmt;
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::time::Duration; use std::time::Duration;
use serde::{Serialize, Serializer, Error, Deserialize, Deserializer}; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::de::{Visitor, MapVisitor}; use serde::de::{Error, Visitor, MapVisitor};
use serde::de::impls::BTreeMapVisitor; use serde::de::impls::BTreeMapVisitor;
use serde_json::Value; use serde_json::Value;
use serde_json::de::from_reader; use serde_json::de::from_reader;
@ -37,7 +38,7 @@ pub struct UserDefaults {
} }
impl Serialize for UserDefaults { impl Serialize for UserDefaults {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
let mut map: BTreeMap<String, Value> = BTreeMap::new(); let mut map: BTreeMap<String, Value> = BTreeMap::new();
map.insert("pruning".into(), Value::String(self.pruning.as_str().into())); map.insert("pruning".into(), Value::String(self.pruning.as_str().into()));
@ -46,12 +47,12 @@ impl Serialize for UserDefaults {
let mode_str = match self.mode { let mode_str = match self.mode {
Mode::Off => "offline", Mode::Off => "offline",
Mode::Dark(timeout) => { Mode::Dark(timeout) => {
map.insert("mode.timeout".into(), Value::U64(timeout.as_secs())); map.insert("mode.timeout".into(), Value::Number(timeout.as_secs().into()));
"dark" "dark"
}, },
Mode::Passive(timeout, alarm) => { Mode::Passive(timeout, alarm) => {
map.insert("mode.timeout".into(), Value::U64(timeout.as_secs())); map.insert("mode.timeout".into(), Value::Number(timeout.as_secs().into()));
map.insert("mode.alarm".into(), Value::U64(alarm.as_secs())); map.insert("mode.alarm".into(), Value::Number(alarm.as_secs().into()));
"passive" "passive"
}, },
Mode::Active => "active", Mode::Active => "active",
@ -65,7 +66,7 @@ impl Serialize for UserDefaults {
struct UserDefaultsVisitor; struct UserDefaultsVisitor;
impl Deserialize for UserDefaults { impl Deserialize for UserDefaults {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(UserDefaultsVisitor) deserializer.deserialize(UserDefaultsVisitor)
} }
@ -74,8 +75,11 @@ impl Deserialize for UserDefaults {
impl Visitor for UserDefaultsVisitor { impl Visitor for UserDefaultsVisitor {
type Value = UserDefaults; type Value = UserDefaults;
fn visit_map<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error> fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
where V: MapVisitor { write!(formatter, "a valid UserDefaults object")
}
fn visit_map<V>(self, visitor: V) -> Result<Self::Value, V::Error> where V: MapVisitor {
let mut map: BTreeMap<String, Value> = BTreeMapVisitor::new().visit_map(visitor)?; let mut map: BTreeMap<String, Value> = BTreeMapVisitor::new().visit_map(visitor)?;
let pruning: Value = map.remove("pruning").ok_or_else(|| Error::custom("missing pruning"))?; let pruning: Value = map.remove("pruning").ok_or_else(|| Error::custom("missing pruning"))?;
let pruning = pruning.as_str().ok_or_else(|| Error::custom("invalid pruning value"))?; let pruning = pruning.as_str().ok_or_else(|| Error::custom("invalid pruning value"))?;

View File

@ -4,7 +4,6 @@ name = "ethcore-rpc"
version = "1.6.0" version = "1.6.0"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[lib] [lib]
@ -12,8 +11,9 @@ build = "build.rs"
futures = "0.1" futures = "0.1"
log = "0.3" log = "0.3"
semver = "0.5" semver = "0.5"
serde = "0.8" serde = "0.9"
serde_json = "0.8" serde_json = "0.9"
serde_derive = "0.9"
rustc-serialize = "0.3" rustc-serialize = "0.3"
time = "0.1" time = "0.1"
transient-hashmap = "0.1" transient-hashmap = "0.1"
@ -38,13 +38,7 @@ parity-updater = { path = "../updater" }
rlp = { path = "../util/rlp" } rlp = { path = "../util/rlp" }
fetch = { path = "../util/fetch" } fetch = { path = "../util/fetch" }
parity-reactor = { path = "../util/reactor" } parity-reactor = { path = "../util/reactor" }
serde_macros = { version = "0.8", optional = true }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}
[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
[features] [features]
default = ["serde_codegen"]
nightly = ["serde_macros"]
dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev"] dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev"]

View File

@ -1,41 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
#[cfg(not(feature = "serde_macros"))]
mod inner {
extern crate serde_codegen;
use std::env;
use std::path::Path;
pub fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let src = Path::new("src/v1/types/mod.rs.in");
let dst = Path::new(&out_dir).join("mod.rs");
serde_codegen::expand(&src, &dst).unwrap();
}
}
#[cfg(feature = "serde_macros")]
mod inner {
pub fn main() {}
}
fn main() {
inner::main();
}

View File

@ -16,8 +16,8 @@
//! Ethcore rpc. //! Ethcore rpc.
#![warn(missing_docs)] #![warn(missing_docs)]
#![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))] #![cfg_attr(feature="nightly", feature(plugin))]
#![cfg_attr(feature="nightly", plugin(serde_macros, clippy))] #![cfg_attr(feature="nightly", plugin(clippy))]
extern crate semver; extern crate semver;
extern crate rustc_serialize; extern crate rustc_serialize;
@ -51,6 +51,8 @@ extern crate log;
extern crate ethcore_util as util; extern crate ethcore_util as util;
#[macro_use] #[macro_use]
extern crate jsonrpc_macros; extern crate jsonrpc_macros;
#[macro_use]
extern crate serde_derive;
#[cfg(test)] #[cfg(test)]
extern crate ethjson; extern crate ethjson;

View File

@ -388,7 +388,7 @@ fn should_decrypt_message_if_account_is_unlocked() {
let encrypted: Success = serde_json::from_str(&tester.io.handle_request_sync(&request).unwrap()).unwrap(); let encrypted: Success = serde_json::from_str(&tester.io.handle_request_sync(&request).unwrap()).unwrap();
// then call decrypt // then call decrypt
let request = format!("{}{:?}{}{:?}{}", let request = format!("{}{:?}{}{}{}",
r#"{"jsonrpc": "2.0", "method": "parity_decryptMessage", "params":["0x"#, r#"{"jsonrpc": "2.0", "method": "parity_decryptMessage", "params":["0x"#,
address, address,
r#"","#, r#"","#,

View File

@ -17,6 +17,7 @@
use std::ops::Deref; use std::ops::Deref;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use serde::{Serialize, Serializer}; use serde::{Serialize, Serializer};
use serde::ser::Error;
use v1::types::{Bytes, Transaction, H160, H256, H2048, U256}; use v1::types::{Bytes, Transaction, H160, H256, H2048, U256};
/// Block Transactions /// Block Transactions
@ -29,7 +30,7 @@ pub enum BlockTransactions {
} }
impl Serialize for BlockTransactions { impl Serialize for BlockTransactions {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
BlockTransactions::Hashes(ref hashes) => hashes.serialize(serializer), BlockTransactions::Hashes(ref hashes) => hashes.serialize(serializer),
@ -102,7 +103,7 @@ pub struct RichBlock {
pub block: Block, pub block: Block,
/// Engine-specific fields with additional description. /// Engine-specific fields with additional description.
/// Should be included directly to serialized block object. /// Should be included directly to serialized block object.
#[serde(skip_serializing)] // TODO [ToDr] #[serde(skip_serializing)]
pub extra_info: BTreeMap<String, String>, pub extra_info: BTreeMap<String, String>,
} }
@ -114,17 +115,18 @@ impl Deref for RichBlock {
} }
impl Serialize for RichBlock { impl Serialize for RichBlock {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
use serde_json::{to_value, Value}; use serde_json::{to_value, Value};
let serialized = (to_value(&self.block), to_value(&self.extra_info)); let serialized = (to_value(&self.block), to_value(&self.extra_info));
if let (Value::Object(mut block), Value::Object(extras)) = serialized { if let (Ok(Value::Object(mut block)), Ok(Value::Object(extras))) = serialized {
// join two objects // join two objects
block.extend(extras); block.extend(extras);
// and serialize // and serialize
block.serialize(serializer)?; block.serialize(serializer)
} else {
Err(S::Error::custom("Unserializable structures."))
} }
Ok(())
} }
} }

View File

@ -14,8 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Deserialize, Deserializer, Error, Serialize, Serializer}; use std::fmt;
use serde::de::Visitor; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::{Error, Visitor};
use ethcore::client::BlockId; use ethcore::client::BlockId;
/// Represents rpc api block number param. /// Represents rpc api block number param.
@ -38,8 +39,7 @@ impl Default for BlockNumber {
} }
impl Deserialize for BlockNumber { impl Deserialize for BlockNumber {
fn deserialize<D>(deserializer: &mut D) -> Result<BlockNumber, D::Error> fn deserialize<D>(deserializer: D) -> Result<BlockNumber, D::Error> where D: Deserializer {
where D: Deserializer {
deserializer.deserialize(BlockNumberVisitor) deserializer.deserialize(BlockNumberVisitor)
} }
} }
@ -55,7 +55,7 @@ impl BlockNumber {
} }
impl Serialize for BlockNumber { impl Serialize for BlockNumber {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
match *self { match *self {
BlockNumber::Num(ref x) => serializer.serialize_str(&format!("0x{:x}", x)), BlockNumber::Num(ref x) => serializer.serialize_str(&format!("0x{:x}", x)),
BlockNumber::Latest => serializer.serialize_str("latest"), BlockNumber::Latest => serializer.serialize_str("latest"),
@ -70,7 +70,11 @@ struct BlockNumberVisitor;
impl Visitor for BlockNumberVisitor { impl Visitor for BlockNumberVisitor {
type Value = BlockNumber; type Value = BlockNumber;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a block number or 'latest', 'earliest' or 'pending'")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
match value { match value {
"latest" => Ok(BlockNumber::Latest), "latest" => Ok(BlockNumber::Latest),
"earliest" => Ok(BlockNumber::Earliest), "earliest" => Ok(BlockNumber::Earliest),
@ -80,7 +84,7 @@ impl Visitor for BlockNumberVisitor {
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -16,9 +16,10 @@
//! Serializable wrapper around vector of bytes //! Serializable wrapper around vector of bytes
use std::fmt;
use rustc_serialize::hex::ToHex; use rustc_serialize::hex::ToHex;
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error}; use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::de::Visitor; use serde::de::{Error, Visitor};
use util::common::FromHex; use util::common::FromHex;
/// Wrapper structure around vector of bytes. /// Wrapper structure around vector of bytes.
@ -49,7 +50,7 @@ impl Into<Vec<u8>> for Bytes {
} }
impl Serialize for Bytes { impl Serialize for Bytes {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
let mut serialized = "0x".to_owned(); let mut serialized = "0x".to_owned();
serialized.push_str(self.0.to_hex().as_ref()); serialized.push_str(self.0.to_hex().as_ref());
@ -58,7 +59,7 @@ impl Serialize for Bytes {
} }
impl Deserialize for Bytes { impl Deserialize for Bytes {
fn deserialize<D>(deserializer: &mut D) -> Result<Bytes, D::Error> fn deserialize<D>(deserializer: D) -> Result<Bytes, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(BytesVisitor) deserializer.deserialize(BytesVisitor)
} }
@ -69,7 +70,11 @@ struct BytesVisitor;
impl Visitor for BytesVisitor { impl Visitor for BytesVisitor {
type Value = Bytes; type Value = Bytes;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a 0x-prefixed, hex-encoded vector of bytes")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
if value.is_empty() { if value.is_empty() {
warn!( warn!(
target: "deprecated", target: "deprecated",
@ -83,7 +88,7 @@ impl Visitor for BytesVisitor {
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -130,7 +130,7 @@ pub enum ConfirmationResponse {
} }
impl Serialize for ConfirmationResponse { impl Serialize for ConfirmationResponse {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
match *self { match *self {
@ -225,7 +225,7 @@ impl<A, B> Serialize for Either<A, B> where
A: Serialize + fmt::Debug + Clone, A: Serialize + fmt::Debug + Clone,
B: Serialize + fmt::Debug + Clone, B: Serialize + fmt::Debug + Clone,
{ {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
match *self { match *self {

View File

@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Deserialize, Deserializer, Serialize, Serializer, Error}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::value; use serde::de::Error;
use jsonrpc_core::Value; use serde_json::{Value, from_value};
use ethcore::filter::Filter as EthFilter; use ethcore::filter::Filter as EthFilter;
use ethcore::client::BlockId; use ethcore::client::BlockId;
use v1::types::{BlockNumber, H160, H256, Log}; use v1::types::{BlockNumber, H160, H256, Log};
@ -33,17 +33,17 @@ pub enum VariadicValue<T> where T: Deserialize {
} }
impl<T> Deserialize for VariadicValue<T> where T: Deserialize { impl<T> Deserialize for VariadicValue<T> where T: Deserialize {
fn deserialize<D>(deserializer: &mut D) -> Result<VariadicValue<T>, D::Error> fn deserialize<D>(deserializer: D) -> Result<VariadicValue<T>, D::Error>
where D: Deserializer { where D: Deserializer {
let v = Value::deserialize(deserializer)?; let v: Value = Deserialize::deserialize(deserializer)?;
if v.is_null() { if v.is_null() {
return Ok(VariadicValue::Null); return Ok(VariadicValue::Null);
} }
Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Single) from_value(v.clone()).map(VariadicValue::Single)
.or_else(|_| Deserialize::deserialize(&mut value::Deserializer::new(v.clone())).map(VariadicValue::Multiple)) .or_else(|_| from_value(v).map(VariadicValue::Multiple))
.map_err(|_| Error::custom("")) // unreachable, but types must match .map_err(|_| D::Error::custom("Invalid type."))
} }
} }
@ -111,7 +111,7 @@ pub enum FilterChanges {
} }
impl Serialize for FilterChanges { impl Serialize for FilterChanges {
fn serialize<S>(&self, s: &mut S) -> Result<(), S::Error> where S: Serializer { fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error> where S: Serializer {
match *self { match *self {
FilterChanges::Logs(ref logs) => logs.serialize(s), FilterChanges::Logs(ref logs) => logs.serialize(s),
FilterChanges::Hashes(ref hashes) => hashes.serialize(s), FilterChanges::Hashes(ref hashes) => hashes.serialize(s),

View File

@ -101,7 +101,7 @@ macro_rules! impl_hash {
} }
impl serde::Serialize for $name { impl serde::Serialize for $name {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: serde::Serializer { where S: serde::Serializer {
let mut hex = "0x".to_owned(); let mut hex = "0x".to_owned();
hex.push_str(&self.0.to_hex()); hex.push_str(&self.0.to_hex());
@ -110,16 +110,20 @@ macro_rules! impl_hash {
} }
impl serde::Deserialize for $name { impl serde::Deserialize for $name {
fn deserialize<D>(deserializer: &mut D) -> Result<$name, D::Error> where D: serde::Deserializer { fn deserialize<D>(deserializer: D) -> Result<$name, D::Error> where D: serde::Deserializer {
struct HashVisitor; struct HashVisitor;
impl serde::de::Visitor for HashVisitor { impl serde::de::Visitor for HashVisitor {
type Value = $name; type Value = $name;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a 0x-prefixed, padded, hex-encoded hash of type {}", stringify!($name))
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: serde::de::Error {
if value.len() != 2 + $size * 2 { if value.len() != 2 + $size * 2 {
return Err(serde::Error::custom("Invalid length.")); return Err(E::custom("Invalid length."));
} }
match value[2..].from_hex() { match value[2..].from_hex() {
@ -128,11 +132,11 @@ macro_rules! impl_hash {
result.copy_from_slice(v); result.copy_from_slice(v);
Ok($name(result)) Ok($name(result))
}, },
_ => Err(serde::Error::custom("Invalid hex value.")) _ => Err(E::custom("Invalid hex value."))
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: serde::de::Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -14,8 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Deserialize, Deserializer, Error}; use std::fmt;
use serde::de::Visitor; use serde::{Deserialize, Deserializer};
use serde::de::{Error, Visitor};
/// Represents usize. /// Represents usize.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -29,7 +30,7 @@ impl Index {
} }
impl Deserialize for Index { impl Deserialize for Index {
fn deserialize<D>(deserializer: &mut D) -> Result<Index, D::Error> fn deserialize<D>(deserializer: D) -> Result<Index, D::Error>
where D: Deserializer { where D: Deserializer {
deserializer.deserialize(IndexVisitor) deserializer.deserialize(IndexVisitor)
} }
@ -40,14 +41,18 @@ struct IndexVisitor;
impl Visitor for IndexVisitor { impl Visitor for IndexVisitor {
type Value = Index; type Value = Index;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a hex-encoded or decimal index")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
match value { match value {
_ if value.starts_with("0x") => usize::from_str_radix(&value[2..], 16).map(Index).map_err(|_| Error::custom("invalid index")), _ if value.starts_with("0x") => usize::from_str_radix(&value[2..], 16).map(Index).map_err(|_| Error::custom("invalid index")),
_ => value.parse::<usize>().map(Index).map_err(|_| Error::custom("invalid index")) _ => value.parse::<usize>().map(Index).map_err(|_| Error::custom("invalid index")),
} }
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
self.visit_str(value.as_ref()) self.visit_str(value.as_ref())
} }
} }

View File

@ -14,10 +14,59 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Structures used in RPC communication
#[cfg(feature = "serde_macros")] //! RPC types
include!("mod.rs.in");
#[cfg(not(feature = "serde_macros"))] mod account_info;
include!(concat!(env!("OUT_DIR"), "/mod.rs")); mod bytes;
mod block;
mod block_number;
mod call_request;
mod confirmations;
mod dapp_id;
mod filter;
mod hash;
mod index;
mod log;
mod sync;
mod transaction;
mod transaction_request;
mod transaction_condition;
mod receipt;
mod rpc_settings;
mod trace;
mod trace_filter;
mod uint;
mod work;
mod histogram;
mod consensus_status;
pub use self::bytes::Bytes;
pub use self::block::{RichBlock, Block, BlockTransactions};
pub use self::block_number::BlockNumber;
pub use self::call_request::CallRequest;
pub use self::confirmations::{
ConfirmationPayload, ConfirmationRequest, ConfirmationResponse, ConfirmationResponseWithToken,
TransactionModification, SignRequest, DecryptRequest, Either
};
pub use self::dapp_id::DappId;
pub use self::filter::{Filter, FilterChanges};
pub use self::hash::{H64, H160, H256, H512, H520, H2048};
pub use self::index::Index;
pub use self::log::Log;
pub use self::sync::{
SyncStatus, SyncInfo, Peers, PeerInfo, PeerNetworkInfo, PeerProtocolsInfo,
TransactionStats, ChainStatus, EthProtocolInfo, LesProtocolInfo,
};
pub use self::transaction::{Transaction, RichRawTransaction, LocalTransactionStatus};
pub use self::transaction_request::TransactionRequest;
pub use self::transaction_condition::TransactionCondition;
pub use self::receipt::Receipt;
pub use self::rpc_settings::RpcSettings;
pub use self::trace::{LocalizedTrace, TraceResults};
pub use self::trace_filter::TraceFilter;
pub use self::uint::{U128, U256};
pub use self::work::Work;
pub use self::histogram::Histogram;
pub use self::consensus_status::*;
pub use self::account_info::{AccountInfo, HwAccountInfo};

View File

@ -1,69 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
mod account_info;
mod bytes;
mod block;
mod block_number;
mod call_request;
mod confirmations;
mod dapp_id;
mod filter;
mod hash;
mod index;
mod log;
mod sync;
mod transaction;
mod transaction_request;
mod transaction_condition;
mod receipt;
mod rpc_settings;
mod trace;
mod trace_filter;
mod uint;
mod work;
mod histogram;
mod consensus_status;
pub use self::bytes::Bytes;
pub use self::block::{RichBlock, Block, BlockTransactions};
pub use self::block_number::BlockNumber;
pub use self::call_request::CallRequest;
pub use self::confirmations::{
ConfirmationPayload, ConfirmationRequest, ConfirmationResponse, ConfirmationResponseWithToken,
TransactionModification, SignRequest, DecryptRequest, Either
};
pub use self::dapp_id::DappId;
pub use self::filter::{Filter, FilterChanges};
pub use self::hash::{H64, H160, H256, H512, H520, H2048};
pub use self::index::Index;
pub use self::log::Log;
pub use self::sync::{
SyncStatus, SyncInfo, Peers, PeerInfo, PeerNetworkInfo, PeerProtocolsInfo,
TransactionStats, ChainStatus, EthProtocolInfo, LesProtocolInfo,
};
pub use self::transaction::{Transaction, RichRawTransaction, LocalTransactionStatus};
pub use self::transaction_request::TransactionRequest;
pub use self::transaction_condition::TransactionCondition;
pub use self::receipt::Receipt;
pub use self::rpc_settings::RpcSettings;
pub use self::trace::{LocalizedTrace, TraceResults};
pub use self::trace_filter::TraceFilter;
pub use self::uint::{U128, U256};
pub use self::work::Work;
pub use self::histogram::Histogram;
pub use self::consensus_status::*;
pub use self::account_info::{AccountInfo, HwAccountInfo};

View File

@ -139,7 +139,7 @@ pub enum SyncStatus {
} }
impl Serialize for SyncStatus { impl Serialize for SyncStatus {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
match *self { match *self {
SyncStatus::Info(ref info) => info.serialize(serializer), SyncStatus::Info(ref info) => info.serialize(serializer),

View File

@ -16,6 +16,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use serde::{Serialize, Serializer}; use serde::{Serialize, Serializer};
use serde::ser::SerializeStruct;
use ethcore::trace::{FlatTrace, LocalizedTrace as EthLocalizedTrace, trace, TraceError}; use ethcore::trace::{FlatTrace, LocalizedTrace as EthLocalizedTrace, trace, TraceError};
use ethcore::trace as et; use ethcore::trace as et;
use ethcore::state_diff; use ethcore::state_diff;
@ -200,7 +201,7 @@ impl From<account_diff::AccountDiff> for AccountDiff {
pub struct StateDiff(BTreeMap<H160, AccountDiff>); pub struct StateDiff(BTreeMap<H160, AccountDiff>);
impl Serialize for StateDiff { impl Serialize for StateDiff {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
Serialize::serialize(&self.0, serializer) Serialize::serialize(&self.0, serializer)
} }
@ -428,41 +429,41 @@ pub struct LocalizedTrace {
} }
impl Serialize for LocalizedTrace { impl Serialize for LocalizedTrace {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
let mut state = serializer.serialize_struct("LocalizedTrace", 9)?; let mut struc = serializer.serialize_struct("LocalizedTrace", 9)?;
match self.action { match self.action {
Action::Call(ref call) => { Action::Call(ref call) => {
serializer.serialize_struct_elt(&mut state, "type", "call")?; struc.serialize_field("type", "call")?;
serializer.serialize_struct_elt(&mut state, "action", call)?; struc.serialize_field("action", call)?;
}, },
Action::Create(ref create) => { Action::Create(ref create) => {
serializer.serialize_struct_elt(&mut state, "type", "create")?; struc.serialize_field("type", "create")?;
serializer.serialize_struct_elt(&mut state, "action", create)?; struc.serialize_field("action", create)?;
}, },
Action::Suicide(ref suicide) => { Action::Suicide(ref suicide) => {
serializer.serialize_struct_elt(&mut state, "type", "suicide")?; struc.serialize_field("type", "suicide")?;
serializer.serialize_struct_elt(&mut state, "action", suicide)?; struc.serialize_field("action", suicide)?;
}, },
} }
match self.result { match self.result {
Res::Call(ref call) => serializer.serialize_struct_elt(&mut state, "result", call)?, Res::Call(ref call) => struc.serialize_field("result", call)?,
Res::Create(ref create) => serializer.serialize_struct_elt(&mut state, "result", create)?, Res::Create(ref create) => struc.serialize_field("result", create)?,
Res::FailedCall(ref error) => serializer.serialize_struct_elt(&mut state, "error", error.to_string())?, Res::FailedCall(ref error) => struc.serialize_field("error", &error.to_string())?,
Res::FailedCreate(ref error) => serializer.serialize_struct_elt(&mut state, "error", error.to_string())?, Res::FailedCreate(ref error) => struc.serialize_field("error", &error.to_string())?,
Res::None => serializer.serialize_struct_elt(&mut state, "result", None as Option<u8>)?, Res::None => struc.serialize_field("result", &None as &Option<u8>)?,
} }
serializer.serialize_struct_elt(&mut state, "traceAddress", &self.trace_address)?; struc.serialize_field("traceAddress", &self.trace_address)?;
serializer.serialize_struct_elt(&mut state, "subtraces", &self.subtraces)?; struc.serialize_field("subtraces", &self.subtraces)?;
serializer.serialize_struct_elt(&mut state, "transactionPosition", &self.transaction_position)?; struc.serialize_field("transactionPosition", &self.transaction_position)?;
serializer.serialize_struct_elt(&mut state, "transactionHash", &self.transaction_hash)?; struc.serialize_field("transactionHash", &self.transaction_hash)?;
serializer.serialize_struct_elt(&mut state, "blockNumber", &self.block_number)?; struc.serialize_field("blockNumber", &self.block_number)?;
serializer.serialize_struct_elt(&mut state, "blockHash", &self.block_hash)?; struc.serialize_field("blockHash", &self.block_hash)?;
serializer.serialize_struct_end(state) struc.end()
} }
} }
@ -495,37 +496,37 @@ pub struct Trace {
} }
impl Serialize for Trace { impl Serialize for Trace {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
let mut state = serializer.serialize_struct("Trace", 4)?; let mut struc = serializer.serialize_struct("Trace", 4)?;
match self.action { match self.action {
Action::Call(ref call) => { Action::Call(ref call) => {
serializer.serialize_struct_elt(&mut state, "type", "call")?; struc.serialize_field("type", "call")?;
serializer.serialize_struct_elt(&mut state, "action", call)?; struc.serialize_field("action", call)?;
}, },
Action::Create(ref create) => { Action::Create(ref create) => {
serializer.serialize_struct_elt(&mut state, "type", "create")?; struc.serialize_field("type", "create")?;
serializer.serialize_struct_elt(&mut state, "action", create)?; struc.serialize_field("action", create)?;
}, },
Action::Suicide(ref suicide) => { Action::Suicide(ref suicide) => {
serializer.serialize_struct_elt(&mut state, "type", "suicide")?; struc.serialize_field("type", "suicide")?;
serializer.serialize_struct_elt(&mut state, "action", suicide)?; struc.serialize_field("action", suicide)?;
}, },
} }
match self.result { match self.result {
Res::Call(ref call) => serializer.serialize_struct_elt(&mut state, "result", call)?, Res::Call(ref call) => struc.serialize_field("result", call)?,
Res::Create(ref create) => serializer.serialize_struct_elt(&mut state, "result", create)?, Res::Create(ref create) => struc.serialize_field("result", create)?,
Res::FailedCall(ref error) => serializer.serialize_struct_elt(&mut state, "error", error.to_string())?, Res::FailedCall(ref error) => struc.serialize_field("error", &error.to_string())?,
Res::FailedCreate(ref error) => serializer.serialize_struct_elt(&mut state, "error", error.to_string())?, Res::FailedCreate(ref error) => struc.serialize_field("error", &error.to_string())?,
Res::None => serializer.serialize_struct_elt(&mut state, "result", None as Option<u8>)?, Res::None => struc.serialize_field("result", &None as &Option<u8>)?,
} }
serializer.serialize_struct_elt(&mut state, "traceAddress", &self.trace_address)?; struc.serialize_field("traceAddress", &self.trace_address)?;
serializer.serialize_struct_elt(&mut state, "subtraces", &self.subtraces)?; struc.serialize_field("subtraces", &self.subtraces)?;
serializer.serialize_struct_end(state) struc.end()
} }
} }

View File

@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use serde::{Serialize, Serializer}; use serde::{Serialize, Serializer};
use serde::ser::SerializeStruct;
use ethcore::miner; use ethcore::miner;
use ethcore::contract_address; use ethcore::contract_address;
use ethcore::transaction::{LocalizedTransaction, Action, PendingTransaction, SignedTransaction}; use ethcore::transaction::{LocalizedTransaction, Action, PendingTransaction, SignedTransaction};
@ -93,7 +94,7 @@ pub enum LocalTransactionStatus {
} }
impl Serialize for LocalTransactionStatus { impl Serialize for LocalTransactionStatus {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
use self::LocalTransactionStatus::*; use self::LocalTransactionStatus::*;
@ -108,35 +109,36 @@ impl Serialize for LocalTransactionStatus {
let status = "status"; let status = "status";
let transaction = "transaction"; let transaction = "transaction";
let mut state = serializer.serialize_struct("LocalTransactionStatus", elems)?; let mut struc = serializer.serialize_struct("LocalTransactionStatus", elems)?;
match *self { match *self {
Pending => serializer.serialize_struct_elt(&mut state, status, "pending")?, Pending => struc.serialize_field(status, "pending")?,
Future => serializer.serialize_struct_elt(&mut state, status, "future")?, Future => struc.serialize_field(status, "future")?,
Mined(ref tx) => { Mined(ref tx) => {
serializer.serialize_struct_elt(&mut state, status, "mined")?; struc.serialize_field(status, "mined")?;
serializer.serialize_struct_elt(&mut state, transaction, tx)?; struc.serialize_field(transaction, tx)?;
}, },
Dropped(ref tx) => { Dropped(ref tx) => {
serializer.serialize_struct_elt(&mut state, status, "dropped")?; struc.serialize_field(status, "dropped")?;
serializer.serialize_struct_elt(&mut state, transaction, tx)?; struc.serialize_field(transaction, tx)?;
}, },
Invalid(ref tx) => { Invalid(ref tx) => {
serializer.serialize_struct_elt(&mut state, status, "invalid")?; struc.serialize_field(status, "invalid")?;
serializer.serialize_struct_elt(&mut state, transaction, tx)?; struc.serialize_field(transaction, tx)?;
}, },
Rejected(ref tx, ref reason) => { Rejected(ref tx, ref reason) => {
serializer.serialize_struct_elt(&mut state, status, "rejected")?; struc.serialize_field(status, "rejected")?;
serializer.serialize_struct_elt(&mut state, transaction, tx)?; struc.serialize_field(transaction, tx)?;
serializer.serialize_struct_elt(&mut state, "error", reason)?; struc.serialize_field("error", reason)?;
}, },
Replaced(ref tx, ref gas_price, ref hash) => { Replaced(ref tx, ref gas_price, ref hash) => {
serializer.serialize_struct_elt(&mut state, status, "replaced")?; struc.serialize_field(status, "replaced")?;
serializer.serialize_struct_elt(&mut state, transaction, tx)?; struc.serialize_field(transaction, tx)?;
serializer.serialize_struct_elt(&mut state, "hash", hash)?; struc.serialize_field("hash", hash)?;
serializer.serialize_struct_elt(&mut state, "gasPrice", gas_price)?; struc.serialize_field("gasPrice", gas_price)?;
}, },
} }
serializer.serialize_struct_end(state)
struc.end()
} }
} }

View File

@ -60,33 +60,37 @@ macro_rules! impl_uint {
} }
impl serde::Serialize for $name { impl serde::Serialize for $name {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: serde::Serializer { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
serializer.serialize_str(&format!("0x{}", self.0.to_hex())) serializer.serialize_str(&format!("0x{}", self.0.to_hex()))
} }
} }
impl serde::Deserialize for $name { impl serde::Deserialize for $name {
fn deserialize<D>(deserializer: &mut D) -> Result<$name, D::Error> fn deserialize<D>(deserializer: D) -> Result<$name, D::Error>
where D: serde::Deserializer { where D: serde::Deserializer {
struct UintVisitor; struct UintVisitor;
impl serde::de::Visitor for UintVisitor { impl serde::de::Visitor for UintVisitor {
type Value = $name; type Value = $name;
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a 0x-prefixed, hex-encoded number of type {}", stringify!($name))
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: serde::de::Error {
// 0x + len // 0x + len
if value.len() > 2 + $size * 16 || value.len() < 2 { if value.len() > 2 + $size * 16 || value.len() < 2 {
return Err(serde::Error::custom("Invalid length.")); return Err(E::custom("Invalid length."));
} }
if &value[0..2] != "0x" { if &value[0..2] != "0x" {
return Err(serde::Error::custom("Use hex encoded numbers with 0x prefix.")) return Err(E::custom("Use hex encoded numbers with 0x prefix."))
} }
$other::from_str(&value[2..]).map($name).map_err(|_| serde::Error::custom("Invalid hex value.")) $other::from_str(&value[2..]).map($name).map_err(|_| E::custom("Invalid hex value."))
} }
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error { fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: serde::de::Error {
self.visit_str(&value) self.visit_str(&value)
} }
} }

View File

@ -33,7 +33,7 @@ pub struct Work {
} }
impl Serialize for Work { impl Serialize for Work {
fn serialize<S>(&self, s: &mut S) -> Result<(), S::Error> where S: Serializer { fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error> where S: Serializer {
match self.number.as_ref() { match self.number.as_ref() {
Some(num) => (&self.pow_hash, &self.seed_hash, &self.target, U256::from(*num)).serialize(s), Some(num) => (&self.pow_hash, &self.seed_hash, &self.target, U256::from(*num)).serialize(s),
None => (&self.pow_hash, &self.seed_hash, &self.target).serialize(s), None => (&self.pow_hash, &self.seed_hash, &self.target).serialize(s),

View File

@ -8,12 +8,10 @@ version = "1.4.0"
[dependencies] [dependencies]
futures = "0.1" futures = "0.1"
lazy_static = "0.2.1"
log = "0.3.6" log = "0.3.6"
matches = "0.1.2"
rand = "0.3.14" rand = "0.3.14"
serde = "0.8" serde = "0.9"
serde_json = "0.8" serde_json = "0.9"
tempdir = "0.3.5" tempdir = "0.3.5"
url = "1.2.0" url = "1.2.0"
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" } jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" }

View File

@ -13,11 +13,6 @@ extern crate rand;
extern crate tempdir; extern crate tempdir;
extern crate jsonrpc_core; extern crate jsonrpc_core;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate matches;
#[macro_use] #[macro_use]
extern crate log; extern crate log;

View File

@ -1,5 +1,6 @@
use client::{Rpc, RpcError}; use client::{Rpc, RpcError};
use rpc::v1::types::{ConfirmationRequest, TransactionModification, U256, TransactionCondition}; use rpc::v1::types::{ConfirmationRequest, TransactionModification, U256, TransactionCondition};
use serde;
use serde_json::{Value as JsonValue, to_value}; use serde_json::{Value as JsonValue, to_value};
use std::path::PathBuf; use std::path::PathBuf;
use futures::{BoxFuture, Canceled}; use futures::{BoxFuture, Canceled};
@ -27,9 +28,9 @@ impl SignerRpc {
) -> BoxFuture<Result<U256, RpcError>, Canceled> ) -> BoxFuture<Result<U256, RpcError>, Canceled>
{ {
self.rpc.request("signer_confirmRequest", vec![ self.rpc.request("signer_confirmRequest", vec![
to_value(&format!("{:#x}", id)), Self::to_value(&format!("{:#x}", id)),
to_value(&TransactionModification { sender: None, gas_price: new_gas_price, gas: new_gas, condition: new_condition }), Self::to_value(&TransactionModification { sender: None, gas_price: new_gas_price, gas: new_gas, condition: new_condition }),
to_value(&pwd), Self::to_value(&pwd),
]) ])
} }
pub fn reject_request(&mut self, id: U256) -> pub fn reject_request(&mut self, id: U256) ->
@ -39,4 +40,8 @@ impl SignerRpc {
JsonValue::String(format!("{:#x}", id)) JsonValue::String(format!("{:#x}", id))
]) ])
} }
fn to_value<T: serde::Serialize>(v: &T) -> JsonValue {
to_value(v).expect("Our types are always serializable; qed")
}
} }

View File

@ -198,7 +198,7 @@ impl Stratum {
trace!(target: "stratum", "Invalid submit work format {:?}", params); trace!(target: "stratum", "Invalid submit work format {:?}", params);
to_value(false) to_value(false)
} }
}).boxed() }.expect("Only true/false is returned and it's always serializable; qed")).boxed()
} }
fn subscribe(&self, _params: Params, meta: SocketMetadata) -> RpcResult { fn subscribe(&self, _params: Params, meta: SocketMetadata) -> RpcResult {
@ -210,14 +210,14 @@ impl Stratum {
future::ok(match self.dispatcher.initial() { future::ok(match self.dispatcher.initial() {
Some(initial) => match jsonrpc_core::Value::from_str(&initial) { Some(initial) => match jsonrpc_core::Value::from_str(&initial) {
Ok(val) => val, Ok(val) => Ok(val),
Err(e) => { Err(e) => {
warn!(target: "stratum", "Invalid payload: '{}' ({:?})", &initial, e); warn!(target: "stratum", "Invalid payload: '{}' ({:?})", &initial, e);
to_value(&[0u8; 0]) to_value(&[0u8; 0])
}, },
}, },
None => to_value(&[0u8; 0]), None => to_value(&[0u8; 0]),
}).boxed() }.expect("Empty slices are serializable; qed")).boxed()
} }
fn authorize(&self, params: Params, meta: SocketMetadata) -> RpcResult { fn authorize(&self, params: Params, meta: SocketMetadata) -> RpcResult {
@ -231,7 +231,7 @@ impl Stratum {
trace!(target: "stratum", "New worker #{} registered", worker_id); trace!(target: "stratum", "New worker #{} registered", worker_id);
self.workers.write().insert(meta.addr().clone(), worker_id); self.workers.write().insert(meta.addr().clone(), worker_id);
to_value(true) to_value(true)
})).boxed() }).map(|v| v.expect("Only true/false is returned and it's always serializable; qed"))).boxed()
} }
pub fn subscribers(&self) -> RwLockReadGuard<Vec<SocketAddr>> { pub fn subscribers(&self) -> RwLockReadGuard<Vec<SocketAddr>> {

View File

@ -11,7 +11,7 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies] [dependencies]
log = "0.3" log = "0.3"
ethabi = "0.2.2" ethabi = "1.0.0"
target_info = "0.1" target_info = "0.1"
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethsync = { path = "../sync" } ethsync = { path = "../sync" }

View File

@ -106,14 +106,12 @@ extern crate tiny_keccak;
extern crate rlp; extern crate rlp;
extern crate regex; extern crate regex;
extern crate lru_cache; extern crate lru_cache;
extern crate heapsize;
extern crate itertools;
#[macro_use]
extern crate heapsize;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
#[macro_use] #[macro_use]
extern crate itertools;
#[macro_use]
extern crate log as rlog; extern crate log as rlog;
pub extern crate using_queue; pub extern crate using_queue;