diff --git a/Cargo.lock b/Cargo.lock index b330851e1..7e1db98f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -257,7 +257,7 @@ dependencies = [ name = "common-types" version = "0.1.0" dependencies = [ - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "ethjson 0.1.0", "rlp 0.2.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -429,7 +429,7 @@ dependencies = [ [[package]] name = "ethash" -version = "1.7.0" +version = "1.8.0" dependencies = [ "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -439,7 +439,7 @@ dependencies = [ [[package]] name = "ethcore" -version = "1.7.0" +version = "1.8.0" dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -450,22 +450,22 @@ dependencies = [ "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethash 1.7.0", + "ethash 1.8.0", "ethcore-bloom-journal 0.1.0", - "ethcore-devtools 1.7.0", - "ethcore-io 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-ipc-nano 1.7.0", - "ethcore-logger 1.7.0", - "ethcore-stratum 1.7.0", - "ethcore-util 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-io 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-ipc-nano 1.8.0", + "ethcore-logger 1.8.0", + "ethcore-stratum 1.8.0", + "ethcore-util 1.8.0", "ethjson 0.1.0", "ethkey 0.2.0", "ethstore 0.1.0", "evm 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "hardware-wallet 1.7.0", + "hardware-wallet 1.8.0", "hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -475,11 +475,11 @@ dependencies = [ "native-contracts 0.1.0", "num 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "price-info 1.7.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (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.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "stats 0.1.0", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", @@ -506,14 +506,14 @@ dependencies = [ [[package]] name = "ethcore-devtools" -version = "1.7.0" +version = "1.8.0" dependencies = [ "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethcore-io" -version = "1.7.0" +version = "1.8.0" dependencies = [ "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -524,17 +524,17 @@ dependencies = [ [[package]] name = "ethcore-ipc" -version = "1.7.0" +version = "1.8.0" dependencies = [ - "ethcore-devtools 1.7.0", - "ethcore-util 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-util 1.8.0", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethcore-ipc-codegen" -version = "1.7.0" +version = "1.8.0" dependencies = [ "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -549,9 +549,9 @@ dependencies = [ name = "ethcore-ipc-hypervisor" version = "1.2.0" dependencies = [ - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-ipc-nano 1.7.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-ipc-nano 1.8.0", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -560,9 +560,9 @@ dependencies = [ [[package]] name = "ethcore-ipc-nano" -version = "1.7.0" +version = "1.8.0" dependencies = [ - "ethcore-ipc 1.7.0", + "ethcore-ipc 1.8.0", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", @@ -572,11 +572,11 @@ dependencies = [ name = "ethcore-ipc-tests" version = "0.1.0" dependencies = [ - "ethcore-devtools 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-ipc-nano 1.7.0", - "ethcore-util 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-ipc-nano 1.8.0", + "ethcore-util 1.8.0", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -584,16 +584,16 @@ dependencies = [ [[package]] name = "ethcore-light" -version = "1.7.0" +version = "1.8.0" dependencies = [ "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-devtools 1.7.0", - "ethcore-io 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-network 1.7.0", - "ethcore-util 1.7.0", + "ethcore 1.8.0", + "ethcore-devtools 1.8.0", + "ethcore-io 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-network 1.8.0", + "ethcore-util 1.8.0", "evm 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -609,7 +609,7 @@ dependencies = [ [[package]] name = "ethcore-logger" -version = "1.7.0" +version = "1.8.0" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -624,15 +624,15 @@ dependencies = [ [[package]] name = "ethcore-network" -version = "1.7.0" +version = "1.8.0" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-devtools 1.7.0", - "ethcore-io 1.7.0", - "ethcore-logger 1.7.0", - "ethcore-util 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-io 1.8.0", + "ethcore-logger 1.8.0", + "ethcore-util 1.8.0", "ethcrypto 0.1.0", "ethkey 0.2.0", "igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -657,17 +657,17 @@ version = "1.0.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-devtools 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-ipc-nano 1.7.0", - "ethcore-logger 1.7.0", - "ethcore-util 1.7.0", + "ethcore 1.8.0", + "ethcore-devtools 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-ipc-nano 1.8.0", + "ethcore-logger 1.8.0", + "ethcore-util 1.8.0", "ethcrypto 0.1.0", "ethkey 0.2.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "native-contracts 0.1.0", @@ -685,15 +685,15 @@ dependencies = [ [[package]] name = "ethcore-stratum" -version = "1.7.0" +version = "1.8.0" dependencies = [ "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-devtools 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-ipc-nano 1.7.0", - "ethcore-logger 1.7.0", - "ethcore-util 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-ipc-nano 1.8.0", + "ethcore-logger 1.8.0", + "ethcore-util 1.8.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", @@ -706,7 +706,7 @@ dependencies = [ [[package]] name = "ethcore-util" -version = "1.7.0" +version = "1.8.0" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", @@ -715,8 +715,8 @@ dependencies = [ "eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.1.3", "ethcore-bloom-journal 0.1.0", - "ethcore-devtools 1.7.0", - "ethcore-logger 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-logger 1.8.0", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -756,7 +756,7 @@ name = "ethjson" version = "0.1.0" dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -825,19 +825,19 @@ dependencies = [ [[package]] name = "ethsync" -version = "1.7.0" +version = "1.8.0" dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-devtools 1.7.0", - "ethcore-io 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-ipc-nano 1.7.0", - "ethcore-light 1.7.0", - "ethcore-network 1.7.0", - "ethcore-util 1.7.0", + "ethcore 1.8.0", + "ethcore-devtools 1.8.0", + "ethcore-io 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-ipc-nano 1.8.0", + "ethcore-light 1.8.0", + "ethcore-network 1.8.0", + "ethcore-util 1.8.0", "ethkey 0.2.0", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -856,9 +856,9 @@ dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "common-types 0.1.0", - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "ethjson 0.1.0", - "evmjit 1.7.0", + "evmjit 1.8.0", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -872,8 +872,8 @@ name = "evmbin" version = "0.1.0" dependencies = [ "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-util 1.7.0", + "ethcore 1.8.0", + "ethcore-util 1.8.0", "evm 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -882,7 +882,7 @@ dependencies = [ [[package]] name = "evmjit" -version = "1.7.0" +version = "1.8.0" dependencies = [ "tiny-keccak 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -900,7 +900,7 @@ name = "fetch" version = "0.1.0" dependencies = [ "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -933,10 +933,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-cpupool" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -987,7 +986,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hardware-wallet" -version = "1.7.0" +version = "1.8.0" dependencies = [ "ethcore-bigint 0.1.3", "ethkey 0.2.0", @@ -1014,6 +1013,11 @@ dependencies = [ "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hidapi" version = "0.3.1" @@ -1114,11 +1118,11 @@ dependencies = [ [[package]] name = "ipc-common-types" -version = "1.7.0" +version = "1.8.0" dependencies = [ - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-util 1.7.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-util 1.8.0", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1512,7 +1516,7 @@ version = "0.1.0" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "native-contract-generator 0.1.0", ] @@ -1692,6 +1696,15 @@ name = "order-stat" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ordered-float" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "owning_ref" version = "0.3.3" @@ -1711,36 +1724,37 @@ dependencies = [ "daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-devtools 1.7.0", - "ethcore-io 1.7.0", - "ethcore-ipc 1.7.0", + "ethcore 1.8.0", + "ethcore-devtools 1.8.0", + "ethcore-io 1.8.0", + "ethcore-ipc 1.8.0", "ethcore-ipc-hypervisor 1.2.0", - "ethcore-ipc-nano 1.7.0", + "ethcore-ipc-nano 1.8.0", "ethcore-ipc-tests 0.1.0", - "ethcore-light 1.7.0", - "ethcore-logger 1.7.0", + "ethcore-light 1.8.0", + "ethcore-logger 1.8.0", "ethcore-secretstore 1.0.0", - "ethcore-stratum 1.7.0", - "ethcore-util 1.7.0", + "ethcore-stratum 1.8.0", + "ethcore-util 1.8.0", "ethkey 0.2.0", - "ethsync 1.7.0", + "ethsync 1.8.0", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-dapps 1.7.0", - "parity-hash-fetch 1.7.0", - "parity-ipfs-api 1.7.0", + "parity-dapps 1.8.0", + "parity-hash-fetch 1.8.0", + "parity-ipfs-api 1.8.0", "parity-local-store 0.1.0", "parity-reactor 0.1.0", - "parity-rpc 1.7.0", + "parity-rpc 1.8.0", "parity-rpc-client 1.4.0", - "parity-updater 1.7.0", + "parity-updater 1.8.0", + "parity-whisper 0.1.0", "path 0.1.0", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1761,16 +1775,16 @@ dependencies = [ [[package]] name = "parity-dapps" -version = "1.7.0" +version = "1.8.0" dependencies = [ "base32 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-devtools 1.7.0", - "ethcore-util 1.7.0", + "ethcore-devtools 1.8.0", + "ethcore-util 1.8.0", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1779,9 +1793,9 @@ dependencies = [ "mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "ntp 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-hash-fetch 1.7.0", + "parity-hash-fetch 1.8.0", "parity-reactor 0.1.0", - "parity-ui 1.7.0", + "parity-ui 1.8.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1809,10 +1823,10 @@ dependencies = [ [[package]] name = "parity-hash-fetch" -version = "1.7.0" +version = "1.8.0" dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1826,11 +1840,11 @@ dependencies = [ [[package]] name = "parity-ipfs-api" -version = "1.7.0" +version = "1.8.0" dependencies = [ "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-util 1.7.0", + "ethcore 1.8.0", + "ethcore-util 1.8.0", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1841,9 +1855,9 @@ dependencies = [ name = "parity-local-store" version = "0.1.0" dependencies = [ - "ethcore 1.7.0", - "ethcore-io 1.7.0", - "ethcore-util 1.7.0", + "ethcore 1.8.0", + "ethcore-io 1.8.0", + "ethcore-util 1.8.0", "ethkey 0.2.0", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", @@ -1862,27 +1876,27 @@ dependencies = [ [[package]] name = "parity-rpc" -version = "1.7.0" +version = "1.8.0" dependencies = [ "cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", - "ethash 1.7.0", - "ethcore 1.7.0", - "ethcore-devtools 1.7.0", - "ethcore-io 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-light 1.7.0", - "ethcore-logger 1.7.0", - "ethcore-util 1.7.0", + "ethash 1.8.0", + "ethcore 1.8.0", + "ethcore-devtools 1.8.0", + "ethcore-io 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-light 1.8.0", + "ethcore-logger 1.8.0", + "ethcore-util 1.8.0", "ethcrypto 0.1.0", "ethjson 0.1.0", "ethkey 0.2.0", "ethstore 0.1.0", - "ethsync 1.7.0", + "ethsync 1.8.0", "evm 0.1.0", "fetch 0.1.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-ipc-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", @@ -1894,7 +1908,7 @@ dependencies = [ "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", - "parity-updater 1.7.0", + "parity-updater 1.8.0", "pretty_assertions 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)", "rlp 0.2.0", @@ -1914,13 +1928,13 @@ dependencies = [ name = "parity-rpc-client" version = "1.4.0" dependencies = [ - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-rpc 1.7.0", + "parity-rpc 1.8.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1947,16 +1961,16 @@ dependencies = [ [[package]] name = "parity-ui" -version = "1.7.0" +version = "1.8.0" dependencies = [ - "parity-ui-dev 1.7.0", + "parity-ui-dev 1.8.0", "parity-ui-precompiled 1.4.0 (git+https://github.com/paritytech/js-precompiled.git)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-ui-dev" -version = "1.7.0" +version = "1.8.0" dependencies = [ "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1964,25 +1978,25 @@ dependencies = [ [[package]] name = "parity-ui-precompiled" version = "1.4.0" -source = "git+https://github.com/paritytech/js-precompiled.git#b49a1d46cc6c545403d18579ef7ae9f9d14eea7e" +source = "git+https://github.com/paritytech/js-precompiled.git#26873a9ae6fca50fbf523f201325a20792db3e23" dependencies = [ "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-updater" -version = "1.7.0" +version = "1.8.0" dependencies = [ "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore 1.7.0", - "ethcore-ipc 1.7.0", - "ethcore-ipc-codegen 1.7.0", - "ethcore-util 1.7.0", - "ethsync 1.7.0", + "ethcore 1.8.0", + "ethcore-ipc 1.8.0", + "ethcore-ipc-codegen 1.8.0", + "ethcore-util 1.8.0", + "ethsync 1.8.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-common-types 1.7.0", + "ipc-common-types 1.8.0", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-hash-fetch 1.7.0", + "parity-hash-fetch 1.8.0", "parity-reactor 0.1.0", "path 0.1.0", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1998,6 +2012,36 @@ dependencies = [ "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-whisper" +version = "0.1.0" +dependencies = [ + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-bigint 0.1.3", + "ethcore-network 1.8.0", + "ethcrypto 0.1.0", + "ethkey 0.2.0", + "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", + "jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", + "jsonrpc-pubsub 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", + "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.2.0", + "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.4.0 (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.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parity-wordlist" version = "1.0.1" @@ -2086,6 +2130,17 @@ dependencies = [ "difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "price-info" +version = "1.7.0" +dependencies = [ + "ethcore-util 1.7.0", + "fetch 0.1.0", + "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "primal" version = "0.2.3" @@ -2324,9 +2379,9 @@ name = "rpc-cli" version = "1.4.0" dependencies = [ "bigint 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.0", + "ethcore-util 1.8.0", "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-rpc 1.7.0", + "parity-rpc 1.8.0", "parity-rpc-client 1.4.0", "rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3119,7 +3174,7 @@ dependencies = [ "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" "checksum foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e4056b9bd47f8ac5ba12be771f77a0dae796d1bbaaf5fd0b9c2d38b69b8a29d" "checksum futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8e51e7f9c150ba7fd4cee9df8bf6ea3dea5b63b68955ddad19ccd35b71dcfb4d" -"checksum futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bb982bb25cd8fa5da6a8eb3a460354c984ff1113da82bcb4f0b0862b5795db82" +"checksum futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a283c84501e92cade5ea673a2a7ca44f71f209ccdd302a3e0896f50083d2c5ff" "checksum gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)" = "120d07f202dcc3f72859422563522b66fe6463a4c513df062874daad05f85f0a" "checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" @@ -3128,6 +3183,7 @@ dependencies = [ "checksum hamming 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65043da274378d68241eb9a8f8f8aa54e349136f7b8e12f63e3ef44043cc30e1" "checksum heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c7593b1522161003928c959c20a2ca421c68e940d63d75573316a009e48a6d4" "checksum heck 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f807d2f64cc044a6bcf250ff23e59be0deec7a16612c014f962a06fa7e020f9" +"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum hidapi 0.3.1 (git+https://github.com/paritytech/hidapi-rs)" = "" "checksum httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46534074dbb80b070d60a5cb8ecadd8963a00a438ae1a95268850a7ef73b67ae" "checksum hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)" = "" @@ -3197,6 +3253,7 @@ dependencies = [ "checksum openssl 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b34cd77cf91301fff3123fbd46b065c3b728b17a392835de34c397315dce5586" "checksum openssl-sys 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e035022a50faa380bd7ccdbd184d946ce539ebdb0a358780de92a995882af97a" "checksum order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "efa535d5117d3661134dbf1719b6f0ffe06f2375843b13935db186cd094105eb" +"checksum ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "58d25b6c0e47b20d05226d288ff434940296e7e2f8b877975da32f862152241f" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1d06f6ee0fda786df3784a96ee3f0629f529b91cbfb7d142f6410e6bcd1ce2c" "checksum parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc)" = "" diff --git a/Cargo.toml b/Cargo.toml index 93341b564..d541636da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,7 @@ parity-reactor = { path = "util/reactor" } parity-rpc = { path = "rpc" } parity-rpc-client = { path = "rpc_client" } parity-updater = { path = "updater" } +parity-whisper = { path = "whisper" } path = { path = "util/path" } parity-dapps = { path = "dapps", optional = true } @@ -106,4 +107,4 @@ lto = false panic = "abort" [workspace] -members = ["ethstore/cli", "ethkey/cli", "evmbin"] +members = ["ethstore/cli", "ethkey/cli", "evmbin", "whisper"] diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index a0d63b6e3..75e15e396 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Parity Dapps crate" name = "parity-dapps" -version = "1.7.0" +version = "1.8.0" license = "GPL-3.0" authors = ["Parity Technologies "] diff --git a/dapps/src/handlers/mod.rs b/dapps/src/handlers/mod.rs index bb640ed17..7937ce667 100644 --- a/dapps/src/handlers/mod.rs +++ b/dapps/src/handlers/mod.rs @@ -68,6 +68,9 @@ pub fn add_security_headers(headers: &mut header::Headers, embeddable_on: Embedd b"font-src 'self' data: https:;".to_vec(), // Allow inline scripts and scripts eval (webpack/jsconsole) b"script-src 'self' 'unsafe-inline' 'unsafe-eval';".to_vec(), + // Same restrictions as script-src (fallback) with additional + // blob: that is required for camera access (worker) + b"worker-src 'self' 'unsafe-inline' 'unsafe-eval' blob: ;".to_vec(), // Restrict everything else to the same origin. b"default-src 'self';".to_vec(), // Run in sandbox mode (although it's not fully safe since we allow same-origin and script) @@ -140,4 +143,3 @@ pub fn convert_uri_to_url(uri: &uri::RequestUri, host: Option<&header::Host>) -> _ => None, } } - diff --git a/dapps/ui/Cargo.toml b/dapps/ui/Cargo.toml index adb5ce22c..41763b14d 100644 --- a/dapps/ui/Cargo.toml +++ b/dapps/ui/Cargo.toml @@ -3,7 +3,7 @@ description = "Ethcore Parity UI" homepage = "http://parity.io" license = "GPL-3.0" name = "parity-ui" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] [build-dependencies] diff --git a/devtools/Cargo.toml b/devtools/Cargo.toml index 8759b81c9..faae03731 100644 --- a/devtools/Cargo.toml +++ b/devtools/Cargo.toml @@ -3,7 +3,7 @@ description = "Ethcore development/test/build tools" homepage = "http://parity.io" license = "GPL-3.0" name = "ethcore-devtools" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] [dependencies] diff --git a/ethash/Cargo.toml b/ethash/Cargo.toml index 0defcf3ae..f7d37e375 100644 --- a/ethash/Cargo.toml +++ b/ethash/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethash" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] [lib] diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 2ec89c005..71e329201 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -3,7 +3,7 @@ description = "Ethcore library" homepage = "http://parity.io" license = "GPL-3.0" name = "ethcore" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] build = "build.rs" @@ -44,11 +44,11 @@ lru-cache = "0.1.0" native-contracts = { path = "native_contracts" } num = "0.1" num_cpus = "1.2" +price-info = { path = "../price-info" } rand = "0.3" rlp = { path = "../util/rlp" } rust-crypto = "0.2.34" rustc-hex = "1.0" -rustc-serialize = "0.3" semver = "0.6" stats = { path = "../util/stats" } time = "0.1" diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index f4fb3cd0d..09f2e0e1a 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -3,7 +3,7 @@ description = "Parity Light Client Implementation" homepage = "http://parity.io" license = "GPL-3.0" name = "ethcore-light" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] build = "build.rs" diff --git a/ethcore/light/src/net/mod.rs b/ethcore/light/src/net/mod.rs index 27afed3d5..f823678a9 100644 --- a/ethcore/light/src/net/mod.rs +++ b/ethcore/light/src/net/mod.rs @@ -21,7 +21,7 @@ use ethcore::transaction::UnverifiedTransaction; use io::TimerToken; -use network::{NetworkProtocolHandler, NetworkContext, PeerId}; +use network::{HostInfo, NetworkProtocolHandler, NetworkContext, PeerId}; use rlp::{RlpStream, UntrustedRlp}; use util::hash::H256; use util::{DBValue, Mutex, RwLock, U256}; @@ -1074,7 +1074,7 @@ fn punish(peer: PeerId, io: &IoContext, e: Error) { } impl NetworkProtocolHandler for LightProtocol { - fn initialize(&self, io: &NetworkContext) { + fn initialize(&self, io: &NetworkContext, _host_info: &HostInfo) { io.register_timer(TIMEOUT, TIMEOUT_INTERVAL_MS) .expect("Error registering sync timer."); io.register_timer(TICK_TIMEOUT, TICK_TIMEOUT_INTERVAL_MS) diff --git a/ethcore/src/builtin.rs b/ethcore/src/builtin.rs index d5dc459b2..7f71802b3 100644 --- a/ethcore/src/builtin.rs +++ b/ethcore/src/builtin.rs @@ -352,7 +352,7 @@ fn read_point(reader: &mut io::Chain<&[u8], io::Repeat>) -> Result<::bn::G1, Err let px = Fq::from_slice(&buf[0..32]).map_err(|_| Error::from("Invalid point x coordinate"))?; reader.read_exact(&mut buf[..]).expect("reading from zero-extended memory cannot fail; qed"); - let py = Fq::from_slice(&buf[0..32]).map_err(|_| Error::from("Invalid point x coordinate"))?; + let py = Fq::from_slice(&buf[0..32]).map_err(|_| Error::from("Invalid point y coordinate"))?; Ok( if px == Fq::zero() && py == Fq::zero() { diff --git a/ethcore/src/engines/epoch_verifier.rs b/ethcore/src/engines/epoch_verifier.rs new file mode 100644 index 000000000..cd712baef --- /dev/null +++ b/ethcore/src/engines/epoch_verifier.rs @@ -0,0 +1,49 @@ +// 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 . + +// Epoch verifiers. + +use error::Error; +use header::Header; + +/// Verifier for all blocks within an epoch with self-contained state. +/// +/// See docs on `Engine` relating to proving functions for more details. +pub trait EpochVerifier: Send + Sync { + /// Get the epoch number. + fn epoch_number(&self) -> u64; + + /// Lightly verify the next block header. + /// This may not be a header belonging to a different epoch. + fn verify_light(&self, header: &Header) -> Result<(), Error>; + + /// Perform potentially heavier checks on the next block header. + fn verify_heavy(&self, header: &Header) -> Result<(), Error> { + self.verify_light(header) + } + + /// Check if the header is the end of an epoch. + fn is_epoch_end(&self, header: &Header, Ancestry) -> EpochChange; + +} + +/// Special "no-op" verifier for stateless, epoch-less engines. +pub struct NoOp; + +impl EpochVerifier for NoOp { + fn epoch_number(&self) -> u64 { 0 } + fn verify_light(&self, _header: &Header) -> Result<(), Error> { Ok(()) } +} diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index af7922c20..89f9d2e57 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -98,10 +98,10 @@ extern crate lru_cache; extern crate native_contracts; extern crate num_cpus; extern crate num; +extern crate price_info; extern crate rand; extern crate rlp; extern crate rustc_hex; -extern crate rustc_serialize; extern crate semver; extern crate stats; extern crate time; diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index f037052ce..80971355b 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -33,9 +33,10 @@ use miner::{MinerService, MinerStatus, TransactionQueue, RemovalReason, Transact AccountDetails, TransactionOrigin}; use miner::banning_queue::{BanningTransactionQueue, Threshold}; use miner::work_notify::{WorkPoster, NotifyWork}; -use miner::price_info::PriceInfo; use miner::local_transactions::{Status as LocalTransactionStatus}; use miner::service_transaction_checker::ServiceTransactionChecker; +use price_info::{Client as PriceInfoClient, PriceInfo}; +use price_info::fetch::Client as FetchClient; use header::BlockNumber; /// Different possible definitions for pending transaction set. @@ -98,6 +99,8 @@ pub struct MinerOptions { pub tx_gas_limit: U256, /// Maximum size of the transaction queue. pub tx_queue_size: usize, + /// Maximum memory usage of transactions in the queue (current / future). + pub tx_queue_memory_limit: Option, /// Strategy to use for prioritizing transactions in the queue. pub tx_queue_strategy: PrioritizationStrategy, /// Whether we should fallback to providing all the queue's transactions or just pending. @@ -123,8 +126,9 @@ impl Default for MinerOptions { reseal_on_own_tx: true, reseal_on_uncle: false, tx_gas_limit: !U256::zero(), - tx_queue_size: 1024, - tx_queue_gas_limit: GasLimit::Auto, + tx_queue_size: 8192, + tx_queue_memory_limit: Some(2 * 1024 * 1024), + tx_queue_gas_limit: GasLimit::None, tx_queue_strategy: PrioritizationStrategy::GasPriceOnly, pending_set: PendingSet::AlwaysQueue, reseal_min_period: Duration::from_secs(2), @@ -151,6 +155,7 @@ pub struct GasPriceCalibratorOptions { pub struct GasPriceCalibrator { options: GasPriceCalibratorOptions, next_calibration: Instant, + price_info: PriceInfoClient, } impl GasPriceCalibrator { @@ -160,7 +165,7 @@ impl GasPriceCalibrator { let usd_per_tx = self.options.usd_per_tx; trace!(target: "miner", "Getting price info"); - PriceInfo::get(move |price: PriceInfo| { + self.price_info.get(move |price: PriceInfo| { trace!(target: "miner", "Price info arrived: {:?}", price); let usd_per_eth = price.ethusd; let wei_per_usd: f32 = 1.0e18 / usd_per_eth; @@ -186,10 +191,11 @@ pub enum GasPricer { impl GasPricer { /// Create a new Calibrated `GasPricer`. - pub fn new_calibrated(options: GasPriceCalibratorOptions) -> GasPricer { + pub fn new_calibrated(options: GasPriceCalibratorOptions, fetch: FetchClient) -> GasPricer { GasPricer::Calibrated(GasPriceCalibrator { options: options, next_calibration: Instant::now(), + price_info: PriceInfoClient::new(fetch), }) } @@ -252,8 +258,15 @@ impl Miner { GasLimit::Fixed(ref limit) => *limit, _ => !U256::zero(), }; + let mem_limit = options.tx_queue_memory_limit.unwrap_or_else(usize::max_value); - let txq = TransactionQueue::with_limits(options.tx_queue_strategy, options.tx_queue_size, gas_limit, options.tx_gas_limit); + let txq = TransactionQueue::with_limits( + options.tx_queue_strategy, + options.tx_queue_size, + mem_limit, + gas_limit, + options.tx_gas_limit + ); let txq = match options.tx_queue_banning { Banning::Disabled => BanningTransactionQueue::new(txq, Threshold::NeverBan, Duration::from_secs(180)), Banning::Enabled { ban_duration, min_offends, .. } => BanningTransactionQueue::new( @@ -1328,6 +1341,7 @@ mod tests { reseal_max_period: Duration::from_secs(120), tx_gas_limit: !U256::zero(), tx_queue_size: 1024, + tx_queue_memory_limit: None, tx_queue_gas_limit: GasLimit::None, tx_queue_strategy: PrioritizationStrategy::GasFactorAndGasPrice, pending_set: PendingSet::AlwaysSealing, diff --git a/ethcore/src/miner/mod.rs b/ethcore/src/miner/mod.rs index 78c16ab88..1c07f4fab 100644 --- a/ethcore/src/miner/mod.rs +++ b/ethcore/src/miner/mod.rs @@ -45,7 +45,6 @@ mod banning_queue; mod external; mod local_transactions; mod miner; -mod price_info; mod service_transaction_checker; mod transaction_queue; mod work_notify; diff --git a/ethcore/src/miner/price_info.rs b/ethcore/src/miner/price_info.rs deleted file mode 100644 index 29994afb4..000000000 --- a/ethcore/src/miner/price_info.rs +++ /dev/null @@ -1,125 +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 . - -use rustc_serialize::json::Json; -use std::thread; -use std::io::Read; -use std::time::Duration; -use std::str::FromStr; -use std::sync::mpsc; -use hyper::client::{Handler, Request, Response, Client}; -use hyper::{Url, Next, Encoder, Decoder}; -use hyper::net::HttpStream; - -#[derive(Debug)] -pub struct PriceInfo { - pub ethusd: f32, -} - -pub struct SetPriceHandler { - set_price: F, - channel: mpsc::Sender<()>, -} - -impl Drop for SetPriceHandler { - fn drop(&mut self) { - let _ = self.channel.send(()); - } -} - -impl Handler for SetPriceHandler { - fn on_request(&mut self, _: &mut Request) -> Next { Next::read().timeout(Duration::from_secs(3)) } - fn on_request_writable(&mut self, _: &mut Encoder) -> Next { Next::read().timeout(Duration::from_secs(3)) } - fn on_response(&mut self, _: Response) -> Next { Next::read().timeout(Duration::from_secs(3)) } - - fn on_response_readable(&mut self, r: &mut Decoder) -> Next { - let mut body = String::new(); - let info = r.read_to_string(&mut body) - .map_err(|e| format!("Unable to read response: {:?}", e)) - .and_then(|_| self.process_response(&body)); - - if let Err(e) = info { - warn!("Failed to auto-update latest ETH price: {:?}", e); - } - Next::end() - } -} - -impl SetPriceHandler { - fn process_response(&self, body: &str) -> Result<(), String> { - let json = Json::from_str(body).map_err(|e| format!("Invalid JSON returned: {:?}", e))?; - let obj = json.find_path(&["result", "ethusd"]).ok_or("USD price not found".to_owned())?; - let ethusd = match *obj { - Json::String(ref s) => FromStr::from_str(s).ok(), - _ => None, - }.ok_or("Unexpected price format.".to_owned())?; - - (self.set_price)(PriceInfo { - ethusd: ethusd, - }); - Ok(()) - } -} - -impl PriceInfo { - pub fn get(set_price: F) { - thread::spawn(move || { - let url = FromStr::from_str("http://api.etherscan.io/api?module=stats&action=ethprice") - .expect("string known to be a valid URL; qed"); - - if let Err(e) = Self::request(url, set_price) { - warn!("Failed to auto-update latest ETH price: {:?}", e); - } - }); - } - - fn request(url: Url, set_price: F) -> Result<(), String> { - let (tx, rx) = mpsc::channel(); - let client = Client::new().map_err(|e| format!("Unable to start client: {:?}", e))?; - - client.request( - url, - SetPriceHandler { - set_price: set_price, - channel: tx, - }, - ).map_err(|_| "Request failed.".to_owned())?; - - // Wait for exit - let _ = rx.recv().map_err(|e| format!("Request interrupted: {:?}", e))?; - client.close(); - - Ok(()) - } -} - -#[test] #[ignore] -fn should_get_price_info() { - use std::sync::Arc; - use std::time::Duration; - use ethcore_logger::init_log; - use util::{Condvar, Mutex}; - - init_log(); - let done = Arc::new((Mutex::new(PriceInfo { ethusd: 0f32 }), Condvar::new())); - let rdone = done.clone(); - - PriceInfo::get(move |price| { let mut p = rdone.0.lock(); *p = price; rdone.1.notify_one(); }); - let mut p = done.0.lock(); - let t = done.1.wait_for(&mut p, Duration::from_millis(10000)); - assert!(!t.timed_out()); - assert!(p.ethusd != 0f32); -} diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index 8da9f7150..542b42b93 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -105,7 +105,7 @@ use std::cmp::Ordering; use std::cmp; use std::collections::{HashSet, HashMap, BTreeSet, BTreeMap}; use linked_hash_map::LinkedHashMap; -use util::{Address, H256, U256}; +use util::{Address, H256, U256, HeapSizeOf}; use util::table::Table; use transaction::*; use error::{Error, TransactionError}; @@ -171,6 +171,8 @@ struct TransactionOrder { /// Gas (limit) of the transaction. Usage depends on strategy. /// Low gas limit = High priority (processed earlier) gas: U256, + /// Heap usage of this transaction. + mem_usage: usize, /// Transaction ordering strategy strategy: PrioritizationStrategy, /// Hash to identify associated transaction @@ -191,8 +193,9 @@ impl TransactionOrder { TransactionOrder { nonce_height: tx.nonce() - base_nonce, gas_price: tx.transaction.gas_price, - gas: tx.transaction.gas, gas_factor: factor, + gas: tx.transaction.gas, + mem_usage: tx.transaction.heap_size_of_children(), strategy: strategy, hash: tx.hash(), insertion_id: tx.insertion_id, @@ -370,7 +373,8 @@ struct TransactionSet { by_address: Table, by_gas_price: GasPriceQueue, limit: usize, - gas_limit: U256, + total_gas_limit: U256, + memory_limit: usize, } impl TransactionSet { @@ -402,18 +406,24 @@ impl TransactionSet { /// Returns addresses and lowest nonces of transactions removed because of limit. fn enforce_limit(&mut self, by_hash: &mut HashMap, local: &mut LocalTransactionsList) -> Option> { let mut count = 0; + let mut mem_usage = 0; let mut gas: U256 = 0.into(); let to_drop : Vec<(Address, U256)> = { self.by_priority .iter() .filter(|order| { - count = count + 1; + // update transaction count and mem usage + count += 1; + mem_usage += order.mem_usage; + + // calculate current gas usage let r = gas.overflowing_add(order.gas); if r.1 { return false } gas = r.0; + + let is_own_or_retracted = order.origin.is_local() || order.origin == TransactionOrigin::RetractedBlock; // Own and retracted transactions are allowed to go above all limits. - order.origin != TransactionOrigin::Local && order.origin != TransactionOrigin::RetractedBlock && - (gas > self.gas_limit || count > self.limit) + !is_own_or_retracted && (mem_usage > self.memory_limit || count > self.limit || gas > self.total_gas_limit) }) .map(|order| by_hash.get(&order.hash) .expect("All transactions in `self.by_priority` and `self.by_address` are kept in sync with `by_hash`.")) @@ -502,6 +512,10 @@ const GAS_LIMIT_HYSTERESIS: usize = 200; // (100/GAS_LIMIT_HYSTERESIS) % /// `new_gas_price > old_gas_price + old_gas_price >> SHIFT` const GAS_PRICE_BUMP_SHIFT: usize = 3; // 2 = 25%, 3 = 12.5%, 4 = 6.25% +/// Future queue limits are lower from current queue limits: +/// `future_limit = current_limit >> SHIFT` +const FUTURE_QUEUE_LIMITS_SHIFT: usize = 3; // 2 = 25%, 3 = 12.5%, 4 = 6.25% + /// Describes the strategy used to prioritize transactions in the queue. #[cfg_attr(feature="dev", allow(enum_variant_names))] #[derive(Debug, Copy, Clone, PartialEq, Eq)] @@ -557,7 +571,7 @@ pub struct TransactionQueue { /// The maximum amount of gas any individual transaction may use. tx_gas_limit: U256, /// Current gas limit (block gas limit * factor). Transactions above the limit will not be accepted (default to !0) - gas_limit: U256, + total_gas_limit: U256, /// Maximal time transaction may occupy the queue. /// When we reach `max_time_in_queue / 2^3` we re-validate /// account balance. @@ -585,35 +599,43 @@ impl Default for TransactionQueue { impl TransactionQueue { /// Creates new instance of this Queue pub fn new(strategy: PrioritizationStrategy) -> Self { - Self::with_limits(strategy, 1024, !U256::zero(), !U256::zero()) + Self::with_limits(strategy, 8192, usize::max_value(), !U256::zero(), !U256::zero()) } /// Create new instance of this Queue with specified limits - pub fn with_limits(strategy: PrioritizationStrategy, limit: usize, gas_limit: U256, tx_gas_limit: U256) -> Self { + pub fn with_limits( + strategy: PrioritizationStrategy, + limit: usize, + memory_limit: usize, + total_gas_limit: U256, + tx_gas_limit: U256, + ) -> Self { let current = TransactionSet { by_priority: BTreeSet::new(), by_address: Table::new(), by_gas_price: Default::default(), - limit: limit, - gas_limit: gas_limit, + limit, + total_gas_limit, + memory_limit, }; let future = TransactionSet { by_priority: BTreeSet::new(), by_address: Table::new(), by_gas_price: Default::default(), - limit: limit, - gas_limit: gas_limit, + total_gas_limit: total_gas_limit >> FUTURE_QUEUE_LIMITS_SHIFT, + limit: limit >> FUTURE_QUEUE_LIMITS_SHIFT, + memory_limit: memory_limit >> FUTURE_QUEUE_LIMITS_SHIFT, }; TransactionQueue { - strategy: strategy, + strategy, minimal_gas_price: U256::zero(), - tx_gas_limit: tx_gas_limit, - gas_limit: !U256::zero(), + total_gas_limit: !U256::zero(), + tx_gas_limit, max_time_in_queue: DEFAULT_QUEUING_PERIOD, - current: current, - future: future, + current, + future, by_hash: HashMap::new(), last_nonces: HashMap::new(), local_transactions: LocalTransactionsList::default(), @@ -624,7 +646,7 @@ impl TransactionQueue { /// Set the new limit for `current` and `future` queue. pub fn set_limit(&mut self, limit: usize) { self.current.set_limit(limit); - self.future.set_limit(limit); + self.future.set_limit(limit >> FUTURE_QUEUE_LIMITS_SHIFT); // And ensure the limits self.current.enforce_limit(&mut self.by_hash, &mut self.local_transactions); self.future.enforce_limit(&mut self.by_hash, &mut self.local_transactions); @@ -657,16 +679,17 @@ impl TransactionQueue { pub fn set_gas_limit(&mut self, gas_limit: U256) { let extra = gas_limit / U256::from(GAS_LIMIT_HYSTERESIS); - self.gas_limit = match gas_limit.overflowing_add(extra) { + let total_gas_limit = match gas_limit.overflowing_add(extra) { (_, true) => !U256::zero(), (val, false) => val, }; + self.total_gas_limit = total_gas_limit; } /// Sets new total gas limit. - pub fn set_total_gas_limit(&mut self, gas_limit: U256) { - self.future.gas_limit = gas_limit; - self.current.gas_limit = gas_limit; + pub fn set_total_gas_limit(&mut self, total_gas_limit: U256) { + self.current.total_gas_limit = total_gas_limit; + self.future.total_gas_limit = total_gas_limit >> FUTURE_QUEUE_LIMITS_SHIFT; self.future.enforce_limit(&mut self.by_hash, &mut self.local_transactions); } @@ -796,16 +819,17 @@ impl TransactionQueue { })); } - if tx.gas > self.gas_limit || tx.gas > self.tx_gas_limit { + let gas_limit = cmp::min(self.tx_gas_limit, self.total_gas_limit); + if tx.gas > gas_limit { trace!(target: "txqueue", "Dropping transaction above gas limit: {:?} ({} > min({}, {}))", tx.hash(), tx.gas, - self.gas_limit, + self.total_gas_limit, self.tx_gas_limit ); return Err(Error::Transaction(TransactionError::GasLimitExceeded { - limit: self.gas_limit, + limit: gas_limit, got: tx.gas, })); } @@ -1591,7 +1615,13 @@ pub mod test { #[test] fn should_return_correct_nonces_when_dropped_because_of_limit() { // given - let mut txq = TransactionQueue::with_limits(PrioritizationStrategy::GasPriceOnly, 2, !U256::zero(), !U256::zero()); + let mut txq = TransactionQueue::with_limits( + PrioritizationStrategy::GasPriceOnly, + 2, + usize::max_value(), + !U256::zero(), + !U256::zero(), + ); let (tx1, tx2) = new_tx_pair(123.into(), 1.into(), 1.into(), 0.into()); let sender = tx1.sender(); let nonce = tx1.nonce; @@ -1631,7 +1661,8 @@ pub mod test { by_address: Table::new(), by_gas_price: Default::default(), limit: 1, - gas_limit: !U256::zero(), + total_gas_limit: !U256::zero(), + memory_limit: usize::max_value(), }; let (tx1, tx2) = new_tx_pair_default(1.into(), 0.into()); let tx1 = VerifiedTransaction::new(tx1, TransactionOrigin::External, None, 0, 0); @@ -1672,7 +1703,8 @@ pub mod test { by_address: Table::new(), by_gas_price: Default::default(), limit: 1, - gas_limit: !U256::zero(), + total_gas_limit: !U256::zero(), + memory_limit: 0, }; // Create two transactions with same nonce // (same hash) @@ -1721,7 +1753,8 @@ pub mod test { by_address: Table::new(), by_gas_price: Default::default(), limit: 2, - gas_limit: !U256::zero(), + total_gas_limit: !U256::zero(), + memory_limit: 0, }; let tx = new_tx_default(); let tx1 = VerifiedTransaction::new(tx.clone(), TransactionOrigin::External, None, 0, 0); @@ -1739,7 +1772,8 @@ pub mod test { by_address: Table::new(), by_gas_price: Default::default(), limit: 1, - gas_limit: !U256::zero(), + total_gas_limit: !U256::zero(), + memory_limit: 0, }; assert_eq!(set.gas_price_entry_limit(), 0.into()); @@ -1884,17 +1918,17 @@ pub mod test { } #[test] - fn gas_limit_should_never_overflow() { + fn tx_gas_limit_should_never_overflow() { // given let mut txq = TransactionQueue::default(); txq.set_gas_limit(U256::zero()); - assert_eq!(txq.gas_limit, U256::zero()); + assert_eq!(txq.total_gas_limit, U256::zero()); // when txq.set_gas_limit(!U256::zero()); // then - assert_eq!(txq.gas_limit, !U256::zero()); + assert_eq!(txq.total_gas_limit, !U256::zero()); } #[test] @@ -2352,7 +2386,13 @@ pub mod test { #[test] fn should_drop_old_transactions_when_hitting_the_limit() { // given - let mut txq = TransactionQueue::with_limits(PrioritizationStrategy::GasPriceOnly, 1, !U256::zero(), !U256::zero()); + let mut txq = TransactionQueue::with_limits( + PrioritizationStrategy::GasPriceOnly, + 1, + usize::max_value(), + !U256::zero(), + !U256::zero() + ); let (tx, tx2) = new_tx_pair_default(1.into(), 0.into()); let sender = tx.sender(); let nonce = tx.nonce; @@ -2373,7 +2413,13 @@ pub mod test { #[test] fn should_limit_future_transactions() { - let mut txq = TransactionQueue::with_limits(PrioritizationStrategy::GasPriceOnly, 1, !U256::zero(), !U256::zero()); + let mut txq = TransactionQueue::with_limits( + PrioritizationStrategy::GasPriceOnly, + 1 << FUTURE_QUEUE_LIMITS_SHIFT, + usize::max_value(), + !U256::zero(), + !U256::zero(), + ); txq.current.set_limit(10); let (tx1, tx2) = new_tx_pair_default(4.into(), 1.into()); let (tx3, tx4) = new_tx_pair_default(4.into(), 2.into()); @@ -2392,7 +2438,13 @@ pub mod test { #[test] fn should_limit_by_gas() { - let mut txq = TransactionQueue::with_limits(PrioritizationStrategy::GasPriceOnly, 100, default_gas_val() * U256::from(2), !U256::zero()); + let mut txq = TransactionQueue::with_limits( + PrioritizationStrategy::GasPriceOnly, + 100, + usize::max_value(), + default_gas_val() * U256::from(2), + !U256::zero() + ); let (tx1, tx2) = new_tx_pair_default(U256::from(1), U256::from(1)); let (tx3, tx4) = new_tx_pair_default(U256::from(1), U256::from(2)); txq.add(tx1.clone(), TransactionOrigin::External, 0, None, &default_tx_provider()).unwrap(); @@ -2405,7 +2457,13 @@ pub mod test { #[test] fn should_keep_own_transactions_above_gas_limit() { - let mut txq = TransactionQueue::with_limits(PrioritizationStrategy::GasPriceOnly, 100, default_gas_val() * U256::from(2), !U256::zero()); + let mut txq = TransactionQueue::with_limits( + PrioritizationStrategy::GasPriceOnly, + 100, + usize::max_value(), + default_gas_val() * U256::from(2), + !U256::zero() + ); let (tx1, tx2) = new_tx_pair_default(U256::from(1), U256::from(1)); let (tx3, tx4) = new_tx_pair_default(U256::from(1), U256::from(2)); let (tx5, _) = new_tx_pair_default(U256::from(1), U256::from(2)); @@ -2679,7 +2737,13 @@ pub mod test { #[test] fn should_keep_right_order_in_future() { // given - let mut txq = TransactionQueue::with_limits(PrioritizationStrategy::GasPriceOnly, 1, !U256::zero(), !U256::zero()); + let mut txq = TransactionQueue::with_limits( + PrioritizationStrategy::GasPriceOnly, + 1 << FUTURE_QUEUE_LIMITS_SHIFT, + usize::max_value(), + !U256::zero(), + !U256::zero() + ); let (tx1, tx2) = new_tx_pair_default(1.into(), 0.into()); let prev_nonce = default_account_details().nonce - U256::one(); diff --git a/ethkey/src/brain.rs b/ethkey/src/brain.rs index 9976bdb01..8bc9d2cd7 100644 --- a/ethkey/src/brain.rs +++ b/ethkey/src/brain.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use keccak::Keccak256; -use super::{KeyPair, Error, Generator, Secret}; +use super::{KeyPair, Generator, Secret}; /// Simple brainwallet. pub struct Brain(String); @@ -27,7 +27,9 @@ impl Brain { } impl Generator for Brain { - fn generate(self) -> Result { + type Error = ::Void; + + fn generate(self) -> Result { let seed = self.0; let mut secret = seed.into_bytes().keccak256(); @@ -38,11 +40,10 @@ impl Generator for Brain { match i > 16384 { false => i += 1, true => { - if let Ok(secret) = Secret::from_unsafe_slice(&secret) { - let result = KeyPair::from_secret(secret); - if result.as_ref().ok().map_or(false, |r| r.address()[0] == 0) { - return result; - } + if let Ok(pair) = Secret::from_unsafe_slice(&secret) + .and_then(KeyPair::from_secret) + { + if pair.address()[0] == 0 { return Ok(pair) } } }, } diff --git a/ethkey/src/lib.rs b/ethkey/src/lib.rs index e87e198df..271a5f166 100644 --- a/ethkey/src/lib.rs +++ b/ethkey/src/lib.rs @@ -15,8 +15,6 @@ // along with Parity. If not, see . extern crate rand; -#[macro_use] -extern crate lazy_static; extern crate tiny_keccak; extern crate secp256k1; extern crate rustc_hex; @@ -24,6 +22,9 @@ extern crate ethcore_bigint as bigint; extern crate crypto as rcrypto; extern crate byteorder; +#[macro_use] +extern crate lazy_static; + mod brain; mod error; mod keypair; @@ -34,21 +35,12 @@ mod signature; mod secret; mod extended; -lazy_static! { - pub static ref SECP256K1: secp256k1::Secp256k1 = secp256k1::Secp256k1::new(); -} - -/// Generates new keypair. -pub trait Generator { - /// Should be called to generate new keypair. - fn generate(self) -> Result; -} - pub mod math; pub use self::brain::Brain; pub use self::error::Error; pub use self::keypair::{KeyPair, public_to_address}; +pub use self::math::public_is_valid; pub use self::prefix::Prefix; pub use self::random::Random; pub use self::signature::{sign, verify_public, verify_address, recover, Signature}; @@ -57,6 +49,22 @@ pub use self::extended::{ExtendedPublic, ExtendedSecret, ExtendedKeyPair, Deriva use bigint::hash::{H160, H256, H512}; +lazy_static! { + pub static ref SECP256K1: secp256k1::Secp256k1 = secp256k1::Secp256k1::new(); +} + +/// Uninstantiatable error type for infallible generators. +#[derive(Debug)] +pub enum Void {} + +/// Generates new keypair. +pub trait Generator { + type Error; + + /// Should be called to generate new keypair. + fn generate(self) -> Result; +} + pub type Address = H160; pub type Message = H256; pub type Public = H512; diff --git a/ethkey/src/math.rs b/ethkey/src/math.rs index cf7012132..4c875bd8f 100644 --- a/ethkey/src/math.rs +++ b/ethkey/src/math.rs @@ -20,6 +20,12 @@ use secp256k1::constants::{GENERATOR_X, GENERATOR_Y, CURVE_ORDER}; use bigint::prelude::U256; use bigint::hash::H256; +/// Whether the public key is valid. +pub fn public_is_valid(public: &Public) -> bool { + to_secp256k1_public(public).ok() + .map_or(false, |p| p.is_valid()) +} + /// Inplace multiply public key by secret key (EC point * scalar) pub fn public_mul_secret(public: &mut Public, secret: &Secret) -> Result<(), Error> { let key_secret = secret.to_secp256k1_secret()?; diff --git a/ethkey/src/prefix.rs b/ethkey/src/prefix.rs index 174c877b0..25b1ab3f7 100644 --- a/ethkey/src/prefix.rs +++ b/ethkey/src/prefix.rs @@ -32,6 +32,8 @@ impl Prefix { } impl Generator for Prefix { + type Error = Error; + fn generate(self) -> Result { for _ in 0..self.iterations { let keypair = Random.generate()?; diff --git a/ethkey/src/random.rs b/ethkey/src/random.rs index b84402427..715dd3cb5 100644 --- a/ethkey/src/random.rs +++ b/ethkey/src/random.rs @@ -15,18 +15,30 @@ // along with Parity. If not, see . use rand::os::OsRng; -use super::{Generator, KeyPair, Error, SECP256K1}; +use super::{Generator, KeyPair, SECP256K1}; -/// Randomly generates new keypair. +/// Randomly generates new keypair, instantiating the RNG each time. pub struct Random; impl Generator for Random { - fn generate(self) -> Result { - let context = &SECP256K1; + type Error = ::std::io::Error; + + fn generate(self) -> Result { let mut rng = OsRng::new()?; - let (sec, publ) = context.generate_keypair(&mut rng)?; + match rng.generate() { + Ok(pair) => Ok(pair), + Err(void) => match void {}, // LLVM unreachable + } + } +} + +impl<'a> Generator for &'a mut OsRng { + type Error = ::Void; + + fn generate(self) -> Result { + let (sec, publ) = SECP256K1.generate_keypair(self) + .expect("context always created with full capabilities; qed"); Ok(KeyPair::from_keypair(sec, publ)) } } - diff --git a/evmjit/Cargo.toml b/evmjit/Cargo.toml index 5c36cc34b..e4daf3dae 100644 --- a/evmjit/Cargo.toml +++ b/evmjit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "evmjit" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] [lib] diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index 17da00215..502723bbb 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -3,7 +3,7 @@ description = "Fetching hash-addressed content." homepage = "http://parity.io" license = "GPL-3.0" name = "parity-hash-fetch" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] [dependencies] diff --git a/hw/Cargo.toml b/hw/Cargo.toml index 261721470..345b1c3bb 100644 --- a/hw/Cargo.toml +++ b/hw/Cargo.toml @@ -3,7 +3,7 @@ description = "Hardware wallet support." homepage = "http://parity.io" license = "GPL-3.0" name = "hardware-wallet" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] [dependencies] diff --git a/ipc-common-types/Cargo.toml b/ipc-common-types/Cargo.toml index f74f25e1e..ec9b157d5 100644 --- a/ipc-common-types/Cargo.toml +++ b/ipc-common-types/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Types that implement IPC and are common to multiple modules." name = "ipc-common-types" -version = "1.7.0" +version = "1.8.0" license = "GPL-3.0" authors = ["Parity Technologies "] build = "build.rs" diff --git a/ipc/codegen/Cargo.toml b/ipc/codegen/Cargo.toml index 52016f45a..69580e08d 100644 --- a/ipc/codegen/Cargo.toml +++ b/ipc/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethcore-ipc-codegen" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] license = "GPL-3.0" description = "Macros to auto-generate implementations for ipc call" diff --git a/ipc/nano/Cargo.toml b/ipc/nano/Cargo.toml index 31269ba67..a714e1d00 100644 --- a/ipc/nano/Cargo.toml +++ b/ipc/nano/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethcore-ipc-nano" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] license = "GPL-3.0" diff --git a/ipc/rpc/Cargo.toml b/ipc/rpc/Cargo.toml index 899d4628c..edfcdf103 100644 --- a/ipc/rpc/Cargo.toml +++ b/ipc/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethcore-ipc" -version = "1.7.0" +version = "1.8.0" authors = ["Parity Technologies "] license = "GPL-3.0" diff --git a/ipfs/Cargo.toml b/ipfs/Cargo.toml index fca03d6b8..4b438efe7 100644 --- a/ipfs/Cargo.toml +++ b/ipfs/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Parity IPFS-compatible API" name = "parity-ipfs-api" -version = "1.7.0" +version = "1.8.0" license = "GPL-3.0" authors = ["Parity Technologies "] diff --git a/js/Cargo.toml b/js/Cargo.toml index 71683b899..cf7ba957b 100644 --- a/js/Cargo.toml +++ b/js/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Parity built-in dapps." name = "parity-ui-dev" -version = "1.7.0" +version = "1.8.0" license = "GPL-3.0" authors = ["Parity Technologies "] build = "build.rs" diff --git a/js/package.json b/js/package.json index d9dfb3159..54382d505 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "parity.js", - "version": "1.7.99", + "version": "1.7.101", "main": "release/index.js", "jsnext:main": "src/index.js", "author": "Parity Team ", @@ -209,7 +209,7 @@ "react-intl": "2.1.5", "react-markdown": "2.4.4", "react-portal": "3.0.0", - "react-qr-reader": "1.0.3", + "react-qr-reader": "1.1.3", "react-redux": "4.4.6", "react-router": "3.0.0", "react-router-redux": "4.0.7", diff --git a/js/src/api/transport/error.js b/js/src/api/transport/error.js index 8f0c0053b..9049705fa 100644 --- a/js/src/api/transport/error.js +++ b/js/src/api/transport/error.js @@ -39,7 +39,7 @@ export const ERROR_CODES = { COMPILATION_ERROR: -32050, ENCRYPTION_ERROR: -32055, FETCH_ERROR: -32060, - INVALID_PARAMS: -32602, + INVALID_PARAMS: -32602 }; export default class TransportError extends ExtendableError { diff --git a/js/src/ui/ConfirmDialog/confirmDialog.js b/js/src/ui/ConfirmDialog/confirmDialog.js index 02f400e93..86f668a28 100644 --- a/js/src/ui/ConfirmDialog/confirmDialog.js +++ b/js/src/ui/ConfirmDialog/confirmDialog.js @@ -69,14 +69,14 @@ export default class ConfirmDialog extends Component { } key='deny' label={ labelDeny || DEFAULT_NO } onClick={ onDeny } />,