Merge branch 'master' into signer-auth

This commit is contained in:
Tomasz Drwięga 2016-06-06 12:12:38 +02:00
commit 1dae61f22f
37 changed files with 383 additions and 376 deletions

167
Cargo.lock generated
View File

@ -3,7 +3,7 @@ name = "parity"
version = "1.2.0"
dependencies = [
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)",
"daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
@ -28,7 +28,7 @@ dependencies = [
"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.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -56,10 +56,10 @@ dependencies = [
[[package]]
name = "aster"
version = "0.16.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"syntex_syntax 0.32.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]]
@ -71,7 +71,7 @@ dependencies = [
"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_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -130,11 +130,26 @@ dependencies = [
[[package]]
name = "clippy"
version = "0.0.69"
version = "0.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"clippy_lints 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.3.1 (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.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clippy_lints"
version = "0.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.3.1 (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.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -223,8 +238,8 @@ dependencies = [
"libc 0.2.10 (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)",
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -241,7 +256,7 @@ name = "ethcore"
version = "1.2.0"
dependencies = [
"bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.2.0",
@ -257,7 +272,7 @@ dependencies = [
"rayon 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -265,11 +280,11 @@ dependencies = [
name = "ethcore-dapps"
version = "1.2.0"
dependencies = [
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-rpc 1.2.0",
"ethcore-util 1.2.0",
"hyper 0.9.3 (git+https://github.com/ethcore/hyper)",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-http-server 5.1.0 (git+https://github.com/ethcore/jsonrpc-http-server.git)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -280,10 +295,10 @@ dependencies = [
"parity-dapps-status 0.5.0 (git+https://github.com/ethcore/parity-dapps-status-rs.git)",
"parity-dapps-wallet 0.5.0 (git+https://github.com/ethcore/parity-dapps-wallet-rs.git)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -308,11 +323,11 @@ dependencies = [
name = "ethcore-ipc-codegen"
version = "1.2.0"
dependencies = [
"aster 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi_codegen 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi_codegen 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 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]]
@ -320,7 +335,7 @@ name = "ethcore-ipc-nano"
version = "1.2.0"
dependencies = [
"ethcore-ipc 1.2.0",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
]
@ -329,7 +344,7 @@ dependencies = [
name = "ethcore-rpc"
version = "1.2.0"
dependencies = [
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.2.0",
"ethcore 1.2.0",
"ethcore-devtools 1.2.0",
@ -337,14 +352,14 @@ dependencies = [
"ethjson 0.1.0",
"ethsync 1.2.0",
"json-ipc-server 0.1.0 (git+https://github.com/ethcore/json-ipc-server.git)",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-http-server 5.1.0 (git+https://github.com/ethcore/jsonrpc-http-server.git?branch=multiple_cors_domains)",
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-http-server 5.1.0 (git+https://github.com/ethcore/jsonrpc-http-server.git)",
"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)",
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -352,11 +367,11 @@ dependencies = [
name = "ethcore-signer"
version = "1.2.0"
dependencies = [
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-rpc 1.2.0",
"ethcore-util 1.2.0",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-minimal-sysui 0.1.0 (git+https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -370,7 +385,7 @@ dependencies = [
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"bigint 0.1.0",
"chrono 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -390,7 +405,7 @@ dependencies = [
"rust-crypto 0.2.35 (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)",
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"sha3 0.1.0",
"slab 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -405,17 +420,17 @@ version = "0.1.0"
dependencies = [
"ethcore-util 1.2.0",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ethsync"
version = "1.2.0"
dependencies = [
"clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.2.0",
"ethcore-util 1.2.0",
@ -563,7 +578,7 @@ version = "0.1.0"
source = "git+https://github.com/ethcore/json-ipc-server.git#4f9226c4f84dcce2385a188374e3b5fc66b63e68"
dependencies = [
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -578,32 +593,22 @@ dependencies = [
[[package]]
name = "jsonrpc-core"
version = "2.0.4"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jsonrpc-http-server"
version = "5.1.0"
source = "git+https://github.com/ethcore/jsonrpc-http-server.git#12f23b0cd85013ca980240b9d0206bf1fc9c909e"
source = "git+https://github.com/ethcore/jsonrpc-http-server.git#77dcac785c02c3a7622d36aa635ee80d63d0b20c"
dependencies = [
"hyper 0.9.3 (git+https://github.com/ethcore/hyper)",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jsonrpc-http-server"
version = "5.1.0"
source = "git+https://github.com/ethcore/jsonrpc-http-server.git?branch=multiple_cors_domains#9c026feeb6573c82c99c8005c5d8244de68a2e30"
dependencies = [
"hyper 0.9.3 (git+https://github.com/ethcore/hyper)",
"jsonrpc-core 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -881,15 +886,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "parity-dapps"
version = "0.3.0"
source = "git+https://github.com/ethcore/parity-dapps-rs.git#01ff8c2a3e61ea436f0d47acbbb8ac4bea4cd234"
source = "git+https://github.com/ethcore/parity-dapps-rs.git#1f065d93aa49338e4a453c77c839957f2db78895"
dependencies = [
"aster 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi_codegen 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi_codegen 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 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]]
@ -1014,20 +1019,20 @@ dependencies = [
[[package]]
name = "quasi"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"syntex_syntax 0.32.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 = "quasi_codegen"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aster 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 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]]
@ -1164,28 +1169,28 @@ dependencies = [
[[package]]
name = "serde"
version = "0.7.0"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_codegen"
version = "0.7.4"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aster 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi_codegen 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quasi_codegen 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex 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 = "serde_json"
version = "0.7.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.0 (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.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1234,15 +1239,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syntex"
version = "0.32.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"syntex_syntax 0.32.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_syntax"
version = "0.32.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -9,7 +9,7 @@ build = "build.rs"
[build-dependencies]
rustc_version = "0.1"
syntex = "*"
"ethcore-ipc-codegen" = { path = "ipc/codegen" }
ethcore-ipc-codegen = { path = "ipc/codegen" }
[dependencies]
log = "0.3"
@ -23,7 +23,7 @@ daemonize = "0.2"
num_cpus = "0.2"
number_prefix = "0.2"
rpassword = "0.2.1"
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
ethcore = { path = "ethcore" }
ethcore-util = { path = "util" }
ethsync = { path = "sync" }

View File

@ -28,11 +28,11 @@ parity-dapps-wallet = { git = "https://github.com/ethcore/parity-dapps-wallet-rs
parity-dapps-dao = { git = "https://github.com/ethcore/parity-dapps-dao-rs.git", version = "0.3.0", optional = true }
parity-dapps-makerotc = { git = "https://github.com/ethcore/parity-dapps-makerotc-rs.git", version = "0.2.0", optional = true }
mime_guess = { version = "1.6.1" }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
[build-dependencies]
serde_codegen = { version = "0.7.0", optional = true }
syntex = "0.32.0"
syntex = "*"
[features]
default = ["serde_codegen", "extra-dapps"]

View File

@ -23,14 +23,14 @@ pub fn rpc(handler: Arc<IoHandler>, panic_handler: Arc<Mutex<Option<Box<Fn() ->
Box::new(RpcEndpoint {
handler: handler,
panic_handler: panic_handler,
cors_domain: Some(AccessControlAllowOrigin::Null)
cors_domain: vec![AccessControlAllowOrigin::Null],
})
}
struct RpcEndpoint {
handler: Arc<IoHandler>,
panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>,
cors_domain: Option<AccessControlAllowOrigin>,
cors_domain: Vec<AccessControlAllowOrigin>,
}
impl Endpoint for RpcEndpoint {

View File

@ -8,7 +8,7 @@ authors = ["Ethcore <admin@ethcore.io>"]
build = "build.rs"
[build-dependencies]
syntex = "0.32"
syntex = "*"
ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies]

View File

@ -22,7 +22,7 @@ ethcore-util = { path = "../util" }
evmjit = { path = "../evmjit", optional = true }
ethash = { path = "../ethash" }
num_cpus = "0.2"
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
crossbeam = "0.2.9"
lazy_static = "0.1"
ethcore-devtools = { path = "../devtools" }

View File

@ -371,9 +371,27 @@ impl<V> Client<V> where V: Verifier {
return Some(self.state())
}
self.block_header(id).map(|header| {
let block_number = match self.block_number(id.clone()) {
Some(num) => num,
None => return None,
};
self.block_header(id).and_then(|header| {
let db = self.state_db.lock().unwrap().boxed_clone();
State::from_existing(db, HeaderView::new(&header).state_root(), self.engine.account_start_nonce())
// early exit for pruned blocks
if db.is_pruned() && self.chain.best_block_number() >= block_number + HISTORY {
return None;
}
let root = HeaderView::new(&header).state_root();
// TODO [rob]: refactor State::from_existing so we avoid doing redundant lookups.
if !db.contains(&root) {
return None;
}
Some(State::from_existing(db, root, self.engine.account_start_nonce()))
})
}

View File

@ -17,7 +17,6 @@
///! Rust VM implementation
use common::*;
use trace::VMTracer;
use super::instructions as instructions;
use super::instructions::{Instruction, get_info};
use std::marker::Copy;

View File

@ -81,14 +81,14 @@ impl<'a> Executive<'a> {
}
/// Creates `Externalities` from `Executive`.
pub fn as_externalities<'_, T, V>(
&'_ mut self,
pub fn as_externalities<'any, T, V>(
&'any mut self,
origin_info: OriginInfo,
substate: &'_ mut Substate,
output: OutputPolicy<'_, '_>,
tracer: &'_ mut T,
vm_tracer: &'_ mut V
) -> Externalities<'_, T, V> where T: Tracer, V: VMTracer {
substate: &'any mut Substate,
output: OutputPolicy<'any, 'any>,
tracer: &'any mut T,
vm_tracer: &'any mut V
) -> Externalities<'any, T, V> where T: Tracer, V: VMTracer {
Externalities::new(self.state, self.info, self.engine, self.vm_factory, self.depth, origin_info, substate, output, tracer, vm_tracer)
}

View File

@ -85,7 +85,8 @@ declare_test!{BlockchainTests_bcForkStressTest, "BlockchainTests/bcForkStressTes
declare_test!{BlockchainTests_bcForkUncle, "BlockchainTests/bcForkUncle"}
declare_test!{BlockchainTests_bcGasPricerTest, "BlockchainTests/bcGasPricerTest"}
declare_test!{BlockchainTests_bcInvalidHeaderTest, "BlockchainTests/bcInvalidHeaderTest"}
declare_test!{BlockchainTests_bcInvalidRLPTest, "BlockchainTests/bcInvalidRLPTest"}
// TODO [ToDr] Ignored because of incorrect JSON (https://github.com/ethereum/tests/pull/113)
declare_test!{ignore => BlockchainTests_bcInvalidRLPTest, "BlockchainTests/bcInvalidRLPTest"}
declare_test!{BlockchainTests_bcMultiChainTest, "BlockchainTests/bcMultiChainTest"}
declare_test!{BlockchainTests_bcRPC_API_Test, "BlockchainTests/bcRPC_API_Test"}
declare_test!{BlockchainTests_bcStateTest, "BlockchainTests/bcStateTest"}

View File

@ -26,7 +26,8 @@ declare_test!{BlockchainTests_Homestead_bcBlockGasLimitTest, "BlockchainTests/Ho
declare_test!{BlockchainTests_Homestead_bcForkStressTest, "BlockchainTests/Homestead/bcForkStressTest"}
declare_test!{BlockchainTests_Homestead_bcGasPricerTest, "BlockchainTests/Homestead/bcGasPricerTest"}
declare_test!{BlockchainTests_Homestead_bcInvalidHeaderTest, "BlockchainTests/Homestead/bcInvalidHeaderTest"}
declare_test!{BlockchainTests_Homestead_bcInvalidRLPTest, "BlockchainTests/Homestead/bcInvalidRLPTest"}
// TODO [ToDr] Ignored because of incorrect JSON (https://github.com/ethereum/tests/pull/113)
declare_test!{ignore => BlockchainTests_Homestead_bcInvalidRLPTest, "BlockchainTests/Homestead/bcInvalidRLPTest"}
declare_test!{BlockchainTests_Homestead_bcMultiChainTest, "BlockchainTests/Homestead/bcMultiChainTest"}
declare_test!{BlockchainTests_Homestead_bcRPC_API_Test, "BlockchainTests/Homestead/bcRPC_API_Test"}
declare_test!{BlockchainTests_Homestead_bcStateTest, "BlockchainTests/Homestead/bcStateTest"}

View File

@ -117,7 +117,7 @@ impl VMTracer for ExecutiveVMTracer {
self.data.operations.push(VMOperation {
pc: pc,
instruction: instruction,
gas_cost: gas_cost.clone(),
gas_cost: gas_cost.clone(),
executed: None,
});
true
@ -133,10 +133,10 @@ impl VMTracer for ExecutiveVMTracer {
self.data.operations.last_mut().expect("trace_executed is always called after a trace_prepare_execute").executed = Some(ex);
}
fn prepare_subtrace(&self, code: &Bytes) -> Self {
fn prepare_subtrace(&self, code: &[u8]) -> Self {
ExecutiveVMTracer { data: VMTrace {
parent_step: self.data.operations.len(),
code: code.clone(),
code: code.to_vec(),
operations: vec![],
subs: vec![],
}}

View File

@ -98,7 +98,7 @@ pub trait VMTracer: Send {
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}
/// Spawn subtracer which will be used to trace deeper levels of execution.
fn prepare_subtrace(&self, code: &Bytes) -> Self where Self: Sized;
fn prepare_subtrace(&self, code: &[u8]) -> Self where Self: Sized;
/// Spawn subtracer which will be used to trace deeper levels of execution.
fn done_subtrace(&mut self, sub: Self) where Self: Sized;

View File

@ -75,7 +75,7 @@ impl VMTracer for NoopVMTracer {
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}
/// Spawn subtracer which will be used to trace deeper levels of execution.
fn prepare_subtrace(&self, _code: &Bytes) -> Self { NoopVMTracer }
fn prepare_subtrace(&self, _code: &[u8]) -> Self { NoopVMTracer }
/// Spawn subtracer which will be used to trace deeper levels of execution.
fn done_subtrace(&mut self, _sub: Self) {}

View File

@ -14,13 +14,13 @@ nightly-testing = ["clippy"]
with-syntex = ["quasi/with-syntex", "quasi_codegen", "quasi_codegen/with-syntex", "syntex", "syntex_syntax"]
[build-dependencies]
quasi_codegen = { version = "0.10", optional = true }
syntex = { version = "^0.31", optional = true }
quasi_codegen = { version = "0.11", optional = true }
syntex = { version = "*", optional = true }
[dependencies]
aster = { version = "0.16", default-features = false }
aster = { version = "0.17", default-features = false }
clippy = { version = "^0.*", optional = true }
quasi = { version = "0.10", default-features = false }
quasi_macros = { version = "0.10", optional = true }
syntex = { version = "0.32", optional = true }
syntex_syntax = { version = "0.32", optional = true }
quasi = { version = "0.11", default-features = false }
quasi_macros = { version = "0.11", optional = true }
syntex = { version = "*", optional = true }
syntex_syntax = { version = "*", optional = true }

View File

@ -8,7 +8,7 @@ license = "GPL-3.0"
[dependencies]
jsonrpc-core = "2.0"
"ethcore-ipc" = { path = "../rpc" }
ethcore-ipc = { path = "../rpc" }
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
log = "0.3"

View File

@ -8,7 +8,7 @@ build = "build.rs"
path = "run.rs"
[dependencies]
"ethcore-ipc" = { path = "../rpc" }
ethcore-ipc = { path = "../rpc" }
ethcore-devtools = { path = "../../devtools" }
semver = "0.2.0"
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
@ -17,4 +17,4 @@ ethcore-util = { path = "../../util" }
[build-dependencies]
syntex = "*"
"ethcore-ipc-codegen" = { path = "../codegen" }
ethcore-ipc-codegen = { path = "../codegen" }

View File

@ -10,11 +10,11 @@ rustc-serialize = "0.3"
serde = "0.7.0"
serde_json = "0.7.0"
serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
[build-dependencies]
serde_codegen = { version = "0.7.0", optional = true }
syntex = "0.32.0"
syntex = "*"
[features]
default = ["serde_codegen"]

View File

@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::sync::{RwLock,Arc};
use std::ops::*;
use ipc::IpcConfig;
use std::collections::HashMap;
use std::mem;

View File

@ -153,10 +153,10 @@ pub fn setup_rpc<T: Extendable>(server: T, deps: Arc<Dependencies>, apis: ApiSet
}
},
Api::Ethcore => {
server.add_delegate(EthcoreClient::new(&deps.client, &deps.miner, deps.logger.clone(), deps.settings.clone()).to_delegate())
server.add_delegate(EthcoreClient::new(&deps.miner, deps.logger.clone(), deps.settings.clone()).to_delegate())
},
Api::Traces => {
server.add_delegate(TracesClient::new(&deps.client).to_delegate())
server.add_delegate(TracesClient::new(&deps.client, &deps.miner).to_delegate())
},
Api::Rpc => {
let modules = to_modules(&apis);

View File

@ -13,7 +13,7 @@ log = "0.3"
serde = "0.7.0"
serde_json = "0.7.0"
jsonrpc-core = "2.0"
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc-http-server.git", branch = "multiple_cors_domains" }
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc-http-server.git" }
ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" }
ethash = { path = "../ethash" }
@ -23,12 +23,12 @@ ethcore-devtools = { path = "../devtools" }
rustc-serialize = "0.3"
transient-hashmap = "0.1"
serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
[build-dependencies]
serde_codegen = { version = "0.7.0", optional = true }
syntex = "^0.32.0"
syntex = "*"
[features]
default = ["serde_codegen"]

View File

@ -15,151 +15,39 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Ethcore-specific rpc implementation.
use util::{U256, Address, RotatingLogger, FixedHash, Uint};
use util::{U256, Address, RotatingLogger, FixedHash};
use util::network_settings::NetworkSettings;
use util::misc::version_data;
use std::sync::{Arc, Weak};
use std::ops::Deref;
use std::collections::BTreeMap;
use jsonrpc_core::*;
use serde;
use ethcore::miner::MinerService;
use ethcore::state_diff::StateDiff;
use ethcore::account_diff::{Diff, Existance};
use ethcore::transaction::{Transaction as EthTransaction, SignedTransaction, Action};
use ethcore::client::{BlockChainClient, CallAnalytics};
use ethcore::trace::VMTrace;
use ethcore::client::{BlockChainClient};
use v1::traits::Ethcore;
use v1::types::{Bytes, CallRequest};
use v1::types::{Bytes};
/// Ethcore implementation.
pub struct EthcoreClient<C, M> where
C: BlockChainClient,
pub struct EthcoreClient<M> where
M: MinerService {
client: Weak<C>,
miner: Weak<M>,
logger: Arc<RotatingLogger>,
settings: Arc<NetworkSettings>,
}
impl<C, M> EthcoreClient<C, M> where C: BlockChainClient, M: MinerService {
impl<M> EthcoreClient<M> where M: MinerService {
/// Creates new `EthcoreClient`.
pub fn new(client: &Arc<C>, miner: &Arc<M>, logger: Arc<RotatingLogger>, settings: Arc<NetworkSettings>) -> Self {
pub fn new(miner: &Arc<M>, logger: Arc<RotatingLogger>, settings: Arc<NetworkSettings>) -> Self {
EthcoreClient {
client: Arc::downgrade(client),
miner: Arc::downgrade(miner),
logger: logger,
settings: settings,
}
}
// TODO: share with eth.rs
fn sign_call(&self, request: CallRequest) -> Result<SignedTransaction, Error> {
let client = take_weak!(self.client);
let miner = take_weak!(self.miner);
let from = request.from.unwrap_or(Address::zero());
Ok(EthTransaction {
nonce: request.nonce.unwrap_or_else(|| client.latest_nonce(&from)),
action: request.to.map_or(Action::Create, Action::Call),
gas: request.gas.unwrap_or(U256::from(50_000_000)),
gas_price: request.gas_price.unwrap_or_else(|| miner.sensible_gas_price()),
value: request.value.unwrap_or_else(U256::zero),
data: request.data.map_or_else(Vec::new, |d| d.to_vec())
}.fake_sign(from))
}
}
fn vm_trace_to_object(t: &VMTrace) -> Value {
let mut ret = BTreeMap::new();
ret.insert("code".to_owned(), to_value(&t.code).unwrap());
let mut subs = t.subs.iter();
let mut next_sub = subs.next();
let ops = t.operations
.iter()
.enumerate()
.map(|(i, op)| {
let mut m = map![
"pc".to_owned() => to_value(&op.pc).unwrap(),
"cost".to_owned() => match op.gas_cost <= U256::from(!0u64) {
true => to_value(&op.gas_cost.low_u64()),
false => to_value(&op.gas_cost),
}.unwrap()
];
if let Some(ref ex) = op.executed {
let mut em = map![
"used".to_owned() => to_value(&ex.gas_used.low_u64()).unwrap(),
"push".to_owned() => to_value(&ex.stack_push).unwrap()
];
if let Some(ref md) = ex.mem_diff {
em.insert("mem".to_owned(), Value::Object(map![
"off".to_owned() => to_value(&md.offset).unwrap(),
"data".to_owned() => to_value(&md.data).unwrap()
]));
}
if let Some(ref sd) = ex.store_diff {
em.insert("store".to_owned(), Value::Object(map![
"key".to_owned() => to_value(&sd.location).unwrap(),
"val".to_owned() => to_value(&sd.value).unwrap()
]));
}
m.insert("ex".to_owned(), Value::Object(em));
}
if next_sub.is_some() && next_sub.unwrap().parent_step == i {
m.insert("sub".to_owned(), vm_trace_to_object(next_sub.unwrap()));
next_sub = subs.next();
}
Value::Object(m)
})
.collect::<Vec<_>>();
ret.insert("ops".to_owned(), Value::Array(ops));
Value::Object(ret)
}
fn diff_to_object<T>(d: &Diff<T>) -> Value where T: serde::Serialize + Eq {
let mut ret = BTreeMap::new();
match *d {
Diff::Same => {
ret.insert("diff".to_owned(), Value::String("=".to_owned()));
}
Diff::Born(ref x) => {
ret.insert("diff".to_owned(), Value::String("+".to_owned()));
ret.insert("+".to_owned(), to_value(x).unwrap());
}
Diff::Died(ref x) => {
ret.insert("diff".to_owned(), Value::String("-".to_owned()));
ret.insert("-".to_owned(), to_value(x).unwrap());
}
Diff::Changed(ref from, ref to) => {
ret.insert("diff".to_owned(), Value::String("*".to_owned()));
ret.insert("-".to_owned(), to_value(from).unwrap());
ret.insert("+".to_owned(), to_value(to).unwrap());
}
};
Value::Object(ret)
}
fn state_diff_to_object(t: &StateDiff) -> Value {
Value::Object(t.iter().map(|(address, account)| {
(address.hex(), Value::Object(map![
"existance".to_owned() => Value::String(match account.existance() {
Existance::Born => "+",
Existance::Alive => ".",
Existance::Died => "-",
}.to_owned()),
"balance".to_owned() => diff_to_object(&account.balance),
"nonce".to_owned() => diff_to_object(&account.nonce),
"code".to_owned() => diff_to_object(&account.code),
"storage".to_owned() => Value::Object(account.storage.iter().map(|(key, val)| {
(key.hex(), diff_to_object(&val))
}).collect::<BTreeMap<_, _>>())
]))
}).collect::<BTreeMap<_, _>>())
}
impl<C, M> Ethcore for EthcoreClient<C, M> where C: BlockChainClient + 'static, M: MinerService + 'static {
impl<M> Ethcore for EthcoreClient<M> where M: MinerService + 'static {
fn set_min_gas_price(&self, params: Params) -> Result<Value, Error> {
from_params::<(U256,)>(params).and_then(|(gas_price,)| {
@ -249,34 +137,4 @@ impl<C, M> Ethcore for EthcoreClient<C, M> where C: BlockChainClient + 'static,
let version = version_data();
to_value(&Bytes::new(version))
}
fn vm_trace_call(&self, params: Params) -> Result<Value, Error> {
trace!(target: "jsonrpc", "vm_trace_call: {:?}", params);
from_params(params)
.and_then(|(request,)| {
let signed = try!(self.sign_call(request));
let r = take_weak!(self.client).call(&signed, CallAnalytics{ vm_tracing: true, state_diffing: false });
if let Ok(executed) = r {
if let Some(vm_trace) = executed.vm_trace {
return Ok(vm_trace_to_object(&vm_trace));
}
}
Ok(Value::Null)
})
}
fn state_diff_call(&self, params: Params) -> Result<Value, Error> {
trace!(target: "jsonrpc", "state_diff_call: {:?}", params);
from_params(params)
.and_then(|(request,)| {
let signed = try!(self.sign_call(request));
let r = take_weak!(self.client).call(&signed, CallAnalytics{ vm_tracing: false, state_diffing: true });
if let Ok(executed) = r {
if let Some(state_diff) = executed.state_diff {
return Ok(state_diff_to_object(&state_diff));
}
}
Ok(Value::Null)
})
}
}

View File

@ -18,26 +18,139 @@
use std::sync::{Weak, Arc};
use jsonrpc_core::*;
use util::H256;
use ethcore::client::{BlockChainClient, TransactionID, TraceId};
use std::collections::BTreeMap;
use util::{H256, U256, FixedHash, Uint};
use serde;
use ethcore::client::{BlockChainClient, CallAnalytics, TransactionID, TraceId};
use ethcore::trace::VMTrace;
use ethcore::miner::MinerService;
use ethcore::state_diff::StateDiff;
use ethcore::account_diff::{Diff, Existance};
use ethcore::transaction::{Transaction as EthTransaction, SignedTransaction, Action};
use v1::traits::Traces;
use v1::types::{TraceFilter, Trace, BlockNumber, Index};
use v1::types::{TraceFilter, Trace, BlockNumber, Index, CallRequest};
/// Traces api implementation.
pub struct TracesClient<C> where C: BlockChainClient {
pub struct TracesClient<C, M> where C: BlockChainClient, M: MinerService {
client: Weak<C>,
miner: Weak<M>,
}
impl<C> TracesClient<C> where C: BlockChainClient {
impl<C, M> TracesClient<C, M> where C: BlockChainClient, M: MinerService {
/// Creates new Traces client.
pub fn new(client: &Arc<C>) -> Self {
pub fn new(client: &Arc<C>, miner: &Arc<M>) -> Self {
TracesClient {
client: Arc::downgrade(client),
miner: Arc::downgrade(miner),
}
}
// TODO: share with eth.rs
fn sign_call(&self, request: CallRequest) -> Result<SignedTransaction, Error> {
let client = take_weak!(self.client);
let miner = take_weak!(self.miner);
let from = request.from.unwrap_or(0.into());
Ok(EthTransaction {
nonce: request.nonce.unwrap_or_else(|| client.latest_nonce(&from)),
action: request.to.map_or(Action::Create, Action::Call),
gas: request.gas.unwrap_or(50_000_000.into()),
gas_price: request.gas_price.unwrap_or_else(|| miner.sensible_gas_price()),
value: request.value.unwrap_or(0.into()),
data: request.data.map_or_else(Vec::new, |d| d.to_vec())
}.fake_sign(from))
}
}
impl<C> Traces for TracesClient<C> where C: BlockChainClient + 'static {
fn vm_trace_to_object(t: &VMTrace) -> Value {
let mut ret = BTreeMap::new();
ret.insert("code".to_owned(), to_value(&t.code).unwrap());
let mut subs = t.subs.iter();
let mut next_sub = subs.next();
let ops = t.operations
.iter()
.enumerate()
.map(|(i, op)| {
let mut m = map![
"pc".to_owned() => to_value(&op.pc).unwrap(),
"cost".to_owned() => match op.gas_cost <= U256::from(!0u64) {
true => to_value(&op.gas_cost.low_u64()),
false => to_value(&op.gas_cost),
}.unwrap()
];
if let Some(ref ex) = op.executed {
let mut em = map![
"used".to_owned() => to_value(&ex.gas_used.low_u64()).unwrap(),
"push".to_owned() => to_value(&ex.stack_push).unwrap()
];
if let Some(ref md) = ex.mem_diff {
em.insert("mem".to_owned(), Value::Object(map![
"off".to_owned() => to_value(&md.offset).unwrap(),
"data".to_owned() => to_value(&md.data).unwrap()
]));
}
if let Some(ref sd) = ex.store_diff {
em.insert("store".to_owned(), Value::Object(map![
"key".to_owned() => to_value(&sd.location).unwrap(),
"val".to_owned() => to_value(&sd.value).unwrap()
]));
}
m.insert("ex".to_owned(), Value::Object(em));
}
if next_sub.is_some() && next_sub.unwrap().parent_step == i {
m.insert("sub".to_owned(), vm_trace_to_object(next_sub.unwrap()));
next_sub = subs.next();
}
Value::Object(m)
})
.collect::<Vec<_>>();
ret.insert("ops".to_owned(), Value::Array(ops));
Value::Object(ret)
}
fn diff_to_object<T>(d: &Diff<T>) -> Value where T: serde::Serialize + Eq {
let mut ret = BTreeMap::new();
match *d {
Diff::Same => {
ret.insert("diff".to_owned(), Value::String("=".to_owned()));
}
Diff::Born(ref x) => {
ret.insert("diff".to_owned(), Value::String("+".to_owned()));
ret.insert("+".to_owned(), to_value(x).unwrap());
}
Diff::Died(ref x) => {
ret.insert("diff".to_owned(), Value::String("-".to_owned()));
ret.insert("-".to_owned(), to_value(x).unwrap());
}
Diff::Changed(ref from, ref to) => {
ret.insert("diff".to_owned(), Value::String("*".to_owned()));
ret.insert("-".to_owned(), to_value(from).unwrap());
ret.insert("+".to_owned(), to_value(to).unwrap());
}
};
Value::Object(ret)
}
fn state_diff_to_object(t: &StateDiff) -> Value {
Value::Object(t.iter().map(|(address, account)| {
(address.hex(), Value::Object(map![
"existance".to_owned() => Value::String(match account.existance() {
Existance::Born => "+",
Existance::Alive => ".",
Existance::Died => "-",
}.to_owned()),
"balance".to_owned() => diff_to_object(&account.balance),
"nonce".to_owned() => diff_to_object(&account.nonce),
"code".to_owned() => diff_to_object(&account.code),
"storage".to_owned() => Value::Object(account.storage.iter().map(|(key, val)| {
(key.hex(), diff_to_object(&val))
}).collect::<BTreeMap<_, _>>())
]))
}).collect::<BTreeMap<_, _>>())
}
impl<C, M> Traces for TracesClient<C, M> where C: BlockChainClient + 'static, M: MinerService + 'static {
fn filter(&self, params: Params) -> Result<Value, Error> {
from_params::<(TraceFilter,)>(params)
.and_then(|(filter, )| {
@ -81,4 +194,34 @@ impl<C> Traces for TracesClient<C> where C: BlockChainClient + 'static {
to_value(&trace)
})
}
fn vm_trace_call(&self, params: Params) -> Result<Value, Error> {
trace!(target: "jsonrpc", "vm_trace_call: {:?}", params);
from_params(params)
.and_then(|(request,)| {
let signed = try!(self.sign_call(request));
let r = take_weak!(self.client).call(&signed, CallAnalytics{ vm_tracing: true, state_diffing: false });
if let Ok(executed) = r {
if let Some(vm_trace) = executed.vm_trace {
return Ok(vm_trace_to_object(&vm_trace));
}
}
Ok(Value::Null)
})
}
fn state_diff_call(&self, params: Params) -> Result<Value, Error> {
trace!(target: "jsonrpc", "state_diff_call: {:?}", params);
from_params(params)
.and_then(|(request,)| {
let signed = try!(self.sign_call(request));
let r = take_weak!(self.client).call(&signed, CallAnalytics{ vm_tracing: false, state_diffing: true });
if let Ok(executed) = r {
if let Some(state_diff) = executed.state_diff {
return Ok(state_diff_to_object(&state_diff));
}
}
Ok(Value::Null)
})
}
}

View File

@ -18,7 +18,6 @@ use std::sync::Arc;
use std::str::FromStr;
use jsonrpc_core::IoHandler;
use v1::{Ethcore, EthcoreClient};
use ethcore::client::{TestBlockChainClient};
use ethcore::miner::MinerService;
use v1::tests::helpers::TestMinerService;
use util::numbers::*;
@ -26,11 +25,6 @@ use rustc_serialize::hex::FromHex;
use util::log::RotatingLogger;
use util::network_settings::NetworkSettings;
fn blockchain_client() -> Arc<TestBlockChainClient> {
let client = TestBlockChainClient::new();
Arc::new(client)
}
fn miner_service() -> Arc<TestMinerService> {
Arc::new(TestMinerService::default())
}
@ -51,15 +45,14 @@ fn settings() -> Arc<NetworkSettings> {
})
}
fn ethcore_client(client: &Arc<TestBlockChainClient>, miner: &Arc<TestMinerService>) -> EthcoreClient<TestBlockChainClient, TestMinerService> {
EthcoreClient::new(&client, &miner, logger(), settings())
fn ethcore_client(miner: &Arc<TestMinerService>) -> EthcoreClient<TestMinerService> {
EthcoreClient::new(&miner, logger(), settings())
}
#[test]
fn rpc_ethcore_extra_data() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -75,8 +68,7 @@ fn rpc_ethcore_default_extra_data() {
use util::ToPretty;
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -89,8 +81,7 @@ fn rpc_ethcore_default_extra_data() {
#[test]
fn rpc_ethcore_gas_floor_target() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -103,8 +94,7 @@ fn rpc_ethcore_gas_floor_target() {
#[test]
fn rpc_ethcore_min_gas_price() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -117,8 +107,7 @@ fn rpc_ethcore_min_gas_price() {
#[test]
fn rpc_ethcore_set_min_gas_price() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -132,8 +121,7 @@ fn rpc_ethcore_set_min_gas_price() {
#[test]
fn rpc_ethcore_set_gas_floor_target() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -147,8 +135,7 @@ fn rpc_ethcore_set_gas_floor_target() {
#[test]
fn rpc_ethcore_set_extra_data() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -162,8 +149,7 @@ fn rpc_ethcore_set_extra_data() {
#[test]
fn rpc_ethcore_set_author() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -177,11 +163,10 @@ fn rpc_ethcore_set_author() {
#[test]
fn rpc_ethcore_dev_logs() {
let miner = miner_service();
let client = blockchain_client();
let logger = logger();
logger.append("a".to_owned());
logger.append("b".to_owned());
let ethcore = EthcoreClient::new(&client, &miner, logger.clone(), settings()).to_delegate();
let ethcore = EthcoreClient::new(&miner, logger.clone(), settings()).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -194,8 +179,7 @@ fn rpc_ethcore_dev_logs() {
#[test]
fn rpc_ethcore_dev_logs_levels() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -207,8 +191,7 @@ fn rpc_ethcore_dev_logs_levels() {
#[test]
fn rpc_ethcore_set_transactions_limit() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -222,8 +205,7 @@ fn rpc_ethcore_set_transactions_limit() {
#[test]
fn rpc_ethcore_transactions_limit() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -236,8 +218,7 @@ fn rpc_ethcore_transactions_limit() {
#[test]
fn rpc_ethcore_net_chain() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -250,8 +231,7 @@ fn rpc_ethcore_net_chain() {
#[test]
fn rpc_ethcore_net_max_peers() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -264,8 +244,7 @@ fn rpc_ethcore_net_max_peers() {
#[test]
fn rpc_ethcore_net_port() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -278,8 +257,7 @@ fn rpc_ethcore_net_port() {
#[test]
fn rpc_ethcore_rpc_settings() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);
@ -292,8 +270,7 @@ fn rpc_ethcore_rpc_settings() {
#[test]
fn rpc_ethcore_node_name() {
let miner = miner_service();
let client = blockchain_client();
let ethcore = ethcore_client(&client, &miner).to_delegate();
let ethcore = ethcore_client(&miner).to_delegate();
let io = IoHandler::new();
io.add_delegate(ethcore);

View File

@ -72,12 +72,6 @@ pub trait Ethcore: Sized + Send + Sync + 'static {
/// Returns default extra data
fn default_extra_data(&self, _: Params) -> Result<Value, Error>;
/// Executes the given call and returns the VM trace for it.
fn vm_trace_call(&self, _: Params) -> Result<Value, Error>;
/// Executes the given call and returns the diff for it.
fn state_diff_call(&self, params: Params) -> Result<Value, Error>;
/// Should be used to convert object to io delegate.
fn to_delegate(self) -> IoDelegate<Self> {
let mut delegate = IoDelegate::new(Arc::new(self));
@ -100,9 +94,6 @@ pub trait Ethcore: Sized + Send + Sync + 'static {
delegate.add_method("ethcore_nodeName", Ethcore::node_name);
delegate.add_method("ethcore_defaultExtraData", Ethcore::default_extra_data);
delegate.add_method("ethcore_vmTraceCall", Ethcore::vm_trace_call);
delegate.add_method("ethcore_stateDiffCall", Ethcore::state_diff_call);
delegate
}
}

View File

@ -32,6 +32,12 @@ pub trait Traces: Sized + Send + Sync + 'static {
/// Returns all traces produced at given block.
fn block_traces(&self, _: Params) -> Result<Value, Error>;
/// Executes the given call and returns the VM trace for it.
fn vm_trace_call(&self, _: Params) -> Result<Value, Error>;
/// Executes the given call and returns the diff for it.
fn state_diff_call(&self, params: Params) -> Result<Value, Error>;
/// Should be used to convert object to io delegate.
fn to_delegate(self) -> IoDelegate<Self> {
let mut delegate = IoDelegate::new(Arc::new(self));
@ -39,6 +45,10 @@ pub trait Traces: Sized + Send + Sync + 'static {
delegate.add_method("trace_get", Traces::trace);
delegate.add_method("trace_transaction", Traces::transaction_traces);
delegate.add_method("trace_block", Traces::block_traces);
delegate.add_method("trace_vmTraceCall", Traces::vm_trace_call);
delegate.add_method("trace_stateDiffCall", Traces::state_diff_call);
delegate
}
}

View File

@ -19,7 +19,7 @@ ethcore-util = { path = "../util" }
ethcore-rpc = { path = "../rpc" }
parity-minimal-sysui = { git = "https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git" }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
[features]
dev = ["clippy"]

View File

@ -10,7 +10,7 @@ authors = ["Ethcore <admin@ethcore.io"]
[dependencies]
ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
log = "0.3"
env_logger = "0.3"
time = "0.1.34"

View File

@ -918,7 +918,7 @@ impl ChainSync {
let skip: usize = try!(r.val_at(2));
let reverse: bool = try!(r.val_at(3));
let last = io.chain().chain_info().best_block_number;
let mut number = if try!(r.at(0)).size() == 32 {
let number = if try!(r.at(0)).size() == 32 {
// id is a hash
let hash: H256 = try!(r.val_at(0));
trace!(target: "sync", "-> GetBlockHeaders (hash: {}, max: {}, skip: {}, reverse:{})", hash, max_headers, skip, reverse);
@ -931,11 +931,11 @@ impl ChainSync {
try!(r.val_at(0))
};
if reverse {
number = min(last, number);
let mut number = if reverse {
min(last, number)
} else {
number = max(0, number);
}
max(0, number)
};
let max_count = min(MAX_HEADERS_TO_SEND, max_headers);
let mut count = 0;
let mut data = Bytes::new();
@ -1188,11 +1188,12 @@ impl ChainSync {
let mut sent = 0;
let last_parent = HeaderView::new(&io.chain().block_header(BlockID::Hash(chain_info.best_block_hash.clone())).unwrap()).parent_hash();
for (peer_id, peer_number) in lucky_peers {
let mut peer_best = self.peers.get(&peer_id).unwrap().latest_hash.clone();
if chain_info.best_block_number - peer_number > MAX_PEER_LAG_PROPAGATION as BlockNumber {
let peer_best = if chain_info.best_block_number - peer_number > MAX_PEER_LAG_PROPAGATION as BlockNumber {
// If we think peer is too far behind just send one latest hash
peer_best = last_parent.clone();
}
last_parent.clone()
} else {
self.peers.get(&peer_id).unwrap().latest_hash.clone()
};
sent += match ChainSync::create_new_hashes_rlp(io.chain(), &peer_best, &chain_info.best_block_hash) {
Some(rlp) => {
{

View File

@ -162,6 +162,7 @@ impl NetworkProtocolHandler<SyncMessage> for EthSync {
self.sync.write().unwrap().maintain_sync(&mut NetSyncIo::new(io, self.chain.deref()));
}
#[cfg_attr(feature="dev", allow(single_match))]
fn message(&self, io: &NetworkContext<SyncMessage>, message: &SyncMessage) {
match *message {
SyncMessage::NewChainBlocks { ref imported, ref invalid, ref enacted, ref retracted } => {

View File

@ -28,7 +28,7 @@ crossbeam = "0.2"
slab = "0.2"
sha3 = { path = "sha3" }
serde = "0.7.0"
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
json-tests = { path = "json-tests" }
igd = "0.4.2"
ethcore-devtools = { path = "../devtools" }

View File

@ -501,8 +501,8 @@ macro_rules! impl_hash {
}
}
impl<'_> From<&'_ str> for $from {
fn from(s: &'_ str) -> $from {
impl<'a> From<&'a str> for $from {
fn from(s: &'a str) -> $from {
use std::str::FromStr;
if s.len() % 2 == 1 {
$from::from_str(&("0".to_owned() + &(clean_0x(s).to_owned()))[..]).unwrap_or_else(|_| $from::new())
@ -524,8 +524,8 @@ impl From<U256> for H256 {
}
}
impl<'_> From<&'_ U256> for H256 {
fn from(value: &'_ U256) -> H256 {
impl<'a> From<&'a U256> for H256 {
fn from(value: &'a U256) -> H256 {
unsafe {
let mut ret: H256 = ::std::mem::uninitialized();
value.to_raw_bytes(&mut ret);
@ -540,8 +540,8 @@ impl From<H256> for U256 {
}
}
impl<'_> From<&'_ H256> for U256 {
fn from(value: &'_ H256) -> U256 {
impl<'a> From<&'a H256> for U256 {
fn from(value: &'a H256) -> U256 {
U256::from(value.bytes())
}
}
@ -566,8 +566,8 @@ impl From<H256> for H64 {
}
}
/*
impl<'_> From<&'_ H256> for Address {
fn from(value: &'_ H256) -> Address {
impl<'a> From<&'a H256> for Address {
fn from(value: &'a H256) -> Address {
unsafe {
let mut ret: Address = ::std::mem::uninitialized();
::std::ptr::copy(value.as_ptr().offset(12), ret.as_mut_ptr(), 20);
@ -586,8 +586,8 @@ impl From<Address> for H256 {
}
}
impl<'_> From<&'_ Address> for H256 {
fn from(value: &'_ Address) -> H256 {
impl<'a> From<&'a Address> for H256 {
fn from(value: &'a Address) -> H256 {
unsafe {
let mut ret = H256::new();
::std::ptr::copy(value.as_ptr(), ret.as_mut_ptr().offset(12), 20);

View File

@ -175,6 +175,8 @@ impl JournalDB for ArchiveDB {
fn state(&self, id: &H256) -> Option<Bytes> {
self.backing.get_by_prefix(&id.bytes()[0..12]).and_then(|b| Some(b.to_vec()))
}
fn is_pruned(&self) -> bool { false }
}
#[cfg(test)]

View File

@ -42,4 +42,7 @@ pub trait JournalDB : HashDB + Send + Sync {
fn state(&self, _id: &H256) -> Option<Bytes> {
None
}
/// Whether this database is pruned.
fn is_pruned(&self) -> bool { true }
}

View File

@ -494,10 +494,11 @@ impl Discovery {
}
pub fn update_registration<Host:Handler>(&self, event_loop: &mut EventLoop<Host>) -> Result<(), NetworkError> {
let mut registration = EventSet::readable();
if !self.send_queue.is_empty() {
registration = registration | EventSet::writable();
}
let registration = if !self.send_queue.is_empty() {
EventSet::readable() | EventSet::writable()
} else {
EventSet::readable()
};
event_loop.reregister(&self.udp_socket, Token(self.token), registration, PollOpt::edge()).expect("Error reregistering UDP socket");
Ok(())
}

View File

@ -712,28 +712,25 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
let mut failure_id = None;
let mut deregister = false;
let mut expired_session = None;
match token {
FIRST_SESSION ... LAST_SESSION => {
let sessions = self.sessions.write().unwrap();
if let Some(session) = sessions.get(token).cloned() {
expired_session = Some(session.clone());
let mut s = session.lock().unwrap();
if !s.expired() {
if s.is_ready() {
for (p, _) in self.handlers.read().unwrap().iter() {
if s.have_capability(p) {
self.num_sessions.fetch_sub(1, AtomicOrdering::SeqCst);
to_disconnect.push(p);
}
if let FIRST_SESSION ... LAST_SESSION = token {
let sessions = self.sessions.write().unwrap();
if let Some(session) = sessions.get(token).cloned() {
expired_session = Some(session.clone());
let mut s = session.lock().unwrap();
if !s.expired() {
if s.is_ready() {
for (p, _) in self.handlers.read().unwrap().iter() {
if s.have_capability(p) {
self.num_sessions.fetch_sub(1, AtomicOrdering::SeqCst);
to_disconnect.push(p);
}
}
s.set_expired();
failure_id = s.id().cloned();
}
deregister = remote || s.done();
s.set_expired();
failure_id = s.id().cloned();
}
},
_ => {},
deregister = remote || s.done();
}
}
if let Some(id) = failure_id {
if remote {

View File

@ -59,7 +59,7 @@ impl<'db> TrieDB<'db> {
/// Create a new trie with the backing database `db` and `root`
/// Panics, if `root` does not exist
pub fn new(db: &'db HashDB, root: &'db H256) -> Self {
if !db.exists(root) {
if !db.contains(root) {
flushln!("TrieDB::new({}): Trie root not found!", root);
panic!("Trie root not found!");
}