Merge branch 'master' into secretstore_kovan

This commit is contained in:
Svyatoslav Nikolsky 2017-11-20 19:58:01 +03:00
commit b5fad300ba
160 changed files with 1616 additions and 1272 deletions

View File

@ -2,11 +2,10 @@ _Before filing a new issue, please **provide the following information**._
> I'm running: > I'm running:
> >
> - **Parity version**: 0.0.0 > - **Which Parity version?**: 0.0.0
> - **Operating system**: Windows / MacOS / Linux > - **Which operating system?**: Windows / MacOS / Linux
> - **And installed**: via installer / homebrew / binaries / from source > - **How installed?**: via installer / homebrew / binaries / from source
> - **Are you fully synchronized?**: no / yes
> - **Did you try to restart the node?**: no / yes
_Your issue description goes here below. Try to include **actual** vs. **expected behavior** and **steps to reproduce** the issue._ _Your issue description goes here below. Try to include **actual** vs. **expected behavior** and **steps to reproduce** the issue._
---

View File

@ -1,3 +1,42 @@
## Parity [v1.8.3](https://github.com/paritytech/parity/releases/tag/v1.8.3) (2017-11-15)
Parity 1.8.3 contains several bug-fixes and removes the ability to deploy built-in multi-signature wallets.
The full list of included changes:
- Backports to beta ([#7043](https://github.com/paritytech/parity/pull/7043))
- pwasm-std update ([#7018](https://github.com/paritytech/parity/pull/7018))
- Version 1.8.3
- Make CLI arguments parsing more backwards compatible ([#7004](https://github.com/paritytech/parity/pull/7004))
- Skip nonce check for gas estimation ([#6997](https://github.com/paritytech/parity/pull/6997))
- Events in WASM runtime ([#6967](https://github.com/paritytech/parity/pull/6967))
- Return decoded seal fields. ([#6932](https://github.com/paritytech/parity/pull/6932))
- Fix serialization of status in transaction receipts. ([#6926](https://github.com/paritytech/parity/pull/6926))
- Windows fixes ([#6921](https://github.com/paritytech/parity/pull/6921))
- Disallow built-in multi-sig deploy (only watch) ([#7014](https://github.com/paritytech/parity/pull/7014))
- Add hint in ActionParams for splitting code/data ([#6968](https://github.com/paritytech/parity/pull/6968))
- Action params and embedded params handling
- Fix name-spaces
## Parity [v1.8.2](https://github.com/paritytech/parity/releases/tag/v1.8.2) (2017-10-26)
Parity 1.8.2 fixes an important potential consensus issue and a few additional minor issues:
- `blockNumber` transaction field is now returned correctly in RPC calls.
- Possible crash when `--force-sealing` option is used.
The full list of included changes:
- Beta Backports ([#6891](https://github.com/paritytech/parity/pull/6891))
- Bump to v1.8.2
- Refactor static context check in CREATE. ([#6886](https://github.com/paritytech/parity/pull/6886))
- Refactor static context check in CREATE.
- Fix wasm.
- Fix serialization of non-localized transactions ([#6868](https://github.com/paritytech/parity/pull/6868))
- Fix serialization of non-localized transactions.
- Return proper SignedTransactions representation.
- Allow force sealing and reseal=0 for non-dev chains. ([#6878](https://github.com/paritytech/parity/pull/6878))
## Parity [v1.8.1](https://github.com/paritytech/parity/releases/tag/v1.8.1) (2017-10-20) ## Parity [v1.8.1](https://github.com/paritytech/parity/releases/tag/v1.8.1) (2017-10-20)
Parity 1.8.1 fixes several bugs with token balances, tweaks snapshot-sync, improves the performance of nodes with huge amounts of accounts and changes the Trezor account derivation path. Parity 1.8.1 fixes several bugs with token balances, tweaks snapshot-sync, improves the performance of nodes with huge amounts of accounts and changes the Trezor account derivation path.
@ -13,7 +52,7 @@ Parity 1.8.1 fixes several bugs with token balances, tweaks snapshot-sync, impro
If you don't want to downgrade or move your funds off your Trezor-device, you can also use the official Trezor application or other wallets allowing to select the derivation path to access the funds. If you don't want to downgrade or move your funds off your Trezor-device, you can also use the official Trezor application or other wallets allowing to select the derivation path to access the funds.
Full list of included changes: The full list of included changes:
- Add ECIP1017 to Morden config ([#6845](https://github.com/paritytech/parity/pull/6845)) - Add ECIP1017 to Morden config ([#6845](https://github.com/paritytech/parity/pull/6845))
- Ethstore optimizations ([#6844](https://github.com/paritytech/parity/pull/6844)) - Ethstore optimizations ([#6844](https://github.com/paritytech/parity/pull/6844))
@ -45,7 +84,7 @@ Further, users upgrading from 1.7 should acknowledge the following changes:
- `trace_filter` RPC method now comes with pagination. [#6312](https://github.com/paritytech/parity/pull/6312) - `trace_filter` RPC method now comes with pagination. [#6312](https://github.com/paritytech/parity/pull/6312)
- Added tracing of rewards on closing blocks. [#6194](https://github.com/paritytech/parity/pull/6194) - Added tracing of rewards on closing blocks. [#6194](https://github.com/paritytech/parity/pull/6194)
Full list of included changes: The full list of included changes:
- Updated ethabi to fix auto-update ([#6771](https://github.com/paritytech/parity/pull/6771)) - Updated ethabi to fix auto-update ([#6771](https://github.com/paritytech/parity/pull/6771))
- Fixed kovan chain validation ([#6760](https://github.com/paritytech/parity/pull/6760)) - Fixed kovan chain validation ([#6760](https://github.com/paritytech/parity/pull/6760))

254
Cargo.lock generated
View File

@ -168,7 +168,7 @@ name = "bloomable"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"hash 0.1.0", "keccak-hash 0.1.0",
] ]
[[package]] [[package]]
@ -284,9 +284,9 @@ dependencies = [
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"ethjson 0.1.0", "ethjson 0.1.0",
"hash 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "keccak-hash 0.1.0",
"rlp 0.2.1",
"rlp_derive 0.1.0", "rlp_derive 0.1.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -459,7 +459,7 @@ version = "1.9.0"
dependencies = [ dependencies = [
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0", "keccak-hash 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -493,12 +493,12 @@ dependencies = [
"evm 0.1.0", "evm 0.1.0",
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"hardware-wallet 1.9.0", "hardware-wallet 1.9.0",
"hash 0.1.0", "hashdb 0.1.1",
"hashdb 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)", "hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"journaldb 0.1.0", "journaldb 0.1.0",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"kvdb-rocksdb 0.1.0", "kvdb-rocksdb 0.1.0",
@ -508,18 +508,18 @@ dependencies = [
"lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"macros 0.1.0", "macros 0.1.0",
"memory-cache 0.1.0", "memory-cache 0.1.0",
"memorydb 0.1.0", "memorydb 0.1.1",
"migration 0.1.0", "migration 0.1.0",
"native-contracts 0.1.0", "native-contracts 0.1.0",
"num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-machine 0.1.0", "parity-machine 0.1.0",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"patricia_trie 0.1.0", "patricia-trie 0.1.0",
"price-info 1.7.0", "price-info 1.7.0",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"rlp_derive 0.1.0", "rlp_derive 0.1.0",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -586,30 +586,30 @@ dependencies = [
"ethcore 1.9.0", "ethcore 1.9.0",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-devtools 1.9.0",
"ethcore-io 1.9.0", "ethcore-io 1.9.0",
"ethcore-network 1.9.0", "ethcore-network 1.9.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"evm 0.1.0", "evm 0.1.0",
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"kvdb-rocksdb 0.1.0", "kvdb-rocksdb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memory-cache 0.1.0", "memory-cache 0.1.0",
"memorydb 0.1.0", "memorydb 0.1.1",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"patricia_trie 0.1.0", "patricia-trie 0.1.0",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"rlp_derive 0.1.0", "rlp_derive 0.1.0",
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"stats 0.1.0", "stats 0.1.0",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"triehash 0.1.0", "triehash 0.1.0",
"vm 0.1.0", "vm 0.1.0",
@ -637,6 +637,7 @@ dependencies = [
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-devtools 1.9.0", "ethcore-devtools 1.9.0",
@ -645,16 +646,16 @@ dependencies = [
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"hash 0.1.0",
"igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.0",
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"path 0.1.0", "path 0.1.0",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -673,7 +674,6 @@ dependencies = [
"ethcore 1.9.0", "ethcore 1.9.0",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-devtools 1.9.0",
"ethcore-logger 1.9.0", "ethcore-logger 1.9.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
@ -681,8 +681,8 @@ dependencies = [
"ethsync 1.9.0", "ethsync 1.9.0",
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-rocksdb 0.1.0", "kvdb-rocksdb 0.1.0",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -693,6 +693,7 @@ dependencies = [
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -707,13 +708,11 @@ version = "1.9.0"
dependencies = [ dependencies = [
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-devtools 1.9.0",
"ethcore-logger 1.9.0", "ethcore-logger 1.9.0",
"ethcore-util 1.9.0", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"hash 0.1.0", "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "keccak-hash 0.1.0",
"jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -731,18 +730,18 @@ dependencies = [
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-logger 1.9.0", "ethcore-logger 1.9.0",
"hash 0.1.0", "hashdb 0.1.1",
"hashdb 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"journaldb 0.1.0", "journaldb 0.1.0",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memorydb 0.1.0", "memorydb 0.1.1",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"patricia_trie 0.1.0", "patricia-trie 0.1.0",
"rlp 0.2.0", "rlp 0.2.1",
"rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)", "rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -848,22 +847,21 @@ dependencies = [
"ethcore 1.9.0", "ethcore 1.9.0",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-devtools 1.9.0",
"ethcore-io 1.9.0", "ethcore-io 1.9.0",
"ethcore-light 1.9.0", "ethcore-light 1.9.0",
"ethcore-network 1.9.0", "ethcore-network 1.9.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"hash 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"macros 0.1.0", "macros 0.1.0",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
@ -878,8 +876,8 @@ dependencies = [
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"evmjit 1.9.0", "evmjit 1.9.0",
"hash 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.0",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memory-cache 0.1.0", "memory-cache 0.1.0",
@ -1026,19 +1024,9 @@ dependencies = [
"trezor-sys 1.0.0 (git+https://github.com/paritytech/trezor-sys)", "trezor-sys 1.0.0 (git+https://github.com/paritytech/trezor-sys)",
] ]
[[package]]
name = "hash"
version = "0.1.0"
dependencies = [
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "hashdb" name = "hashdb"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
@ -1179,6 +1167,11 @@ name = "integer-encoding"
version = "1.0.3" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "interleaved-ordered"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "iovec" name = "iovec"
version = "0.1.0" version = "0.1.0"
@ -1223,22 +1216,22 @@ dependencies = [
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-logger 1.9.0", "ethcore-logger 1.9.0",
"hash 0.1.0", "hashdb 0.1.1",
"hashdb 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memorydb 0.1.0", "memorydb 0.1.1",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"util-error 0.1.0", "util-error 0.1.0",
] ]
[[package]] [[package]]
name = "jsonrpc-core" name = "jsonrpc-core"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1250,11 +1243,11 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-http-server" name = "jsonrpc-http-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1263,10 +1256,10 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-ipc-server" name = "jsonrpc-ipc-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc)", "parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc)",
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1275,19 +1268,19 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-macros" name = "jsonrpc-macros"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "jsonrpc-pubsub" name = "jsonrpc-pubsub"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1295,11 +1288,11 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-server-utils" name = "jsonrpc-server-utils"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1308,10 +1301,10 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-tcp-server" name = "jsonrpc-tcp-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1320,16 +1313,27 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-ws-server" name = "jsonrpc-ws-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ws 0.7.1 (git+https://github.com/tomusdrw/ws-rs)", "ws 0.7.1 (git+https://github.com/tomusdrw/ws-rs)",
] ]
[[package]]
name = "keccak-hash"
version = "0.1.0"
dependencies = [
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "kernel32-sys" name = "kernel32-sys"
version = "0.2.2" version = "0.2.2"
@ -1354,7 +1358,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"kvdb 0.1.0", "kvdb 0.1.0",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
] ]
[[package]] [[package]]
@ -1363,11 +1367,12 @@ version = "0.1.0"
dependencies = [ dependencies = [
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb 0.1.0", "kvdb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)", "rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1508,15 +1513,15 @@ dependencies = [
[[package]] [[package]]
name = "memorydb" name = "memorydb"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"bigint 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bigint 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"hash 0.1.0", "hashdb 0.1.1",
"hashdb 0.1.0",
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "keccak-hash 0.1.0",
"rlp 0.2.1",
] ]
[[package]] [[package]]
@ -1921,11 +1926,11 @@ dependencies = [
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0",
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
"isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"journaldb 0.1.0", "journaldb 0.1.0",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"keccak-hash 0.1.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-rocksdb 0.1.0", "kvdb-rocksdb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1948,7 +1953,7 @@ dependencies = [
"path 0.1.0", "path 0.1.0",
"pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rpc-cli 1.4.0", "rpc-cli 1.4.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1977,10 +1982,10 @@ dependencies = [
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"keccak-hash 0.1.0",
"linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2038,7 +2043,7 @@ dependencies = [
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"fetch 0.1.0", "fetch 0.1.0",
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0", "keccak-hash 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2057,11 +2062,10 @@ dependencies = [
"ethcore 1.9.0", "ethcore 1.9.0",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-util 1.9.0", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
"multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2071,12 +2075,11 @@ version = "0.1.0"
dependencies = [ dependencies = [
"ethcore 1.9.0", "ethcore 1.9.0",
"ethcore-io 1.9.0", "ethcore-io 1.9.0",
"ethcore-util 1.9.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2124,14 +2127,14 @@ dependencies = [
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hardware-wallet 1.9.0", "hardware-wallet 1.9.0",
"hash 0.1.0",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"keccak-hash 0.1.0",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"macros 0.1.0", "macros 0.1.0",
@ -2143,7 +2146,7 @@ dependencies = [
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2152,6 +2155,7 @@ dependencies = [
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"stats 0.1.0", "stats 0.1.0",
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"transient-hashmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "transient-hashmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"vm 0.1.0", "vm 0.1.0",
@ -2162,9 +2166,9 @@ name = "parity-rpc-client"
version = "1.4.0" version = "1.4.0"
dependencies = [ dependencies = [
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "keccak-hash 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-rpc 1.9.0", "parity-rpc 1.9.0",
@ -2227,7 +2231,7 @@ dependencies = [
[[package]] [[package]]
name = "parity-ui-precompiled" name = "parity-ui-precompiled"
version = "1.9.0" version = "1.9.0"
source = "git+https://github.com/paritytech/js-precompiled.git#31b526f7ec289801a96100e80f19c4cbe850276b" source = "git+https://github.com/paritytech/js-precompiled.git#5b3e31509c369f558c8cb90f6f9918e50cdb2501"
dependencies = [ dependencies = [
"parity-dapps-glue 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2273,15 +2277,15 @@ dependencies = [
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 0.5.0 (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.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"ring 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.9.7 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2327,19 +2331,19 @@ name = "path"
version = "0.1.0" version = "0.1.0"
[[package]] [[package]]
name = "patricia_trie" name = "patricia-trie"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-logger 1.9.0", "ethcore-logger 1.9.0",
"hash 0.1.0", "hashdb 0.1.1",
"hashdb 0.1.0", "keccak-hash 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memorydb 0.1.0", "memorydb 0.1.1",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"triehash 0.1.0", "triehash 0.1.0",
] ]
@ -2617,7 +2621,7 @@ dependencies = [
[[package]] [[package]]
name = "rlp" name = "rlp"
version = "0.2.0" version = "0.2.1"
dependencies = [ dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2631,7 +2635,7 @@ name = "rlp_derive"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.1",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2940,6 +2944,7 @@ name = "snappy"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)",
] ]
[[package]] [[package]]
@ -3247,8 +3252,8 @@ name = "triehash"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"hash 0.1.0", "keccak-hash 0.1.0",
"rlp 0.2.0", "rlp 0.2.1",
] ]
[[package]] [[package]]
@ -3351,7 +3356,7 @@ dependencies = [
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"kvdb 0.1.0", "kvdb 0.1.0",
"rlp 0.2.0", "rlp 0.2.1",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3398,10 +3403,10 @@ dependencies = [
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"ethjson 0.1.0", "ethjson 0.1.0",
"hash 0.1.0", "keccak-hash 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"patricia_trie 0.1.0", "patricia-trie 0.1.0",
"rlp 0.2.0", "rlp 0.2.1",
] ]
[[package]] [[package]]
@ -3581,19 +3586,20 @@ dependencies = [
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
"checksum igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "356a0dc23a4fa0f8ce4777258085d00a01ea4923b2efd93538fc44bf5e1bda76" "checksum igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "356a0dc23a4fa0f8ce4777258085d00a01ea4923b2efd93538fc44bf5e1bda76"
"checksum integer-encoding 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a053c9c7dcb7db1f2aa012c37dc176c62e4cdf14898dee0eecc606de835b8acb" "checksum integer-encoding 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a053c9c7dcb7db1f2aa012c37dc176c62e4cdf14898dee0eecc606de835b8acb"
"checksum interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "141340095b15ed7491bd3d4ced9d20cebfb826174b6bb03386381f62b01e3d77"
"checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be" "checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be"
"checksum ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)" = "2134e210e2a024b5684f90e1556d5f71a1ce7f8b12e9ac9924c67fb36f63b336" "checksum ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)" = "2134e210e2a024b5684f90e1556d5f71a1ce7f8b12e9ac9924c67fb36f63b336"
"checksum isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fa500db770a99afe2a0f2229be2a3d09c7ed9d7e4e8440bf71253141994e240f" "checksum isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fa500db770a99afe2a0f2229be2a3d09c7ed9d7e4e8440bf71253141994e240f"
"checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc" "checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc"
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
"checksum jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"

View File

@ -31,7 +31,7 @@ futures-cpupool = "0.1"
fdlimit = "0.1" fdlimit = "0.1"
ws2_32-sys = "0.2" ws2_32-sys = "0.2"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" } ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethsync = { path = "sync" } ethsync = { path = "sync" }
ethcore = { path = "ethcore" } ethcore = { path = "ethcore" }
ethcore-util = { path = "util" } ethcore-util = { path = "util" }
@ -58,7 +58,7 @@ parity-updater = { path = "updater" }
parity-whisper = { path = "whisper" } parity-whisper = { path = "whisper" }
path = { path = "util/path" } path = { path = "util/path" }
panic_hook = { path = "panic_hook" } panic_hook = { path = "panic_hook" }
hash = { path = "util/hash" } keccak-hash = { path = "util/hash" }
migration = { path = "util/migration" } migration = { path = "util/migration" }
kvdb = { path = "util/kvdb" } kvdb = { path = "util/kvdb" }
kvdb-rocksdb = { path = "util/kvdb-rocksdb" } kvdb-rocksdb = { path = "util/kvdb-rocksdb" }

View File

@ -25,8 +25,8 @@ unicase = "1.4"
zip = { version = "0.1", default-features = false } zip = { version = "0.1", default-features = false }
itertools = "0.5" itertools = "0.5"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-bigint = { path = "../util/bigint" } ethcore-bigint = { path = "../util/bigint" }
@ -36,7 +36,7 @@ node-health = { path = "./node-health" }
parity-hash-fetch = { path = "../hash-fetch" } parity-hash-fetch = { path = "../hash-fetch" }
parity-reactor = { path = "../util/reactor" } parity-reactor = { path = "../util/reactor" }
parity-ui = { path = "./ui" } parity-ui = { path = "./ui" }
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}

View File

@ -18,7 +18,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::BoxFuture; use futures::Future;
use hyper; use hyper;
#[derive(Debug, PartialEq, Default, Clone)] #[derive(Debug, PartialEq, Default, Clone)]
@ -47,7 +47,7 @@ pub struct EndpointInfo {
} }
pub type Endpoints = BTreeMap<String, Box<Endpoint>>; pub type Endpoints = BTreeMap<String, Box<Endpoint>>;
pub type Response = BoxFuture<hyper::Response, hyper::Error>; pub type Response = Box<Future<Item=hyper::Response, Error=hyper::Error> + Send>;
pub type Request = hyper::Request; pub type Request = hyper::Request;
pub trait Endpoint : Send + Sync { pub trait Endpoint : Send + Sync {

View File

@ -24,7 +24,6 @@ use fetch::{self, Fetch};
use futures::sync::oneshot; use futures::sync::oneshot;
use futures::{self, Future}; use futures::{self, Future};
use hyper::{self, Method, StatusCode}; use hyper::{self, Method, StatusCode};
use jsonrpc_core::BoxFuture;
use parking_lot::Mutex; use parking_lot::Mutex;
use endpoint::{self, EndpointPath}; use endpoint::{self, EndpointPath};
@ -212,7 +211,7 @@ impl Errors {
enum FetchState { enum FetchState {
Error(ContentHandler), Error(ContentHandler),
InProgress(BoxFuture<FetchState, ()>), InProgress(Box<Future<Item=FetchState, Error=()> + Send>),
Streaming(hyper::Response), Streaming(hyper::Response),
Done(local::Dapp, endpoint::Response), Done(local::Dapp, endpoint::Response),
Empty, Empty,
@ -289,7 +288,7 @@ impl ContentFetcherHandler {
path: EndpointPath, path: EndpointPath,
errors: Errors, errors: Errors,
installer: H, installer: H,
) -> BoxFuture<FetchState, ()> { ) -> Box<Future<Item=FetchState, Error=()> + Send> {
// Start fetching the content // Start fetching the content
let fetch2 = fetch.clone(); let fetch2 = fetch.clone();
let future = fetch.fetch_with_abort(url, abort.into()).then(move |result| { let future = fetch.fetch_with_abort(url, abort.into()).then(move |result| {

View File

@ -32,7 +32,6 @@ extern crate serde_json;
extern crate unicase; extern crate unicase;
extern crate zip; extern crate zip;
extern crate jsonrpc_core;
extern crate jsonrpc_http_server; extern crate jsonrpc_http_server;
extern crate ethcore_util as util; extern crate ethcore_util as util;
@ -43,7 +42,7 @@ extern crate node_health;
extern crate parity_dapps_glue as parity_dapps; extern crate parity_dapps_glue as parity_dapps;
extern crate parity_hash_fetch as hash_fetch; extern crate parity_hash_fetch as hash_fetch;
extern crate parity_ui; extern crate parity_ui;
extern crate hash; extern crate keccak_hash as hash;
#[macro_use] #[macro_use]
extern crate futures; extern crate futures;
@ -52,10 +51,12 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
#[cfg(test)]
extern crate env_logger;
#[cfg(test)] #[cfg(test)]
extern crate ethcore_devtools as devtools; extern crate ethcore_devtools as devtools;
#[cfg(test)] #[cfg(test)]
extern crate env_logger; extern crate jsonrpc_core;
#[cfg(test)] #[cfg(test)]
extern crate parity_reactor; extern crate parity_reactor;

View File

@ -14,8 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::env; use std::{env, io, str};
use std::str;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::Arc; use std::sync::Arc;
@ -187,7 +186,7 @@ impl<T: Fetch> ServerBuilder<T> {
/// Asynchronously start server with no authentication, /// Asynchronously start server with no authentication,
/// returns result with `Server` handle on success or an error. /// returns result with `Server` handle on success or an error.
pub fn start_unsecured_http(self, addr: &SocketAddr, io: IoHandler) -> Result<Server, http::Error> { pub fn start_unsecured_http(self, addr: &SocketAddr, io: IoHandler) -> io::Result<Server> {
let fetch = self.fetch_client(); let fetch = self.fetch_client();
Server::start_http( Server::start_http(
addr, addr,
@ -234,7 +233,7 @@ impl Server {
remote: Remote, remote: Remote,
fetch: F, fetch: F,
serve_ui: bool, serve_ui: bool,
) -> Result<Server, http::Error> { ) -> io::Result<Server> {
let health = NodeHealth::new( let health = NodeHealth::new(
sync_status.clone(), sync_status.clone(),
TimeChecker::new::<String>(&[], CpuPool::new(1)), TimeChecker::new::<String>(&[], CpuPool::new(1)),

View File

@ -1,23 +1,26 @@
### Parity [v1.7.8](https://github.com/paritytech/parity/releases/tag/v1.7.8) (2017-10-27) ### Parity [v1.7.9](https://github.com/paritytech/parity/releases/tag/v1.7.9) (2017-11-14)
- [stable] Refactor static context check in CREATE ([#6889](https://github.com/paritytech/parity/pull/6889)) Parity 1.7.9 removes the ability to deploy built-in multi-signature wallets.
- Fix #6228: do not display eth price in cli for etc ([#6877](https://github.com/paritytech/parity/pull/6877))
- Fix mining help ([#6885](https://github.com/paritytech/parity/pull/6885)) The full list of included changes:
- [stable] v1.7.8 ([#6890](https://github.com/paritytech/parity/pull/6890))
- Refactor static context check in CREATE. ([#6886](https://github.com/paritytech/parity/pull/6886)) - Bump to v1.7.9 ([#7047](https://github.com/paritytech/parity/pull/7047))
- Cleanup some configuration options ([#6878](https://github.com/paritytech/parity/pull/6878)) - Disallow built-in multi-sig deploy (only watch) ([#7017](https://github.com/paritytech/parity/pull/7017))
- Fix serialization of non-localized transactions ([#6868](https://github.com/paritytech/parity/pull/6868))
- Updated NTP to version 0.3 ([#6854](https://github.com/paritytech/parity/pull/6854)) ### Parity [v1.7.8](https://github.com/paritytech/parity/releases/tag/v1.7.8) (2017-10-26)
- Align README with 1.8 and prepare CHANGELOG with 1.8.1 ([#6833](https://github.com/paritytech/parity/pull/6833))
- Return error on timed unlock ([#6777](https://github.com/paritytech/parity/pull/6777)) Parity 1.7.8 fixes a critical Byzantium consensus issue. Update is highly recommended.
- Fix dapps tests in master ([#6866](https://github.com/paritytech/parity/pull/6866))
- [Beta] Add ECIP1017 to Morden config (#6810) ([#6845](https://github.com/paritytech/parity/pull/6845)) The full list of included changes:
- Refactor static context check in CREATE ([#6889](https://github.com/paritytech/parity/pull/6889))
- Bump to v1.7.8 ([#6890](https://github.com/paritytech/parity/pull/6890))
## Parity [v1.7.7](https://github.com/paritytech/parity/releases/tag/v1.7.7) (2017-10-15) ## Parity [v1.7.7](https://github.com/paritytech/parity/releases/tag/v1.7.7) (2017-10-15)
Parity 1.7.7 Fixes an issue with auto-update system. Updating is recommended, but not required for Byzantium. Parity 1.7.7 fixes an issue with auto-update system. Updating is recommended, but not required for Byzantium.
Full list of included changes: The full list of included changes:
- Fix auto-update ([#6769](https://github.com/paritytech/parity/pull/6759)) - Fix auto-update ([#6769](https://github.com/paritytech/parity/pull/6759))
- Bump to v1.7.7 - Bump to v1.7.7
@ -28,7 +31,7 @@ Full list of included changes:
Parity 1.7.6 includes a critical consensus-relevant fix for the Byzantium hard-fork. Please upgrade your Ethereum client before block number `4_370_000`. Parity 1.7.6 includes a critical consensus-relevant fix for the Byzantium hard-fork. Please upgrade your Ethereum client before block number `4_370_000`.
Full list of included changes: The full list of included changes:
- Fixed modexp gas calculation overflow ([#6746](https://github.com/paritytech/parity/pull/6746)) - Fixed modexp gas calculation overflow ([#6746](https://github.com/paritytech/parity/pull/6746))
- Fixed modexp gas calculation overflow ([#6741](https://github.com/paritytech/parity/pull/6741)) - Fixed modexp gas calculation overflow ([#6741](https://github.com/paritytech/parity/pull/6741))
@ -40,7 +43,7 @@ Parity 1.7.5 includes a critical consensus-relevant fix for the Byzantium hard-f
Parity 1.7.5 is the first stable release of the 1.7 branch. With this release the support for 1.6 releases ends. Please upgrade your stable nodes to 1.7.5. Parity 1.7.5 is the first stable release of the 1.7 branch. With this release the support for 1.6 releases ends. Please upgrade your stable nodes to 1.7.5.
Full list of included changes: The full list of included changes:
- Backport stable - Fixes Badges ([#6731](https://github.com/paritytech/parity/pull/6731)) - Backport stable - Fixes Badges ([#6731](https://github.com/paritytech/parity/pull/6731))
- Fix badges not showing up ([#6730](https://github.com/paritytech/parity/pull/6730)) - Fix badges not showing up ([#6730](https://github.com/paritytech/parity/pull/6730))
@ -67,7 +70,7 @@ Full list of included changes:
Parity 1.7.4 includes a critical consensus-relevant fix for the Byzantium hard-fork. Please upgrade your Ethereum client before block number `4_370_000`. Parity 1.7.4 includes a critical consensus-relevant fix for the Byzantium hard-fork. Please upgrade your Ethereum client before block number `4_370_000`.
Full list of included changes: The full list of included changes:
- Backport ([#6715](https://github.com/paritytech/parity/pull/6715)) - Backport ([#6715](https://github.com/paritytech/parity/pull/6715))
- Fix estimate gas if from is not provided. ([#6714](https://github.com/paritytech/parity/pull/6714)) - Fix estimate gas if from is not provided. ([#6714](https://github.com/paritytech/parity/pull/6714))
@ -95,7 +98,7 @@ Parity 1.7.3 enables the Byzantium fork for Ethereum main network on Block 4_370
- Revised timeout and batch size constants for bigger blocks. - Revised timeout and batch size constants for bigger blocks.
- Renamed RPC receipt `statusCode` field to `status`. - Renamed RPC receipt `statusCode` field to `status`.
Full list of included changes: The full list of included changes:
- Backporting ([#6676](https://github.com/paritytech/parity/pull/6676)) - Backporting ([#6676](https://github.com/paritytech/parity/pull/6676))
- Fix wallet view ([#6597](https://github.com/paritytech/parity/pull/6597)) - Fix wallet view ([#6597](https://github.com/paritytech/parity/pull/6597))
@ -143,7 +146,7 @@ Parity 1.7.2 is a bug-fix release to improve performance and stability. Among ot
- Tweaked warp-sync to quickly catch up with chains fallen back more than 10,000 blocks. - Tweaked warp-sync to quickly catch up with chains fallen back more than 10,000 blocks.
- Fixes to the Chrome extension and macOS installer upgrades. - Fixes to the Chrome extension and macOS installer upgrades.
Full list of included changes: The full list of included changes:
- Fix output from eth_call. ([#6538](https://github.com/paritytech/parity/pull/6538)) - Fix output from eth_call. ([#6538](https://github.com/paritytech/parity/pull/6538))
- Ropsten fork ([#6532](https://github.com/paritytech/parity/pull/6532)) - Ropsten fork ([#6532](https://github.com/paritytech/parity/pull/6532))
@ -294,7 +297,7 @@ Parity 1.7.0 is a major release introducing several important features:
- **PubSub API**. https://github.com/paritytech/parity/wiki/JSONRPC-Parity-Pub-Sub-module - **PubSub API**. https://github.com/paritytech/parity/wiki/JSONRPC-Parity-Pub-Sub-module
- **Signer apps for IOS and Android**. - **Signer apps for IOS and Android**.
Full list of included changes: The full list of included changes:
- Backports [#6163](https://github.com/paritytech/parity/pull/6163) - Backports [#6163](https://github.com/paritytech/parity/pull/6163)
- Light client improvements ([#6156](https://github.com/paritytech/parity/pull/6156)) - Light client improvements ([#6156](https://github.com/paritytech/parity/pull/6156))

View File

@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
log = "0.3" log = "0.3"
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
primal = "0.2.3" primal = "0.2.3"
parking_lot = "0.4" parking_lot = "0.4"
crunchy = "0.1.0" crunchy = "0.1.0"

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
extern crate hash; extern crate keccak_hash as hash;
pub type H256 = [u8; 32]; pub type H256 = [u8; 32];

View File

@ -19,7 +19,7 @@ ethcore-bloom-journal = { path = "../util/bloom" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
hashdb = { path = "../util/hashdb" } hashdb = { path = "../util/hashdb" }
memorydb = { path = "../util/memorydb" } memorydb = { path = "../util/memorydb" }
patricia_trie = { path = "../util/patricia_trie" } patricia-trie = { path = "../util/patricia_trie" }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore-logger = { path = "../logger" } ethcore-logger = { path = "../logger" }
@ -67,7 +67,7 @@ table = { path = "../util/table" }
bloomable = { path = "../util/bloomable" } bloomable = { path = "../util/bloomable" }
vm = { path = "vm" } vm = { path = "vm" }
wasm = { path = "wasm" } wasm = { path = "wasm" }
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
triehash = { path = "../util/triehash" } triehash = { path = "../util/triehash" }
semantic_version = { path = "../util/semantic_version" } semantic_version = { path = "../util/semantic_version" }
unexpected = { path = "../util/unexpected" } unexpected = { path = "../util/unexpected" }

View File

@ -12,7 +12,7 @@ heapsize = "0.4"
lazy_static = "0.2" lazy_static = "0.2"
log = "0.3" log = "0.3"
vm = { path = "../vm" } vm = { path = "../vm" }
hash = { path = "../../util/hash" } keccak-hash = { path = "../../util/hash" }
parking_lot = "0.4" parking_lot = "0.4"
memory-cache = { path = "../../util/memory_cache" } memory-cache = { path = "../../util/memory_cache" }

View File

@ -22,7 +22,7 @@ extern crate ethcore_bigint as bigint;
extern crate parking_lot; extern crate parking_lot;
extern crate heapsize; extern crate heapsize;
extern crate vm; extern crate vm;
extern crate hash; extern crate keccak_hash as hash;
extern crate memory_cache; extern crate memory_cache;
#[macro_use] #[macro_use]

View File

@ -13,10 +13,9 @@ ethcore-util = { path = "../../util" }
ethcore-bigint = { path = "../../util/bigint" } ethcore-bigint = { path = "../../util/bigint" }
ethcore-bytes = { path = "../../util/bytes" } ethcore-bytes = { path = "../../util/bytes" }
memorydb = { path = "../../util/memorydb" } memorydb = { path = "../../util/memorydb" }
patricia_trie = { path = "../../util/patricia_trie" } patricia-trie = { path = "../../util/patricia_trie" }
ethcore-network = { path = "../../util/network" } ethcore-network = { path = "../../util/network" }
ethcore-io = { path = "../../util/io" } ethcore-io = { path = "../../util/io" }
ethcore-devtools = { path = "../../devtools" }
evm = { path = "../evm" } evm = { path = "../evm" }
heapsize = "0.4" heapsize = "0.4"
vm = { path = "../vm" } vm = { path = "../vm" }
@ -32,12 +31,15 @@ serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
parking_lot = "0.4" parking_lot = "0.4"
stats = { path = "../../util/stats" } stats = { path = "../../util/stats" }
hash = { path = "../../util/hash" } keccak-hash = { path = "../../util/hash" }
triehash = { path = "../../util/triehash" } triehash = { path = "../../util/triehash" }
kvdb = { path = "../../util/kvdb" } kvdb = { path = "../../util/kvdb" }
kvdb-rocksdb = { path = "../../util/kvdb-rocksdb" } kvdb-rocksdb = { path = "../../util/kvdb-rocksdb" }
kvdb-memorydb = { path = "../../util/kvdb-memorydb" } kvdb-memorydb = { path = "../../util/kvdb-memorydb" }
memory-cache = { path = "../../util/memory_cache" } memory-cache = { path = "../../util/memory_cache" }
[dev-dependencies]
tempdir = "0.3"
[features] [features]
default = [] default = []

View File

@ -120,7 +120,6 @@ impl<T: ChainDataFetcher> IoHandler<ClientIoMessage> for ImportBlocks<T> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::Service; use super::Service;
use devtools::RandomTempPath;
use ethcore::spec::Spec; use ethcore::spec::Spec;
use std::sync::Arc; use std::sync::Arc;
@ -128,13 +127,14 @@ mod tests {
use client::fetch; use client::fetch;
use time::Duration; use time::Duration;
use parking_lot::Mutex; use parking_lot::Mutex;
use tempdir::TempDir;
#[test] #[test]
fn it_works() { fn it_works() {
let tempdir = TempDir::new("").unwrap();
let spec = Spec::new_test(); let spec = Spec::new_test();
let temp_path = RandomTempPath::new();
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::hours(6)))); let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::hours(6))));
Service::start(Default::default(), &spec, fetch::unavailable(), temp_path.as_path(), cache).unwrap(); Service::start(Default::default(), &spec, fetch::unavailable(), tempdir.path(), cache).unwrap();
} }
} }

View File

@ -76,7 +76,7 @@ extern crate smallvec;
extern crate stats; extern crate stats;
extern crate time; extern crate time;
extern crate vm; extern crate vm;
extern crate hash; extern crate keccak_hash as hash;
extern crate triehash; extern crate triehash;
extern crate kvdb; extern crate kvdb;
extern crate kvdb_memorydb; extern crate kvdb_memorydb;
@ -84,4 +84,4 @@ extern crate kvdb_rocksdb;
extern crate memory_cache; extern crate memory_cache;
#[cfg(test)] #[cfg(test)]
extern crate ethcore_devtools as devtools; extern crate tempdir;

View File

@ -17,10 +17,8 @@
//! Defines error types and levels of punishment to use upon //! Defines error types and levels of punishment to use upon
//! encountering. //! encountering.
use rlp::DecoderError;
use network::NetworkError;
use std::fmt; use std::fmt;
use {rlp, network};
/// Levels of punishment. /// Levels of punishment.
/// ///
@ -41,9 +39,9 @@ pub enum Punishment {
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
/// An RLP decoding error. /// An RLP decoding error.
Rlp(DecoderError), Rlp(rlp::DecoderError),
/// A network error. /// A network error.
Network(NetworkError), Network(network::Error),
/// Out of credits. /// Out of credits.
NoCredits, NoCredits,
/// Unrecognized packet code. /// Unrecognized packet code.
@ -92,14 +90,14 @@ impl Error {
} }
} }
impl From<DecoderError> for Error { impl From<rlp::DecoderError> for Error {
fn from(err: DecoderError) -> Self { fn from(err: rlp::DecoderError) -> Self {
Error::Rlp(err) Error::Rlp(err)
} }
} }
impl From<NetworkError> for Error { impl From<network::Error> for Error {
fn from(err: NetworkError) -> Self { fn from(err: network::Error) -> Self {
Error::Network(err) Error::Network(err)
} }
} }

View File

@ -264,8 +264,9 @@ mod tests {
#[test] #[test]
fn file_store() { fn file_store() {
let path = ::devtools::RandomTempPath::new(); let tempdir = ::tempdir::TempDir::new("").unwrap();
let store = FileStore(path.as_path().clone()); let path = tempdir.path().join("file");
let store = FileStore(path);
let mut samples = store.load(); let mut samples = store.load();
assert!(samples.is_empty()); assert!(samples.is_empty());

View File

@ -23,7 +23,8 @@
] ]
}, },
"validateScoreTransition": 1000000, "validateScoreTransition": 1000000,
"validateStepTransition": 1500000 "validateStepTransition": 1500000,
"maximumUncleCount": 2
} }
} }
}, },

View File

@ -65,6 +65,8 @@ pub struct AuthorityRoundParams {
pub immediate_transitions: bool, pub immediate_transitions: bool,
/// Block reward in base units. /// Block reward in base units.
pub block_reward: U256, pub block_reward: U256,
/// Number of accepted uncles.
pub maximum_uncle_count: usize,
} }
impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams { impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
@ -77,6 +79,7 @@ impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
validate_step_transition: p.validate_step_transition.map_or(0, Into::into), validate_step_transition: p.validate_step_transition.map_or(0, Into::into),
immediate_transitions: p.immediate_transitions.unwrap_or(false), immediate_transitions: p.immediate_transitions.unwrap_or(false),
block_reward: p.block_reward.map_or_else(Default::default, Into::into), block_reward: p.block_reward.map_or_else(Default::default, Into::into),
maximum_uncle_count: p.maximum_uncle_count.map_or(0, Into::into),
} }
} }
} }
@ -218,6 +221,7 @@ pub struct AuthorityRound {
epoch_manager: Mutex<EpochManager>, epoch_manager: Mutex<EpochManager>,
immediate_transitions: bool, immediate_transitions: bool,
block_reward: U256, block_reward: U256,
maximum_uncle_count: usize,
machine: EthereumMachine, machine: EthereumMachine,
} }
@ -365,6 +369,7 @@ impl AuthorityRound {
epoch_manager: Mutex::new(EpochManager::blank()), epoch_manager: Mutex::new(EpochManager::blank()),
immediate_transitions: our_params.immediate_transitions, immediate_transitions: our_params.immediate_transitions,
block_reward: our_params.block_reward, block_reward: our_params.block_reward,
maximum_uncle_count: our_params.maximum_uncle_count,
machine: machine, machine: machine,
}); });
@ -436,6 +441,8 @@ impl Engine<EthereumMachine> for AuthorityRound {
] ]
} }
fn maximum_uncle_count(&self) -> usize { self.maximum_uncle_count }
fn populate_from_parent(&self, header: &mut Header, parent: &Header) { fn populate_from_parent(&self, header: &mut Header, parent: &Header) {
// Chain scoring: total weight is sqrt(U256::max_value())*height - step // Chain scoring: total weight is sqrt(U256::max_value())*height - step
let new_difficulty = U256::from(U128::max_value()) + header_step(parent).expect("Header has been verified; qed").into() - self.step.load().into(); let new_difficulty = U256::from(U128::max_value()) + header_step(parent).expect("Header has been verified; qed").into() - self.step.load().into();
@ -949,6 +956,7 @@ mod tests {
validate_score_transition: 0, validate_score_transition: 0,
validate_step_transition: 0, validate_step_transition: 0,
immediate_transitions: true, immediate_transitions: true,
maximum_uncle_count: 0,
block_reward: Default::default(), block_reward: Default::default(),
}; };

View File

@ -192,7 +192,7 @@ pub trait Engine<M: Machine>: Sync + Send {
fn extra_info(&self, _header: &M::Header) -> BTreeMap<String, String> { BTreeMap::new() } fn extra_info(&self, _header: &M::Header) -> BTreeMap<String, String> { BTreeMap::new() }
/// Maximum number of uncles a block is allowed to declare. /// Maximum number of uncles a block is allowed to declare.
fn maximum_uncle_count(&self) -> usize { 2 } fn maximum_uncle_count(&self) -> usize { 0 }
/// The number of generations back that uncles can be. /// The number of generations back that uncles can be.
fn maximum_uncle_age(&self) -> usize { 6 } fn maximum_uncle_age(&self) -> usize { 6 }

View File

@ -95,6 +95,8 @@ impl<M: WithBalances> Engine<M> for NullEngine<M> {
self.machine.note_rewards(block, &[(author, result_block_reward)], &uncle_rewards) self.machine.note_rewards(block, &[(author, result_block_reward)], &uncle_rewards)
} }
fn maximum_uncle_count(&self) -> usize { 2 }
fn verify_local_seal(&self, _header: &M::Header) -> Result<(), M::Error> { fn verify_local_seal(&self, _header: &M::Header) -> Result<(), M::Error> {
Ok(()) Ok(())
} }

View File

@ -181,6 +181,8 @@ impl Engine<EthereumMachine> for Arc<Ethash> {
} }
} }
fn maximum_uncle_count(&self) -> usize { 2 }
fn populate_from_parent(&self, header: &mut Header, parent: &Header) { fn populate_from_parent(&self, header: &mut Header, parent: &Header) {
let difficulty = self.calculate_difficulty(header, parent); let difficulty = self.calculate_difficulty(header, parent);
header.set_difficulty(difficulty); header.set_difficulty(difficulty);

View File

@ -103,7 +103,7 @@ extern crate price_info;
extern crate rand; extern crate rand;
extern crate rayon; extern crate rayon;
extern crate rlp; extern crate rlp;
extern crate hash; extern crate keccak_hash as hash;
extern crate heapsize; extern crate heapsize;
extern crate memorydb; extern crate memorydb;
extern crate patricia_trie as trie; extern crate patricia_trie as trie;

View File

@ -12,7 +12,7 @@ ethcore-util = { path = "../../util" }
ethcore-bigint = { path = "../../util/bigint" } ethcore-bigint = { path = "../../util/bigint" }
ethjson = { path = "../../json" } ethjson = { path = "../../json" }
bloomable = { path = "../../util/bloomable" } bloomable = { path = "../../util/bloomable" }
hash = { path = "../../util/hash" } keccak-hash = { path = "../../util/hash" }
heapsize = "0.4" heapsize = "0.4"
[dev-dependencies] [dev-dependencies]

View File

@ -24,7 +24,7 @@ extern crate rlp;
#[macro_use] #[macro_use]
extern crate rlp_derive; extern crate rlp_derive;
extern crate bloomable; extern crate bloomable;
extern crate hash; extern crate keccak_hash as hash;
extern crate heapsize; extern crate heapsize;
#[cfg(test)] #[cfg(test)]

View File

@ -8,9 +8,9 @@ byteorder = "1.0"
ethcore-util = { path = "../../util" } ethcore-util = { path = "../../util" }
ethcore-bytes = { path = "../../util/bytes" } ethcore-bytes = { path = "../../util/bytes" }
ethcore-bigint = { path = "../../util/bigint" } ethcore-bigint = { path = "../../util/bigint" }
patricia_trie = { path = "../../util/patricia_trie" } patricia-trie = { path = "../../util/patricia_trie" }
log = "0.3" log = "0.3"
common-types = { path = "../types" } common-types = { path = "../types" }
ethjson = { path = "../../json" } ethjson = { path = "../../json" }
rlp = { path = "../../util/rlp" } rlp = { path = "../../util/rlp" }
hash = { path = "../../util/hash" } keccak-hash = { path = "../../util/hash" }

View File

@ -22,7 +22,7 @@ extern crate ethcore_bytes as bytes;
extern crate common_types as types; extern crate common_types as types;
extern crate ethjson; extern crate ethjson;
extern crate rlp; extern crate rlp;
extern crate hash; extern crate keccak_hash as hash;
extern crate patricia_trie as trie; extern crate patricia_trie as trie;
mod action_params; mod action_params;

View File

@ -209,8 +209,8 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
let secret = args.arg_secret.parse().map_err(|_| ethstore::Error::InvalidSecret)?; let secret = args.arg_secret.parse().map_err(|_| ethstore::Error::InvalidSecret)?;
let password = load_password(&args.arg_password)?; let password = load_password(&args.arg_password)?;
let vault_ref = open_args_vault(&store, &args)?; let vault_ref = open_args_vault(&store, &args)?;
let address = store.insert_account(vault_ref, secret, &password)?; let account_ref = store.insert_account(vault_ref, secret, &password)?;
Ok(format!("0x{:?}", address)) Ok(format!("0x{:?}", account_ref.address))
} else if args.cmd_change_pwd { } else if args.cmd_change_pwd {
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?; let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
let old_pwd = load_password(&args.arg_old_pwd)?; let old_pwd = load_password(&args.arg_old_pwd)?;
@ -237,8 +237,8 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
let password = load_password(&args.arg_password)?; let password = load_password(&args.arg_password)?;
let kp = wallet.decrypt(&password)?; let kp = wallet.decrypt(&password)?;
let vault_ref = open_args_vault(&store, &args)?; let vault_ref = open_args_vault(&store, &args)?;
let address = store.insert_account(vault_ref, kp.secret().clone(), &password)?; let account_ref = store.insert_account(vault_ref, kp.secret().clone(), &password)?;
Ok(format!("0x{:?}", address)) Ok(format!("0x{:?}", account_ref.address))
} else if args.cmd_remove { } else if args.cmd_remove {
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?; let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
let password = load_password(&args.arg_password)?; let password = load_password(&args.arg_password)?;

View File

@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::iter::repeat;
use std::str; use std::str;
use ethkey::Secret; use ethkey::Secret;
use {json, Error, crypto}; use {json, Error, crypto};
@ -90,9 +89,7 @@ impl Crypto {
// preallocated (on-stack in case of `Secret`) buffer to hold cipher // preallocated (on-stack in case of `Secret`) buffer to hold cipher
// length = length(plain) as we are using CTR-approach // length = length(plain) as we are using CTR-approach
let plain_len = plain.len(); let plain_len = plain.len();
let mut ciphertext: SmallVec<[u8; 32]> = SmallVec::new(); let mut ciphertext: SmallVec<[u8; 32]> = SmallVec::from_vec(vec![0; plain_len]);
ciphertext.grow(plain_len);
ciphertext.extend(repeat(0).take(plain_len));
// aes-128-ctr with initial vector of iv // aes-128-ctr with initial vector of iv
crypto::aes::encrypt(&derived_left_bits, &iv, plain, &mut *ciphertext); crypto::aes::encrypt(&derived_left_bits, &iv, plain, &mut *ciphertext);
@ -143,9 +140,7 @@ impl Crypto {
return Err(Error::InvalidPassword); return Err(Error::InvalidPassword);
} }
let mut plain: SmallVec<[u8; 32]> = SmallVec::new(); let mut plain: SmallVec<[u8; 32]> = SmallVec::from_vec(vec![0; expected_len]);
plain.grow(expected_len);
plain.extend(repeat(0).take(expected_len));
match self.cipher { match self.cipher {
Cipher::Aes128Ctr(ref params) => { Cipher::Aes128Ctr(ref params) => {

View File

@ -19,7 +19,7 @@ ethcore-bigint = { path = "../util/bigint" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
parity-reactor = { path = "../util/reactor" } parity-reactor = { path = "../util/reactor" }
native-contracts = { path = "../ethcore/native_contracts" } native-contracts = { path = "../ethcore/native_contracts" }
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
[dev-dependencies] [dev-dependencies]
ethabi = "4.0" ethabi = "4.0"

View File

@ -25,7 +25,7 @@ extern crate ethcore_util as util;
extern crate ethcore_bigint as bigint; extern crate ethcore_bigint as bigint;
extern crate ethcore_bytes as bytes; extern crate ethcore_bytes as bytes;
extern crate futures; extern crate futures;
extern crate hash; extern crate keccak_hash as hash;
extern crate mime; extern crate mime;
extern crate mime_guess; extern crate mime_guess;
extern crate native_contracts; extern crate native_contracts;

View File

@ -7,11 +7,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethcore-util = { path = "../util" }
ethcore-bigint = { path = "../util/bigint" } ethcore-bigint = { path = "../util/bigint" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
rlp = { path = "../util/rlp" } rlp = { path = "../util/rlp" }
cid = "0.2" cid = "0.2"
multihash = "0.6" multihash = "0.6"

View File

@ -20,7 +20,6 @@ extern crate unicase;
extern crate rlp; extern crate rlp;
extern crate ethcore; extern crate ethcore;
extern crate ethcore_util as util;
extern crate ethcore_bigint as bigint; extern crate ethcore_bigint as bigint;
extern crate ethcore_bytes as bytes; extern crate ethcore_bytes as bytes;
extern crate jsonrpc_core as core; extern crate jsonrpc_core as core;

46
js/package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "Parity", "name": "Parity",
"version": "1.9.9", "version": "1.9.10",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -118,16 +118,16 @@
} }
}, },
"@parity/plugin-signer-account": { "@parity/plugin-signer-account": {
"version": "github:paritytech/plugin-signer-account#a00e131273becccab59e9852ec3313cb0fe19663" "version": "github:paritytech/plugin-signer-account#90ca570e550fe0ff7f06fc9b67426982a083c928"
}, },
"@parity/plugin-signer-default": { "@parity/plugin-signer-default": {
"version": "github:paritytech/plugin-signer-default#54e7fa63063f2dcae409ead222ff87fbcc19f1f9" "version": "github:paritytech/plugin-signer-default#0299349a7ea1aacca9a598057103e6e9cd6f8fa8"
}, },
"@parity/plugin-signer-hardware": { "@parity/plugin-signer-hardware": {
"version": "github:paritytech/plugin-signer-hardware#34b5562062bb1fe8ea6246c06d45624d7f309aa7" "version": "github:paritytech/plugin-signer-hardware#ebdb81997a310709cbd261b7904b0ab93afbf6c8"
}, },
"@parity/plugin-signer-qr": { "@parity/plugin-signer-qr": {
"version": "github:paritytech/plugin-signer-qr#8d937dd5f5d726fb22be72967fd9a472fa467bfd" "version": "github:paritytech/plugin-signer-qr#4ae59a9e6867356596c1d13ae605bcd7934df932"
}, },
"@parity/shared": { "@parity/shared": {
"version": "2.2.5", "version": "2.2.5",
@ -151,9 +151,9 @@
} }
}, },
"@parity/ui": { "@parity/ui": {
"version": "2.2.6", "version": "2.2.13",
"resolved": "https://registry.npmjs.org/@parity/ui/-/ui-2.2.6.tgz", "resolved": "https://registry.npmjs.org/@parity/ui/-/ui-2.2.13.tgz",
"integrity": "sha512-QBvAoD7sjrGCCWet/nb25Md3kub/86x/kim4CYse0qVnsc46myWLB4ijURSXhWnGUaeVJEeQLWr8usSIRk9iIg==", "integrity": "sha512-hMs151GydqeU6fKNt4abptUU91df0GvDzO4I7P9WJ9L/GJYYl2plYZCdhysAg3eYSaKCSMUqD5LZt+JsqoHROQ==",
"requires": { "requires": {
"@parity/api": "2.1.3", "@parity/api": "2.1.3",
"@parity/etherscan": "2.1.3", "@parity/etherscan": "2.1.3",
@ -561,7 +561,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"browserslist": "1.7.7", "browserslist": "1.7.7",
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"normalize-range": "0.1.2", "normalize-range": "0.1.2",
"num2fraction": "1.2.2", "num2fraction": "1.2.2",
"postcss": "5.2.18", "postcss": "5.2.18",
@ -574,7 +574,7 @@
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"electron-to-chromium": "1.3.27" "electron-to-chromium": "1.3.27"
} }
} }
@ -1949,7 +1949,7 @@
"integrity": "sha512-vJEBcDTANoDhSHL46NeOEW5hvQw7It9uCqzeFPQhpawXfnOwnpvW5C97vn1eGJ7iCkSg8wWU0nYObE7d/N95Iw==", "integrity": "sha512-vJEBcDTANoDhSHL46NeOEW5hvQw7It9uCqzeFPQhpawXfnOwnpvW5C97vn1eGJ7iCkSg8wWU0nYObE7d/N95Iw==",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-lite": "1.0.30000760", "caniuse-lite": "1.0.30000764",
"electron-to-chromium": "1.3.27" "electron-to-chromium": "1.3.27"
} }
}, },
@ -2045,7 +2045,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"browserslist": "1.7.7", "browserslist": "1.7.7",
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"lodash.memoize": "4.1.2", "lodash.memoize": "4.1.2",
"lodash.uniq": "4.5.0" "lodash.uniq": "4.5.0"
}, },
@ -2056,22 +2056,22 @@
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"electron-to-chromium": "1.3.27" "electron-to-chromium": "1.3.27"
} }
} }
} }
}, },
"caniuse-db": { "caniuse-db": {
"version": "1.0.30000760", "version": "1.0.30000764",
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000760.tgz", "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000764.tgz",
"integrity": "sha1-PqKUc+t4psywny63Osnh3r/sUo0=", "integrity": "sha1-1zqxGuYvap4vaYZ9bZwjrj8uXY0=",
"dev": true "dev": true
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30000760", "version": "1.0.30000764",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000764.tgz",
"integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=", "integrity": "sha1-l+p0cvnT5pHu3jTyGYPPwhmseEI=",
"dev": true "dev": true
}, },
"caseless": { "caseless": {
@ -3335,7 +3335,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"browserslist": "1.7.7", "browserslist": "1.7.7",
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"css-rule-stream": "1.1.0", "css-rule-stream": "1.1.0",
"duplexer2": "0.0.2", "duplexer2": "0.0.2",
"jsonfilter": "1.1.2", "jsonfilter": "1.1.2",
@ -3354,7 +3354,7 @@
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"electron-to-chromium": "1.3.27" "electron-to-chromium": "1.3.27"
} }
}, },
@ -9128,7 +9128,7 @@
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"electron-to-chromium": "1.3.27" "electron-to-chromium": "1.3.27"
} }
} }
@ -11693,7 +11693,7 @@
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
"dev": true, "dev": true,
"requires": { "requires": {
"caniuse-db": "1.0.30000760", "caniuse-db": "1.0.30000764",
"electron-to-chromium": "1.3.27" "electron-to-chromium": "1.3.27"
} }
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "Parity", "name": "Parity",
"version": "1.9.9", "version": "1.9.10",
"main": "src/index.parity.js", "main": "src/index.parity.js",
"jsnext:main": "src/index.parity.js", "jsnext:main": "src/index.parity.js",
"author": "Parity Team <admin@parity.io>", "author": "Parity Team <admin@parity.io>",
@ -27,7 +27,7 @@
"build:embed": "cross-env EMBED=1 node webpack/embed", "build:embed": "cross-env EMBED=1 node webpack/embed",
"build:i18n": "npm run clean && npm run build && babel-node ./scripts/build-i18n.js", "build:i18n": "npm run clean && npm run build && babel-node ./scripts/build-i18n.js",
"ci:build": "cross-env NODE_ENV=production npm run build", "ci:build": "cross-env NODE_ENV=production npm run build",
"clean": "rimraf ./.build ./.coverage ./.happypack ./build ./node_modules/.cache", "clean": "rimraf ./.build ./.coverage ./.happypack ./build",
"coveralls": "npm run testCoverage && coveralls < coverage/lcov.info", "coveralls": "npm run testCoverage && coveralls < coverage/lcov.info",
"lint": "npm run lint:css && npm run lint:js", "lint": "npm run lint:css && npm run lint:js",
"lint:cached": "npm run lint:css && npm run lint:js:cached", "lint:cached": "npm run lint:css && npm run lint:js:cached",
@ -143,12 +143,12 @@
"@parity/dapp-signaturereg": "paritytech/dapp-signaturereg", "@parity/dapp-signaturereg": "paritytech/dapp-signaturereg",
"@parity/dapp-tokendeploy": "paritytech/dapp-tokendeploy", "@parity/dapp-tokendeploy": "paritytech/dapp-tokendeploy",
"@parity/dapp-tokenreg": "paritytech/dapp-tokenreg", "@parity/dapp-tokenreg": "paritytech/dapp-tokenreg",
"@parity/dapp-vaults": "paritytech/dapp-vaults",
"@parity/dapp-web": "paritytech/dapp-web", "@parity/dapp-web": "paritytech/dapp-web",
"@parity/plugin-signer-account": "paritytech/plugin-signer-account", "@parity/plugin-signer-account": "paritytech/plugin-signer-account",
"@parity/plugin-signer-default": "paritytech/plugin-signer-default", "@parity/plugin-signer-default": "paritytech/plugin-signer-default",
"@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware", "@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware",
"@parity/plugin-signer-qr": "paritytech/plugin-signer-qr", "@parity/plugin-signer-qr": "paritytech/plugin-signer-qr",
"@parity/dapp-vaults": "paritytech/dapp-vaults",
"@parity/shared": "2.2.x", "@parity/shared": "2.2.x",
"@parity/ui": "2.2.x", "@parity/ui": "2.2.x",
"keythereum": "1.0.2", "keythereum": "1.0.2",

View File

@ -189,9 +189,9 @@ $modalZ: 10001;
} }
.header { .header {
/* height: 2em; */ border-radius: 4px 4px 0 0;
padding: 0.5em 1em;
margin-bottom: 0; margin-bottom: 0;
padding: 0.5em 1em;
&::after { &::after {
clear: both; clear: both;

View File

@ -43,6 +43,8 @@ pub struct AuthorityRoundParams {
/// Reward per block in wei. /// Reward per block in wei.
#[serde(rename="blockReward")] #[serde(rename="blockReward")]
pub block_reward: Option<Uint>, pub block_reward: Option<Uint>,
#[serde(rename="maximumUncleCount")]
pub maximum_uncle_count: Option<Uint>,
} }
/// Authority engine deserialization. /// Authority engine deserialization.

View File

@ -5,7 +5,6 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
ethcore-util = { path = "../util" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
rlp = { path = "../util/rlp" } rlp = { path = "../util/rlp" }

View File

@ -29,7 +29,6 @@ use rlp::UntrustedRlp;
use kvdb::KeyValueDB; use kvdb::KeyValueDB;
extern crate ethcore; extern crate ethcore;
extern crate ethcore_util as util;
extern crate ethcore_io as io; extern crate ethcore_io as io;
extern crate rlp; extern crate rlp;
extern crate serde_json; extern crate serde_json;

View File

@ -1,5 +1,5 @@
[package] [package]
description = "Ethcore client." description = "Log implementation for Parity"
name = "ethcore-logger" name = "ethcore-logger"
version = "1.9.0" version = "1.9.0"
license = "GPL-3.0" license = "GPL-3.0"

View File

@ -28,7 +28,7 @@ use bigint::hash::H256;
use util::{version_data, Address}; use util::{version_data, Address};
use bytes::Bytes; use bytes::Bytes;
use ansi_term::Colour; use ansi_term::Colour;
use ethsync::{NetworkConfiguration, validate_node_url, NetworkError}; use ethsync::{NetworkConfiguration, validate_node_url, self};
use ethcore::ethstore::ethkey::{Secret, Public}; use ethcore::ethstore::ethkey::{Secret, Public};
use ethcore::client::{VMType}; use ethcore::client::{VMType};
use ethcore::miner::{MinerOptions, Banning, StratumOptions}; use ethcore::miner::{MinerOptions, Banning, StratumOptions};
@ -700,9 +700,9 @@ impl Configuration {
let lines = buffer.lines().map(|s| s.trim().to_owned()).filter(|s| !s.is_empty() && !s.starts_with("#")).collect::<Vec<_>>(); let lines = buffer.lines().map(|s| s.trim().to_owned()).filter(|s| !s.is_empty() && !s.starts_with("#")).collect::<Vec<_>>();
for line in &lines { for line in &lines {
match validate_node_url(line) { match validate_node_url(line).map(Into::into) {
None => continue, None => continue,
Some(NetworkError::AddressResolve(_)) => return Err(format!("Failed to resolve hostname of a boot node: {}", line)), Some(ethsync::ErrorKind::AddressResolve(_)) => return Err(format!("Failed to resolve hostname of a boot node: {}", line)),
Some(_) => return Err(format!("Invalid node address format given for a boot node: {}", line)), Some(_) => return Err(format!("Invalid node address format given for a boot node: {}", line)),
} }
} }

View File

@ -22,7 +22,6 @@ use ethcore::client::{Client, BlockChainClient, BlockId};
use ethcore::transaction::{Transaction, Action}; use ethcore::transaction::{Transaction, Action};
use ethsync::LightSync; use ethsync::LightSync;
use futures::{future, IntoFuture, Future}; use futures::{future, IntoFuture, Future};
use jsonrpc_core::BoxFuture;
use hash_fetch::fetch::Client as FetchClient; use hash_fetch::fetch::Client as FetchClient;
use hash_fetch::urlhint::ContractClient; use hash_fetch::urlhint::ContractClient;
use helpers::replace_home; use helpers::replace_home;
@ -80,7 +79,7 @@ impl ContractClient for FullRegistrar {
}) })
} }
fn call(&self, address: Address, data: Bytes) -> BoxFuture<Bytes, String> { fn call(&self, address: Address, data: Bytes) -> Box<Future<Item=Bytes, Error=String> + Send> {
Box::new(self.client.call_contract(BlockId::Latest, address, data) Box::new(self.client.call_contract(BlockId::Latest, address, data)
.into_future()) .into_future())
} }
@ -105,7 +104,7 @@ impl<T: LightChainClient + 'static> ContractClient for LightRegistrar<T> {
}) })
} }
fn call(&self, address: Address, data: Bytes) -> BoxFuture<Bytes, String> { fn call(&self, address: Address, data: Bytes) -> Box<Future<Item=Bytes, Error=String> + Send> {
let header = self.client.best_block_header(); let header = self.client.best_block_header();
let env_info = self.client.env_info(BlockId::Hash(header.hash())) let env_info = self.client.env_info(BlockId::Hash(header.hash()))
.ok_or_else(|| format!("Cannot fetch env info for header {}", header.hash())); .ok_or_else(|| format!("Cannot fetch env info for header {}", header.hash()));

View File

@ -29,7 +29,7 @@ use cache::CacheConfig;
use dir::DatabaseDirectories; use dir::DatabaseDirectories;
use upgrade::{upgrade, upgrade_data_paths}; use upgrade::{upgrade, upgrade_data_paths};
use migration::migrate; use migration::migrate;
use ethsync::{validate_node_url, NetworkError}; use ethsync::{validate_node_url, self};
use path; use path;
pub fn to_duration(s: &str) -> Result<Duration, String> { pub fn to_duration(s: &str) -> Result<Duration, String> {
@ -181,9 +181,9 @@ pub fn parity_ipc_path(base: &str, path: &str, shift: u16) -> String {
pub fn to_bootnodes(bootnodes: &Option<String>) -> Result<Vec<String>, String> { pub fn to_bootnodes(bootnodes: &Option<String>) -> Result<Vec<String>, String> {
match *bootnodes { match *bootnodes {
Some(ref x) if !x.is_empty() => x.split(',').map(|s| { Some(ref x) if !x.is_empty() => x.split(',').map(|s| {
match validate_node_url(s) { match validate_node_url(s).map(Into::into) {
None => Ok(s.to_owned()), None => Ok(s.to_owned()),
Some(NetworkError::AddressResolve(_)) => Err(format!("Failed to resolve hostname of a boot node: {}", s)), Some(ethsync::ErrorKind::AddressResolve(_)) => Err(format!("Failed to resolve hostname of a boot node: {}", s)),
Some(_) => Err(format!("Invalid node address format given for a boot node: {}", s)), Some(_) => Err(format!("Invalid node address format given for a boot node: {}", s)),
} }
}).collect(), }).collect(),

View File

@ -75,7 +75,7 @@ extern crate parity_whisper;
extern crate path; extern crate path;
extern crate rpc_cli; extern crate rpc_cli;
extern crate node_filter; extern crate node_filter;
extern crate hash; extern crate keccak_hash as hash;
extern crate journaldb; extern crate journaldb;
#[macro_use] #[macro_use]

View File

@ -17,7 +17,7 @@
use std::sync::Arc; use std::sync::Arc;
use ethcore::client::BlockChainClient; use ethcore::client::BlockChainClient;
use ethsync::{AttachedProtocol, SyncConfig, NetworkConfiguration, NetworkError, Params, ConnectionFilter}; use ethsync::{self, AttachedProtocol, SyncConfig, NetworkConfiguration, Params, ConnectionFilter};
use ethcore::snapshot::SnapshotService; use ethcore::snapshot::SnapshotService;
use light::Provider; use light::Provider;
@ -36,7 +36,7 @@ pub fn sync(
_log_settings: &LogConfig, _log_settings: &LogConfig,
attached_protos: Vec<AttachedProtocol>, attached_protos: Vec<AttachedProtocol>,
connection_filter: Option<Arc<ConnectionFilter>>, connection_filter: Option<Arc<ConnectionFilter>>,
) -> Result<SyncModules, NetworkError> { ) -> Result<SyncModules, ethsync::Error> {
let eth_sync = EthSync::new(Params { let eth_sync = EthSync::new(Params {
config: sync_cfg, config: sync_cfg,
chain: client, chain: client,

View File

@ -246,7 +246,7 @@ pub fn new_ws<D: rpc_apis::Dependencies>(
match start_result { match start_result {
Ok(server) => Ok(Some(server)), Ok(server) => Ok(Some(server)),
Err(rpc::ws::Error::Io(ref err)) if err.kind() == io::ErrorKind::AddrInUse => Err( Err(rpc::ws::Error(rpc::ws::ErrorKind::Io(ref err), _)) if err.kind() == io::ErrorKind::AddrInUse => Err(
format!("WebSockets address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --ws-port and --ws-interface options.", url) format!("WebSockets address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --ws-port and --ws-interface options.", url)
), ),
Err(e) => Err(format!("WebSockets error: {:?}", e)), Err(e) => Err(format!("WebSockets error: {:?}", e)),
@ -286,7 +286,7 @@ pub fn new_http<D: rpc_apis::Dependencies>(
match start_result { match start_result {
Ok(server) => Ok(Some(server)), Ok(server) => Ok(Some(server)),
Err(rpc::HttpServerError::Io(ref err)) if err.kind() == io::ErrorKind::AddrInUse => Err( Err(ref err) if err.kind() == io::ErrorKind::AddrInUse => Err(
format!("{} address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --{}-port and --{}-interface options.", id, url, options, options) format!("{} address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --{}-port and --{}-interface options.", id, url, options, options)
), ),
Err(e) => Err(format!("{} error: {:?}", id, e)), Err(e) => Err(format!("{} error: {:?}", id, e)),

View File

@ -15,8 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::cmp::PartialEq; use std::cmp::PartialEq;
use std::collections::BTreeMap; use std::collections::{BTreeMap, HashSet};
use std::collections::HashSet;
use std::str::FromStr; use std::str::FromStr;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};

View File

@ -24,16 +24,17 @@ serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
time = "0.1" time = "0.1"
tiny-keccak = "1.3"
tokio-timer = "0.1" tokio-timer = "0.1"
transient-hashmap = "0.4" transient-hashmap = "0.4"
itertools = "0.5" itertools = "0.5"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-ipc-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-ipc-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
@ -56,7 +57,7 @@ parity-updater = { path = "../updater" }
rlp = { path = "../util/rlp" } rlp = { path = "../util/rlp" }
stats = { path = "../util/stats" } stats = { path = "../util/stats" }
vm = { path = "../ethcore/vm" } vm = { path = "../ethcore/vm" }
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
hardware-wallet = { path = "../hw" } hardware-wallet = { path = "../hw" }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}

View File

@ -37,6 +37,7 @@ extern crate semver;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate time; extern crate time;
extern crate tiny_keccak;
extern crate tokio_timer; extern crate tokio_timer;
extern crate transient_hashmap; extern crate transient_hashmap;
@ -65,7 +66,7 @@ extern crate parity_reactor;
extern crate parity_updater as updater; extern crate parity_updater as updater;
extern crate rlp; extern crate rlp;
extern crate stats; extern crate stats;
extern crate hash; extern crate keccak_hash as hash;
extern crate hardware_wallet; extern crate hardware_wallet;
#[macro_use] #[macro_use]
@ -117,26 +118,6 @@ use http::tokio_core;
/// RPC HTTP Server instance /// RPC HTTP Server instance
pub type HttpServer = http::Server; pub type HttpServer = http::Server;
/// RPC HTTP Server error
#[derive(Debug)]
pub enum HttpServerError {
/// IO error
Io(::std::io::Error),
/// Other hyper error
Hyper(hyper::Error),
}
impl From<http::Error> for HttpServerError {
fn from(e: http::Error) -> Self {
use self::HttpServerError::*;
match e {
http::Error::Io(io) => Io(io),
http::Error::Other(hyper) => Hyper(hyper),
}
}
}
/// Start http server asynchronously and returns result with `Server` handle on success or an error. /// Start http server asynchronously and returns result with `Server` handle on success or an error.
pub fn start_http<M, S, H, T, R>( pub fn start_http<M, S, H, T, R>(
addr: &SocketAddr, addr: &SocketAddr,
@ -147,7 +128,7 @@ pub fn start_http<M, S, H, T, R>(
extractor: T, extractor: T,
middleware: Option<R>, middleware: Option<R>,
threads: usize, threads: usize,
) -> Result<HttpServer, HttpServerError> where ) -> ::std::io::Result<HttpServer> where
M: jsonrpc_core::Metadata, M: jsonrpc_core::Metadata,
S: jsonrpc_core::Middleware<M>, S: jsonrpc_core::Middleware<M>,
H: Into<jsonrpc_core::MetaIoHandler<M, S>>, H: Into<jsonrpc_core::MetaIoHandler<M, S>>,

View File

@ -42,7 +42,7 @@ use ethcore::transaction::{Action, SignedTransaction, PendingTransaction, Transa
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use crypto::DEFAULT_MAC; use crypto::DEFAULT_MAC;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result, Error};
use jsonrpc_core::futures::{future, Future, Poll, Async}; use jsonrpc_core::futures::{future, Future, Poll, Async};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use v1::helpers::{errors, nonce, TransactionRequest, FilledTransactionRequest, ConfirmationPayload}; use v1::helpers::{errors, nonce, TransactionRequest, FilledTransactionRequest, ConfirmationPayload};
@ -67,18 +67,18 @@ pub trait Dispatcher: Send + Sync + Clone {
/// Fill optional fields of a transaction request, fetching gas price but not nonce. /// Fill optional fields of a transaction request, fetching gas price but not nonce.
fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool) fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool)
-> BoxFuture<FilledTransactionRequest, Error>; -> BoxFuture<FilledTransactionRequest>;
/// Sign the given transaction request without dispatching, fetching appropriate nonce. /// Sign the given transaction request without dispatching, fetching appropriate nonce.
fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith) fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith)
-> BoxFuture<WithToken<SignedTransaction>, Error>; -> BoxFuture<WithToken<SignedTransaction>>;
/// Converts a `SignedTransaction` into `RichRawTransaction` /// Converts a `SignedTransaction` into `RichRawTransaction`
fn enrich(&self, SignedTransaction) -> RpcRichRawTransaction; fn enrich(&self, SignedTransaction) -> RpcRichRawTransaction;
/// "Dispatch" a local transaction. /// "Dispatch" a local transaction.
fn dispatch_transaction(&self, signed_transaction: PendingTransaction) fn dispatch_transaction(&self, signed_transaction: PendingTransaction)
-> Result<H256, Error>; -> Result<H256>;
} }
/// A dispatcher which uses references to a client and miner in order to sign /// A dispatcher which uses references to a client and miner in order to sign
@ -92,7 +92,11 @@ pub struct FullDispatcher<C, M> {
impl<C, M> FullDispatcher<C, M> { impl<C, M> FullDispatcher<C, M> {
/// Create a `FullDispatcher` from Arc references to a client and miner. /// Create a `FullDispatcher` from Arc references to a client and miner.
pub fn new(client: Arc<C>, miner: Arc<M>, nonces: Arc<Mutex<nonce::Reservations>>) -> Self { pub fn new(
client: Arc<C>,
miner: Arc<M>,
nonces: Arc<Mutex<nonce::Reservations>>,
) -> Self {
FullDispatcher { FullDispatcher {
client, client,
miner, miner,
@ -118,7 +122,7 @@ impl<C: MiningBlockChainClient, M: MinerService> FullDispatcher<C, M> {
} }
/// Imports transaction to the miner's queue. /// Imports transaction to the miner's queue.
pub fn dispatch_transaction(client: &C, miner: &M, signed_transaction: PendingTransaction) -> Result<H256, Error> { pub fn dispatch_transaction(client: &C, miner: &M, signed_transaction: PendingTransaction) -> Result<H256> {
let hash = signed_transaction.transaction.hash(); let hash = signed_transaction.transaction.hash();
miner.import_own_transaction(client, signed_transaction) miner.import_own_transaction(client, signed_transaction)
@ -129,7 +133,7 @@ impl<C: MiningBlockChainClient, M: MinerService> FullDispatcher<C, M> {
impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C, M> { impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C, M> {
fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool) fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool)
-> BoxFuture<FilledTransactionRequest, Error> -> BoxFuture<FilledTransactionRequest>
{ {
let request = request; let request = request;
let from = request.from.unwrap_or(default_sender); let from = request.from.unwrap_or(default_sender);
@ -153,7 +157,7 @@ impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C
} }
fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith) fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith)
-> BoxFuture<WithToken<SignedTransaction>, Error> -> BoxFuture<WithToken<SignedTransaction>>
{ {
let chain_id = self.client.signing_chain_id(); let chain_id = self.client.signing_chain_id();
@ -162,7 +166,8 @@ impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C
} }
let state = self.state_nonce(&filled.from); let state = self.state_nonce(&filled.from);
let reserved = self.nonces.lock().reserve_nonce(state); let reserved = self.nonces.lock().reserve(filled.from, state);
Box::new(ProspectiveSigner::new(accounts, filled, chain_id, reserved, password)) Box::new(ProspectiveSigner::new(accounts, filled, chain_id, reserved, password))
} }
@ -171,7 +176,7 @@ impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C
RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition()) RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition())
} }
fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256, Error> { fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256> {
Self::dispatch_transaction(&*self.client, &*self.miner, signed_transaction) Self::dispatch_transaction(&*self.client, &*self.miner, signed_transaction)
} }
} }
@ -183,7 +188,7 @@ pub fn fetch_gas_price_corpus(
client: Arc<LightChainClient>, client: Arc<LightChainClient>,
on_demand: Arc<OnDemand>, on_demand: Arc<OnDemand>,
cache: Arc<Mutex<LightDataCache>>, cache: Arc<Mutex<LightDataCache>>,
) -> BoxFuture<Corpus<U256>, Error> { ) -> BoxFuture<Corpus<U256>> {
const GAS_PRICE_SAMPLE_SIZE: usize = 100; const GAS_PRICE_SAMPLE_SIZE: usize = 100;
if let Some(cached) = { cache.lock().gas_price_corpus() } { if let Some(cached) = { cache.lock().gas_price_corpus() } {
@ -279,7 +284,7 @@ impl LightDispatcher {
/// Get a recent gas price corpus. /// Get a recent gas price corpus.
// TODO: this could be `impl Trait`. // TODO: this could be `impl Trait`.
pub fn gas_price_corpus(&self) -> BoxFuture<Corpus<U256>, Error> { pub fn gas_price_corpus(&self) -> BoxFuture<Corpus<U256>> {
fetch_gas_price_corpus( fetch_gas_price_corpus(
self.sync.clone(), self.sync.clone(),
self.client.clone(), self.client.clone(),
@ -289,7 +294,7 @@ impl LightDispatcher {
} }
/// Get an account's next nonce. /// Get an account's next nonce.
pub fn next_nonce(&self, addr: Address) -> BoxFuture<U256, Error> { pub fn next_nonce(&self, addr: Address) -> BoxFuture<U256> {
// fast path where we don't go to network; nonce provided or can be gotten from queue. // fast path where we don't go to network; nonce provided or can be gotten from queue.
let maybe_nonce = self.transaction_queue.read().next_nonce(&addr); let maybe_nonce = self.transaction_queue.read().next_nonce(&addr);
if let Some(nonce) = maybe_nonce { if let Some(nonce) = maybe_nonce {
@ -315,7 +320,7 @@ impl LightDispatcher {
impl Dispatcher for LightDispatcher { impl Dispatcher for LightDispatcher {
fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool) fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool)
-> BoxFuture<FilledTransactionRequest, Error> -> BoxFuture<FilledTransactionRequest>
{ {
const DEFAULT_GAS_PRICE: U256 = U256([0, 0, 0, 21_000_000]); const DEFAULT_GAS_PRICE: U256 = U256([0, 0, 0, 21_000_000]);
@ -369,7 +374,7 @@ impl Dispatcher for LightDispatcher {
} }
fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith) fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith)
-> BoxFuture<WithToken<SignedTransaction>, Error> -> BoxFuture<WithToken<SignedTransaction>>
{ {
let chain_id = self.client.signing_chain_id(); let chain_id = self.client.signing_chain_id();
@ -382,7 +387,8 @@ impl Dispatcher for LightDispatcher {
Box::new(self.next_nonce(filled.from) Box::new(self.next_nonce(filled.from)
.map_err(|_| errors::no_light_peers()) .map_err(|_| errors::no_light_peers())
.and_then(move |nonce| { .and_then(move |nonce| {
let reserved = nonces.lock().reserve_nonce(nonce); let reserved = nonces.lock().reserve(filled.from, nonce);
ProspectiveSigner::new(accounts, filled, chain_id, reserved, password) ProspectiveSigner::new(accounts, filled, chain_id, reserved, password)
})) }))
} }
@ -392,7 +398,7 @@ impl Dispatcher for LightDispatcher {
RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition()) RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition())
} }
fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256, Error> { fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256> {
let hash = signed_transaction.transaction.hash(); let hash = signed_transaction.transaction.hash();
self.transaction_queue.write().import(signed_transaction) self.transaction_queue.write().import(signed_transaction)
@ -408,7 +414,7 @@ fn sign_transaction(
chain_id: Option<u64>, chain_id: Option<u64>,
nonce: U256, nonce: U256,
password: SignWith, password: SignWith,
) -> Result<WithToken<SignedTransaction>, Error> { ) -> Result<WithToken<SignedTransaction>> {
let t = Transaction { let t = Transaction {
nonce: nonce, nonce: nonce,
action: filled.to.map_or(Action::Create, Action::Call), action: filled.to.map_or(Action::Create, Action::Call),
@ -445,7 +451,7 @@ struct ProspectiveSigner {
reserved: nonce::Reserved, reserved: nonce::Reserved,
password: SignWith, password: SignWith,
state: ProspectiveSignerState, state: ProspectiveSignerState,
prospective: Option<Result<WithToken<SignedTransaction>, Error>>, prospective: Option<Result<WithToken<SignedTransaction>>>,
ready: Option<nonce::Ready>, ready: Option<nonce::Ready>,
} }
@ -479,7 +485,7 @@ impl ProspectiveSigner {
} }
} }
fn sign(&self, nonce: &U256) -> Result<WithToken<SignedTransaction>, Error> { fn sign(&self, nonce: &U256) -> Result<WithToken<SignedTransaction>> {
sign_transaction( sign_transaction(
&*self.accounts, &*self.accounts,
self.filled.clone(), self.filled.clone(),
@ -637,7 +643,7 @@ pub fn execute<D: Dispatcher + 'static>(
accounts: Arc<AccountProvider>, accounts: Arc<AccountProvider>,
payload: ConfirmationPayload, payload: ConfirmationPayload,
pass: SignWith pass: SignWith
) -> BoxFuture<WithToken<ConfirmationResponse>, Error> { ) -> BoxFuture<WithToken<ConfirmationResponse>> {
match payload { match payload {
ConfirmationPayload::SendTransaction(request) => { ConfirmationPayload::SendTransaction(request) => {
let condition = request.condition.clone().map(Into::into); let condition = request.condition.clone().map(Into::into);
@ -688,7 +694,7 @@ pub fn execute<D: Dispatcher + 'static>(
} }
} }
fn signature(accounts: &AccountProvider, address: Address, hash: H256, password: SignWith) -> Result<WithToken<Signature>, Error> { fn signature(accounts: &AccountProvider, address: Address, hash: H256, password: SignWith) -> Result<WithToken<Signature>> {
match password.clone() { match password.clone() {
SignWith::Nothing => accounts.sign(address, None, hash).map(WithToken::No), SignWith::Nothing => accounts.sign(address, None, hash).map(WithToken::No),
SignWith::Password(pass) => accounts.sign(address, Some(pass), hash).map(WithToken::No), SignWith::Password(pass) => accounts.sign(address, Some(pass), hash).map(WithToken::No),
@ -701,7 +707,7 @@ fn signature(accounts: &AccountProvider, address: Address, hash: H256, password:
// obtain a hardware signature from the given account. // obtain a hardware signature from the given account.
fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transaction, chain_id: Option<u64>) fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transaction, chain_id: Option<u64>)
-> Result<SignedTransaction, Error> -> Result<SignedTransaction>
{ {
debug_assert!(accounts.is_hardware_address(&address)); debug_assert!(accounts.is_hardware_address(&address));
@ -720,7 +726,7 @@ fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transacti
}) })
} }
fn decrypt(accounts: &AccountProvider, address: Address, msg: Bytes, password: SignWith) -> Result<WithToken<Bytes>, Error> { fn decrypt(accounts: &AccountProvider, address: Address, msg: Bytes, password: SignWith) -> Result<WithToken<Bytes>> {
match password.clone() { match password.clone() {
SignWith::Nothing => accounts.decrypt(address, None, &DEFAULT_MAC, &msg).map(WithToken::No), SignWith::Nothing => accounts.decrypt(address, None, &DEFAULT_MAC, &msg).map(WithToken::No),
SignWith::Password(pass) => accounts.decrypt(address, Some(pass), &DEFAULT_MAC, &msg).map(WithToken::No), SignWith::Password(pass) => accounts.decrypt(address, Some(pass), &DEFAULT_MAC, &msg).map(WithToken::No),
@ -741,7 +747,7 @@ pub fn default_gas_price<C, M>(client: &C, miner: &M) -> U256 where
/// Convert RPC confirmation payload to signer confirmation payload. /// Convert RPC confirmation payload to signer confirmation payload.
/// May need to resolve in the future to fetch things like gas price. /// May need to resolve in the future to fetch things like gas price.
pub fn from_rpc<D>(payload: RpcConfirmationPayload, default_account: Address, dispatcher: &D) -> BoxFuture<ConfirmationPayload, Error> pub fn from_rpc<D>(payload: RpcConfirmationPayload, default_account: Address, dispatcher: &D) -> BoxFuture<ConfirmationPayload>
where D: Dispatcher where D: Dispatcher
{ {
match payload { match payload {

View File

@ -26,7 +26,7 @@ use ethcore::filter::Filter as EthcoreFilter;
use ethcore::transaction::{Action, Transaction as EthTransaction, SignedTransaction, LocalizedTransaction}; use ethcore::transaction::{Action, Transaction as EthTransaction, SignedTransaction, LocalizedTransaction};
use ethcore::receipt::Receipt; use ethcore::receipt::Receipt;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
@ -87,7 +87,7 @@ pub fn extract_transaction_at_index(block: encoded::Block, index: usize, eip86_t
/// Type alias for convenience. /// Type alias for convenience.
pub type ExecutionResult = Result<Executed, ExecutionError>; pub type ExecutionResult = ::std::result::Result<Executed, ExecutionError>;
// extract the header indicated by the given `HeaderRef` from the given responses. // extract the header indicated by the given `HeaderRef` from the given responses.
// fails only if they do not correspond. // fails only if they do not correspond.
@ -104,7 +104,7 @@ fn extract_header(res: &[OnDemandResponse], header: HeaderRef) -> Option<encoded
impl LightFetch { impl LightFetch {
// push the necessary requests onto the request chain to get the header by the given ID. // push the necessary requests onto the request chain to get the header by the given ID.
// yield a header reference which other requests can use. // yield a header reference which other requests can use.
fn make_header_requests(&self, id: BlockId, reqs: &mut Vec<OnDemandRequest>) -> Result<HeaderRef, Error> { fn make_header_requests(&self, id: BlockId, reqs: &mut Vec<OnDemandRequest>) -> Result<HeaderRef> {
if let Some(h) = self.client.block_header(id) { if let Some(h) = self.client.block_header(id) {
return Ok(h.into()); return Ok(h.into());
} }
@ -138,7 +138,7 @@ impl LightFetch {
} }
/// Get a block header from the on demand service or client, or error. /// Get a block header from the on demand service or client, or error.
pub fn header(&self, id: BlockId) -> BoxFuture<encoded::Header, Error> { pub fn header(&self, id: BlockId) -> BoxFuture<encoded::Header> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -162,7 +162,7 @@ impl LightFetch {
/// Helper for getting account info at a given block. /// Helper for getting account info at a given block.
/// `None` indicates the account doesn't exist at the given block. /// `None` indicates the account doesn't exist at the given block.
pub fn account(&self, address: Address, id: BlockId) -> BoxFuture<Option<BasicAccount>, Error> { pub fn account(&self, address: Address, id: BlockId) -> BoxFuture<Option<BasicAccount>> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -188,7 +188,7 @@ impl LightFetch {
} }
/// Helper for getting proved execution. /// Helper for getting proved execution.
pub fn proved_execution(&self, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<ExecutionResult, Error> { pub fn proved_execution(&self, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<ExecutionResult> {
const DEFAULT_GAS_PRICE: u64 = 21_000; const DEFAULT_GAS_PRICE: u64 = 21_000;
// starting gas when gas not provided. // starting gas when gas not provided.
const START_GAS: u64 = 50_000; const START_GAS: u64 = 50_000;
@ -265,7 +265,7 @@ impl LightFetch {
} }
/// Get a block itself. Fails on unknown block ID. /// Get a block itself. Fails on unknown block ID.
pub fn block(&self, id: BlockId) -> BoxFuture<encoded::Block, Error> { pub fn block(&self, id: BlockId) -> BoxFuture<encoded::Block> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -291,7 +291,7 @@ impl LightFetch {
} }
/// Get the block receipts. Fails on unknown block ID. /// Get the block receipts. Fails on unknown block ID.
pub fn receipts(&self, id: BlockId) -> BoxFuture<Vec<Receipt>, Error> { pub fn receipts(&self, id: BlockId) -> BoxFuture<Vec<Receipt>> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -317,7 +317,7 @@ impl LightFetch {
} }
/// Get transaction logs /// Get transaction logs
pub fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error> { pub fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>> {
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::futures::stream::{self, Stream}; use jsonrpc_core::futures::stream::{self, Stream};
@ -375,7 +375,7 @@ impl LightFetch {
// Get a transaction by hash. also returns the index in the block. // Get a transaction by hash. also returns the index in the block.
// Only returns transactions in the canonical chain. // Only returns transactions in the canonical chain.
pub fn transaction_by_hash(&self, tx_hash: H256, eip86_transition: u64) pub fn transaction_by_hash(&self, tx_hash: H256, eip86_transition: u64)
-> BoxFuture<Option<(Transaction, usize)>, Error> -> BoxFuture<Option<(Transaction, usize)>>
{ {
let params = (self.sync.clone(), self.on_demand.clone()); let params = (self.sync.clone(), self.on_demand.clone());
let fetcher: Self = self.clone(); let fetcher: Self = self.clone();
@ -445,7 +445,7 @@ struct ExecuteParams {
// has a peer execute the transaction with given params. If `gas_known` is false, // has a peer execute the transaction with given params. If `gas_known` is false,
// this will double the gas on each `OutOfGas` error. // this will double the gas on each `OutOfGas` error.
fn execute_tx(gas_known: bool, params: ExecuteParams) -> BoxFuture<ExecutionResult, Error> { fn execute_tx(gas_known: bool, params: ExecuteParams) -> BoxFuture<ExecutionResult> {
if !gas_known { if !gas_known {
Box::new(future::loop_fn(params, |mut params| { Box::new(future::loop_fn(params, |mut params| {
execute_tx(true, params.clone()).and_then(move |res| { execute_tx(true, params.clone()).and_then(move |res| {

View File

@ -15,25 +15,29 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::{cmp, mem}; use std::{cmp, mem};
use std::collections::HashMap;
use std::sync::{atomic, Arc}; use std::sync::{atomic, Arc};
use std::sync::atomic::AtomicUsize; use std::sync::atomic::{AtomicBool, AtomicUsize};
use bigint::prelude::U256; use bigint::prelude::U256;
use futures::{Future, future, Poll, Async}; use futures::{Future, future, Poll, Async};
use futures::future::Either; use futures::future::Either;
use futures::sync::oneshot; use futures::sync::oneshot;
use futures_cpupool::CpuPool; use futures_cpupool::CpuPool;
use util::Address;
/// Manages currently reserved and prospective nonces. /// Manages currently reserved and prospective nonces
/// for multiple senders.
#[derive(Debug)] #[derive(Debug)]
pub struct Reservations { pub struct Reservations {
previous: Option<oneshot::Receiver<U256>>, nonces: HashMap<Address, SenderReservations>,
pool: CpuPool, pool: CpuPool,
prospective_value: U256,
dropped: Arc<AtomicUsize>,
} }
impl Reservations { impl Reservations {
/// A maximal number of reserved nonces in the hashmap
/// before we start clearing the unused ones.
const CLEAN_AT: usize = 512;
/// Create new nonces manager and spawn a single-threaded cpu pool /// Create new nonces manager and spawn a single-threaded cpu pool
/// for progressing execution of dropped nonces. /// for progressing execution of dropped nonces.
pub fn new() -> Self { pub fn new() -> Self {
@ -43,7 +47,49 @@ impl Reservations {
/// Create new nonces manager with given cpupool. /// Create new nonces manager with given cpupool.
pub fn with_pool(pool: CpuPool) -> Self { pub fn with_pool(pool: CpuPool) -> Self {
Reservations { Reservations {
nonces: Default::default(),
pool,
}
}
/// Reserve a nonce for particular address.
///
/// The reserved nonce cannot be smaller than the minimal nonce.
pub fn reserve(&mut self, sender: Address, minimal: U256) -> Reserved {
if self.nonces.len() + 1 > Self::CLEAN_AT {
self.nonces.retain(|_, v| !v.is_empty());
}
let pool = &self.pool;
self.nonces.entry(sender)
.or_insert_with(move || SenderReservations::with_pool(pool.clone()))
.reserve_nonce(minimal)
}
}
/// Manages currently reserved and prospective nonces.
#[derive(Debug)]
pub struct SenderReservations {
previous: Option<oneshot::Receiver<U256>>,
previous_ready: Arc<AtomicBool>,
pool: CpuPool,
prospective_value: U256,
dropped: Arc<AtomicUsize>,
}
impl SenderReservations {
/// Create new nonces manager and spawn a single-threaded cpu pool
/// for progressing execution of dropped nonces.
#[cfg(test)]
pub fn new() -> Self {
Self::with_pool(CpuPool::new(1))
}
/// Create new nonces manager with given cpu pool.
pub fn with_pool(pool: CpuPool) -> Self {
SenderReservations {
previous: None, previous: None,
previous_ready: Arc::new(AtomicBool::new(true)),
pool, pool,
prospective_value: Default::default(), prospective_value: Default::default(),
dropped: Default::default(), dropped: Default::default(),
@ -64,12 +110,15 @@ impl Reservations {
let (next, rx) = oneshot::channel(); let (next, rx) = oneshot::channel();
let next = Some(next); let next = Some(next);
let next_sent = Arc::new(AtomicBool::default());
let pool = self.pool.clone(); let pool = self.pool.clone();
let dropped = self.dropped.clone(); let dropped = self.dropped.clone();
self.previous_ready = next_sent.clone();
match mem::replace(&mut self.previous, Some(rx)) { match mem::replace(&mut self.previous, Some(rx)) {
Some(previous) => Reserved { Some(previous) => Reserved {
previous: Either::A(previous), previous: Either::A(previous),
next, next,
next_sent,
minimal, minimal,
prospective_value, prospective_value,
pool, pool,
@ -78,6 +127,7 @@ impl Reservations {
None => Reserved { None => Reserved {
previous: Either::B(future::ok(minimal)), previous: Either::B(future::ok(minimal)),
next, next,
next_sent,
minimal, minimal,
prospective_value, prospective_value,
pool, pool,
@ -85,6 +135,11 @@ impl Reservations {
}, },
} }
} }
/// Returns true if there are no reserved nonces.
pub fn is_empty(&self) -> bool {
self.previous_ready.load(atomic::Ordering::SeqCst)
}
} }
/// Represents a future nonce. /// Represents a future nonce.
@ -92,9 +147,10 @@ impl Reservations {
pub struct Reserved { pub struct Reserved {
previous: Either< previous: Either<
oneshot::Receiver<U256>, oneshot::Receiver<U256>,
future::FutureResult<U256, oneshot::Canceled> future::FutureResult<U256, oneshot::Canceled>,
>, >,
next: Option<oneshot::Sender<U256>>, next: Option<oneshot::Sender<U256>>,
next_sent: Arc<AtomicBool>,
minimal: U256, minimal: U256,
prospective_value: U256, prospective_value: U256,
pool: CpuPool, pool: CpuPool,
@ -128,6 +184,7 @@ impl Future for Reserved {
value, value,
matches_prospective, matches_prospective,
next: self.next.take(), next: self.next.take(),
next_sent: self.next_sent.clone(),
dropped: self.dropped.clone(), dropped: self.dropped.clone(),
})) }))
} }
@ -136,10 +193,12 @@ impl Future for Reserved {
impl Drop for Reserved { impl Drop for Reserved {
fn drop(&mut self) { fn drop(&mut self) {
if let Some(next) = self.next.take() { if let Some(next) = self.next.take() {
let next_sent = self.next_sent.clone();
self.dropped.fetch_add(1, atomic::Ordering::SeqCst); self.dropped.fetch_add(1, atomic::Ordering::SeqCst);
// If Reserved is dropped just pipe previous and next together. // If Reserved is dropped just pipe previous and next together.
let previous = mem::replace(&mut self.previous, Either::B(future::ok(U256::default()))); let previous = mem::replace(&mut self.previous, Either::B(future::ok(U256::default())));
self.pool.spawn(previous.map(|nonce| { self.pool.spawn(previous.map(move |nonce| {
next_sent.store(true, atomic::Ordering::SeqCst);
next.send(nonce).expect(Ready::RECV_PROOF) next.send(nonce).expect(Ready::RECV_PROOF)
})).forget() })).forget()
} }
@ -156,6 +215,7 @@ pub struct Ready {
value: U256, value: U256,
matches_prospective: bool, matches_prospective: bool,
next: Option<oneshot::Sender<U256>>, next: Option<oneshot::Sender<U256>>,
next_sent: Arc<AtomicBool>,
dropped: Arc<AtomicUsize>, dropped: Arc<AtomicUsize>,
} }
@ -176,15 +236,17 @@ impl Ready {
/// Make sure to call that method after this nonce has been consumed. /// Make sure to call that method after this nonce has been consumed.
pub fn mark_used(mut self) { pub fn mark_used(mut self) {
let next = self.next.take().expect("Nonce can be marked as used only once; qed"); let next = self.next.take().expect("Nonce can be marked as used only once; qed");
self.next_sent.store(true, atomic::Ordering::SeqCst);
next.send(self.value + 1.into()).expect(Self::RECV_PROOF); next.send(self.value + 1.into()).expect(Self::RECV_PROOF);
} }
} }
impl Drop for Ready { impl Drop for Ready {
fn drop(&mut self) { fn drop(&mut self) {
if let Some(send) = self.next.take() { if let Some(next) = self.next.take() {
self.dropped.fetch_add(1, atomic::Ordering::SeqCst); self.dropped.fetch_add(1, atomic::Ordering::SeqCst);
send.send(self.value).expect(Self::RECV_PROOF); self.next_sent.store(true, atomic::Ordering::SeqCst);
next.send(self.value).expect(Self::RECV_PROOF);
} }
} }
} }
@ -195,12 +257,14 @@ mod tests {
#[test] #[test]
fn should_reserve_a_set_of_nonces_and_resolve_them() { fn should_reserve_a_set_of_nonces_and_resolve_them() {
let mut nonces = Reservations::new(); let mut nonces = SenderReservations::new();
assert!(nonces.is_empty());
let n1 = nonces.reserve_nonce(5.into()); let n1 = nonces.reserve_nonce(5.into());
let n2 = nonces.reserve_nonce(5.into()); let n2 = nonces.reserve_nonce(5.into());
let n3 = nonces.reserve_nonce(5.into()); let n3 = nonces.reserve_nonce(5.into());
let n4 = nonces.reserve_nonce(5.into()); let n4 = nonces.reserve_nonce(5.into());
assert!(!nonces.is_empty());
// Check first nonce // Check first nonce
let r = n1.wait().unwrap(); let r = n1.wait().unwrap();
@ -234,11 +298,13 @@ mod tests {
assert_eq!(r.value(), &U256::from(10)); assert_eq!(r.value(), &U256::from(10));
assert!(r.matches_prospective()); assert!(r.matches_prospective());
r.mark_used(); r.mark_used();
assert!(nonces.is_empty());
} }
#[test] #[test]
fn should_return_prospective_nonce() { fn should_return_prospective_nonce() {
let mut nonces = Reservations::new(); let mut nonces = SenderReservations::new();
let n1 = nonces.reserve_nonce(5.into()); let n1 = nonces.reserve_nonce(5.into());
let n2 = nonces.reserve_nonce(5.into()); let n2 = nonces.reserve_nonce(5.into());

View File

@ -14,13 +14,15 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::iter::repeat; use std::collections::BTreeSet;
use rand::{Rng, OsRng}; use rand::{Rng, OsRng};
use ethkey::{Public, Secret, math}; use ethkey::{Public, Secret, math};
use crypto; use crypto;
use bytes::Bytes; use bytes::Bytes;
use jsonrpc_core::Error; use jsonrpc_core::Error;
use v1::helpers::errors; use v1::helpers::errors;
use v1::types::{H256, H512};
use tiny_keccak::Keccak;
/// Initialization vector length. /// Initialization vector length.
const INIT_VEC_LEN: usize = 16; const INIT_VEC_LEN: usize = 16;
@ -32,10 +34,13 @@ pub fn encrypt_document(key: Bytes, document: Bytes) -> Result<Bytes, Error> {
// use symmetric encryption to encrypt document // use symmetric encryption to encrypt document
let iv = initialization_vector(); let iv = initialization_vector();
let mut encrypted_document = Vec::with_capacity(document.len() + iv.len()); let mut encrypted_document = vec![0; document.len() + iv.len()];
encrypted_document.extend(repeat(0).take(document.len())); {
crypto::aes::encrypt(&key, &iv, &document, &mut encrypted_document); let (mut encryption_buffer, iv_buffer) = encrypted_document.split_at_mut(document.len());
encrypted_document.extend_from_slice(&iv);
crypto::aes::encrypt(&key, &iv, &document, &mut encryption_buffer);
iv_buffer.copy_from_slice(&iv);
}
Ok(encrypted_document) Ok(encrypted_document)
} }
@ -53,18 +58,31 @@ pub fn decrypt_document(key: Bytes, mut encrypted_document: Bytes) -> Result<Byt
// use symmetric decryption to decrypt document // use symmetric decryption to decrypt document
let iv = encrypted_document.split_off(encrypted_document_len - INIT_VEC_LEN); let iv = encrypted_document.split_off(encrypted_document_len - INIT_VEC_LEN);
let mut document = Vec::with_capacity(encrypted_document_len - INIT_VEC_LEN); let mut document = vec![0; encrypted_document_len - INIT_VEC_LEN];
document.extend(repeat(0).take(encrypted_document_len - INIT_VEC_LEN));
crypto::aes::decrypt(&key, &iv, &encrypted_document, &mut document); crypto::aes::decrypt(&key, &iv, &encrypted_document, &mut document);
Ok(document) Ok(document)
} }
/// Decrypt document given secret shadow.
pub fn decrypt_document_with_shadow(decrypted_secret: Public, common_point: Public, shadows: Vec<Secret>, encrypted_document: Bytes) -> Result<Bytes, Error> { pub fn decrypt_document_with_shadow(decrypted_secret: Public, common_point: Public, shadows: Vec<Secret>, encrypted_document: Bytes) -> Result<Bytes, Error> {
let key = decrypt_with_shadow_coefficients(decrypted_secret, common_point, shadows)?; let key = decrypt_with_shadow_coefficients(decrypted_secret, common_point, shadows)?;
decrypt_document(key.to_vec(), encrypted_document) decrypt_document(key.to_vec(), encrypted_document)
} }
/// Calculate Keccak(ordered servers set)
pub fn ordered_servers_keccak(servers_set: BTreeSet<H512>) -> H256 {
let mut servers_set_keccak = Keccak::new_keccak256();
for server in servers_set {
servers_set_keccak.update(&server.0);
}
let mut servers_set_keccak_value = [0u8; 32];
servers_set_keccak.finalize(&mut servers_set_keccak_value);
servers_set_keccak_value.into()
}
fn into_document_key(key: Bytes) -> Result<Bytes, Error> { fn into_document_key(key: Bytes) -> Result<Bytes, Error> {
// key is a previously distributely generated Public // key is a previously distributely generated Public
if key.len() != 64 { if key.len() != 64 {

View File

@ -23,7 +23,7 @@ use parking_lot::Mutex;
use jsonrpc_core::futures::future::{self, Either}; use jsonrpc_core::futures::future::{self, Either};
use jsonrpc_core::futures::sync::mpsc; use jsonrpc_core::futures::sync::mpsc;
use jsonrpc_core::futures::{Sink, Future}; use jsonrpc_core::futures::{Sink, Future};
use jsonrpc_core::{self as core, MetaIoHandler, BoxFuture}; use jsonrpc_core::{self as core, MetaIoHandler};
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
use v1::helpers::Subscribers; use v1::helpers::Subscribers;
@ -87,7 +87,7 @@ impl<S: core::Middleware<Metadata>> GenericPollManager<S> {
}).is_some() }).is_some()
} }
pub fn tick(&self) -> BoxFuture<(), ()> { pub fn tick(&self) -> Box<Future<Item=(), Error=()> + Send> {
let mut futures = Vec::new(); let mut futures = Vec::new();
// poll all subscriptions // poll all subscriptions
for (id, subscription) in self.subscribers.iter() { for (id, subscription) in self.subscribers.iter() {

View File

@ -40,7 +40,7 @@ use ethcore::transaction::SignedTransaction;
use ethcore::snapshot::SnapshotService; use ethcore::snapshot::SnapshotService;
use ethsync::{SyncProvider}; use ethsync::{SyncProvider};
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::future; use jsonrpc_core::futures::future;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
@ -139,11 +139,11 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn block(&self, id: BlockId, include_txs: bool) -> Result<Option<RichBlock>, Error> { fn block(&self, id: BlockId, include_txs: bool) -> Result<Option<RichBlock>> {
let client = &self.client; let client = &self.client;
match (client.block(id.clone()), client.block_total_difficulty(id)) { match (client.block(id.clone()), client.block_total_difficulty(id)) {
(Some(block), Some(total_difficulty)) => { (Some(block), Some(total_difficulty)) => {
@ -181,14 +181,14 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
} }
} }
fn transaction(&self, id: TransactionId) -> Result<Option<Transaction>, Error> { fn transaction(&self, id: TransactionId) -> Result<Option<Transaction>> {
match self.client.transaction(id) { match self.client.transaction(id) {
Some(t) => Ok(Some(Transaction::from_localized(t, self.eip86_transition))), Some(t) => Ok(Some(Transaction::from_localized(t, self.eip86_transition))),
None => Ok(None), None => Ok(None),
} }
} }
fn uncle(&self, id: UncleId) -> Result<Option<RichBlock>, Error> { fn uncle(&self, id: UncleId) -> Result<Option<RichBlock>> {
let client = &self.client; let client = &self.client;
let uncle: BlockHeader = match client.uncle(id) { let uncle: BlockHeader = match client.uncle(id) {
Some(hdr) => hdr.decode(), Some(hdr) => hdr.decode(),
@ -232,7 +232,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
Ok(Some(block)) Ok(Some(block))
} }
fn dapp_accounts(&self, dapp: DappId) -> Result<Vec<H160>, Error> { fn dapp_accounts(&self, dapp: DappId) -> Result<Vec<H160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store store
.note_dapp_used(dapp.clone()) .note_dapp_used(dapp.clone())
@ -260,7 +260,7 @@ pub fn pending_logs<M>(miner: &M, best_block: EthBlockNumber, filter: &EthcoreFi
result result
} }
fn check_known<C>(client: &C, number: BlockNumber) -> Result<(), Error> where C: MiningBlockChainClient { fn check_known<C>(client: &C, number: BlockNumber) -> Result<()> where C: MiningBlockChainClient {
use ethcore::block_status::BlockStatus; use ethcore::block_status::BlockStatus;
match client.block_status(number.into()) { match client.block_status(number.into()) {
@ -281,12 +281,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
{ {
type Metadata = Metadata; type Metadata = Metadata;
fn protocol_version(&self) -> Result<String, Error> { fn protocol_version(&self) -> Result<String> {
let version = self.sync.status().protocol_version.to_owned(); let version = self.sync.status().protocol_version.to_owned();
Ok(format!("{}", version)) Ok(format!("{}", version))
} }
fn syncing(&self) -> Result<SyncStatus, Error> { fn syncing(&self) -> Result<SyncStatus> {
use ethcore::snapshot::RestorationStatus; use ethcore::snapshot::RestorationStatus;
let status = self.sync.status(); let status = self.sync.status();
@ -318,7 +318,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
} }
} }
fn author(&self, meta: Metadata) -> Result<RpcH160, Error> { fn author(&self, meta: Metadata) -> Result<RpcH160> {
let dapp = meta.dapp_id(); let dapp = meta.dapp_id();
let mut miner = self.miner.author(); let mut miner = self.miner.author();
@ -329,30 +329,30 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Ok(RpcH160::from(miner)) Ok(RpcH160::from(miner))
} }
fn is_mining(&self) -> Result<bool, Error> { fn is_mining(&self) -> Result<bool> {
Ok(self.miner.is_currently_sealing()) Ok(self.miner.is_currently_sealing())
} }
fn hashrate(&self) -> Result<RpcU256, Error> { fn hashrate(&self) -> Result<RpcU256> {
Ok(RpcU256::from(self.external_miner.hashrate())) Ok(RpcU256::from(self.external_miner.hashrate()))
} }
fn gas_price(&self) -> Result<RpcU256, Error> { fn gas_price(&self) -> Result<RpcU256> {
Ok(RpcU256::from(default_gas_price(&*self.client, &*self.miner))) Ok(RpcU256::from(default_gas_price(&*self.client, &*self.miner)))
} }
fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>, Error> { fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>> {
let dapp = meta.dapp_id(); let dapp = meta.dapp_id();
let accounts = self.dapp_accounts(dapp.into())?; let accounts = self.dapp_accounts(dapp.into())?;
Ok(accounts.into_iter().map(Into::into).collect()) Ok(accounts.into_iter().map(Into::into).collect())
} }
fn block_number(&self) -> Result<RpcU256, Error> { fn block_number(&self) -> Result<RpcU256> {
Ok(RpcU256::from(self.client.chain_info().best_block_number)) Ok(RpcU256::from(self.client.chain_info().best_block_number))
} }
fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
let address = address.into(); let address = address.into();
let id = num.unwrap_or_default(); let id = num.unwrap_or_default();
@ -366,7 +366,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn storage_at(&self, address: RpcH160, pos: RpcU256, num: Trailing<BlockNumber>) -> BoxFuture<RpcH256, Error> { fn storage_at(&self, address: RpcH160, pos: RpcU256, num: Trailing<BlockNumber>) -> BoxFuture<RpcH256> {
let address: Address = RpcH160::into(address); let address: Address = RpcH160::into(address);
let position: U256 = RpcU256::into(pos); let position: U256 = RpcU256::into(pos);
@ -381,7 +381,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
let address: Address = RpcH160::into(address); let address: Address = RpcH160::into(address);
let res = match num.unwrap_or_default() { let res = match num.unwrap_or_default() {
@ -406,12 +406,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(self.client.block(BlockId::Hash(hash.into())) Box::new(future::ok(self.client.block(BlockId::Hash(hash.into()))
.map(|block| block.transactions_count().into()))) .map(|block| block.transactions_count().into())))
} }
fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(match num { Box::new(future::ok(match num {
BlockNumber::Pending => Some( BlockNumber::Pending => Some(
self.miner.status().transactions_in_pending_block.into() self.miner.status().transactions_in_pending_block.into()
@ -422,12 +422,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
})) }))
} }
fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(self.client.block(BlockId::Hash(hash.into())) Box::new(future::ok(self.client.block(BlockId::Hash(hash.into()))
.map(|block| block.uncles_count().into()))) .map(|block| block.uncles_count().into())))
} }
fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(match num { Box::new(future::ok(match num {
BlockNumber::Pending => Some(0.into()), BlockNumber::Pending => Some(0.into()),
_ => self.client.block(num.into()) _ => self.client.block(num.into())
@ -436,7 +436,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
})) }))
} }
fn code_at(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn code_at(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
let address: Address = RpcH160::into(address); let address: Address = RpcH160::into(address);
let id = num.unwrap_or_default(); let id = num.unwrap_or_default();
@ -450,15 +450,15 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.block(BlockId::Hash(hash.into()), include_txs))) Box::new(future::done(self.block(BlockId::Hash(hash.into()), include_txs)))
} }
fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.block(num.into(), include_txs))) Box::new(future::done(self.block(num.into(), include_txs)))
} }
fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>> {
let hash: H256 = hash.into(); let hash: H256 = hash.into();
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
let tx = try_bf!(self.transaction(TransactionId::Hash(hash))).or_else(|| { let tx = try_bf!(self.transaction(TransactionId::Hash(hash))).or_else(|| {
@ -469,19 +469,19 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::ok(tx)) Box::new(future::ok(tx))
} }
fn transaction_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<Transaction>> {
Box::new(future::done( Box::new(future::done(
self.transaction(TransactionId::Location(BlockId::Hash(hash.into()), index.value())) self.transaction(TransactionId::Location(BlockId::Hash(hash.into()), index.value()))
)) ))
} }
fn transaction_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<Transaction>> {
Box::new(future::done( Box::new(future::done(
self.transaction(TransactionId::Location(num.into(), index.value())) self.transaction(TransactionId::Location(num.into(), index.value()))
)) ))
} }
fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>, Error> { fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>> {
let best_block = self.client.chain_info().best_block_number; let best_block = self.client.chain_info().best_block_number;
let hash: H256 = hash.into(); let hash: H256 = hash.into();
@ -494,25 +494,25 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
} }
} }
fn uncle_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.uncle(UncleId { Box::new(future::done(self.uncle(UncleId {
block: BlockId::Hash(hash.into()), block: BlockId::Hash(hash.into()),
position: index.value() position: index.value()
}))) })))
} }
fn uncle_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.uncle(UncleId { Box::new(future::done(self.uncle(UncleId {
block: num.into(), block: num.into(),
position: index.value() position: index.value()
}))) })))
} }
fn compilers(&self) -> Result<Vec<String>, Error> { fn compilers(&self) -> Result<Vec<String>> {
Err(errors::deprecated("Compilation functionality is deprecated.".to_string())) Err(errors::deprecated("Compilation functionality is deprecated.".to_string()))
} }
fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>> {
let include_pending = filter.to_block == Some(BlockNumber::Pending); let include_pending = filter.to_block == Some(BlockNumber::Pending);
let filter: EthcoreFilter = filter.into(); let filter: EthcoreFilter = filter.into();
let mut logs = self.client.logs(filter.clone()) let mut logs = self.client.logs(filter.clone())
@ -531,7 +531,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::ok(logs)) Box::new(future::ok(logs))
} }
fn work(&self, no_new_work_timeout: Trailing<u64>) -> Result<Work, Error> { fn work(&self, no_new_work_timeout: Trailing<u64>) -> Result<Work> {
if !self.miner.can_produce_work_package() { if !self.miner.can_produce_work_package() {
warn!(target: "miner", "Cannot give work package - engine seals internally."); warn!(target: "miner", "Cannot give work package - engine seals internally.");
return Err(errors::no_work_required()) return Err(errors::no_work_required())
@ -585,7 +585,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
}).unwrap_or(Err(errors::internal("No work found.", ""))) }).unwrap_or(Err(errors::internal("No work found.", "")))
} }
fn submit_work(&self, nonce: RpcH64, pow_hash: RpcH256, mix_hash: RpcH256) -> Result<bool, Error> { fn submit_work(&self, nonce: RpcH64, pow_hash: RpcH256, mix_hash: RpcH256) -> Result<bool> {
if !self.miner.can_produce_work_package() { if !self.miner.can_produce_work_package() {
warn!(target: "miner", "Cannot submit work - engine seals internally."); warn!(target: "miner", "Cannot submit work - engine seals internally.");
return Err(errors::no_work_required()) return Err(errors::no_work_required())
@ -600,12 +600,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Ok(self.miner.submit_seal(&*self.client, pow_hash, seal).is_ok()) Ok(self.miner.submit_seal(&*self.client, pow_hash, seal).is_ok())
} }
fn submit_hashrate(&self, rate: RpcU256, id: RpcH256) -> Result<bool, Error> { fn submit_hashrate(&self, rate: RpcU256, id: RpcH256) -> Result<bool> {
self.external_miner.submit_hashrate(rate.into(), id.into()); self.external_miner.submit_hashrate(rate.into(), id.into());
Ok(true) Ok(true)
} }
fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256> {
UntrustedRlp::new(&raw.into_vec()).as_val() UntrustedRlp::new(&raw.into_vec()).as_val()
.map_err(errors::rlp) .map_err(errors::rlp)
.and_then(|tx| SignedTransaction::new(tx).map_err(errors::transaction)) .and_then(|tx| SignedTransaction::new(tx).map_err(errors::transaction))
@ -619,11 +619,11 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
.map(Into::into) .map(Into::into)
} }
fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256> {
self.send_raw_transaction(raw) self.send_raw_transaction(raw)
} }
fn call(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn call(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
let request = CallRequest::into(request); let request = CallRequest::into(request);
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp())); let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
@ -636,7 +636,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
)) ))
} }
fn estimate_gas(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn estimate_gas(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
let request = CallRequest::into(request); let request = CallRequest::into(request);
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp())); let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
Box::new(future::done(self.client.estimate_gas(&signed, num.unwrap_or_default().into()) Box::new(future::done(self.client.estimate_gas(&signed, num.unwrap_or_default().into())
@ -645,15 +645,15 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
)) ))
} }
fn compile_lll(&self, _: String) -> Result<Bytes, Error> { fn compile_lll(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string()))
} }
fn compile_serpent(&self, _: String) -> Result<Bytes, Error> { fn compile_serpent(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string()))
} }
fn compile_solidity(&self, _: String) -> Result<Bytes, Error> { fn compile_solidity(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string()))
} }
} }

View File

@ -25,7 +25,7 @@ use ethcore::client::{BlockChainClient, BlockId};
use bigint::hash::H256; use bigint::hash::H256;
use parking_lot::Mutex; use parking_lot::Mutex;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use v1::traits::EthFilter; use v1::traits::EthFilter;
@ -45,7 +45,7 @@ pub trait Filterable {
fn pending_transactions_hashes(&self, block_number: u64) -> Vec<H256>; fn pending_transactions_hashes(&self, block_number: u64) -> Vec<H256>;
/// Get logs that match the given filter. /// Get logs that match the given filter.
fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error>; fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>>;
/// Get logs from the pending block. /// Get logs from the pending block.
fn pending_logs(&self, block_number: u64, filter: &EthcoreFilter) -> Vec<Log>; fn pending_logs(&self, block_number: u64, filter: &EthcoreFilter) -> Vec<Log>;
@ -88,7 +88,7 @@ impl<C, M> Filterable for EthFilterClient<C, M> where C: BlockChainClient, M: Mi
self.miner.pending_transactions_hashes(best) self.miner.pending_transactions_hashes(best)
} }
fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>> {
Box::new(future::ok(self.client.logs(filter).into_iter().map(Into::into).collect())) Box::new(future::ok(self.client.logs(filter).into_iter().map(Into::into).collect()))
} }
@ -102,20 +102,20 @@ impl<C, M> Filterable for EthFilterClient<C, M> where C: BlockChainClient, M: Mi
impl<T: Filterable + Send + Sync + 'static> EthFilter for T { impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
fn new_filter(&self, filter: Filter) -> Result<RpcU256, Error> { fn new_filter(&self, filter: Filter) -> Result<RpcU256> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
let block_number = self.best_block_number(); let block_number = self.best_block_number();
let id = polls.create_poll(PollFilter::Logs(block_number, Default::default(), filter)); let id = polls.create_poll(PollFilter::Logs(block_number, Default::default(), filter));
Ok(id.into()) Ok(id.into())
} }
fn new_block_filter(&self) -> Result<RpcU256, Error> { fn new_block_filter(&self) -> Result<RpcU256> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
let id = polls.create_poll(PollFilter::Block(self.best_block_number())); let id = polls.create_poll(PollFilter::Block(self.best_block_number()));
Ok(id.into()) Ok(id.into())
} }
fn new_pending_transaction_filter(&self) -> Result<RpcU256, Error> { fn new_pending_transaction_filter(&self) -> Result<RpcU256> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
let best_block = self.best_block_number(); let best_block = self.best_block_number();
let pending_transactions = self.pending_transactions_hashes(best_block); let pending_transactions = self.pending_transactions_hashes(best_block);
@ -123,7 +123,7 @@ impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
Ok(id.into()) Ok(id.into())
} }
fn filter_changes(&self, index: Index) -> BoxFuture<FilterChanges, Error> { fn filter_changes(&self, index: Index) -> BoxFuture<FilterChanges> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
Box::new(match polls.poll_mut(&index.value()) { Box::new(match polls.poll_mut(&index.value()) {
None => Either::A(future::ok(FilterChanges::Empty)), None => Either::A(future::ok(FilterChanges::Empty)),
@ -209,7 +209,7 @@ impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
}) })
} }
fn filter_logs(&self, index: Index) -> BoxFuture<Vec<Log>, Error> { fn filter_logs(&self, index: Index) -> BoxFuture<Vec<Log>> {
let filter = { let filter = {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
@ -240,7 +240,7 @@ impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
) )
} }
fn uninstall_filter(&self, index: Index) -> Result<bool, Error> { fn uninstall_filter(&self, index: Index) -> Result<bool> {
self.polls().lock().remove_poll(&index.value()); self.polls().lock().remove_poll(&index.value());
Ok(true) Ok(true)
} }

View File

@ -19,7 +19,7 @@
use std::sync::Arc; use std::sync::Arc;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result, Error};
use jsonrpc_core::futures::{self, Future, IntoFuture}; use jsonrpc_core::futures::{self, Future, IntoFuture};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::{Sink, Subscriber}; use jsonrpc_macros::pubsub::{Sink, Subscriber};
@ -170,7 +170,7 @@ pub trait LightClient: Send + Sync {
fn block_header(&self, id: BlockId) -> Option<encoded::Header>; fn block_header(&self, id: BlockId) -> Option<encoded::Header>;
/// Fetch logs. /// Fetch logs.
fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>, Error>; fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>>;
} }
impl LightClient for LightFetch { impl LightClient for LightFetch {
@ -178,7 +178,7 @@ impl LightClient for LightFetch {
self.client.block_header(id) self.client.block_header(id)
} }
fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>> {
LightFetch::logs(self, filter) LightFetch::logs(self, filter)
} }
} }
@ -272,7 +272,7 @@ impl<C: Send + Sync + 'static> EthPubSub for EthPubSubClient<C> {
let _ = subscriber.reject(error); let _ = subscriber.reject(error);
} }
fn unsubscribe(&self, id: SubscriptionId) -> Result<bool, Error> { fn unsubscribe(&self, id: SubscriptionId) -> Result<bool> {
let res = self.heads_subscribers.write().remove(&id).is_some(); let res = self.heads_subscribers.write().remove(&id).is_some();
let res2 = self.logs_subscribers.write().remove(&id).is_some(); let res2 = self.logs_subscribers.write().remove(&id).is_some();

View File

@ -18,7 +18,7 @@
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
@ -112,7 +112,7 @@ impl<T: LightChainClient + 'static> EthClient<T> {
} }
// get a "rich" block structure. Fails on unknown block. // get a "rich" block structure. Fails on unknown block.
fn rich_block(&self, id: BlockId, include_txs: bool) -> BoxFuture<RichBlock, Error> { fn rich_block(&self, id: BlockId, include_txs: bool) -> BoxFuture<RichBlock> {
let (on_demand, sync) = (self.on_demand.clone(), self.sync.clone()); let (on_demand, sync) = (self.on_demand.clone(), self.sync.clone());
let (client, engine) = (self.client.clone(), self.client.engine().clone()); let (client, engine) = (self.client.clone(), self.client.engine().clone());
let eip86_transition = self.client.eip86_transition(); let eip86_transition = self.client.eip86_transition();
@ -202,11 +202,11 @@ impl<T: LightChainClient + 'static> EthClient<T> {
impl<T: LightChainClient + 'static> Eth for EthClient<T> { impl<T: LightChainClient + 'static> Eth for EthClient<T> {
type Metadata = Metadata; type Metadata = Metadata;
fn protocol_version(&self) -> Result<String, Error> { fn protocol_version(&self) -> Result<String> {
Ok(format!("{}", ::light::net::MAX_PROTOCOL_VERSION)) Ok(format!("{}", ::light::net::MAX_PROTOCOL_VERSION))
} }
fn syncing(&self) -> Result<SyncStatus, Error> { fn syncing(&self) -> Result<SyncStatus> {
if self.sync.is_major_importing() { if self.sync.is_major_importing() {
let chain_info = self.client.chain_info(); let chain_info = self.client.chain_info();
let current_block = U256::from(chain_info.best_block_number); let current_block = U256::from(chain_info.best_block_number);
@ -225,26 +225,26 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
} }
} }
fn author(&self, _meta: Self::Metadata) -> Result<RpcH160, Error> { fn author(&self, _meta: Self::Metadata) -> Result<RpcH160> {
Ok(Default::default()) Ok(Default::default())
} }
fn is_mining(&self) -> Result<bool, Error> { fn is_mining(&self) -> Result<bool> {
Ok(false) Ok(false)
} }
fn hashrate(&self) -> Result<RpcU256, Error> { fn hashrate(&self) -> Result<RpcU256> {
Ok(Default::default()) Ok(Default::default())
} }
fn gas_price(&self) -> Result<RpcU256, Error> { fn gas_price(&self) -> Result<RpcU256> {
Ok(self.cache.lock().gas_price_corpus() Ok(self.cache.lock().gas_price_corpus()
.and_then(|c| c.median().cloned()) .and_then(|c| c.median().cloned())
.map(RpcU256::from) .map(RpcU256::from)
.unwrap_or_else(Default::default)) .unwrap_or_else(Default::default))
} }
fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>, Error> { fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>> {
let dapp: DappId = meta.dapp_id().into(); let dapp: DappId = meta.dapp_id().into();
self.accounts self.accounts
@ -254,33 +254,33 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
.map(|accs| accs.into_iter().map(Into::<RpcH160>::into).collect()) .map(|accs| accs.into_iter().map(Into::<RpcH160>::into).collect())
} }
fn block_number(&self) -> Result<RpcU256, Error> { fn block_number(&self) -> Result<RpcU256> {
Ok(self.client.chain_info().best_block_number.into()) Ok(self.client.chain_info().best_block_number.into())
} }
fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into()) Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into())
.map(|acc| acc.map_or(0.into(), |a| a.balance).into())) .map(|acc| acc.map_or(0.into(), |a| a.balance).into()))
} }
fn storage_at(&self, _address: RpcH160, _key: RpcU256, _num: Trailing<BlockNumber>) -> BoxFuture<RpcH256, Error> { fn storage_at(&self, _address: RpcH160, _key: RpcU256, _num: Trailing<BlockNumber>) -> BoxFuture<RpcH256> {
Box::new(future::err(errors::unimplemented(None))) Box::new(future::err(errors::unimplemented(None)))
} }
fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(self.rich_block(BlockId::Hash(hash.into()), include_txs).map(Some)) Box::new(self.rich_block(BlockId::Hash(hash.into()), include_txs).map(Some))
} }
fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(self.rich_block(num.into(), include_txs).map(Some)) Box::new(self.rich_block(num.into(), include_txs).map(Some))
} }
fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into()) Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into())
.map(|acc| acc.map_or(0.into(), |a| a.nonce).into())) .map(|acc| acc.map_or(0.into(), |a| a.nonce).into()))
} }
fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| { Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| {
@ -296,7 +296,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(num.into()).and_then(move |hdr| { Box::new(self.fetcher().header(num.into()).and_then(move |hdr| {
@ -312,7 +312,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| { Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| {
@ -328,7 +328,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(num.into()).and_then(move |hdr| { Box::new(self.fetcher().header(num.into()).and_then(move |hdr| {
@ -344,11 +344,11 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn code_at(&self, _address: RpcH160, _num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn code_at(&self, _address: RpcH160, _num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
Box::new(future::err(errors::unimplemented(None))) Box::new(future::err(errors::unimplemented(None)))
} }
fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256> {
let best_header = self.client.best_block_header().decode(); let best_header = self.client.best_block_header().decode();
UntrustedRlp::new(&raw.into_vec()).as_val() UntrustedRlp::new(&raw.into_vec()).as_val()
@ -368,11 +368,11 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
.map(Into::into) .map(Into::into)
} }
fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256> {
self.send_raw_transaction(raw) self.send_raw_transaction(raw)
} }
fn call(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn call(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
Box::new(self.fetcher().proved_execution(req, num).and_then(|res| { Box::new(self.fetcher().proved_execution(req, num).and_then(|res| {
match res { match res {
Ok(exec) => Ok(exec.output.into()), Ok(exec) => Ok(exec.output.into()),
@ -381,7 +381,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn estimate_gas(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn estimate_gas(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
// TODO: binary chop for more accurate estimates. // TODO: binary chop for more accurate estimates.
Box::new(self.fetcher().proved_execution(req, num).and_then(|res| { Box::new(self.fetcher().proved_execution(req, num).and_then(|res| {
match res { match res {
@ -391,7 +391,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>> {
let hash = hash.into(); let hash = hash.into();
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
@ -409,21 +409,21 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
Box::new(self.fetcher().transaction_by_hash(hash, eip86).map(|x| x.map(|(tx, _)| tx))) Box::new(self.fetcher().transaction_by_hash(hash, eip86).map(|x| x.map(|(tx, _)| tx)))
} }
fn transaction_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<Transaction>> {
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| { Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| {
light_fetch::extract_transaction_at_index(block, idx.value(), eip86) light_fetch::extract_transaction_at_index(block, idx.value(), eip86)
})) }))
} }
fn transaction_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<Transaction>> {
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
Box::new(self.fetcher().block(num.into()).map(move |block| { Box::new(self.fetcher().block(num.into()).map(move |block| {
light_fetch::extract_transaction_at_index(block, idx.value(), eip86) light_fetch::extract_transaction_at_index(block, idx.value(), eip86)
})) }))
} }
fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>, Error> { fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>> {
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
let fetcher = self.fetcher(); let fetcher = self.fetcher();
Box::new(fetcher.transaction_by_hash(hash.clone().into(), eip86).and_then(move |tx| { Box::new(fetcher.transaction_by_hash(hash.clone().into(), eip86).and_then(move |tx| {
@ -454,52 +454,52 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn uncle_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<RichBlock>> {
let client = self.client.clone(); let client = self.client.clone();
Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| { Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| {
extract_uncle_at_index(block, idx, client) extract_uncle_at_index(block, idx, client)
})) }))
} }
fn uncle_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<RichBlock>> {
let client = self.client.clone(); let client = self.client.clone();
Box::new(self.fetcher().block(num.into()).map(move |block| { Box::new(self.fetcher().block(num.into()).map(move |block| {
extract_uncle_at_index(block, idx, client) extract_uncle_at_index(block, idx, client)
})) }))
} }
fn compilers(&self) -> Result<Vec<String>, Error> { fn compilers(&self) -> Result<Vec<String>> {
Err(errors::deprecated("Compilation functionality is deprecated.".to_string())) Err(errors::deprecated("Compilation functionality is deprecated.".to_string()))
} }
fn compile_lll(&self, _: String) -> Result<Bytes, Error> { fn compile_lll(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string()))
} }
fn compile_serpent(&self, _: String) -> Result<Bytes, Error> { fn compile_serpent(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string()))
} }
fn compile_solidity(&self, _: String) -> Result<Bytes, Error> { fn compile_solidity(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string()))
} }
fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>> {
let limit = filter.limit; let limit = filter.limit;
Box::new(Filterable::logs(self, filter.into()) Box::new(Filterable::logs(self, filter.into())
.map(move|logs| limit_logs(logs, limit))) .map(move|logs| limit_logs(logs, limit)))
} }
fn work(&self, _timeout: Trailing<u64>) -> Result<Work, Error> { fn work(&self, _timeout: Trailing<u64>) -> Result<Work> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn submit_work(&self, _nonce: RpcH64, _pow_hash: RpcH256, _mix_hash: RpcH256) -> Result<bool, Error> { fn submit_work(&self, _nonce: RpcH64, _pow_hash: RpcH256, _mix_hash: RpcH256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn submit_hashrate(&self, _rate: RpcU256, _id: RpcH256) -> Result<bool, Error> { fn submit_hashrate(&self, _rate: RpcU256, _id: RpcH256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
} }
@ -516,7 +516,7 @@ impl<T: LightChainClient + 'static> Filterable for EthClient<T> {
Vec::new() Vec::new()
} }
fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>> {
self.fetcher().logs(filter) self.fetcher().logs(filter)
} }

View File

@ -16,7 +16,7 @@
//! Net rpc implementation. //! Net rpc implementation.
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use ethsync::LightSyncProvider; use ethsync::LightSyncProvider;
use v1::traits::Net; use v1::traits::Net;
@ -35,15 +35,15 @@ impl<S: ?Sized> NetClient<S> where S: LightSyncProvider {
} }
impl<S: ?Sized + Sync + Send + 'static> Net for NetClient<S> where S: LightSyncProvider { impl<S: ?Sized + Sync + Send + 'static> Net for NetClient<S> where S: LightSyncProvider {
fn version(&self) -> Result<String, Error> { fn version(&self) -> Result<String> {
Ok(format!("{}", self.sync.network_id()).to_owned()) Ok(format!("{}", self.sync.network_id()).to_owned())
} }
fn peer_count(&self) -> Result<String, Error> { fn peer_count(&self) -> Result<String> {
Ok(format!("0x{:x}", self.sync.peer_numbers().connected as u64).to_owned()) Ok(format!("0x{:x}", self.sync.peer_numbers().connected as u64).to_owned())
} }
fn is_listening(&self) -> Result<bool, Error> { fn is_listening(&self) -> Result<bool> {
Ok(true) Ok(true)
} }
} }

View File

@ -30,7 +30,7 @@ use node_health::{NodeHealth, Health};
use light::client::LightChainClient; use light::client::LightChainClient;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::Future; use jsonrpc_core::futures::Future;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::helpers::{self, errors, ipfs, SigningQueue, SignerService, NetworkSettings}; use v1::helpers::{self, errors, ipfs, SigningQueue, SignerService, NetworkSettings};
@ -103,7 +103,7 @@ impl ParityClient {
impl Parity for ParityClient { impl Parity for ParityClient {
type Metadata = Metadata; type Metadata = Metadata;
fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>, Error> { fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>> {
let dapp = dapp.unwrap_or_default(); let dapp = dapp.unwrap_or_default();
let store = &self.accounts; let store = &self.accounts;
@ -125,7 +125,7 @@ impl Parity for ParityClient {
) )
} }
fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>, Error> { fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>> {
let store = &self.accounts; let store = &self.accounts;
let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?; let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?;
Ok(info Ok(info
@ -135,12 +135,12 @@ impl Parity for ParityClient {
) )
} }
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>, Error> { fn locked_hardware_accounts_info(&self) -> Result<Vec<String>> {
let store = &self.accounts; let store = &self.accounts;
Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?) Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?)
} }
fn default_account(&self, meta: Self::Metadata) -> Result<H160, Error> { fn default_account(&self, meta: Self::Metadata) -> Result<H160> {
let dapp_id = meta.dapp_id(); let dapp_id = meta.dapp_id();
Ok(self.accounts Ok(self.accounts
.dapp_addresses(dapp_id.into()) .dapp_addresses(dapp_id.into())
@ -150,40 +150,40 @@ impl Parity for ParityClient {
.unwrap_or_default()) .unwrap_or_default())
} }
fn transactions_limit(&self) -> Result<usize, Error> { fn transactions_limit(&self) -> Result<usize> {
Ok(usize::max_value()) Ok(usize::max_value())
} }
fn min_gas_price(&self) -> Result<U256, Error> { fn min_gas_price(&self) -> Result<U256> {
Ok(U256::default()) Ok(U256::default())
} }
fn extra_data(&self) -> Result<Bytes, Error> { fn extra_data(&self) -> Result<Bytes> {
Ok(Bytes::default()) Ok(Bytes::default())
} }
fn gas_floor_target(&self) -> Result<U256, Error> { fn gas_floor_target(&self) -> Result<U256> {
Ok(U256::default()) Ok(U256::default())
} }
fn gas_ceil_target(&self) -> Result<U256, Error> { fn gas_ceil_target(&self) -> Result<U256> {
Ok(U256::default()) Ok(U256::default())
} }
fn dev_logs(&self) -> Result<Vec<String>, Error> { fn dev_logs(&self) -> Result<Vec<String>> {
let logs = self.logger.logs(); let logs = self.logger.logs();
Ok(logs.as_slice().to_owned()) Ok(logs.as_slice().to_owned())
} }
fn dev_logs_levels(&self) -> Result<String, Error> { fn dev_logs_levels(&self) -> Result<String> {
Ok(self.logger.levels().to_owned()) Ok(self.logger.levels().to_owned())
} }
fn net_chain(&self) -> Result<String, Error> { fn net_chain(&self) -> Result<String> {
Ok(self.settings.chain.clone()) Ok(self.settings.chain.clone())
} }
fn net_peers(&self) -> Result<Peers, Error> { fn net_peers(&self) -> Result<Peers> {
let peers = self.light_dispatch.sync.peers().into_iter().map(Into::into).collect(); let peers = self.light_dispatch.sync.peers().into_iter().map(Into::into).collect();
let peer_numbers = self.light_dispatch.sync.peer_numbers(); let peer_numbers = self.light_dispatch.sync.peer_numbers();
@ -195,19 +195,19 @@ impl Parity for ParityClient {
}) })
} }
fn net_port(&self) -> Result<u16, Error> { fn net_port(&self) -> Result<u16> {
Ok(self.settings.network_port) Ok(self.settings.network_port)
} }
fn node_name(&self) -> Result<String, Error> { fn node_name(&self) -> Result<String> {
Ok(self.settings.name.clone()) Ok(self.settings.name.clone())
} }
fn registry_address(&self) -> Result<Option<H160>, Error> { fn registry_address(&self) -> Result<Option<H160>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn rpc_settings(&self) -> Result<RpcSettings, Error> { fn rpc_settings(&self) -> Result<RpcSettings> {
Ok(RpcSettings { Ok(RpcSettings {
enabled: self.settings.rpc_enabled, enabled: self.settings.rpc_enabled,
interface: self.settings.rpc_interface.clone(), interface: self.settings.rpc_interface.clone(),
@ -215,46 +215,46 @@ impl Parity for ParityClient {
}) })
} }
fn default_extra_data(&self) -> Result<Bytes, Error> { fn default_extra_data(&self) -> Result<Bytes> {
Ok(Bytes::new(version_data())) Ok(Bytes::new(version_data()))
} }
fn gas_price_histogram(&self) -> BoxFuture<Histogram, Error> { fn gas_price_histogram(&self) -> BoxFuture<Histogram> {
Box::new(self.light_dispatch.gas_price_corpus() Box::new(self.light_dispatch.gas_price_corpus()
.and_then(|corpus| corpus.histogram(10).ok_or_else(errors::not_enough_data)) .and_then(|corpus| corpus.histogram(10).ok_or_else(errors::not_enough_data))
.map(Into::into)) .map(Into::into))
} }
fn unsigned_transactions_count(&self) -> Result<usize, Error> { fn unsigned_transactions_count(&self) -> Result<usize> {
match self.signer { match self.signer {
None => Err(errors::signer_disabled()), None => Err(errors::signer_disabled()),
Some(ref signer) => Ok(signer.len()), Some(ref signer) => Ok(signer.len()),
} }
} }
fn generate_secret_phrase(&self) -> Result<String, Error> { fn generate_secret_phrase(&self) -> Result<String> {
Ok(random_phrase(12)) Ok(random_phrase(12))
} }
fn phrase_to_address(&self, phrase: String) -> Result<H160, Error> { fn phrase_to_address(&self, phrase: String) -> Result<H160> {
Ok(Brain::new(phrase).generate().unwrap().address().into()) Ok(Brain::new(phrase).generate().unwrap().address().into())
} }
fn list_accounts(&self, _: u64, _: Option<H160>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>, Error> { fn list_accounts(&self, _: u64, _: Option<H160>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn list_storage_keys(&self, _: H160, _: u64, _: Option<H256>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>, Error> { fn list_storage_keys(&self, _: H160, _: u64, _: Option<H256>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes, Error> { fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes> {
ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0) ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0)
.map_err(errors::encryption) .map_err(errors::encryption)
.map(Into::into) .map(Into::into)
} }
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error> { fn pending_transactions(&self) -> Result<Vec<Transaction>> {
let txq = self.light_dispatch.transaction_queue.read(); let txq = self.light_dispatch.transaction_queue.read();
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
Ok( Ok(
@ -265,7 +265,7 @@ impl Parity for ParityClient {
) )
} }
fn future_transactions(&self) -> Result<Vec<Transaction>, Error> { fn future_transactions(&self) -> Result<Vec<Transaction>> {
let txq = self.light_dispatch.transaction_queue.read(); let txq = self.light_dispatch.transaction_queue.read();
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
Ok( Ok(
@ -276,7 +276,7 @@ impl Parity for ParityClient {
) )
} }
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>, Error> { fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>> {
let stats = self.light_dispatch.sync.transactions_stats(); let stats = self.light_dispatch.sync.transactions_stats();
Ok(stats.into_iter() Ok(stats.into_iter()
.map(|(hash, stats)| (hash.into(), stats.into())) .map(|(hash, stats)| (hash.into(), stats.into()))
@ -284,7 +284,7 @@ impl Parity for ParityClient {
) )
} }
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>, Error> { fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>> {
let mut map = BTreeMap::new(); let mut map = BTreeMap::new();
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
let (best_num, best_tm) = (chain_info.best_block_number, chain_info.best_block_timestamp); let (best_num, best_tm) = (chain_info.best_block_number, chain_info.best_block_timestamp);
@ -303,49 +303,49 @@ impl Parity for ParityClient {
Ok(map) Ok(map)
} }
fn dapps_url(&self) -> Result<String, Error> { fn dapps_url(&self) -> Result<String> {
helpers::to_url(&self.dapps_address) helpers::to_url(&self.dapps_address)
.ok_or_else(|| errors::dapps_disabled()) .ok_or_else(|| errors::dapps_disabled())
} }
fn ws_url(&self) -> Result<String, Error> { fn ws_url(&self) -> Result<String> {
helpers::to_url(&self.ws_address) helpers::to_url(&self.ws_address)
.ok_or_else(|| errors::ws_disabled()) .ok_or_else(|| errors::ws_disabled())
} }
fn next_nonce(&self, address: H160) -> BoxFuture<U256, Error> { fn next_nonce(&self, address: H160) -> BoxFuture<U256> {
Box::new(self.light_dispatch.next_nonce(address.into()).map(Into::into)) Box::new(self.light_dispatch.next_nonce(address.into()).map(Into::into))
} }
fn mode(&self) -> Result<String, Error> { fn mode(&self) -> Result<String> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn chain_id(&self) -> Result<Option<U64>, Error> { fn chain_id(&self) -> Result<Option<U64>> {
Ok(self.client.signing_chain_id().map(U64::from)) Ok(self.client.signing_chain_id().map(U64::from))
} }
fn chain(&self) -> Result<String, Error> { fn chain(&self) -> Result<String> {
Ok(self.settings.chain.clone()) Ok(self.settings.chain.clone())
} }
fn enode(&self) -> Result<String, Error> { fn enode(&self) -> Result<String> {
self.light_dispatch.sync.enode().ok_or_else(errors::network_disabled) self.light_dispatch.sync.enode().ok_or_else(errors::network_disabled)
} }
fn consensus_capability(&self) -> Result<ConsensusCapability, Error> { fn consensus_capability(&self) -> Result<ConsensusCapability> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn version_info(&self) -> Result<VersionInfo, Error> { fn version_info(&self) -> Result<VersionInfo> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn releases_info(&self) -> Result<Option<OperationsInfo>, Error> { fn releases_info(&self) -> Result<Option<OperationsInfo>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn chain_status(&self) -> Result<ChainStatus, Error> { fn chain_status(&self) -> Result<ChainStatus> {
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1)) let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1))
@ -356,7 +356,7 @@ impl Parity for ParityClient {
}) })
} }
fn node_kind(&self) -> Result<::v1::types::NodeKind, Error> { fn node_kind(&self) -> Result<::v1::types::NodeKind> {
use ::v1::types::{NodeKind, Availability, Capability}; use ::v1::types::{NodeKind, Availability, Capability};
Ok(NodeKind { Ok(NodeKind {
@ -365,7 +365,7 @@ impl Parity for ParityClient {
}) })
} }
fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader, Error> { fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader> {
use ethcore::encoded; use ethcore::encoded;
let engine = self.light_dispatch.client.engine().clone(); let engine = self.light_dispatch.client.engine().clone();
@ -399,15 +399,15 @@ impl Parity for ParityClient {
Box::new(self.fetcher().header(number.unwrap_or_default().into()).map(from_encoded)) Box::new(self.fetcher().header(number.unwrap_or_default().into()).map(from_encoded))
} }
fn ipfs_cid(&self, content: Bytes) -> Result<String, Error> { fn ipfs_cid(&self, content: Bytes) -> Result<String> {
ipfs::cid(content) ipfs::cid(content)
} }
fn call(&self, _meta: Self::Metadata, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>, Error> { fn call(&self, _meta: Self::Metadata, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn node_health(&self) -> BoxFuture<Health, Error> { fn node_health(&self) -> BoxFuture<Health> {
Box::new(self.health.health() Box::new(self.health.health()
.map_err(|err| errors::internal("Health API failure.", err))) .map_err(|err| errors::internal("Health API failure.", err)))
} }

View File

@ -24,7 +24,7 @@ use ethsync::ManageNetwork;
use fetch::Fetch; use fetch::Fetch;
use hash::keccak_buffer; use hash::keccak_buffer;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::Future; use jsonrpc_core::futures::Future;
use v1::helpers::dapps::DappsService; use v1::helpers::dapps::DappsService;
use v1::helpers::errors; use v1::helpers::errors;
@ -50,81 +50,81 @@ impl<F: Fetch> ParitySetClient<F> {
} }
impl<F: Fetch> ParitySet for ParitySetClient<F> { impl<F: Fetch> ParitySet for ParitySetClient<F> {
fn set_min_gas_price(&self, _gas_price: U256) -> Result<bool, Error> { fn set_min_gas_price(&self, _gas_price: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_gas_floor_target(&self, _target: U256) -> Result<bool, Error> { fn set_gas_floor_target(&self, _target: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_gas_ceil_target(&self, _target: U256) -> Result<bool, Error> { fn set_gas_ceil_target(&self, _target: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_extra_data(&self, _extra_data: Bytes) -> Result<bool, Error> { fn set_extra_data(&self, _extra_data: Bytes) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_author(&self, _author: H160) -> Result<bool, Error> { fn set_author(&self, _author: H160) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_engine_signer(&self, _address: H160, _password: String) -> Result<bool, Error> { fn set_engine_signer(&self, _address: H160, _password: String) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_transactions_limit(&self, _limit: usize) -> Result<bool, Error> { fn set_transactions_limit(&self, _limit: usize) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_tx_gas_limit(&self, _limit: U256) -> Result<bool, Error> { fn set_tx_gas_limit(&self, _limit: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn add_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn add_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.add_reserved_peer(peer) { match self.net.add_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn remove_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn remove_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.remove_reserved_peer(peer) { match self.net.remove_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn drop_non_reserved_peers(&self) -> Result<bool, Error> { fn drop_non_reserved_peers(&self) -> Result<bool> {
self.net.deny_unreserved_peers(); self.net.deny_unreserved_peers();
Ok(true) Ok(true)
} }
fn accept_non_reserved_peers(&self) -> Result<bool, Error> { fn accept_non_reserved_peers(&self) -> Result<bool> {
self.net.accept_unreserved_peers(); self.net.accept_unreserved_peers();
Ok(true) Ok(true)
} }
fn start_network(&self) -> Result<bool, Error> { fn start_network(&self) -> Result<bool> {
self.net.start_network(); self.net.start_network();
Ok(true) Ok(true)
} }
fn stop_network(&self) -> Result<bool, Error> { fn stop_network(&self) -> Result<bool> {
self.net.stop_network(); self.net.stop_network();
Ok(true) Ok(true)
} }
fn set_mode(&self, _mode: String) -> Result<bool, Error> { fn set_mode(&self, _mode: String) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_spec_name(&self, _spec_name: String) -> Result<bool, Error> { fn set_spec_name(&self, _spec_name: String) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn hash_content(&self, url: String) -> BoxFuture<H256, Error> { fn hash_content(&self, url: String) -> BoxFuture<H256> {
self.fetch.process(self.fetch.fetch(&url).then(move |result| { self.fetch.process(self.fetch.fetch(&url).then(move |result| {
result result
.map_err(errors::fetch) .map_err(errors::fetch)
@ -135,23 +135,23 @@ impl<F: Fetch> ParitySet for ParitySetClient<F> {
})) }))
} }
fn dapps_refresh(&self) -> Result<bool, Error> { fn dapps_refresh(&self) -> Result<bool> {
self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn dapps_list(&self) -> Result<Vec<LocalDapp>, Error> { fn dapps_list(&self) -> Result<Vec<LocalDapp>> {
self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>, Error> { fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn execute_upgrade(&self) -> Result<bool, Error> { fn execute_upgrade(&self) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn remove_transaction(&self, _hash: H256) -> Result<Option<Transaction>, Error> { fn remove_transaction(&self, _hash: H256) -> Result<Option<Transaction>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
} }

View File

@ -16,7 +16,7 @@
//! Traces api implementation. //! Traces api implementation.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::Metadata; use v1::Metadata;
use v1::traits::Traces; use v1::traits::Traces;
@ -30,35 +30,35 @@ pub struct TracesClient;
impl Traces for TracesClient { impl Traces for TracesClient {
type Metadata = Metadata; type Metadata = Metadata;
fn filter(&self, _filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn filter(&self, _filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn block_traces(&self, _block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn block_traces(&self, _block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn transaction_traces(&self, _transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn transaction_traces(&self, _transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn trace(&self, _transaction_hash: H256, _address: Vec<Index>) -> Result<Option<LocalizedTrace>, Error> { fn trace(&self, _transaction_hash: H256, _address: Vec<Index>) -> Result<Option<LocalizedTrace>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn call(&self, _meta: Self::Metadata, _request: CallRequest, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn call(&self, _meta: Self::Metadata, _request: CallRequest, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn call_many(&self, _meta: Self::Metadata, _request: Vec<(CallRequest, TraceOptions)>, _block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>, Error> { fn call_many(&self, _meta: Self::Metadata, _request: Vec<(CallRequest, TraceOptions)>, _block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn raw_transaction(&self, _raw_transaction: Bytes, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn raw_transaction(&self, _raw_transaction: Bytes, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn replay_transaction(&self, _transaction_hash: H256, _flags: TraceOptions) -> Result<TraceResults, Error> { fn replay_transaction(&self, _transaction_hash: H256, _flags: TraceOptions) -> Result<TraceResults> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
} }

View File

@ -16,7 +16,7 @@
//! Net rpc implementation. //! Net rpc implementation.
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use ethsync::SyncProvider; use ethsync::SyncProvider;
use v1::traits::Net; use v1::traits::Net;
@ -35,15 +35,15 @@ impl<S: ?Sized> NetClient<S> where S: SyncProvider {
} }
impl<S: ?Sized> Net for NetClient<S> where S: SyncProvider + 'static { impl<S: ?Sized> Net for NetClient<S> where S: SyncProvider + 'static {
fn version(&self) -> Result<String, Error> { fn version(&self) -> Result<String> {
Ok(format!("{}", self.sync.status().network_id).to_owned()) Ok(format!("{}", self.sync.status().network_id).to_owned())
} }
fn peer_count(&self) -> Result<String, Error> { fn peer_count(&self) -> Result<String> {
Ok(format!("0x{:x}", self.sync.status().num_peers as u64).to_owned()) Ok(format!("0x{:x}", self.sync.status().num_peers as u64).to_owned())
} }
fn is_listening(&self) -> Result<bool, Error> { fn is_listening(&self) -> Result<bool> {
// right now (11 march 2016), we are always listening for incoming connections // right now (11 march 2016), we are always listening for incoming connections
// //
// (this may not be true now -- 26 september 2016) // (this may not be true now -- 26 september 2016)

View File

@ -35,7 +35,7 @@ use ethcore_logger::RotatingLogger;
use node_health::{NodeHealth, Health}; use node_health::{NodeHealth, Health};
use updater::{Service as UpdateService}; use updater::{Service as UpdateService};
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings}; use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings};
@ -107,7 +107,7 @@ impl<C, M, U> ParityClient<C, M, U> where
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
} }
@ -119,7 +119,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
{ {
type Metadata = Metadata; type Metadata = Metadata;
fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>, Error> { fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>> {
let dapp = dapp.unwrap_or_default(); let dapp = dapp.unwrap_or_default();
let store = self.account_provider()?; let store = self.account_provider()?;
@ -141,7 +141,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>, Error> { fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>> {
let store = self.account_provider()?; let store = self.account_provider()?;
let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?; let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?;
Ok(info Ok(info
@ -151,12 +151,12 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>, Error> { fn locked_hardware_accounts_info(&self) -> Result<Vec<String>> {
let store = self.account_provider()?; let store = self.account_provider()?;
Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?) Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?)
} }
fn default_account(&self, meta: Self::Metadata) -> Result<H160, Error> { fn default_account(&self, meta: Self::Metadata) -> Result<H160> {
let dapp_id = meta.dapp_id(); let dapp_id = meta.dapp_id();
Ok(self.account_provider()? Ok(self.account_provider()?
@ -166,48 +166,48 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
.unwrap_or_default()) .unwrap_or_default())
} }
fn transactions_limit(&self) -> Result<usize, Error> { fn transactions_limit(&self) -> Result<usize> {
Ok(self.miner.transactions_limit()) Ok(self.miner.transactions_limit())
} }
fn min_gas_price(&self) -> Result<U256, Error> { fn min_gas_price(&self) -> Result<U256> {
Ok(U256::from(self.miner.minimal_gas_price())) Ok(U256::from(self.miner.minimal_gas_price()))
} }
fn extra_data(&self) -> Result<Bytes, Error> { fn extra_data(&self) -> Result<Bytes> {
Ok(Bytes::new(self.miner.extra_data())) Ok(Bytes::new(self.miner.extra_data()))
} }
fn gas_floor_target(&self) -> Result<U256, Error> { fn gas_floor_target(&self) -> Result<U256> {
Ok(U256::from(self.miner.gas_floor_target())) Ok(U256::from(self.miner.gas_floor_target()))
} }
fn gas_ceil_target(&self) -> Result<U256, Error> { fn gas_ceil_target(&self) -> Result<U256> {
Ok(U256::from(self.miner.gas_ceil_target())) Ok(U256::from(self.miner.gas_ceil_target()))
} }
fn dev_logs(&self) -> Result<Vec<String>, Error> { fn dev_logs(&self) -> Result<Vec<String>> {
let logs = self.logger.logs(); let logs = self.logger.logs();
Ok(logs.as_slice().to_owned()) Ok(logs.as_slice().to_owned())
} }
fn dev_logs_levels(&self) -> Result<String, Error> { fn dev_logs_levels(&self) -> Result<String> {
Ok(self.logger.levels().to_owned()) Ok(self.logger.levels().to_owned())
} }
fn net_chain(&self) -> Result<String, Error> { fn net_chain(&self) -> Result<String> {
Ok(self.settings.chain.clone()) Ok(self.settings.chain.clone())
} }
fn chain_id(&self) -> Result<Option<U64>, Error> { fn chain_id(&self) -> Result<Option<U64>> {
Ok(self.client.signing_chain_id().map(U64::from)) Ok(self.client.signing_chain_id().map(U64::from))
} }
fn chain(&self) -> Result<String, Error> { fn chain(&self) -> Result<String> {
Ok(self.client.spec_name()) Ok(self.client.spec_name())
} }
fn net_peers(&self) -> Result<Peers, Error> { fn net_peers(&self) -> Result<Peers> {
let sync_status = self.sync.status(); let sync_status = self.sync.status();
let net_config = self.net.network_config(); let net_config = self.net.network_config();
let peers = self.sync.peers().into_iter().map(Into::into).collect(); let peers = self.sync.peers().into_iter().map(Into::into).collect();
@ -220,15 +220,15 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn net_port(&self) -> Result<u16, Error> { fn net_port(&self) -> Result<u16> {
Ok(self.settings.network_port) Ok(self.settings.network_port)
} }
fn node_name(&self) -> Result<String, Error> { fn node_name(&self) -> Result<String> {
Ok(self.settings.name.clone()) Ok(self.settings.name.clone())
} }
fn registry_address(&self) -> Result<Option<H160>, Error> { fn registry_address(&self) -> Result<Option<H160>> {
Ok( Ok(
self.client self.client
.additional_params() .additional_params()
@ -238,7 +238,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn rpc_settings(&self) -> Result<RpcSettings, Error> { fn rpc_settings(&self) -> Result<RpcSettings> {
Ok(RpcSettings { Ok(RpcSettings {
enabled: self.settings.rpc_enabled, enabled: self.settings.rpc_enabled,
interface: self.settings.rpc_interface.clone(), interface: self.settings.rpc_interface.clone(),
@ -246,11 +246,11 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn default_extra_data(&self) -> Result<Bytes, Error> { fn default_extra_data(&self) -> Result<Bytes> {
Ok(Bytes::new(version_data())) Ok(Bytes::new(version_data()))
} }
fn gas_price_histogram(&self) -> BoxFuture<Histogram, Error> { fn gas_price_histogram(&self) -> BoxFuture<Histogram> {
Box::new(future::done(self.client Box::new(future::done(self.client
.gas_price_corpus(100) .gas_price_corpus(100)
.histogram(10) .histogram(10)
@ -259,50 +259,50 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
)) ))
} }
fn unsigned_transactions_count(&self) -> Result<usize, Error> { fn unsigned_transactions_count(&self) -> Result<usize> {
match self.signer { match self.signer {
None => Err(errors::signer_disabled()), None => Err(errors::signer_disabled()),
Some(ref signer) => Ok(signer.len()), Some(ref signer) => Ok(signer.len()),
} }
} }
fn generate_secret_phrase(&self) -> Result<String, Error> { fn generate_secret_phrase(&self) -> Result<String> {
Ok(random_phrase(12)) Ok(random_phrase(12))
} }
fn phrase_to_address(&self, phrase: String) -> Result<H160, Error> { fn phrase_to_address(&self, phrase: String) -> Result<H160> {
Ok(Brain::new(phrase).generate().unwrap().address().into()) Ok(Brain::new(phrase).generate().unwrap().address().into())
} }
fn list_accounts(&self, count: u64, after: Option<H160>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>, Error> { fn list_accounts(&self, count: u64, after: Option<H160>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>> {
Ok(self.client Ok(self.client
.list_accounts(block_number.unwrap_or_default().into(), after.map(Into::into).as_ref(), count) .list_accounts(block_number.unwrap_or_default().into(), after.map(Into::into).as_ref(), count)
.map(|a| a.into_iter().map(Into::into).collect())) .map(|a| a.into_iter().map(Into::into).collect()))
} }
fn list_storage_keys(&self, address: H160, count: u64, after: Option<H256>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>, Error> { fn list_storage_keys(&self, address: H160, count: u64, after: Option<H256>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>> {
Ok(self.client Ok(self.client
.list_storage(block_number.unwrap_or_default().into(), &address.into(), after.map(Into::into).as_ref(), count) .list_storage(block_number.unwrap_or_default().into(), &address.into(), after.map(Into::into).as_ref(), count)
.map(|a| a.into_iter().map(Into::into).collect())) .map(|a| a.into_iter().map(Into::into).collect()))
} }
fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes, Error> { fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes> {
ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0) ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0)
.map_err(errors::encryption) .map_err(errors::encryption)
.map(Into::into) .map(Into::into)
} }
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error> { fn pending_transactions(&self) -> Result<Vec<Transaction>> {
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
Ok(self.miner.pending_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>()) Ok(self.miner.pending_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>())
} }
fn future_transactions(&self) -> Result<Vec<Transaction>, Error> { fn future_transactions(&self) -> Result<Vec<Transaction>> {
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
Ok(self.miner.future_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>()) Ok(self.miner.future_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>())
} }
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>, Error> { fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>> {
let stats = self.sync.transactions_stats(); let stats = self.sync.transactions_stats();
Ok(stats.into_iter() Ok(stats.into_iter()
.map(|(hash, stats)| (hash.into(), stats.into())) .map(|(hash, stats)| (hash.into(), stats.into()))
@ -310,7 +310,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>, Error> { fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>> {
// Return nothing if accounts are disabled (running as public node) // Return nothing if accounts are disabled (running as public node)
if self.accounts.is_none() { if self.accounts.is_none() {
return Ok(BTreeMap::new()); return Ok(BTreeMap::new());
@ -325,17 +325,17 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn dapps_url(&self) -> Result<String, Error> { fn dapps_url(&self) -> Result<String> {
helpers::to_url(&self.dapps_address) helpers::to_url(&self.dapps_address)
.ok_or_else(|| errors::dapps_disabled()) .ok_or_else(|| errors::dapps_disabled())
} }
fn ws_url(&self) -> Result<String, Error> { fn ws_url(&self) -> Result<String> {
helpers::to_url(&self.ws_address) helpers::to_url(&self.ws_address)
.ok_or_else(|| errors::ws_disabled()) .ok_or_else(|| errors::ws_disabled())
} }
fn next_nonce(&self, address: H160) -> BoxFuture<U256, Error> { fn next_nonce(&self, address: H160) -> BoxFuture<U256> {
let address: Address = address.into(); let address: Address = address.into();
Box::new(future::ok(self.miner.last_nonce(&address) Box::new(future::ok(self.miner.last_nonce(&address)
@ -345,7 +345,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
)) ))
} }
fn mode(&self) -> Result<String, Error> { fn mode(&self) -> Result<String> {
Ok(match self.client.mode() { Ok(match self.client.mode() {
Mode::Off => "offline", Mode::Off => "offline",
Mode::Dark(..) => "dark", Mode::Dark(..) => "dark",
@ -354,23 +354,23 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}.into()) }.into())
} }
fn enode(&self) -> Result<String, Error> { fn enode(&self) -> Result<String> {
self.sync.enode().ok_or_else(errors::network_disabled) self.sync.enode().ok_or_else(errors::network_disabled)
} }
fn consensus_capability(&self) -> Result<ConsensusCapability, Error> { fn consensus_capability(&self) -> Result<ConsensusCapability> {
Ok(self.updater.capability().into()) Ok(self.updater.capability().into())
} }
fn version_info(&self) -> Result<VersionInfo, Error> { fn version_info(&self) -> Result<VersionInfo> {
Ok(self.updater.version_info().into()) Ok(self.updater.version_info().into())
} }
fn releases_info(&self) -> Result<Option<OperationsInfo>, Error> { fn releases_info(&self) -> Result<Option<OperationsInfo>> {
Ok(self.updater.info().map(Into::into)) Ok(self.updater.info().map(Into::into))
} }
fn chain_status(&self) -> Result<ChainStatus, Error> { fn chain_status(&self) -> Result<ChainStatus> {
let chain_info = self.client.chain_info(); let chain_info = self.client.chain_info();
let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1)) let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1))
@ -381,7 +381,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn node_kind(&self) -> Result<::v1::types::NodeKind, Error> { fn node_kind(&self) -> Result<::v1::types::NodeKind> {
use ::v1::types::{NodeKind, Availability, Capability}; use ::v1::types::{NodeKind, Availability, Capability};
let availability = match self.accounts { let availability = match self.accounts {
@ -395,7 +395,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader, Error> { fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader> {
const EXTRA_INFO_PROOF: &'static str = "Object exists in in blockchain (fetched earlier), extra_info is always available if object exists; qed"; const EXTRA_INFO_PROOF: &'static str = "Object exists in in blockchain (fetched earlier), extra_info is always available if object exists; qed";
let id: BlockId = number.unwrap_or_default().into(); let id: BlockId = number.unwrap_or_default().into();
@ -410,18 +410,18 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
})) }))
} }
fn ipfs_cid(&self, content: Bytes) -> Result<String, Error> { fn ipfs_cid(&self, content: Bytes) -> Result<String> {
ipfs::cid(content) ipfs::cid(content)
} }
fn call(&self, meta: Self::Metadata, requests: Vec<CallRequest>, block: Trailing<BlockNumber>) -> Result<Vec<Bytes>, Error> { fn call(&self, meta: Self::Metadata, requests: Vec<CallRequest>, block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
let requests = requests let requests = requests
.into_iter() .into_iter()
.map(|request| Ok(( .map(|request| Ok((
fake_sign::sign_call(request.into(), meta.is_dapp())?, fake_sign::sign_call(request.into(), meta.is_dapp())?,
Default::default() Default::default()
))) )))
.collect::<Result<Vec<_>, Error>>()?; .collect::<Result<Vec<_>>>()?;
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
@ -430,7 +430,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
.map_err(errors::call) .map_err(errors::call)
} }
fn node_health(&self) -> BoxFuture<Health, Error> { fn node_health(&self) -> BoxFuture<Health> {
Box::new(self.health.health() Box::new(self.health.health()
.map_err(|err| errors::internal("Health API failure.", err))) .map_err(|err| errors::internal("Health API failure.", err)))
} }

View File

@ -23,7 +23,7 @@ use ethkey::{Brain, Generator, Secret};
use ethstore::KeyFile; use ethstore::KeyFile;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::helpers::errors; use v1::helpers::errors;
use v1::helpers::accounts::unwrap_provider; use v1::helpers::accounts::unwrap_provider;
use v1::traits::ParityAccounts; use v1::traits::ParityAccounts;
@ -44,13 +44,13 @@ impl ParityAccountsClient {
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
} }
impl ParityAccounts for ParityAccountsClient { impl ParityAccounts for ParityAccountsClient {
fn all_accounts_info(&self) -> Result<BTreeMap<RpcH160, ExtAccountInfo>, Error> { fn all_accounts_info(&self) -> Result<BTreeMap<RpcH160, ExtAccountInfo>> {
let store = self.account_provider()?; let store = self.account_provider()?;
let info = store.accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?; let info = store.accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?;
let other = store.addresses_info(); let other = store.addresses_info();
@ -82,7 +82,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(accounts) Ok(accounts)
} }
fn new_account_from_phrase(&self, phrase: String, pass: String) -> Result<RpcH160, Error> { fn new_account_from_phrase(&self, phrase: String, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
let brain = Brain::new(phrase).generate().unwrap(); let brain = Brain::new(phrase).generate().unwrap();
@ -91,7 +91,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn new_account_from_wallet(&self, json: String, pass: String) -> Result<RpcH160, Error> { fn new_account_from_wallet(&self, json: String, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.import_presale(json.as_bytes(), &pass) store.import_presale(json.as_bytes(), &pass)
@ -100,7 +100,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn new_account_from_secret(&self, secret: RpcH256, pass: String) -> Result<RpcH160, Error> { fn new_account_from_secret(&self, secret: RpcH256, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
let secret = Secret::from_unsafe_slice(&secret.0) let secret = Secret::from_unsafe_slice(&secret.0)
@ -110,7 +110,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn test_password(&self, account: RpcH160, password: String) -> Result<bool, Error> { fn test_password(&self, account: RpcH160, password: String) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
self.account_provider()? self.account_provider()?
@ -118,7 +118,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not fetch account info.", e)) .map_err(|e| errors::account("Could not fetch account info.", e))
} }
fn change_password(&self, account: RpcH160, password: String, new_password: String) -> Result<bool, Error> { fn change_password(&self, account: RpcH160, password: String, new_password: String) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
self.account_provider()? self.account_provider()?
.change_password(&account, password, new_password) .change_password(&account, password, new_password)
@ -126,7 +126,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not fetch account info.", e)) .map_err(|e| errors::account("Could not fetch account info.", e))
} }
fn kill_account(&self, account: RpcH160, password: String) -> Result<bool, Error> { fn kill_account(&self, account: RpcH160, password: String) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
self.account_provider()? self.account_provider()?
.kill_account(&account, &password) .kill_account(&account, &password)
@ -134,7 +134,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not delete account.", e)) .map_err(|e| errors::account("Could not delete account.", e))
} }
fn remove_address(&self, addr: RpcH160) -> Result<bool, Error> { fn remove_address(&self, addr: RpcH160) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
let addr: Address = addr.into(); let addr: Address = addr.into();
@ -142,7 +142,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(true) Ok(true)
} }
fn set_account_name(&self, addr: RpcH160, name: String) -> Result<bool, Error> { fn set_account_name(&self, addr: RpcH160, name: String) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
let addr: Address = addr.into(); let addr: Address = addr.into();
@ -151,7 +151,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(true) Ok(true)
} }
fn set_account_meta(&self, addr: RpcH160, meta: String) -> Result<bool, Error> { fn set_account_meta(&self, addr: RpcH160, meta: String) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
let addr: Address = addr.into(); let addr: Address = addr.into();
@ -160,7 +160,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(true) Ok(true)
} }
fn set_dapp_addresses(&self, dapp: DappId, addresses: Option<Vec<RpcH160>>) -> Result<bool, Error> { fn set_dapp_addresses(&self, dapp: DappId, addresses: Option<Vec<RpcH160>>) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.set_dapp_addresses(dapp.into(), addresses.map(into_vec)) store.set_dapp_addresses(dapp.into(), addresses.map(into_vec))
@ -168,7 +168,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn dapp_addresses(&self, dapp: DappId) -> Result<Vec<RpcH160>, Error> { fn dapp_addresses(&self, dapp: DappId) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.dapp_addresses(dapp.into()) store.dapp_addresses(dapp.into())
@ -176,7 +176,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(into_vec) .map(into_vec)
} }
fn set_dapp_default_address(&self, dapp: DappId, address: RpcH160) -> Result<bool, Error> { fn set_dapp_default_address(&self, dapp: DappId, address: RpcH160) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.set_dapp_default_address(dapp.into(), address.into()) store.set_dapp_default_address(dapp.into(), address.into())
@ -184,7 +184,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn dapp_default_address(&self, dapp: DappId) -> Result<RpcH160, Error> { fn dapp_default_address(&self, dapp: DappId) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.dapp_default_address(dapp.into()) store.dapp_default_address(dapp.into())
@ -192,7 +192,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(Into::into) .map(Into::into)
} }
fn set_new_dapps_addresses(&self, addresses: Option<Vec<RpcH160>>) -> Result<bool, Error> { fn set_new_dapps_addresses(&self, addresses: Option<Vec<RpcH160>>) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store store
@ -201,7 +201,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn new_dapps_addresses(&self) -> Result<Option<Vec<RpcH160>>, Error> { fn new_dapps_addresses(&self) -> Result<Option<Vec<RpcH160>>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.new_dapps_addresses() store.new_dapps_addresses()
@ -209,7 +209,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|accounts| accounts.map(into_vec)) .map(|accounts| accounts.map(into_vec))
} }
fn set_new_dapps_default_address(&self, address: RpcH160) -> Result<bool, Error> { fn set_new_dapps_default_address(&self, address: RpcH160) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.set_new_dapps_default_address(address.into()) store.set_new_dapps_default_address(address.into())
@ -217,7 +217,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn new_dapps_default_address(&self) -> Result<RpcH160, Error> { fn new_dapps_default_address(&self) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.new_dapps_default_address() store.new_dapps_default_address()
@ -225,7 +225,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(Into::into) .map(Into::into)
} }
fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>, Error> { fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.recent_dapps() store.recent_dapps()
@ -233,7 +233,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|map| map.into_iter().map(|(k, v)| (k.into(), v)).collect()) .map(|map| map.into_iter().map(|(k, v)| (k.into(), v)).collect())
} }
fn import_geth_accounts(&self, addresses: Vec<RpcH160>) -> Result<Vec<RpcH160>, Error> { fn import_geth_accounts(&self, addresses: Vec<RpcH160>) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store store
@ -242,73 +242,73 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Couldn't import Geth accounts", e)) .map_err(|e| errors::account("Couldn't import Geth accounts", e))
} }
fn geth_accounts(&self) -> Result<Vec<RpcH160>, Error> { fn geth_accounts(&self) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
Ok(into_vec(store.list_geth_accounts(false))) Ok(into_vec(store.list_geth_accounts(false)))
} }
fn create_vault(&self, name: String, password: String) -> Result<bool, Error> { fn create_vault(&self, name: String, password: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.create_vault(&name, &password) .create_vault(&name, &password)
.map_err(|e| errors::account("Could not create vault.", e)) .map_err(|e| errors::account("Could not create vault.", e))
.map(|_| true) .map(|_| true)
} }
fn open_vault(&self, name: String, password: String) -> Result<bool, Error> { fn open_vault(&self, name: String, password: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.open_vault(&name, &password) .open_vault(&name, &password)
.map_err(|e| errors::account("Could not open vault.", e)) .map_err(|e| errors::account("Could not open vault.", e))
.map(|_| true) .map(|_| true)
} }
fn close_vault(&self, name: String) -> Result<bool, Error> { fn close_vault(&self, name: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.close_vault(&name) .close_vault(&name)
.map_err(|e| errors::account("Could not close vault.", e)) .map_err(|e| errors::account("Could not close vault.", e))
.map(|_| true) .map(|_| true)
} }
fn list_vaults(&self) -> Result<Vec<String>, Error> { fn list_vaults(&self) -> Result<Vec<String>> {
self.account_provider()? self.account_provider()?
.list_vaults() .list_vaults()
.map_err(|e| errors::account("Could not list vaults.", e)) .map_err(|e| errors::account("Could not list vaults.", e))
} }
fn list_opened_vaults(&self) -> Result<Vec<String>, Error> { fn list_opened_vaults(&self) -> Result<Vec<String>> {
self.account_provider()? self.account_provider()?
.list_opened_vaults() .list_opened_vaults()
.map_err(|e| errors::account("Could not list vaults.", e)) .map_err(|e| errors::account("Could not list vaults.", e))
} }
fn change_vault_password(&self, name: String, new_password: String) -> Result<bool, Error> { fn change_vault_password(&self, name: String, new_password: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.change_vault_password(&name, &new_password) .change_vault_password(&name, &new_password)
.map_err(|e| errors::account("Could not change vault password.", e)) .map_err(|e| errors::account("Could not change vault password.", e))
.map(|_| true) .map(|_| true)
} }
fn change_vault(&self, address: RpcH160, new_vault: String) -> Result<bool, Error> { fn change_vault(&self, address: RpcH160, new_vault: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.change_vault(address.into(), &new_vault) .change_vault(address.into(), &new_vault)
.map_err(|e| errors::account("Could not change vault.", e)) .map_err(|e| errors::account("Could not change vault.", e))
.map(|_| true) .map(|_| true)
} }
fn get_vault_meta(&self, name: String) -> Result<String, Error> { fn get_vault_meta(&self, name: String) -> Result<String> {
self.account_provider()? self.account_provider()?
.get_vault_meta(&name) .get_vault_meta(&name)
.map_err(|e| errors::account("Could not get vault metadata.", e)) .map_err(|e| errors::account("Could not get vault metadata.", e))
} }
fn set_vault_meta(&self, name: String, meta: String) -> Result<bool, Error> { fn set_vault_meta(&self, name: String, meta: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.set_vault_meta(&name, &meta) .set_vault_meta(&name, &meta)
.map_err(|e| errors::account("Could not update vault metadata.", e)) .map_err(|e| errors::account("Could not update vault metadata.", e))
.map(|_| true) .map(|_| true)
} }
fn derive_key_index(&self, addr: RpcH160, password: String, derivation: DeriveHierarchical, save_as_account: bool) -> Result<RpcH160, Error> { fn derive_key_index(&self, addr: RpcH160, password: String, derivation: DeriveHierarchical, save_as_account: bool) -> Result<RpcH160> {
let addr: Address = addr.into(); let addr: Address = addr.into();
self.account_provider()? self.account_provider()?
.derive_account( .derive_account(
@ -321,7 +321,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not derive account.", e)) .map_err(|e| errors::account("Could not derive account.", e))
} }
fn derive_key_hash(&self, addr: RpcH160, password: String, derivation: DeriveHash, save_as_account: bool) -> Result<RpcH160, Error> { fn derive_key_hash(&self, addr: RpcH160, password: String, derivation: DeriveHash, save_as_account: bool) -> Result<RpcH160> {
let addr: Address = addr.into(); let addr: Address = addr.into();
self.account_provider()? self.account_provider()?
.derive_account( .derive_account(
@ -334,7 +334,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not derive account.", e)) .map_err(|e| errors::account("Could not derive account.", e))
} }
fn export_account(&self, addr: RpcH160, password: String) -> Result<KeyFile, Error> { fn export_account(&self, addr: RpcH160, password: String) -> Result<KeyFile> {
let addr = addr.into(); let addr = addr.into();
self.account_provider()? self.account_provider()?
.export_account( .export_account(
@ -345,7 +345,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not export account.", e)) .map_err(|e| errors::account("Could not export account.", e))
} }
fn sign_message(&self, addr: RpcH160, password: String, message: RpcH256) -> Result<RpcH520, Error> { fn sign_message(&self, addr: RpcH160, password: String, message: RpcH256) -> Result<RpcH520> {
self.account_provider()? self.account_provider()?
.sign( .sign(
addr.into(), addr.into(),
@ -356,7 +356,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not sign message.", e)) .map_err(|e| errors::account("Could not sign message.", e))
} }
fn hardware_pin_matrix_ack(&self, path: String, pin: String) -> Result<bool, Error> { fn hardware_pin_matrix_ack(&self, path: String, pin: String) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
Ok(store.hardware_pin_matrix_ack(&path, &pin).map_err(|e| errors::account("Error communicating with hardware wallet.", e))?) Ok(store.hardware_pin_matrix_ack(&path, &pin).map_err(|e| errors::account("Error communicating with hardware wallet.", e))?)
} }

View File

@ -26,7 +26,7 @@ use fetch::{self, Fetch};
use hash::keccak_buffer; use hash::keccak_buffer;
use updater::{Service as UpdateService}; use updater::{Service as UpdateService};
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::Future; use jsonrpc_core::futures::Future;
use v1::helpers::dapps::DappsService; use v1::helpers::dapps::DappsService;
use v1::helpers::errors; use v1::helpers::errors;
@ -75,81 +75,81 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
F: Fetch + 'static, F: Fetch + 'static,
{ {
fn set_min_gas_price(&self, gas_price: U256) -> Result<bool, Error> { fn set_min_gas_price(&self, gas_price: U256) -> Result<bool> {
self.miner.set_minimal_gas_price(gas_price.into()); self.miner.set_minimal_gas_price(gas_price.into());
Ok(true) Ok(true)
} }
fn set_gas_floor_target(&self, target: U256) -> Result<bool, Error> { fn set_gas_floor_target(&self, target: U256) -> Result<bool> {
self.miner.set_gas_floor_target(target.into()); self.miner.set_gas_floor_target(target.into());
Ok(true) Ok(true)
} }
fn set_gas_ceil_target(&self, target: U256) -> Result<bool, Error> { fn set_gas_ceil_target(&self, target: U256) -> Result<bool> {
self.miner.set_gas_ceil_target(target.into()); self.miner.set_gas_ceil_target(target.into());
Ok(true) Ok(true)
} }
fn set_extra_data(&self, extra_data: Bytes) -> Result<bool, Error> { fn set_extra_data(&self, extra_data: Bytes) -> Result<bool> {
self.miner.set_extra_data(extra_data.into_vec()); self.miner.set_extra_data(extra_data.into_vec());
Ok(true) Ok(true)
} }
fn set_author(&self, author: H160) -> Result<bool, Error> { fn set_author(&self, author: H160) -> Result<bool> {
self.miner.set_author(author.into()); self.miner.set_author(author.into());
Ok(true) Ok(true)
} }
fn set_engine_signer(&self, address: H160, password: String) -> Result<bool, Error> { fn set_engine_signer(&self, address: H160, password: String) -> Result<bool> {
self.miner.set_engine_signer(address.into(), password).map_err(Into::into).map_err(errors::password)?; self.miner.set_engine_signer(address.into(), password).map_err(Into::into).map_err(errors::password)?;
Ok(true) Ok(true)
} }
fn set_transactions_limit(&self, limit: usize) -> Result<bool, Error> { fn set_transactions_limit(&self, limit: usize) -> Result<bool> {
self.miner.set_transactions_limit(limit); self.miner.set_transactions_limit(limit);
Ok(true) Ok(true)
} }
fn set_tx_gas_limit(&self, limit: U256) -> Result<bool, Error> { fn set_tx_gas_limit(&self, limit: U256) -> Result<bool> {
self.miner.set_tx_gas_limit(limit.into()); self.miner.set_tx_gas_limit(limit.into());
Ok(true) Ok(true)
} }
fn add_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn add_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.add_reserved_peer(peer) { match self.net.add_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn remove_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn remove_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.remove_reserved_peer(peer) { match self.net.remove_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn drop_non_reserved_peers(&self) -> Result<bool, Error> { fn drop_non_reserved_peers(&self) -> Result<bool> {
self.net.deny_unreserved_peers(); self.net.deny_unreserved_peers();
Ok(true) Ok(true)
} }
fn accept_non_reserved_peers(&self) -> Result<bool, Error> { fn accept_non_reserved_peers(&self) -> Result<bool> {
self.net.accept_unreserved_peers(); self.net.accept_unreserved_peers();
Ok(true) Ok(true)
} }
fn start_network(&self) -> Result<bool, Error> { fn start_network(&self) -> Result<bool> {
self.net.start_network(); self.net.start_network();
Ok(true) Ok(true)
} }
fn stop_network(&self) -> Result<bool, Error> { fn stop_network(&self) -> Result<bool> {
self.net.stop_network(); self.net.stop_network();
Ok(true) Ok(true)
} }
fn set_mode(&self, mode: String) -> Result<bool, Error> { fn set_mode(&self, mode: String) -> Result<bool> {
self.client.set_mode(match mode.as_str() { self.client.set_mode(match mode.as_str() {
"offline" => Mode::Off, "offline" => Mode::Off,
"dark" => Mode::Dark(300), "dark" => Mode::Dark(300),
@ -160,12 +160,12 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
Ok(true) Ok(true)
} }
fn set_spec_name(&self, spec_name: String) -> Result<bool, Error> { fn set_spec_name(&self, spec_name: String) -> Result<bool> {
self.client.set_spec_name(spec_name); self.client.set_spec_name(spec_name);
Ok(true) Ok(true)
} }
fn hash_content(&self, url: String) -> BoxFuture<H256, Error> { fn hash_content(&self, url: String) -> BoxFuture<H256> {
self.fetch.process(self.fetch.fetch(&url).then(move |result| { self.fetch.process(self.fetch.fetch(&url).then(move |result| {
result result
.map_err(errors::fetch) .map_err(errors::fetch)
@ -176,23 +176,23 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
})) }))
} }
fn dapps_refresh(&self) -> Result<bool, Error> { fn dapps_refresh(&self) -> Result<bool> {
self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn dapps_list(&self) -> Result<Vec<LocalDapp>, Error> { fn dapps_list(&self) -> Result<Vec<LocalDapp>> {
self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>, Error> { fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>> {
Ok(self.updater.upgrade_ready().map(Into::into)) Ok(self.updater.upgrade_ready().map(Into::into))
} }
fn execute_upgrade(&self) -> Result<bool, Error> { fn execute_upgrade(&self) -> Result<bool> {
Ok(self.updater.execute_upgrade()) Ok(self.updater.execute_upgrade())
} }
fn remove_transaction(&self, hash: H256) -> Result<Option<Transaction>, Error> { fn remove_transaction(&self, hash: H256) -> Result<Option<Transaction>> {
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
let hash = hash.into(); let hash = hash.into();

View File

@ -24,7 +24,7 @@ use bigint::prelude::U128;
use util::Address; use util::Address;
use bytes::ToPretty; use bytes::ToPretty;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use v1::helpers::errors; use v1::helpers::errors;
use v1::helpers::dispatch::{Dispatcher, SignWith}; use v1::helpers::dispatch::{Dispatcher, SignWith};
@ -50,7 +50,7 @@ impl<D: Dispatcher> PersonalClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
} }
@ -58,13 +58,13 @@ impl<D: Dispatcher> PersonalClient<D> {
impl<D: Dispatcher + 'static> Personal for PersonalClient<D> { impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn accounts(&self) -> Result<Vec<RpcH160>, Error> { fn accounts(&self) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
let accounts = store.accounts().map_err(|e| errors::account("Could not fetch accounts.", e))?; let accounts = store.accounts().map_err(|e| errors::account("Could not fetch accounts.", e))?;
Ok(accounts.into_iter().map(Into::into).collect::<Vec<RpcH160>>()) Ok(accounts.into_iter().map(Into::into).collect::<Vec<RpcH160>>())
} }
fn new_account(&self, pass: String) -> Result<RpcH160, Error> { fn new_account(&self, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.new_account(&pass) store.new_account(&pass)
@ -72,7 +72,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn unlock_account(&self, account: RpcH160, account_pass: String, duration: Option<RpcU128>) -> Result<bool, Error> { fn unlock_account(&self, account: RpcH160, account_pass: String, duration: Option<RpcU128>) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
let store = self.account_provider()?; let store = self.account_provider()?;
let duration = match duration { let duration = match duration {
@ -104,7 +104,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
} }
} }
fn send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256, Error> { fn send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256> {
let dispatcher = self.dispatcher.clone(); let dispatcher = self.dispatcher.clone();
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
@ -137,7 +137,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
})) }))
} }
fn sign_and_send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256, Error> { fn sign_and_send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256> {
warn!("Using deprecated personal_signAndSendTransaction, use personal_sendTransaction instead."); warn!("Using deprecated personal_signAndSendTransaction, use personal_sendTransaction instead.");
self.send_transaction(meta, request, password) self.send_transaction(meta, request, password)
} }

View File

@ -20,7 +20,7 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use parking_lot::RwLock; use parking_lot::RwLock;
use jsonrpc_core::{self as core, Error, MetaIoHandler}; use jsonrpc_core::{self as core, Result, MetaIoHandler};
use jsonrpc_core::futures::{Future, Stream, Sink}; use jsonrpc_core::futures::{Future, Stream, Sink};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
@ -94,7 +94,7 @@ impl<S: core::Middleware<Metadata>> PubSub for PubSubClient<S> {
} }
} }
fn parity_unsubscribe(&self, id: SubscriptionId) -> Result<bool, Error> { fn parity_unsubscribe(&self, id: SubscriptionId) -> Result<bool> {
let res = self.poll_manager.write().unsubscribe(&id); let res = self.poll_manager.write().unsubscribe(&id);
Ok(res) Ok(res)
} }

View File

@ -16,7 +16,7 @@
//! RPC generic methods implementation. //! RPC generic methods implementation.
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::traits::Rpc; use v1::traits::Rpc;
/// RPC generic methods implementation. /// RPC generic methods implementation.
@ -39,7 +39,7 @@ impl RpcClient {
} }
impl Rpc for RpcClient { impl Rpc for RpcClient {
fn rpc_modules(&self) -> Result<BTreeMap<String, String>, Error> { fn rpc_modules(&self) -> Result<BTreeMap<String, String>> {
let modules = self.modules.iter() let modules = self.modules.iter()
.fold(BTreeMap::new(), |mut map, (k, v)| { .fold(BTreeMap::new(), |mut map, (k, v)| {
map.insert(k.to_owned(), v.to_owned()); map.insert(k.to_owned(), v.to_owned());
@ -49,7 +49,7 @@ impl Rpc for RpcClient {
Ok(modules) Ok(modules)
} }
fn modules(&self) -> Result<BTreeMap<String, String>, Error> { fn modules(&self) -> Result<BTreeMap<String, String>> {
let modules = self.modules.iter() let modules = self.modules.iter()
.filter(|&(k, _v)| { .filter(|&(k, _v)| {
self.valid_apis.contains(k) self.valid_apis.contains(k)

View File

@ -16,16 +16,17 @@
//! SecretStore-specific rpc implementation. //! SecretStore-specific rpc implementation.
use std::collections::BTreeSet;
use std::sync::Arc; use std::sync::Arc;
use crypto::DEFAULT_MAC; use crypto::DEFAULT_MAC;
use ethkey::Secret; use ethkey::Secret;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::helpers::errors; use v1::helpers::errors;
use v1::helpers::accounts::unwrap_provider; use v1::helpers::accounts::unwrap_provider;
use v1::helpers::secretstore::{encrypt_document, decrypt_document, decrypt_document_with_shadow}; use v1::helpers::secretstore::{encrypt_document, decrypt_document, decrypt_document_with_shadow, ordered_servers_keccak};
use v1::traits::SecretStore; use v1::traits::SecretStore;
use v1::types::{H160, H512, Bytes}; use v1::types::{H160, H512, Bytes};
@ -44,36 +45,36 @@ impl SecretStoreClient {
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
/// Decrypt public key using account' private key /// Decrypt public key using account' private key
fn decrypt_key(&self, address: H160, password: String, key: Bytes) -> Result<Vec<u8>, Error> { fn decrypt_key(&self, address: H160, password: String, key: Bytes) -> Result<Vec<u8>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.decrypt(address.into(), Some(password), &DEFAULT_MAC, &key.0) store.decrypt(address.into(), Some(password), &DEFAULT_MAC, &key.0)
.map_err(|e| errors::account("Could not decrypt key.", e)) .map_err(|e| errors::account("Could not decrypt key.", e))
} }
/// Decrypt secret key using account' private key /// Decrypt secret key using account' private key
fn decrypt_secret(&self, address: H160, password: String, key: Bytes) -> Result<Secret, Error> { fn decrypt_secret(&self, address: H160, password: String, key: Bytes) -> Result<Secret> {
self.decrypt_key(address, password, key) self.decrypt_key(address, password, key)
.and_then(|s| Secret::from_unsafe_slice(&s).map_err(|e| errors::account("invalid secret", e))) .and_then(|s| Secret::from_unsafe_slice(&s).map_err(|e| errors::account("invalid secret", e)))
} }
} }
impl SecretStore for SecretStoreClient { impl SecretStore for SecretStoreClient {
fn encrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes, Error> { fn encrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes> {
encrypt_document(self.decrypt_key(address, password, key)?, data.0) encrypt_document(self.decrypt_key(address, password, key)?, data.0)
.map(Into::into) .map(Into::into)
} }
fn decrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes, Error> { fn decrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes> {
decrypt_document(self.decrypt_key(address, password, key)?, data.0) decrypt_document(self.decrypt_key(address, password, key)?, data.0)
.map(Into::into) .map(Into::into)
} }
fn shadow_decrypt(&self, address: H160, password: String, decrypted_secret: H512, common_point: H512, decrypt_shadows: Vec<Bytes>, data: Bytes) -> Result<Bytes, Error> { fn shadow_decrypt(&self, address: H160, password: String, decrypted_secret: H512, common_point: H512, decrypt_shadows: Vec<Bytes>, data: Bytes) -> Result<Bytes> {
let mut shadows = Vec::with_capacity(decrypt_shadows.len()); let mut shadows = Vec::with_capacity(decrypt_shadows.len());
for decrypt_shadow in decrypt_shadows { for decrypt_shadow in decrypt_shadows {
shadows.push(self.decrypt_secret(address.clone(), password.clone(), decrypt_shadow)?); shadows.push(self.decrypt_secret(address.clone(), password.clone(), decrypt_shadow)?);
@ -82,4 +83,13 @@ impl SecretStore for SecretStoreClient {
decrypt_document_with_shadow(decrypted_secret.into(), common_point.into(), shadows, data.0) decrypt_document_with_shadow(decrypted_secret.into(), common_point.into(), shadows, data.0)
.map(Into::into) .map(Into::into)
} }
fn sign_servers_set(&self, address: H160, password: String, servers_set: BTreeSet<H512>) -> Result<Bytes> {
let servers_set_keccak_value = ordered_servers_keccak(servers_set);
let store = self.account_provider()?;
store
.sign(address.into(), Some(password), servers_set_keccak_value.into())
.map(|s| Bytes::new((*s).to_vec()))
.map_err(|e| errors::account("Could not sign servers set.", e))
}
} }

View File

@ -25,7 +25,7 @@ use parity_reactor::Remote;
use rlp::UntrustedRlp; use rlp::UntrustedRlp;
use parking_lot::Mutex; use parking_lot::Mutex;
use jsonrpc_core::{Error, BoxFuture}; use jsonrpc_core::{Result, BoxFuture, Error};
use jsonrpc_core::futures::{future, Future, IntoFuture}; use jsonrpc_core::futures::{future, Future, IntoFuture};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
@ -78,11 +78,11 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>, Error> where fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>> where
F: FnOnce(D, Arc<AccountProvider>, ConfirmationPayload) -> T, F: FnOnce(D, Arc<AccountProvider>, ConfirmationPayload) -> T,
T: IntoFuture<Item=WithToken<ConfirmationResponse>, Error=Error>, T: IntoFuture<Item=WithToken<ConfirmationResponse>, Error=Error>,
T::Future: Send + 'static T::Future: Send + 'static
@ -124,8 +124,8 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
.unwrap_or_else(|| Either::B(future::err(errors::invalid_params("Unknown RequestID", id))))) .unwrap_or_else(|| Either::B(future::err(errors::invalid_params("Unknown RequestID", id)))))
} }
fn verify_transaction<F>(bytes: Bytes, request: FilledTransactionRequest, process: F) -> Result<ConfirmationResponse, Error> where fn verify_transaction<F>(bytes: Bytes, request: FilledTransactionRequest, process: F) -> Result<ConfirmationResponse> where
F: FnOnce(PendingTransaction) -> Result<ConfirmationResponse, Error>, F: FnOnce(PendingTransaction) -> Result<ConfirmationResponse>,
{ {
let signed_transaction = UntrustedRlp::new(&bytes.0).as_val().map_err(errors::rlp)?; let signed_transaction = UntrustedRlp::new(&bytes.0).as_val().map_err(errors::rlp)?;
let signed_transaction = SignedTransaction::new(signed_transaction).map_err(|e| errors::invalid_params("Invalid signature.", e))?; let signed_transaction = SignedTransaction::new(signed_transaction).map_err(|e| errors::invalid_params("Invalid signature.", e))?;
@ -159,7 +159,7 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
impl<D: Dispatcher + 'static> Signer for SignerClient<D> { impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>, Error> { fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>> {
Ok(self.signer.requests() Ok(self.signer.requests()
.into_iter() .into_iter()
.map(Into::into) .map(Into::into)
@ -170,7 +170,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
// TODO [ToDr] TransactionModification is redundant for some calls // TODO [ToDr] TransactionModification is redundant for some calls
// might be better to replace it in future // might be better to replace it in future
fn confirm_request(&self, id: U256, modification: TransactionModification, pass: String) fn confirm_request(&self, id: U256, modification: TransactionModification, pass: String)
-> BoxFuture<ConfirmationResponse, Error> -> BoxFuture<ConfirmationResponse>
{ {
Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| { Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| {
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Password(pass)) dispatch::execute(dis, accounts, payload, dispatch::SignWith::Password(pass))
@ -178,7 +178,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
} }
fn confirm_request_with_token(&self, id: U256, modification: TransactionModification, token: String) fn confirm_request_with_token(&self, id: U256, modification: TransactionModification, token: String)
-> BoxFuture<ConfirmationResponseWithToken, Error> -> BoxFuture<ConfirmationResponseWithToken>
{ {
Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| { Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| {
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Token(token)) dispatch::execute(dis, accounts, payload, dispatch::SignWith::Token(token))
@ -191,7 +191,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
})) }))
} }
fn confirm_request_raw(&self, id: U256, bytes: Bytes) -> Result<ConfirmationResponse, Error> { fn confirm_request_raw(&self, id: U256, bytes: Bytes) -> Result<ConfirmationResponse> {
let id = id.into(); let id = id.into();
self.signer.peek(&id).map(|confirmation| { self.signer.peek(&id).map(|confirmation| {
@ -230,17 +230,17 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
}).unwrap_or_else(|| Err(errors::invalid_params("Unknown RequestID", id))) }).unwrap_or_else(|| Err(errors::invalid_params("Unknown RequestID", id)))
} }
fn reject_request(&self, id: U256) -> Result<bool, Error> { fn reject_request(&self, id: U256) -> Result<bool> {
let res = self.signer.request_rejected(id.into()); let res = self.signer.request_rejected(id.into());
Ok(res.is_some()) Ok(res.is_some())
} }
fn generate_token(&self) -> Result<String, Error> { fn generate_token(&self) -> Result<String> {
self.signer.generate_token() self.signer.generate_token()
.map_err(|e| errors::token(e)) .map_err(|e| errors::token(e))
} }
fn generate_web_proxy_token(&self, domain: String) -> Result<String, Error> { fn generate_web_proxy_token(&self, domain: String) -> Result<String> {
Ok(self.signer.generate_web_proxy_access_token(domain.into())) Ok(self.signer.generate_web_proxy_access_token(domain.into()))
} }
@ -248,7 +248,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
self.subscribers.lock().push(sub) self.subscribers.lock().push(sub)
} }
fn unsubscribe_pending(&self, id: SubscriptionId) -> Result<bool, Error> { fn unsubscribe_pending(&self, id: SubscriptionId) -> Result<bool> {
let res = self.subscribers.lock().remove(&id).is_some(); let res = self.subscribers.lock().remove(&id).is_some();
Ok(res) Ok(res)
} }

View File

@ -23,7 +23,7 @@ use parking_lot::Mutex;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result, Error};
use jsonrpc_core::futures::{future, Future, Poll, Async}; use jsonrpc_core::futures::{future, Future, Poll, Async};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use v1::helpers::{ use v1::helpers::{
@ -109,11 +109,11 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture<DispatchResult, Error> { fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture<DispatchResult> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default_account = match default_account { let default_account = match default_account {
DefaultAccount::Provided(acc) => acc, DefaultAccount::Provided(acc) => acc,
@ -143,13 +143,13 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> { impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest, Error> { fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default(); let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default();
Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into)) Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into))
} }
fn post_sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
let remote = self.remote.clone(); let remote = self.remote.clone();
let confirmations = self.confirmations.clone(); let confirmations = self.confirmations.clone();
@ -166,7 +166,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
})) }))
} }
fn post_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
let remote = self.remote.clone(); let remote = self.remote.clone();
let confirmations = self.confirmations.clone(); let confirmations = self.confirmations.clone();
@ -180,7 +180,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
})) }))
} }
fn check_request(&self, id: RpcU256) -> Result<Option<RpcConfirmationResponse>, Error> { fn check_request(&self, id: RpcU256) -> Result<Option<RpcConfirmationResponse>> {
let id: U256 = id.into(); let id: U256 = id.into();
match self.confirmations.lock().get(&id) { match self.confirmations.lock().get(&id) {
None => Err(errors::request_not_found()), // Request info has been dropped, or even never been there None => Err(errors::request_not_found()), // Request info has been dropped, or even never been there
@ -189,7 +189,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
} }
} }
fn decrypt_message(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes, Error> { fn decrypt_message(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::Decrypt((address.clone(), data).into()), RpcConfirmationPayload::Decrypt((address.clone(), data).into()),
address.into(), address.into(),
@ -209,7 +209,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> { impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520, Error> { fn sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()), RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()),
address.into(), address.into(),
@ -224,7 +224,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
})) }))
} }
fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256, Error> { fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::SendTransaction(request), RpcConfirmationPayload::SendTransaction(request),
meta.dapp_id().into(), meta.dapp_id().into(),
@ -239,7 +239,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
})) }))
} }
fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction, Error> { fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::SignTransaction(request), RpcConfirmationPayload::SignTransaction(request),
meta.dapp_id().into(), meta.dapp_id().into(),

View File

@ -20,7 +20,7 @@ use std::sync::Arc;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use v1::helpers::{errors, DefaultAccount}; use v1::helpers::{errors, DefaultAccount};
use v1::helpers::dispatch::{self, Dispatcher}; use v1::helpers::dispatch::{self, Dispatcher};
@ -52,11 +52,11 @@ impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture<RpcConfirmationResponse, Error> { fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture<RpcConfirmationResponse> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default = match account { let default = match account {
DefaultAccount::Provided(acc) => acc, DefaultAccount::Provided(acc) => acc,
@ -76,7 +76,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
{ {
type Metadata = Metadata; type Metadata = Metadata;
fn sign(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520, Error> { fn sign(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520> {
Box::new(self.handle(RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()), address.into()) Box::new(self.handle(RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()), address.into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::Signature(signature)) => Ok(signature), Ok(RpcConfirmationResponse::Signature(signature)) => Ok(signature),
@ -85,7 +85,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
})) }))
} }
fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256, Error> { fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
Box::new(self.handle(RpcConfirmationPayload::SendTransaction(request), meta.dapp_id().into()) Box::new(self.handle(RpcConfirmationPayload::SendTransaction(request), meta.dapp_id().into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::SendTransaction(hash)) => Ok(hash), Ok(RpcConfirmationResponse::SendTransaction(hash)) => Ok(hash),
@ -94,7 +94,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
})) }))
} }
fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction, Error> { fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
Box::new(self.handle(RpcConfirmationPayload::SignTransaction(request), meta.dapp_id().into()) Box::new(self.handle(RpcConfirmationPayload::SignTransaction(request), meta.dapp_id().into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::SignTransaction(tx)) => Ok(tx), Ok(RpcConfirmationResponse::SignTransaction(tx)) => Ok(tx),
@ -107,13 +107,13 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> { impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest, Error> { fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default(); let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default();
Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into)) Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into))
} }
fn decrypt_message(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes, Error> { fn decrypt_message(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes> {
Box::new(self.handle(RpcConfirmationPayload::Decrypt((address.clone(), data).into()), address.into()) Box::new(self.handle(RpcConfirmationPayload::Decrypt((address.clone(), data).into()), address.into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::Decrypt(data)) => Ok(data), Ok(RpcConfirmationResponse::Decrypt(data)) => Ok(data),
@ -122,17 +122,17 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> {
})) }))
} }
fn post_sign(&self, _: Metadata, _: RpcH160, _: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_sign(&self, _: Metadata, _: RpcH160, _: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
// We don't support this in non-signer mode. // We don't support this in non-signer mode.
Box::new(future::err(errors::signer_disabled())) Box::new(future::err(errors::signer_disabled()))
} }
fn post_transaction(&self, _: Metadata, _: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_transaction(&self, _: Metadata, _: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
// We don't support this in non-signer mode. // We don't support this in non-signer mode.
Box::new(future::err((errors::signer_disabled()))) Box::new(future::err((errors::signer_disabled())))
} }
fn check_request(&self, _: RpcU256) -> Result<Option<RpcConfirmationResponse>, Error> { fn check_request(&self, _: RpcU256) -> Result<Option<RpcConfirmationResponse>> {
// We don't support this in non-signer mode. // We don't support this in non-signer mode.
Err(errors::signer_disabled()) Err(errors::signer_disabled())
} }

View File

@ -22,7 +22,7 @@ use ethcore::client::{MiningBlockChainClient, CallAnalytics, TransactionId, Trac
use ethcore::transaction::SignedTransaction; use ethcore::transaction::SignedTransaction;
use rlp::UntrustedRlp; use rlp::UntrustedRlp;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::Metadata; use v1::Metadata;
use v1::traits::Traces; use v1::traits::Traces;
@ -54,22 +54,22 @@ impl<C> TracesClient<C> {
impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static { impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
type Metadata = Metadata; type Metadata = Metadata;
fn filter(&self, filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn filter(&self, filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>> {
Ok(self.client.filter_traces(filter.into()) Ok(self.client.filter_traces(filter.into())
.map(|traces| traces.into_iter().map(LocalizedTrace::from).collect())) .map(|traces| traces.into_iter().map(LocalizedTrace::from).collect()))
} }
fn block_traces(&self, block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn block_traces(&self, block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>> {
Ok(self.client.block_traces(block_number.into()) Ok(self.client.block_traces(block_number.into())
.map(|traces| traces.into_iter().map(LocalizedTrace::from).collect())) .map(|traces| traces.into_iter().map(LocalizedTrace::from).collect()))
} }
fn transaction_traces(&self, transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn transaction_traces(&self, transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>> {
Ok(self.client.transaction_traces(TransactionId::Hash(transaction_hash.into())) Ok(self.client.transaction_traces(TransactionId::Hash(transaction_hash.into()))
.map(|traces| traces.into_iter().map(LocalizedTrace::from).collect())) .map(|traces| traces.into_iter().map(LocalizedTrace::from).collect()))
} }
fn trace(&self, transaction_hash: H256, address: Vec<Index>) -> Result<Option<LocalizedTrace>, Error> { fn trace(&self, transaction_hash: H256, address: Vec<Index>) -> Result<Option<LocalizedTrace>> {
let id = TraceId { let id = TraceId {
transaction: TransactionId::Hash(transaction_hash.into()), transaction: TransactionId::Hash(transaction_hash.into()),
address: address.into_iter().map(|i| i.value()).collect() address: address.into_iter().map(|i| i.value()).collect()
@ -79,7 +79,7 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
.map(LocalizedTrace::from)) .map(LocalizedTrace::from))
} }
fn call(&self, meta: Self::Metadata, request: CallRequest, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn call(&self, meta: Self::Metadata, request: CallRequest, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults> {
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
let request = CallRequest::into(request); let request = CallRequest::into(request);
@ -90,7 +90,7 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
.map_err(errors::call) .map_err(errors::call)
} }
fn call_many(&self, meta: Self::Metadata, requests: Vec<(CallRequest, TraceOptions)>, block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>, Error> { fn call_many(&self, meta: Self::Metadata, requests: Vec<(CallRequest, TraceOptions)>, block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
let requests = requests.into_iter() let requests = requests.into_iter()
@ -99,14 +99,14 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
let signed = fake_sign::sign_call(request, meta.is_dapp())?; let signed = fake_sign::sign_call(request, meta.is_dapp())?;
Ok((signed, to_call_analytics(flags))) Ok((signed, to_call_analytics(flags)))
}) })
.collect::<Result<Vec<_>, Error>>()?; .collect::<Result<Vec<_>>>()?;
self.client.call_many(&requests, block.into()) self.client.call_many(&requests, block.into())
.map(|results| results.into_iter().map(TraceResults::from).collect()) .map(|results| results.into_iter().map(TraceResults::from).collect())
.map_err(errors::call) .map_err(errors::call)
} }
fn raw_transaction(&self, raw_transaction: Bytes, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn raw_transaction(&self, raw_transaction: Bytes, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults> {
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
let tx = UntrustedRlp::new(&raw_transaction.into_vec()).as_val().map_err(|e| errors::invalid_params("Transaction is not valid RLP", e))?; let tx = UntrustedRlp::new(&raw_transaction.into_vec()).as_val().map_err(|e| errors::invalid_params("Transaction is not valid RLP", e))?;
@ -117,7 +117,7 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
.map_err(errors::call) .map_err(errors::call)
} }
fn replay_transaction(&self, transaction_hash: H256, flags: TraceOptions) -> Result<TraceResults, Error> { fn replay_transaction(&self, transaction_hash: H256, flags: TraceOptions) -> Result<TraceResults> {
self.client.replay(TransactionId::Hash(transaction_hash.into()), to_call_analytics(flags)) self.client.replay(TransactionId::Hash(transaction_hash.into()), to_call_analytics(flags))
.map(TraceResults::from) .map(TraceResults::from)
.map_err(errors::call) .map_err(errors::call)

View File

@ -16,7 +16,7 @@
//! Web3 rpc implementation. //! Web3 rpc implementation.
use hash::keccak; use hash::keccak;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use util::version; use util::version;
use v1::traits::Web3; use v1::traits::Web3;
use v1::types::{H256, Bytes}; use v1::types::{H256, Bytes};
@ -30,11 +30,11 @@ impl Web3Client {
} }
impl Web3 for Web3Client { impl Web3 for Web3Client {
fn client_version(&self) -> Result<String, Error> { fn client_version(&self) -> Result<String> {
Ok(version().to_owned().replace("Parity/", "Parity//")) Ok(version().to_owned().replace("Parity/", "Parity//"))
} }
fn sha3(&self, data: Bytes) -> Result<H256, Error> { fn sha3(&self, data: Bytes) -> Result<H256> {
Ok(keccak(&data.0).into()) Ok(keccak(&data.0).into())
} }
} }

View File

@ -17,12 +17,14 @@
use std::sync::Arc; use std::sync::Arc;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use ethkey::{KeyPair, Signature, verify_public};
use serde_json; use serde_json;
use jsonrpc_core::{IoHandler, Success}; use jsonrpc_core::{IoHandler, Success};
use v1::metadata::Metadata; use v1::metadata::Metadata;
use v1::SecretStoreClient; use v1::SecretStoreClient;
use v1::traits::secretstore::SecretStore; use v1::traits::secretstore::SecretStore;
use v1::helpers::secretstore::ordered_servers_keccak;
struct Dependencies { struct Dependencies {
pub accounts: Arc<AccountProvider>, pub accounts: Arc<AccountProvider>,
@ -51,7 +53,7 @@ fn rpc_secretstore_encrypt_and_decrypt() {
let deps = Dependencies::new(); let deps = Dependencies::new();
let io = deps.default_client(); let io = deps.default_client();
// insert new account && unlock it // insert new account
let secret = "c1f1cfe279a5c350d13795bce162941967340c8a228e6ba175489afc564a5bef".parse().unwrap(); let secret = "c1f1cfe279a5c350d13795bce162941967340c8a228e6ba175489afc564a5bef".parse().unwrap();
deps.accounts.insert_account(secret, "password").unwrap(); deps.accounts.insert_account(secret, "password").unwrap();
@ -81,7 +83,7 @@ fn rpc_secretstore_shadow_decrypt() {
let deps = Dependencies::new(); let deps = Dependencies::new();
let io = deps.default_client(); let io = deps.default_client();
// insert new account && unlock it // insert new account
let secret = "82758356bf46b42710d3946a8efa612b7bf5e125e4d49f28facf1139db4a46f4".parse().unwrap(); let secret = "82758356bf46b42710d3946a8efa612b7bf5e125e4d49f28facf1139db4a46f4".parse().unwrap();
deps.accounts.insert_account(secret, "password").unwrap(); deps.accounts.insert_account(secret, "password").unwrap();
@ -96,3 +98,31 @@ fn rpc_secretstore_shadow_decrypt() {
let decryption_response = io.handle_request_sync(&decryption_request).unwrap(); let decryption_response = io.handle_request_sync(&decryption_request).unwrap();
assert_eq!(decryption_response, r#"{"jsonrpc":"2.0","result":"0xdeadbeef","id":1}"#); assert_eq!(decryption_response, r#"{"jsonrpc":"2.0","result":"0xdeadbeef","id":1}"#);
} }
#[test]
fn rpc_secretstore_sign_servers_set() {
let deps = Dependencies::new();
let io = deps.default_client();
// insert new account
let secret = "82758356bf46b42710d3946a8efa612b7bf5e125e4d49f28facf1139db4a46f4".parse().unwrap();
let key_pair = KeyPair::from_secret(secret).unwrap();
deps.accounts.insert_account(key_pair.secret().clone(), "password").unwrap();
// execute signing request
let signing_request = r#"{"jsonrpc": "2.0", "method": "secretstore_signServersSet", "params":[
"0x00dfE63B22312ab4329aD0d28CaD8Af987A01932", "password",
["0x843645726384530ffb0c52f175278143b5a93959af7864460f5a4fec9afd1450cfb8aef63dec90657f43f55b13e0a73c7524d4e9a13c051b4e5f1e53f39ecd91",
"0x07230e34ebfe41337d3ed53b186b3861751f2401ee74b988bba55694e2a6f60c757677e194be2e53c3523cc8548694e636e6acb35c4e8fdc5e29d28679b9b2f3"]
], "id": 1}"#;
let signing_response = io.handle_request_sync(&signing_request).unwrap();
let signing_response = signing_response.replace(r#"{"jsonrpc":"2.0","result":"0x"#, "");
let signing_response = signing_response.replace(r#"","id":1}"#, "");
let signature: Signature = signing_response.parse().unwrap();
let servers_set_keccak = ordered_servers_keccak(vec![
"843645726384530ffb0c52f175278143b5a93959af7864460f5a4fec9afd1450cfb8aef63dec90657f43f55b13e0a73c7524d4e9a13c051b4e5f1e53f39ecd91".parse().unwrap(),
"07230e34ebfe41337d3ed53b186b3861751f2401ee74b988bba55694e2a6f60c757677e194be2e53c3523cc8548694e636e6acb35c4e8fdc5e29d28679b9b2f3".parse().unwrap()
].into_iter().collect());
assert!(verify_public(key_pair.public(), &signature, &servers_set_keccak.into()).unwrap());
}

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Eth rpc interface. //! Eth rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::types::{RichBlock, BlockNumber, Bytes, CallRequest, Filter, FilterChanges, Index}; use v1::types::{RichBlock, BlockNumber, Bytes, CallRequest, Filter, FilterChanges, Index};
@ -29,151 +29,151 @@ build_rpc_trait! {
/// Returns protocol version encoded as a string (quotes are necessary). /// Returns protocol version encoded as a string (quotes are necessary).
#[rpc(name = "eth_protocolVersion")] #[rpc(name = "eth_protocolVersion")]
fn protocol_version(&self) -> Result<String, Error>; fn protocol_version(&self) -> Result<String>;
/// Returns an object with data about the sync status or false. (wtf?) /// Returns an object with data about the sync status or false. (wtf?)
#[rpc(name = "eth_syncing")] #[rpc(name = "eth_syncing")]
fn syncing(&self) -> Result<SyncStatus, Error>; fn syncing(&self) -> Result<SyncStatus>;
/// Returns the number of hashes per second that the node is mining with. /// Returns the number of hashes per second that the node is mining with.
#[rpc(name = "eth_hashrate")] #[rpc(name = "eth_hashrate")]
fn hashrate(&self) -> Result<U256, Error>; fn hashrate(&self) -> Result<U256>;
/// Returns block author. /// Returns block author.
#[rpc(meta, name = "eth_coinbase")] #[rpc(meta, name = "eth_coinbase")]
fn author(&self, Self::Metadata) -> Result<H160, Error>; fn author(&self, Self::Metadata) -> Result<H160>;
/// Returns true if client is actively mining new blocks. /// Returns true if client is actively mining new blocks.
#[rpc(name = "eth_mining")] #[rpc(name = "eth_mining")]
fn is_mining(&self) -> Result<bool, Error>; fn is_mining(&self) -> Result<bool>;
/// Returns current gas_price. /// Returns current gas_price.
#[rpc(name = "eth_gasPrice")] #[rpc(name = "eth_gasPrice")]
fn gas_price(&self) -> Result<U256, Error>; fn gas_price(&self) -> Result<U256>;
/// Returns accounts list. /// Returns accounts list.
#[rpc(meta, name = "eth_accounts")] #[rpc(meta, name = "eth_accounts")]
fn accounts(&self, Self::Metadata) -> Result<Vec<H160>, Error>; fn accounts(&self, Self::Metadata) -> Result<Vec<H160>>;
/// Returns highest block number. /// Returns highest block number.
#[rpc(name = "eth_blockNumber")] #[rpc(name = "eth_blockNumber")]
fn block_number(&self) -> Result<U256, Error>; fn block_number(&self) -> Result<U256>;
/// Returns balance of the given account. /// Returns balance of the given account.
#[rpc(name = "eth_getBalance")] #[rpc(name = "eth_getBalance")]
fn balance(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256, Error>; fn balance(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256>;
/// Returns content of the storage at given address. /// Returns content of the storage at given address.
#[rpc(name = "eth_getStorageAt")] #[rpc(name = "eth_getStorageAt")]
fn storage_at(&self, H160, U256, Trailing<BlockNumber>) -> BoxFuture<H256, Error>; fn storage_at(&self, H160, U256, Trailing<BlockNumber>) -> BoxFuture<H256>;
/// Returns block with given hash. /// Returns block with given hash.
#[rpc(name = "eth_getBlockByHash")] #[rpc(name = "eth_getBlockByHash")]
fn block_by_hash(&self, H256, bool) -> BoxFuture<Option<RichBlock>, Error>; fn block_by_hash(&self, H256, bool) -> BoxFuture<Option<RichBlock>>;
/// Returns block with given number. /// Returns block with given number.
#[rpc(name = "eth_getBlockByNumber")] #[rpc(name = "eth_getBlockByNumber")]
fn block_by_number(&self, BlockNumber, bool) -> BoxFuture<Option<RichBlock>, Error>; fn block_by_number(&self, BlockNumber, bool) -> BoxFuture<Option<RichBlock>>;
/// Returns the number of transactions sent from given address at given time (block number). /// Returns the number of transactions sent from given address at given time (block number).
#[rpc(name = "eth_getTransactionCount")] #[rpc(name = "eth_getTransactionCount")]
fn transaction_count(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256, Error>; fn transaction_count(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256>;
/// Returns the number of transactions in a block with given hash. /// Returns the number of transactions in a block with given hash.
#[rpc(name = "eth_getBlockTransactionCountByHash")] #[rpc(name = "eth_getBlockTransactionCountByHash")]
fn block_transaction_count_by_hash(&self, H256) -> BoxFuture<Option<U256>, Error>; fn block_transaction_count_by_hash(&self, H256) -> BoxFuture<Option<U256>>;
/// Returns the number of transactions in a block with given block number. /// Returns the number of transactions in a block with given block number.
#[rpc(name = "eth_getBlockTransactionCountByNumber")] #[rpc(name = "eth_getBlockTransactionCountByNumber")]
fn block_transaction_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>, Error>; fn block_transaction_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>>;
/// Returns the number of uncles in a block with given hash. /// Returns the number of uncles in a block with given hash.
#[rpc(name = "eth_getUncleCountByBlockHash")] #[rpc(name = "eth_getUncleCountByBlockHash")]
fn block_uncles_count_by_hash(&self, H256) -> BoxFuture<Option<U256>, Error>; fn block_uncles_count_by_hash(&self, H256) -> BoxFuture<Option<U256>>;
/// Returns the number of uncles in a block with given block number. /// Returns the number of uncles in a block with given block number.
#[rpc(name = "eth_getUncleCountByBlockNumber")] #[rpc(name = "eth_getUncleCountByBlockNumber")]
fn block_uncles_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>, Error>; fn block_uncles_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>>;
/// Returns the code at given address at given time (block number). /// Returns the code at given address at given time (block number).
#[rpc(name = "eth_getCode")] #[rpc(name = "eth_getCode")]
fn code_at(&self, H160, Trailing<BlockNumber>) -> BoxFuture<Bytes, Error>; fn code_at(&self, H160, Trailing<BlockNumber>) -> BoxFuture<Bytes>;
/// Sends signed transaction, returning its hash. /// Sends signed transaction, returning its hash.
#[rpc(name = "eth_sendRawTransaction")] #[rpc(name = "eth_sendRawTransaction")]
fn send_raw_transaction(&self, Bytes) -> Result<H256, Error>; fn send_raw_transaction(&self, Bytes) -> Result<H256>;
/// @alias of `eth_sendRawTransaction`. /// @alias of `eth_sendRawTransaction`.
#[rpc(name = "eth_submitTransaction")] #[rpc(name = "eth_submitTransaction")]
fn submit_transaction(&self, Bytes) -> Result<H256, Error>; fn submit_transaction(&self, Bytes) -> Result<H256>;
/// Call contract, returning the output data. /// Call contract, returning the output data.
#[rpc(meta, name = "eth_call")] #[rpc(meta, name = "eth_call")]
fn call(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<Bytes, Error>; fn call(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<Bytes>;
/// Estimate gas needed for execution of given contract. /// Estimate gas needed for execution of given contract.
#[rpc(meta, name = "eth_estimateGas")] #[rpc(meta, name = "eth_estimateGas")]
fn estimate_gas(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<U256, Error>; fn estimate_gas(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<U256>;
/// Get transaction by its hash. /// Get transaction by its hash.
#[rpc(name = "eth_getTransactionByHash")] #[rpc(name = "eth_getTransactionByHash")]
fn transaction_by_hash(&self, H256) -> BoxFuture<Option<Transaction>, Error>; fn transaction_by_hash(&self, H256) -> BoxFuture<Option<Transaction>>;
/// Returns transaction at given block hash and index. /// Returns transaction at given block hash and index.
#[rpc(name = "eth_getTransactionByBlockHashAndIndex")] #[rpc(name = "eth_getTransactionByBlockHashAndIndex")]
fn transaction_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<Transaction>, Error>; fn transaction_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<Transaction>>;
/// Returns transaction by given block number and index. /// Returns transaction by given block number and index.
#[rpc(name = "eth_getTransactionByBlockNumberAndIndex")] #[rpc(name = "eth_getTransactionByBlockNumberAndIndex")]
fn transaction_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<Transaction>, Error>; fn transaction_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<Transaction>>;
/// Returns transaction receipt by transaction hash. /// Returns transaction receipt by transaction hash.
#[rpc(name = "eth_getTransactionReceipt")] #[rpc(name = "eth_getTransactionReceipt")]
fn transaction_receipt(&self, H256) -> BoxFuture<Option<Receipt>, Error>; fn transaction_receipt(&self, H256) -> BoxFuture<Option<Receipt>>;
/// Returns an uncles at given block and index. /// Returns an uncles at given block and index.
#[rpc(name = "eth_getUncleByBlockHashAndIndex")] #[rpc(name = "eth_getUncleByBlockHashAndIndex")]
fn uncle_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<RichBlock>, Error>; fn uncle_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<RichBlock>>;
/// Returns an uncles at given block and index. /// Returns an uncles at given block and index.
#[rpc(name = "eth_getUncleByBlockNumberAndIndex")] #[rpc(name = "eth_getUncleByBlockNumberAndIndex")]
fn uncle_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<RichBlock>, Error>; fn uncle_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<RichBlock>>;
/// Returns available compilers. /// Returns available compilers.
/// @deprecated /// @deprecated
#[rpc(name = "eth_getCompilers")] #[rpc(name = "eth_getCompilers")]
fn compilers(&self) -> Result<Vec<String>, Error>; fn compilers(&self) -> Result<Vec<String>>;
/// Compiles lll code. /// Compiles lll code.
/// @deprecated /// @deprecated
#[rpc(name = "eth_compileLLL")] #[rpc(name = "eth_compileLLL")]
fn compile_lll(&self, String) -> Result<Bytes, Error>; fn compile_lll(&self, String) -> Result<Bytes>;
/// Compiles solidity. /// Compiles solidity.
/// @deprecated /// @deprecated
#[rpc(name = "eth_compileSolidity")] #[rpc(name = "eth_compileSolidity")]
fn compile_solidity(&self, String) -> Result<Bytes, Error>; fn compile_solidity(&self, String) -> Result<Bytes>;
/// Compiles serpent. /// Compiles serpent.
/// @deprecated /// @deprecated
#[rpc(name = "eth_compileSerpent")] #[rpc(name = "eth_compileSerpent")]
fn compile_serpent(&self, String) -> Result<Bytes, Error>; fn compile_serpent(&self, String) -> Result<Bytes>;
/// Returns logs matching given filter object. /// Returns logs matching given filter object.
#[rpc(name = "eth_getLogs")] #[rpc(name = "eth_getLogs")]
fn logs(&self, Filter) -> BoxFuture<Vec<Log>, Error>; fn logs(&self, Filter) -> BoxFuture<Vec<Log>>;
/// Returns the hash of the current block, the seedHash, and the boundary condition to be met. /// Returns the hash of the current block, the seedHash, and the boundary condition to be met.
#[rpc(name = "eth_getWork")] #[rpc(name = "eth_getWork")]
fn work(&self, Trailing<u64>) -> Result<Work, Error>; fn work(&self, Trailing<u64>) -> Result<Work>;
/// Used for submitting a proof-of-work solution. /// Used for submitting a proof-of-work solution.
#[rpc(name = "eth_submitWork")] #[rpc(name = "eth_submitWork")]
fn submit_work(&self, H64, H256, H256) -> Result<bool, Error>; fn submit_work(&self, H64, H256, H256) -> Result<bool>;
/// Used for submitting mining hashrate. /// Used for submitting mining hashrate.
#[rpc(name = "eth_submitHashrate")] #[rpc(name = "eth_submitHashrate")]
fn submit_hashrate(&self, U256, H256) -> Result<bool, Error>; fn submit_hashrate(&self, U256, H256) -> Result<bool>;
} }
} }
@ -183,26 +183,26 @@ build_rpc_trait! {
pub trait EthFilter { pub trait EthFilter {
/// Returns id of new filter. /// Returns id of new filter.
#[rpc(name = "eth_newFilter")] #[rpc(name = "eth_newFilter")]
fn new_filter(&self, Filter) -> Result<U256, Error>; fn new_filter(&self, Filter) -> Result<U256>;
/// Returns id of new block filter. /// Returns id of new block filter.
#[rpc(name = "eth_newBlockFilter")] #[rpc(name = "eth_newBlockFilter")]
fn new_block_filter(&self) -> Result<U256, Error>; fn new_block_filter(&self) -> Result<U256>;
/// Returns id of new block filter. /// Returns id of new block filter.
#[rpc(name = "eth_newPendingTransactionFilter")] #[rpc(name = "eth_newPendingTransactionFilter")]
fn new_pending_transaction_filter(&self) -> Result<U256, Error>; fn new_pending_transaction_filter(&self) -> Result<U256>;
/// Returns filter changes since last poll. /// Returns filter changes since last poll.
#[rpc(name = "eth_getFilterChanges")] #[rpc(name = "eth_getFilterChanges")]
fn filter_changes(&self, Index) -> BoxFuture<FilterChanges, Error>; fn filter_changes(&self, Index) -> BoxFuture<FilterChanges>;
/// Returns all logs matching given filter (in a range 'from' - 'to'). /// Returns all logs matching given filter (in a range 'from' - 'to').
#[rpc(name = "eth_getFilterLogs")] #[rpc(name = "eth_getFilterLogs")]
fn filter_logs(&self, Index) -> BoxFuture<Vec<Log>, Error>; fn filter_logs(&self, Index) -> BoxFuture<Vec<Log>>;
/// Uninstalls filter. /// Uninstalls filter.
#[rpc(name = "eth_uninstallFilter")] #[rpc(name = "eth_uninstallFilter")]
fn uninstall_filter(&self, Index) -> Result<bool, Error>; fn uninstall_filter(&self, Index) -> Result<bool>;
} }
} }

View File

@ -16,7 +16,7 @@
//! Eth PUB-SUB rpc interface. //! Eth PUB-SUB rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
@ -35,7 +35,7 @@ build_rpc_trait! {
/// Unsubscribe from existing Eth subscription. /// Unsubscribe from existing Eth subscription.
#[rpc(name = "eth_unsubscribe")] #[rpc(name = "eth_unsubscribe")]
fn unsubscribe(&self, SubscriptionId) -> Result<bool, Error>; fn unsubscribe(&self, SubscriptionId) -> Result<bool>;
} }
} }
} }

View File

@ -16,7 +16,7 @@
//! Eth rpc interface. //! Eth rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::BoxFuture;
use v1::types::{Bytes, H160, H256, H520, TransactionRequest, RichRawTransaction}; use v1::types::{Bytes, H160, H256, H520, TransactionRequest, RichRawTransaction};
@ -27,18 +27,18 @@ build_rpc_trait! {
/// Signs the hash of data with given address signature. /// Signs the hash of data with given address signature.
#[rpc(meta, name = "eth_sign")] #[rpc(meta, name = "eth_sign")]
fn sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<H520, Error>; fn sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<H520>;
/// Sends transaction; will block waiting for signer to return the /// Sends transaction; will block waiting for signer to return the
/// transaction hash. /// transaction hash.
/// If Signer is disable it will require the account to be unlocked. /// If Signer is disable it will require the account to be unlocked.
#[rpc(meta, name = "eth_sendTransaction")] #[rpc(meta, name = "eth_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<H256, Error>; fn send_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<H256>;
/// Signs transactions without dispatching it to the network. /// Signs transactions without dispatching it to the network.
/// Returns signed transaction RLP representation and the transaction itself. /// Returns signed transaction RLP representation and the transaction itself.
/// It can be later submitted using `eth_sendRawTransaction/eth_submitTransaction`. /// It can be later submitted using `eth_sendRawTransaction/eth_submitTransaction`.
#[rpc(meta, name = "eth_signTransaction")] #[rpc(meta, name = "eth_signTransaction")]
fn sign_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<RichRawTransaction, Error>; fn sign_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<RichRawTransaction>;
} }
} }

View File

@ -15,22 +15,22 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Net rpc interface. //! Net rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
build_rpc_trait! { build_rpc_trait! {
/// Net rpc interface. /// Net rpc interface.
pub trait Net { pub trait Net {
/// Returns protocol version. /// Returns protocol version.
#[rpc(name = "net_version")] #[rpc(name = "net_version")]
fn version(&self) -> Result<String, Error>; fn version(&self) -> Result<String>;
/// Returns number of peers connected to node. /// Returns number of peers connected to node.
#[rpc(name = "net_peerCount")] #[rpc(name = "net_peerCount")]
fn peer_count(&self) -> Result<String, Error>; fn peer_count(&self) -> Result<String>;
/// Returns true if client is actively listening for network connections. /// Returns true if client is actively listening for network connections.
/// Otherwise false. /// Otherwise false.
#[rpc(name = "net_listening")] #[rpc(name = "net_listening")]
fn is_listening(&self) -> Result<bool, Error>; fn is_listening(&self) -> Result<bool>;
} }
} }

View File

@ -18,7 +18,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use node_health::Health; use node_health::Health;
@ -38,188 +38,188 @@ build_rpc_trait! {
/// Returns accounts information. /// Returns accounts information.
#[rpc(name = "parity_accountsInfo")] #[rpc(name = "parity_accountsInfo")]
fn accounts_info(&self, Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>, Error>; fn accounts_info(&self, Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>>;
/// Returns hardware accounts information. /// Returns hardware accounts information.
#[rpc(name = "parity_hardwareAccountsInfo")] #[rpc(name = "parity_hardwareAccountsInfo")]
fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>, Error>; fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>>;
/// Get a list of paths to locked hardware wallets /// Get a list of paths to locked hardware wallets
#[rpc(name = "parity_lockedHardwareAccountsInfo")] #[rpc(name = "parity_lockedHardwareAccountsInfo")]
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>, Error>; fn locked_hardware_accounts_info(&self) -> Result<Vec<String>>;
/// Returns default account for dapp. /// Returns default account for dapp.
#[rpc(meta, name = "parity_defaultAccount")] #[rpc(meta, name = "parity_defaultAccount")]
fn default_account(&self, Self::Metadata) -> Result<H160, Error>; fn default_account(&self, Self::Metadata) -> Result<H160>;
/// Returns current transactions limit. /// Returns current transactions limit.
#[rpc(name = "parity_transactionsLimit")] #[rpc(name = "parity_transactionsLimit")]
fn transactions_limit(&self) -> Result<usize, Error>; fn transactions_limit(&self) -> Result<usize>;
/// Returns mining extra data. /// Returns mining extra data.
#[rpc(name = "parity_extraData")] #[rpc(name = "parity_extraData")]
fn extra_data(&self) -> Result<Bytes, Error>; fn extra_data(&self) -> Result<Bytes>;
/// Returns mining gas floor target. /// Returns mining gas floor target.
#[rpc(name = "parity_gasFloorTarget")] #[rpc(name = "parity_gasFloorTarget")]
fn gas_floor_target(&self) -> Result<U256, Error>; fn gas_floor_target(&self) -> Result<U256>;
/// Returns mining gas floor cap. /// Returns mining gas floor cap.
#[rpc(name = "parity_gasCeilTarget")] #[rpc(name = "parity_gasCeilTarget")]
fn gas_ceil_target(&self) -> Result<U256, Error>; fn gas_ceil_target(&self) -> Result<U256>;
/// Returns minimal gas price for transaction to be included in queue. /// Returns minimal gas price for transaction to be included in queue.
#[rpc(name = "parity_minGasPrice")] #[rpc(name = "parity_minGasPrice")]
fn min_gas_price(&self) -> Result<U256, Error>; fn min_gas_price(&self) -> Result<U256>;
/// Returns latest logs /// Returns latest logs
#[rpc(name = "parity_devLogs")] #[rpc(name = "parity_devLogs")]
fn dev_logs(&self) -> Result<Vec<String>, Error>; fn dev_logs(&self) -> Result<Vec<String>>;
/// Returns logs levels /// Returns logs levels
#[rpc(name = "parity_devLogsLevels")] #[rpc(name = "parity_devLogsLevels")]
fn dev_logs_levels(&self) -> Result<String, Error>; fn dev_logs_levels(&self) -> Result<String>;
/// Returns chain name - DEPRECATED. Use `parity_chainName` instead. /// Returns chain name - DEPRECATED. Use `parity_chainName` instead.
#[rpc(name = "parity_netChain")] #[rpc(name = "parity_netChain")]
fn net_chain(&self) -> Result<String, Error>; fn net_chain(&self) -> Result<String>;
/// Returns peers details /// Returns peers details
#[rpc(name = "parity_netPeers")] #[rpc(name = "parity_netPeers")]
fn net_peers(&self) -> Result<Peers, Error>; fn net_peers(&self) -> Result<Peers>;
/// Returns network port /// Returns network port
#[rpc(name = "parity_netPort")] #[rpc(name = "parity_netPort")]
fn net_port(&self) -> Result<u16, Error>; fn net_port(&self) -> Result<u16>;
/// Returns rpc settings /// Returns rpc settings
#[rpc(name = "parity_rpcSettings")] #[rpc(name = "parity_rpcSettings")]
fn rpc_settings(&self) -> Result<RpcSettings, Error>; fn rpc_settings(&self) -> Result<RpcSettings>;
/// Returns node name /// Returns node name
#[rpc(name = "parity_nodeName")] #[rpc(name = "parity_nodeName")]
fn node_name(&self) -> Result<String, Error>; fn node_name(&self) -> Result<String>;
/// Returns default extra data /// Returns default extra data
#[rpc(name = "parity_defaultExtraData")] #[rpc(name = "parity_defaultExtraData")]
fn default_extra_data(&self) -> Result<Bytes, Error>; fn default_extra_data(&self) -> Result<Bytes>;
/// Returns distribution of gas price in latest blocks. /// Returns distribution of gas price in latest blocks.
#[rpc(name = "parity_gasPriceHistogram")] #[rpc(name = "parity_gasPriceHistogram")]
fn gas_price_histogram(&self) -> BoxFuture<Histogram, Error>; fn gas_price_histogram(&self) -> BoxFuture<Histogram>;
/// Returns number of unsigned transactions waiting in the signer queue (if signer enabled) /// Returns number of unsigned transactions waiting in the signer queue (if signer enabled)
/// Returns error when signer is disabled /// Returns error when signer is disabled
#[rpc(name = "parity_unsignedTransactionsCount")] #[rpc(name = "parity_unsignedTransactionsCount")]
fn unsigned_transactions_count(&self) -> Result<usize, Error>; fn unsigned_transactions_count(&self) -> Result<usize>;
/// Returns a cryptographically random phrase sufficient for securely seeding a secret key. /// Returns a cryptographically random phrase sufficient for securely seeding a secret key.
#[rpc(name = "parity_generateSecretPhrase")] #[rpc(name = "parity_generateSecretPhrase")]
fn generate_secret_phrase(&self) -> Result<String, Error>; fn generate_secret_phrase(&self) -> Result<String>;
/// Returns whatever address would be derived from the given phrase if it were to seed a brainwallet. /// Returns whatever address would be derived from the given phrase if it were to seed a brainwallet.
#[rpc(name = "parity_phraseToAddress")] #[rpc(name = "parity_phraseToAddress")]
fn phrase_to_address(&self, String) -> Result<H160, Error>; fn phrase_to_address(&self, String) -> Result<H160>;
/// Returns the value of the registrar for this network. /// Returns the value of the registrar for this network.
#[rpc(name = "parity_registryAddress")] #[rpc(name = "parity_registryAddress")]
fn registry_address(&self) -> Result<Option<H160>, Error>; fn registry_address(&self) -> Result<Option<H160>>;
/// Returns all addresses if Fat DB is enabled (`--fat-db`), or null if not. /// Returns all addresses if Fat DB is enabled (`--fat-db`), or null if not.
#[rpc(name = "parity_listAccounts")] #[rpc(name = "parity_listAccounts")]
fn list_accounts(&self, u64, Option<H160>, Trailing<BlockNumber>) -> Result<Option<Vec<H160>>, Error>; fn list_accounts(&self, u64, Option<H160>, Trailing<BlockNumber>) -> Result<Option<Vec<H160>>>;
/// Returns all storage keys of the given address (first parameter) if Fat DB is enabled (`--fat-db`), /// Returns all storage keys of the given address (first parameter) if Fat DB is enabled (`--fat-db`),
/// or null if not. /// or null if not.
#[rpc(name = "parity_listStorageKeys")] #[rpc(name = "parity_listStorageKeys")]
fn list_storage_keys(&self, H160, u64, Option<H256>, Trailing<BlockNumber>) -> Result<Option<Vec<H256>>, Error>; fn list_storage_keys(&self, H160, u64, Option<H256>, Trailing<BlockNumber>) -> Result<Option<Vec<H256>>>;
/// Encrypt some data with a public key under ECIES. /// Encrypt some data with a public key under ECIES.
/// First parameter is the 512-byte destination public key, second is the message. /// First parameter is the 512-byte destination public key, second is the message.
#[rpc(name = "parity_encryptMessage")] #[rpc(name = "parity_encryptMessage")]
fn encrypt_message(&self, H512, Bytes) -> Result<Bytes, Error>; fn encrypt_message(&self, H512, Bytes) -> Result<Bytes>;
/// Returns all pending transactions from transaction queue. /// Returns all pending transactions from transaction queue.
#[rpc(name = "parity_pendingTransactions")] #[rpc(name = "parity_pendingTransactions")]
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error>; fn pending_transactions(&self) -> Result<Vec<Transaction>>;
/// Returns all future transactions from transaction queue. /// Returns all future transactions from transaction queue.
#[rpc(name = "parity_futureTransactions")] #[rpc(name = "parity_futureTransactions")]
fn future_transactions(&self) -> Result<Vec<Transaction>, Error>; fn future_transactions(&self) -> Result<Vec<Transaction>>;
/// Returns propagation statistics on transactions pending in the queue. /// Returns propagation statistics on transactions pending in the queue.
#[rpc(name = "parity_pendingTransactionsStats")] #[rpc(name = "parity_pendingTransactionsStats")]
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>, Error>; fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>>;
/// Returns a list of current and past local transactions with status details. /// Returns a list of current and past local transactions with status details.
#[rpc(name = "parity_localTransactions")] #[rpc(name = "parity_localTransactions")]
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>, Error>; fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>>;
/// Returns current Dapps Server interface and port or an error if dapps server is disabled. /// Returns current Dapps Server interface and port or an error if dapps server is disabled.
#[rpc(name = "parity_dappsUrl")] #[rpc(name = "parity_dappsUrl")]
fn dapps_url(&self) -> Result<String, Error>; fn dapps_url(&self) -> Result<String>;
/// Returns current WS Server interface and port or an error if ws server is disabled. /// Returns current WS Server interface and port or an error if ws server is disabled.
#[rpc(name = "parity_wsUrl")] #[rpc(name = "parity_wsUrl")]
fn ws_url(&self) -> Result<String, Error>; fn ws_url(&self) -> Result<String>;
/// Returns next nonce for particular sender. Should include all transactions in the queue. /// Returns next nonce for particular sender. Should include all transactions in the queue.
#[rpc(name = "parity_nextNonce")] #[rpc(name = "parity_nextNonce")]
fn next_nonce(&self, H160) -> BoxFuture<U256, Error>; fn next_nonce(&self, H160) -> BoxFuture<U256>;
/// Get the mode. Returns one of: "active", "passive", "dark", "offline". /// Get the mode. Returns one of: "active", "passive", "dark", "offline".
#[rpc(name = "parity_mode")] #[rpc(name = "parity_mode")]
fn mode(&self) -> Result<String, Error>; fn mode(&self) -> Result<String>;
/// Returns the chain ID used for transaction signing at the /// Returns the chain ID used for transaction signing at the
/// current best block. An empty string is returned if not /// current best block. An empty string is returned if not
/// available. /// available.
#[rpc(name = "parity_chainId")] #[rpc(name = "parity_chainId")]
fn chain_id(&self) -> Result<Option<U64>, Error>; fn chain_id(&self) -> Result<Option<U64>>;
/// Get the chain name. Returns one of: "foundation", "kovan", &c. of a filename. /// Get the chain name. Returns one of: "foundation", "kovan", &c. of a filename.
#[rpc(name = "parity_chain")] #[rpc(name = "parity_chain")]
fn chain(&self) -> Result<String, Error>; fn chain(&self) -> Result<String>;
/// Get the enode of this node. /// Get the enode of this node.
#[rpc(name = "parity_enode")] #[rpc(name = "parity_enode")]
fn enode(&self) -> Result<String, Error>; fn enode(&self) -> Result<String>;
/// Returns information on current consensus capability. /// Returns information on current consensus capability.
#[rpc(name = "parity_consensusCapability")] #[rpc(name = "parity_consensusCapability")]
fn consensus_capability(&self) -> Result<ConsensusCapability, Error>; fn consensus_capability(&self) -> Result<ConsensusCapability>;
/// Get our version information in a nice object. /// Get our version information in a nice object.
#[rpc(name = "parity_versionInfo")] #[rpc(name = "parity_versionInfo")]
fn version_info(&self) -> Result<VersionInfo, Error>; fn version_info(&self) -> Result<VersionInfo>;
/// Get information concerning the latest releases if available. /// Get information concerning the latest releases if available.
#[rpc(name = "parity_releasesInfo")] #[rpc(name = "parity_releasesInfo")]
fn releases_info(&self) -> Result<Option<OperationsInfo>, Error>; fn releases_info(&self) -> Result<Option<OperationsInfo>>;
/// Get the current chain status. /// Get the current chain status.
#[rpc(name = "parity_chainStatus")] #[rpc(name = "parity_chainStatus")]
fn chain_status(&self) -> Result<ChainStatus, Error>; fn chain_status(&self) -> Result<ChainStatus>;
/// Get node kind info. /// Get node kind info.
#[rpc(name = "parity_nodeKind")] #[rpc(name = "parity_nodeKind")]
fn node_kind(&self) -> Result<::v1::types::NodeKind, Error>; fn node_kind(&self) -> Result<::v1::types::NodeKind>;
/// Get block header. /// Get block header.
/// Same as `eth_getBlockByNumber` but without uncles and transactions. /// Same as `eth_getBlockByNumber` but without uncles and transactions.
#[rpc(name = "parity_getBlockHeaderByNumber")] #[rpc(name = "parity_getBlockHeaderByNumber")]
fn block_header(&self, Trailing<BlockNumber>) -> BoxFuture<RichHeader, Error>; fn block_header(&self, Trailing<BlockNumber>) -> BoxFuture<RichHeader>;
/// Get IPFS CIDv0 given protobuf encoded bytes. /// Get IPFS CIDv0 given protobuf encoded bytes.
#[rpc(name = "parity_cidV0")] #[rpc(name = "parity_cidV0")]
fn ipfs_cid(&self, Bytes) -> Result<String, Error>; fn ipfs_cid(&self, Bytes) -> Result<String>;
/// Call contract, returning the output data. /// Call contract, returning the output data.
#[rpc(meta, name = "parity_call")] #[rpc(meta, name = "parity_call")]
fn call(&self, Self::Metadata, Vec<CallRequest>, Trailing<BlockNumber>) -> Result<Vec<Bytes>, Error>; fn call(&self, Self::Metadata, Vec<CallRequest>, Trailing<BlockNumber>) -> Result<Vec<Bytes>>;
/// Returns node's health report. /// Returns node's health report.
#[rpc(name = "parity_nodeHealth")] #[rpc(name = "parity_nodeHealth")]
fn node_health(&self) -> BoxFuture<Health, Error>; fn node_health(&self) -> BoxFuture<Health>;
} }
} }

View File

@ -17,7 +17,7 @@
//! Parity Accounts-related rpc interface. //! Parity Accounts-related rpc interface.
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use ethstore::KeyFile; use ethstore::KeyFile;
use v1::types::{H160, H256, H520, DappId, DeriveHash, DeriveHierarchical, ExtAccountInfo}; use v1::types::{H160, H256, H520, DappId, DeriveHash, DeriveHierarchical, ExtAccountInfo};
@ -26,167 +26,167 @@ build_rpc_trait! {
pub trait ParityAccounts { pub trait ParityAccounts {
/// Returns accounts information. /// Returns accounts information.
#[rpc(name = "parity_allAccountsInfo")] #[rpc(name = "parity_allAccountsInfo")]
fn all_accounts_info(&self) -> Result<BTreeMap<H160, ExtAccountInfo>, Error>; fn all_accounts_info(&self) -> Result<BTreeMap<H160, ExtAccountInfo>>;
/// Creates new account from the given phrase using standard brainwallet mechanism. /// Creates new account from the given phrase using standard brainwallet mechanism.
/// Second parameter is password for the new account. /// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromPhrase")] #[rpc(name = "parity_newAccountFromPhrase")]
fn new_account_from_phrase(&self, String, String) -> Result<H160, Error>; fn new_account_from_phrase(&self, String, String) -> Result<H160>;
/// Creates new account from the given JSON wallet. /// Creates new account from the given JSON wallet.
/// Second parameter is password for the wallet and the new account. /// Second parameter is password for the wallet and the new account.
#[rpc(name = "parity_newAccountFromWallet")] #[rpc(name = "parity_newAccountFromWallet")]
fn new_account_from_wallet(&self, String, String) -> Result<H160, Error>; fn new_account_from_wallet(&self, String, String) -> Result<H160>;
/// Creates new account from the given raw secret. /// Creates new account from the given raw secret.
/// Second parameter is password for the new account. /// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromSecret")] #[rpc(name = "parity_newAccountFromSecret")]
fn new_account_from_secret(&self, H256, String) -> Result<H160, Error>; fn new_account_from_secret(&self, H256, String) -> Result<H160>;
/// Returns true if given `password` would unlock given `account`. /// Returns true if given `password` would unlock given `account`.
/// Arguments: `account`, `password`. /// Arguments: `account`, `password`.
#[rpc(name = "parity_testPassword")] #[rpc(name = "parity_testPassword")]
fn test_password(&self, H160, String) -> Result<bool, Error>; fn test_password(&self, H160, String) -> Result<bool>;
/// Changes an account's password. /// Changes an account's password.
/// Arguments: `account`, `password`, `new_password`. /// Arguments: `account`, `password`, `new_password`.
#[rpc(name = "parity_changePassword")] #[rpc(name = "parity_changePassword")]
fn change_password(&self, H160, String, String) -> Result<bool, Error>; fn change_password(&self, H160, String, String) -> Result<bool>;
/// Permanently deletes an account. /// Permanently deletes an account.
/// Arguments: `account`, `password`. /// Arguments: `account`, `password`.
#[rpc(name = "parity_killAccount")] #[rpc(name = "parity_killAccount")]
fn kill_account(&self, H160, String) -> Result<bool, Error>; fn kill_account(&self, H160, String) -> Result<bool>;
/// Permanently deletes an address from the addressbook /// Permanently deletes an address from the addressbook
/// Arguments: `address` /// Arguments: `address`
#[rpc(name = "parity_removeAddress")] #[rpc(name = "parity_removeAddress")]
fn remove_address(&self, H160) -> Result<bool, Error>; fn remove_address(&self, H160) -> Result<bool>;
/// Set an account's name. /// Set an account's name.
#[rpc(name = "parity_setAccountName")] #[rpc(name = "parity_setAccountName")]
fn set_account_name(&self, H160, String) -> Result<bool, Error>; fn set_account_name(&self, H160, String) -> Result<bool>;
/// Set an account's metadata string. /// Set an account's metadata string.
#[rpc(name = "parity_setAccountMeta")] #[rpc(name = "parity_setAccountMeta")]
fn set_account_meta(&self, H160, String) -> Result<bool, Error>; fn set_account_meta(&self, H160, String) -> Result<bool>;
/// Sets addresses exposed for particular dapp. /// Sets addresses exposed for particular dapp.
/// Setting a non-empty list will also override default account. /// Setting a non-empty list will also override default account.
/// Setting `None` will resets visible account to what's visible for new dapps /// Setting `None` will resets visible account to what's visible for new dapps
/// (does not affect default account though) /// (does not affect default account though)
#[rpc(name = "parity_setDappAddresses")] #[rpc(name = "parity_setDappAddresses")]
fn set_dapp_addresses(&self, DappId, Option<Vec<H160>>) -> Result<bool, Error>; fn set_dapp_addresses(&self, DappId, Option<Vec<H160>>) -> Result<bool>;
/// Gets accounts exposed for particular dapp. /// Gets accounts exposed for particular dapp.
#[rpc(name = "parity_getDappAddresses")] #[rpc(name = "parity_getDappAddresses")]
fn dapp_addresses(&self, DappId) -> Result<Vec<H160>, Error>; fn dapp_addresses(&self, DappId) -> Result<Vec<H160>>;
/// Changes dapp default address. /// Changes dapp default address.
/// Does not affect other accounts exposed for this dapp, but /// Does not affect other accounts exposed for this dapp, but
/// default account will always be retured as the first one. /// default account will always be retured as the first one.
#[rpc(name = "parity_setDappDefaultAddress")] #[rpc(name = "parity_setDappDefaultAddress")]
fn set_dapp_default_address(&self, DappId, H160) -> Result<bool, Error>; fn set_dapp_default_address(&self, DappId, H160) -> Result<bool>;
/// Returns current dapp default address. /// Returns current dapp default address.
/// If not set explicite for the dapp will return global default. /// If not set explicite for the dapp will return global default.
#[rpc(name = "parity_getDappDefaultAddress")] #[rpc(name = "parity_getDappDefaultAddress")]
fn dapp_default_address(&self, DappId) -> Result<H160, Error>; fn dapp_default_address(&self, DappId) -> Result<H160>;
/// Sets accounts exposed for new dapps. /// Sets accounts exposed for new dapps.
/// Setting a non-empty list will also override default account. /// Setting a non-empty list will also override default account.
/// Setting `None` exposes all internal-managed accounts. /// Setting `None` exposes all internal-managed accounts.
/// (does not affect default account though) /// (does not affect default account though)
#[rpc(name = "parity_setNewDappsAddresses")] #[rpc(name = "parity_setNewDappsAddresses")]
fn set_new_dapps_addresses(&self, Option<Vec<H160>>) -> Result<bool, Error>; fn set_new_dapps_addresses(&self, Option<Vec<H160>>) -> Result<bool>;
/// Gets accounts exposed for new dapps. /// Gets accounts exposed for new dapps.
/// `None` means that all accounts are exposes. /// `None` means that all accounts are exposes.
#[rpc(name = "parity_getNewDappsAddresses")] #[rpc(name = "parity_getNewDappsAddresses")]
fn new_dapps_addresses(&self) -> Result<Option<Vec<H160>>, Error>; fn new_dapps_addresses(&self) -> Result<Option<Vec<H160>>>;
/// Changes default address for new dapps (global default address) /// Changes default address for new dapps (global default address)
/// Does not affect other accounts exposed for new dapps, but /// Does not affect other accounts exposed for new dapps, but
/// default account will always be retured as the first one. /// default account will always be retured as the first one.
#[rpc(name = "parity_setNewDappsDefaultAddress")] #[rpc(name = "parity_setNewDappsDefaultAddress")]
fn set_new_dapps_default_address(&self, H160) -> Result<bool, Error>; fn set_new_dapps_default_address(&self, H160) -> Result<bool>;
/// Returns current default address for new dapps (global default address) /// Returns current default address for new dapps (global default address)
/// In case it's not set explicite will return first available account. /// In case it's not set explicite will return first available account.
/// If no accounts are available will return `0x0` /// If no accounts are available will return `0x0`
#[rpc(name = "parity_getNewDappsDefaultAddress")] #[rpc(name = "parity_getNewDappsDefaultAddress")]
fn new_dapps_default_address(&self) -> Result<H160, Error>; fn new_dapps_default_address(&self) -> Result<H160>;
/// Returns identified dapps that recently used RPC /// Returns identified dapps that recently used RPC
/// Includes last usage timestamp. /// Includes last usage timestamp.
#[rpc(name = "parity_listRecentDapps")] #[rpc(name = "parity_listRecentDapps")]
fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>, Error>; fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>>;
/// Imports a number of Geth accounts, with the list provided as the argument. /// Imports a number of Geth accounts, with the list provided as the argument.
#[rpc(name = "parity_importGethAccounts")] #[rpc(name = "parity_importGethAccounts")]
fn import_geth_accounts(&self, Vec<H160>) -> Result<Vec<H160>, Error>; fn import_geth_accounts(&self, Vec<H160>) -> Result<Vec<H160>>;
/// Returns the accounts available for importing from Geth. /// Returns the accounts available for importing from Geth.
#[rpc(name = "parity_listGethAccounts")] #[rpc(name = "parity_listGethAccounts")]
fn geth_accounts(&self) -> Result<Vec<H160>, Error>; fn geth_accounts(&self) -> Result<Vec<H160>>;
/// Create new vault. /// Create new vault.
#[rpc(name = "parity_newVault")] #[rpc(name = "parity_newVault")]
fn create_vault(&self, String, String) -> Result<bool, Error>; fn create_vault(&self, String, String) -> Result<bool>;
/// Open existing vault. /// Open existing vault.
#[rpc(name = "parity_openVault")] #[rpc(name = "parity_openVault")]
fn open_vault(&self, String, String) -> Result<bool, Error>; fn open_vault(&self, String, String) -> Result<bool>;
/// Close previously opened vault. /// Close previously opened vault.
#[rpc(name = "parity_closeVault")] #[rpc(name = "parity_closeVault")]
fn close_vault(&self, String) -> Result<bool, Error>; fn close_vault(&self, String) -> Result<bool>;
/// List all vaults. /// List all vaults.
#[rpc(name = "parity_listVaults")] #[rpc(name = "parity_listVaults")]
fn list_vaults(&self) -> Result<Vec<String>, Error>; fn list_vaults(&self) -> Result<Vec<String>>;
/// List all currently opened vaults. /// List all currently opened vaults.
#[rpc(name = "parity_listOpenedVaults")] #[rpc(name = "parity_listOpenedVaults")]
fn list_opened_vaults(&self) -> Result<Vec<String>, Error>; fn list_opened_vaults(&self) -> Result<Vec<String>>;
/// Change vault password. /// Change vault password.
#[rpc(name = "parity_changeVaultPassword")] #[rpc(name = "parity_changeVaultPassword")]
fn change_vault_password(&self, String, String) -> Result<bool, Error>; fn change_vault_password(&self, String, String) -> Result<bool>;
/// Change vault of the given address. /// Change vault of the given address.
#[rpc(name = "parity_changeVault")] #[rpc(name = "parity_changeVault")]
fn change_vault(&self, H160, String) -> Result<bool, Error>; fn change_vault(&self, H160, String) -> Result<bool>;
/// Get vault metadata string. /// Get vault metadata string.
#[rpc(name = "parity_getVaultMeta")] #[rpc(name = "parity_getVaultMeta")]
fn get_vault_meta(&self, String) -> Result<String, Error>; fn get_vault_meta(&self, String) -> Result<String>;
/// Set vault metadata string. /// Set vault metadata string.
#[rpc(name = "parity_setVaultMeta")] #[rpc(name = "parity_setVaultMeta")]
fn set_vault_meta(&self, String, String) -> Result<bool, Error>; fn set_vault_meta(&self, String, String) -> Result<bool>;
/// Derive new address from given account address using specific hash. /// Derive new address from given account address using specific hash.
/// Resulting address can be either saved as a new account (with the same password). /// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressHash")] #[rpc(name = "parity_deriveAddressHash")]
fn derive_key_hash(&self, H160, String, DeriveHash, bool) -> Result<H160, Error>; fn derive_key_hash(&self, H160, String, DeriveHash, bool) -> Result<H160>;
/// Derive new address from given account address using /// Derive new address from given account address using
/// hierarchical derivation (sequence of 32-bit integer indices). /// hierarchical derivation (sequence of 32-bit integer indices).
/// Resulting address can be either saved as a new account (with the same password). /// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressIndex")] #[rpc(name = "parity_deriveAddressIndex")]
fn derive_key_index(&self, H160, String, DeriveHierarchical, bool) -> Result<H160, Error>; fn derive_key_index(&self, H160, String, DeriveHierarchical, bool) -> Result<H160>;
/// Exports an account with given address if provided password matches. /// Exports an account with given address if provided password matches.
#[rpc(name = "parity_exportAccount")] #[rpc(name = "parity_exportAccount")]
fn export_account(&self, H160, String) -> Result<KeyFile, Error>; fn export_account(&self, H160, String) -> Result<KeyFile>;
/// Sign raw hash with the key corresponding to address and password. /// Sign raw hash with the key corresponding to address and password.
#[rpc(name = "parity_signMessage")] #[rpc(name = "parity_signMessage")]
fn sign_message(&self, H160, String, H256) -> Result<H520, Error>; fn sign_message(&self, H160, String, H256) -> Result<H520>;
/// Send a PinMatrixAck to a hardware wallet, unlocking it /// Send a PinMatrixAck to a hardware wallet, unlocking it
#[rpc(name = "parity_hardwarePinMatrixAck")] #[rpc(name = "parity_hardwarePinMatrixAck")]
fn hardware_pin_matrix_ack(&self, String, String) -> Result<bool, Error>; fn hardware_pin_matrix_ack(&self, String, String) -> Result<bool>;
} }
} }

View File

@ -16,7 +16,7 @@
//! Parity-specific rpc interface for operations altering the settings. //! Parity-specific rpc interface for operations altering the settings.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp}; use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp};
@ -25,91 +25,91 @@ build_rpc_trait! {
pub trait ParitySet { pub trait ParitySet {
/// Sets new minimal gas price for mined blocks. /// Sets new minimal gas price for mined blocks.
#[rpc(name = "parity_setMinGasPrice")] #[rpc(name = "parity_setMinGasPrice")]
fn set_min_gas_price(&self, U256) -> Result<bool, Error>; fn set_min_gas_price(&self, U256) -> Result<bool>;
/// Sets new gas floor target for mined blocks. /// Sets new gas floor target for mined blocks.
#[rpc(name = "parity_setGasFloorTarget")] #[rpc(name = "parity_setGasFloorTarget")]
fn set_gas_floor_target(&self, U256) -> Result<bool, Error>; fn set_gas_floor_target(&self, U256) -> Result<bool>;
/// Sets new gas ceiling target for mined blocks. /// Sets new gas ceiling target for mined blocks.
#[rpc(name = "parity_setGasCeilTarget")] #[rpc(name = "parity_setGasCeilTarget")]
fn set_gas_ceil_target(&self, U256) -> Result<bool, Error>; fn set_gas_ceil_target(&self, U256) -> Result<bool>;
/// Sets new extra data for mined blocks. /// Sets new extra data for mined blocks.
#[rpc(name = "parity_setExtraData")] #[rpc(name = "parity_setExtraData")]
fn set_extra_data(&self, Bytes) -> Result<bool, Error>; fn set_extra_data(&self, Bytes) -> Result<bool>;
/// Sets new author for mined block. /// Sets new author for mined block.
#[rpc(name = "parity_setAuthor")] #[rpc(name = "parity_setAuthor")]
fn set_author(&self, H160) -> Result<bool, Error>; fn set_author(&self, H160) -> Result<bool>;
/// Sets account for signing consensus messages. /// Sets account for signing consensus messages.
#[rpc(name = "parity_setEngineSigner")] #[rpc(name = "parity_setEngineSigner")]
fn set_engine_signer(&self, H160, String) -> Result<bool, Error>; fn set_engine_signer(&self, H160, String) -> Result<bool>;
/// Sets the limits for transaction queue. /// Sets the limits for transaction queue.
#[rpc(name = "parity_setTransactionsLimit")] #[rpc(name = "parity_setTransactionsLimit")]
fn set_transactions_limit(&self, usize) -> Result<bool, Error>; fn set_transactions_limit(&self, usize) -> Result<bool>;
/// Sets the maximum amount of gas a single transaction may consume. /// Sets the maximum amount of gas a single transaction may consume.
#[rpc(name = "parity_setMaxTransactionGas")] #[rpc(name = "parity_setMaxTransactionGas")]
fn set_tx_gas_limit(&self, U256) -> Result<bool, Error>; fn set_tx_gas_limit(&self, U256) -> Result<bool>;
/// Add a reserved peer. /// Add a reserved peer.
#[rpc(name = "parity_addReservedPeer")] #[rpc(name = "parity_addReservedPeer")]
fn add_reserved_peer(&self, String) -> Result<bool, Error>; fn add_reserved_peer(&self, String) -> Result<bool>;
/// Remove a reserved peer. /// Remove a reserved peer.
#[rpc(name = "parity_removeReservedPeer")] #[rpc(name = "parity_removeReservedPeer")]
fn remove_reserved_peer(&self, String) -> Result<bool, Error>; fn remove_reserved_peer(&self, String) -> Result<bool>;
/// Drop all non-reserved peers. /// Drop all non-reserved peers.
#[rpc(name = "parity_dropNonReservedPeers")] #[rpc(name = "parity_dropNonReservedPeers")]
fn drop_non_reserved_peers(&self) -> Result<bool, Error>; fn drop_non_reserved_peers(&self) -> Result<bool>;
/// Accept non-reserved peers (default behavior) /// Accept non-reserved peers (default behavior)
#[rpc(name = "parity_acceptNonReservedPeers")] #[rpc(name = "parity_acceptNonReservedPeers")]
fn accept_non_reserved_peers(&self) -> Result<bool, Error>; fn accept_non_reserved_peers(&self) -> Result<bool>;
/// Start the network. /// Start the network.
/// ///
/// @deprecated - Use `set_mode("active")` instead. /// @deprecated - Use `set_mode("active")` instead.
#[rpc(name = "parity_startNetwork")] #[rpc(name = "parity_startNetwork")]
fn start_network(&self) -> Result<bool, Error>; fn start_network(&self) -> Result<bool>;
/// Stop the network. /// Stop the network.
/// ///
/// @deprecated - Use `set_mode("offline")` instead. /// @deprecated - Use `set_mode("offline")` instead.
#[rpc(name = "parity_stopNetwork")] #[rpc(name = "parity_stopNetwork")]
fn stop_network(&self) -> Result<bool, Error>; fn stop_network(&self) -> Result<bool>;
/// Set the mode. Argument must be one of: "active", "passive", "dark", "offline". /// Set the mode. Argument must be one of: "active", "passive", "dark", "offline".
#[rpc(name = "parity_setMode")] #[rpc(name = "parity_setMode")]
fn set_mode(&self, String) -> Result<bool, Error>; fn set_mode(&self, String) -> Result<bool>;
/// Set the network spec. Argument must be one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse", "musicoin" or a filename. /// Set the network spec. Argument must be one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse", "musicoin" or a filename.
#[rpc(name = "parity_setChain")] #[rpc(name = "parity_setChain")]
fn set_spec_name(&self, String) -> Result<bool, Error>; fn set_spec_name(&self, String) -> Result<bool>;
/// Hash a file content under given URL. /// Hash a file content under given URL.
#[rpc(name = "parity_hashContent")] #[rpc(name = "parity_hashContent")]
fn hash_content(&self, String) -> BoxFuture<H256, Error>; fn hash_content(&self, String) -> BoxFuture<H256>;
/// Returns true if refresh successful, error if unsuccessful or server is disabled. /// Returns true if refresh successful, error if unsuccessful or server is disabled.
#[rpc(name = "parity_dappsRefresh")] #[rpc(name = "parity_dappsRefresh")]
fn dapps_refresh(&self) -> Result<bool, Error>; fn dapps_refresh(&self) -> Result<bool>;
/// Returns a list of local dapps /// Returns a list of local dapps
#[rpc(name = "parity_dappsList")] #[rpc(name = "parity_dappsList")]
fn dapps_list(&self) -> Result<Vec<LocalDapp>, Error>; fn dapps_list(&self) -> Result<Vec<LocalDapp>>;
/// Is there a release ready for install? /// Is there a release ready for install?
#[rpc(name = "parity_upgradeReady")] #[rpc(name = "parity_upgradeReady")]
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>, Error>; fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>>;
/// Execute a release which is ready according to upgrade_ready(). /// Execute a release which is ready according to upgrade_ready().
#[rpc(name = "parity_executeUpgrade")] #[rpc(name = "parity_executeUpgrade")]
fn execute_upgrade(&self) -> Result<bool, Error>; fn execute_upgrade(&self) -> Result<bool>;
/// Removes transaction from transaction queue. /// Removes transaction from transaction queue.
/// Makes sense only for transactions that were not propagated to other peers yet /// Makes sense only for transactions that were not propagated to other peers yet
@ -118,6 +118,6 @@ build_rpc_trait! {
/// or excessive gas limit that are not accepted by other peers whp. /// or excessive gas limit that are not accepted by other peers whp.
/// Returns `true` when transaction was removed, `false` if it was not found. /// Returns `true` when transaction was removed, `false` if it was not found.
#[rpc(name = "parity_removeTransaction")] #[rpc(name = "parity_removeTransaction")]
fn remove_transaction(&self, H256) -> Result<Option<Transaction>, Error>; fn remove_transaction(&self, H256) -> Result<Option<Transaction>>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! ParitySigning rpc interface. //! ParitySigning rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use v1::types::{U256, H160, Bytes, ConfirmationResponse, TransactionRequest, Either}; use v1::types::{U256, H160, Bytes, ConfirmationResponse, TransactionRequest, Either};
@ -27,26 +27,26 @@ build_rpc_trait! {
/// Given partial transaction request produces transaction with all fields filled in. /// Given partial transaction request produces transaction with all fields filled in.
/// Such transaction can be then signed externally. /// Such transaction can be then signed externally.
#[rpc(meta, name = "parity_composeTransaction")] #[rpc(meta, name = "parity_composeTransaction")]
fn compose_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<TransactionRequest, Error>; fn compose_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<TransactionRequest>;
/// Posts sign request asynchronously. /// Posts sign request asynchronously.
/// Will return a confirmation ID for later use with check_transaction. /// Will return a confirmation ID for later use with check_transaction.
#[rpc(meta, name = "parity_postSign")] #[rpc(meta, name = "parity_postSign")]
fn post_sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Either<U256, ConfirmationResponse>, Error>; fn post_sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Either<U256, ConfirmationResponse>>;
/// Posts transaction asynchronously. /// Posts transaction asynchronously.
/// Will return a transaction ID for later use with check_transaction. /// Will return a transaction ID for later use with check_transaction.
#[rpc(meta, name = "parity_postTransaction")] #[rpc(meta, name = "parity_postTransaction")]
fn post_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<Either<U256, ConfirmationResponse>, Error>; fn post_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<Either<U256, ConfirmationResponse>>;
/// Checks the progress of a previously posted request (transaction/sign). /// Checks the progress of a previously posted request (transaction/sign).
/// Should be given a valid send_transaction ID. /// Should be given a valid send_transaction ID.
#[rpc(name = "parity_checkRequest")] #[rpc(name = "parity_checkRequest")]
fn check_request(&self, U256) -> Result<Option<ConfirmationResponse>, Error>; fn check_request(&self, U256) -> Result<Option<ConfirmationResponse>>;
/// Decrypt some ECIES-encrypted message. /// Decrypt some ECIES-encrypted message.
/// First parameter is the address with which it is encrypted, second is the ciphertext. /// First parameter is the address with which it is encrypted, second is the ciphertext.
#[rpc(meta, name = "parity_decryptMessage")] #[rpc(meta, name = "parity_decryptMessage")]
fn decrypt_message(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Bytes, Error>; fn decrypt_message(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Bytes>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Personal rpc interface. //! Personal rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use v1::types::{U128, H160, H256, TransactionRequest}; use v1::types::{U128, H160, H256, TransactionRequest};
@ -26,24 +26,24 @@ build_rpc_trait! {
/// Lists all stored accounts /// Lists all stored accounts
#[rpc(name = "personal_listAccounts")] #[rpc(name = "personal_listAccounts")]
fn accounts(&self) -> Result<Vec<H160>, Error>; fn accounts(&self) -> Result<Vec<H160>>;
/// Creates new account (it becomes new current unlocked account) /// Creates new account (it becomes new current unlocked account)
/// Param is the password for the account. /// Param is the password for the account.
#[rpc(name = "personal_newAccount")] #[rpc(name = "personal_newAccount")]
fn new_account(&self, String) -> Result<H160, Error>; fn new_account(&self, String) -> Result<H160>;
/// Unlocks specified account for use (can only be one unlocked account at one moment) /// Unlocks specified account for use (can only be one unlocked account at one moment)
#[rpc(name = "personal_unlockAccount")] #[rpc(name = "personal_unlockAccount")]
fn unlock_account(&self, H160, String, Option<U128>) -> Result<bool, Error>; fn unlock_account(&self, H160, String, Option<U128>) -> Result<bool>;
/// Sends transaction and signs it in single call. The account is not unlocked in such case. /// Sends transaction and signs it in single call. The account is not unlocked in such case.
#[rpc(meta, name = "personal_sendTransaction")] #[rpc(meta, name = "personal_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>; fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256>;
/// @deprecated alias for `personal_sendTransaction`. /// @deprecated alias for `personal_sendTransaction`.
#[rpc(meta, name = "personal_signAndSendTransaction")] #[rpc(meta, name = "personal_signAndSendTransaction")]
fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>; fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256>;
} }
} }

View File

@ -16,7 +16,7 @@
//! Parity-specific PUB-SUB rpc interface. //! Parity-specific PUB-SUB rpc interface.
use jsonrpc_core::{Error, Value, Params}; use jsonrpc_core::{Result, Value, Params};
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
@ -33,7 +33,7 @@ build_rpc_trait! {
/// Unsubscribe from existing Parity subscription. /// Unsubscribe from existing Parity subscription.
#[rpc(name = "parity_unsubscribe")] #[rpc(name = "parity_unsubscribe")]
fn parity_unsubscribe(&self, SubscriptionId) -> Result<bool, Error>; fn parity_unsubscribe(&self, SubscriptionId) -> Result<bool>;
} }
} }
} }

View File

@ -18,7 +18,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::Error; use jsonrpc_core::Result;
build_rpc_trait! { build_rpc_trait! {
/// RPC Interface. /// RPC Interface.
@ -26,11 +26,11 @@ build_rpc_trait! {
/// Returns supported modules for Geth 1.3.6 /// Returns supported modules for Geth 1.3.6
/// @ignore /// @ignore
#[rpc(name = "modules")] #[rpc(name = "modules")]
fn modules(&self) -> Result<BTreeMap<String, String>, Error>; fn modules(&self) -> Result<BTreeMap<String, String>>;
/// Returns supported modules for Geth 1.4.0 /// Returns supported modules for Geth 1.4.0
/// @ignore /// @ignore
#[rpc(name = "rpc_modules")] #[rpc(name = "rpc_modules")]
fn rpc_modules(&self) -> Result<BTreeMap<String, String>, Error>; fn rpc_modules(&self) -> Result<BTreeMap<String, String>>;
} }
} }

View File

@ -16,7 +16,8 @@
//! SecretStore-specific rpc interface. //! SecretStore-specific rpc interface.
use jsonrpc_core::Error; use std::collections::BTreeSet;
use jsonrpc_core::Result;
use v1::types::{H160, H512, Bytes}; use v1::types::{H160, H512, Bytes};
@ -26,16 +27,21 @@ build_rpc_trait! {
/// Encrypt data with key, received from secret store. /// Encrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`. /// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_encrypt")] #[rpc(name = "secretstore_encrypt")]
fn encrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes, Error>; fn encrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes>;
/// Decrypt data with key, received from secret store. /// Decrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`. /// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_decrypt")] #[rpc(name = "secretstore_decrypt")]
fn decrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes, Error>; fn decrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes>;
/// Decrypt data with shadow key, received from secret store. /// Decrypt data with shadow key, received from secret store.
/// Arguments: `account`, `password`, `decrypted_secret`, `common_point`, `decrypt_shadows`, `data`. /// Arguments: `account`, `password`, `decrypted_secret`, `common_point`, `decrypt_shadows`, `data`.
#[rpc(name = "secretstore_shadowDecrypt")] #[rpc(name = "secretstore_shadowDecrypt")]
fn shadow_decrypt(&self, H160, String, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes, Error>; fn shadow_decrypt(&self, H160, String, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes>;
/// Sign servers set for use in ServersSetChange session.
/// Arguments: `account`, `password`, `servers_set`.
#[rpc(name = "secretstore_signServersSet")]
fn sign_servers_set(&self, H160, String, BTreeSet<H512>) -> Result<Bytes>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Parity Signer-related rpc interface. //! Parity Signer-related rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
@ -28,31 +28,31 @@ build_rpc_trait! {
/// Returns a list of items to confirm. /// Returns a list of items to confirm.
#[rpc(name = "signer_requestsToConfirm")] #[rpc(name = "signer_requestsToConfirm")]
fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>, Error>; fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>>;
/// Confirm specific request. /// Confirm specific request.
#[rpc(name = "signer_confirmRequest")] #[rpc(name = "signer_confirmRequest")]
fn confirm_request(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponse, Error>; fn confirm_request(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponse>;
/// Confirm specific request with token. /// Confirm specific request with token.
#[rpc(name = "signer_confirmRequestWithToken")] #[rpc(name = "signer_confirmRequestWithToken")]
fn confirm_request_with_token(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponseWithToken, Error>; fn confirm_request_with_token(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponseWithToken>;
/// Confirm specific request with already signed data. /// Confirm specific request with already signed data.
#[rpc(name = "signer_confirmRequestRaw")] #[rpc(name = "signer_confirmRequestRaw")]
fn confirm_request_raw(&self, U256, Bytes) -> Result<ConfirmationResponse, Error>; fn confirm_request_raw(&self, U256, Bytes) -> Result<ConfirmationResponse>;
/// Reject the confirmation request. /// Reject the confirmation request.
#[rpc(name = "signer_rejectRequest")] #[rpc(name = "signer_rejectRequest")]
fn reject_request(&self, U256) -> Result<bool, Error>; fn reject_request(&self, U256) -> Result<bool>;
/// Generates new authorization token. /// Generates new authorization token.
#[rpc(name = "signer_generateAuthorizationToken")] #[rpc(name = "signer_generateAuthorizationToken")]
fn generate_token(&self) -> Result<String, Error>; fn generate_token(&self) -> Result<String>;
/// Generates new web proxy access token for particular domain. /// Generates new web proxy access token for particular domain.
#[rpc(name = "signer_generateWebProxyAccessToken")] #[rpc(name = "signer_generateWebProxyAccessToken")]
fn generate_web_proxy_token(&self, String) -> Result<String, Error>; fn generate_web_proxy_token(&self, String) -> Result<String>;
#[pubsub(name = "signer_pending")] { #[pubsub(name = "signer_pending")] {
/// Subscribe to new pending requests on signer interface. /// Subscribe to new pending requests on signer interface.
@ -61,7 +61,7 @@ build_rpc_trait! {
/// Unsubscribe from pending requests subscription. /// Unsubscribe from pending requests subscription.
#[rpc(name = "signer_unsubscribePending")] #[rpc(name = "signer_unsubscribePending")]
fn unsubscribe_pending(&self, SubscriptionId) -> Result<bool, Error>; fn unsubscribe_pending(&self, SubscriptionId) -> Result<bool>;
} }
} }
} }

View File

@ -16,7 +16,7 @@
//! Traces specific rpc interface. //! Traces specific rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, H256, TraceOptions}; use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, H256, TraceOptions};
@ -27,34 +27,34 @@ build_rpc_trait! {
/// Returns traces matching given filter. /// Returns traces matching given filter.
#[rpc(name = "trace_filter")] #[rpc(name = "trace_filter")]
fn filter(&self, TraceFilter) -> Result<Option<Vec<LocalizedTrace>>, Error>; fn filter(&self, TraceFilter) -> Result<Option<Vec<LocalizedTrace>>>;
/// Returns transaction trace at given index. /// Returns transaction trace at given index.
#[rpc(name = "trace_get")] #[rpc(name = "trace_get")]
fn trace(&self, H256, Vec<Index>) -> Result<Option<LocalizedTrace>, Error>; fn trace(&self, H256, Vec<Index>) -> Result<Option<LocalizedTrace>>;
/// Returns all traces of given transaction. /// Returns all traces of given transaction.
#[rpc(name = "trace_transaction")] #[rpc(name = "trace_transaction")]
fn transaction_traces(&self, H256) -> Result<Option<Vec<LocalizedTrace>>, Error>; fn transaction_traces(&self, H256) -> Result<Option<Vec<LocalizedTrace>>>;
/// Returns all traces produced at given block. /// Returns all traces produced at given block.
#[rpc(name = "trace_block")] #[rpc(name = "trace_block")]
fn block_traces(&self, BlockNumber) -> Result<Option<Vec<LocalizedTrace>>, Error>; fn block_traces(&self, BlockNumber) -> Result<Option<Vec<LocalizedTrace>>>;
/// Executes the given call and returns a number of possible traces for it. /// Executes the given call and returns a number of possible traces for it.
#[rpc(meta, name = "trace_call")] #[rpc(meta, name = "trace_call")]
fn call(&self, Self::Metadata, CallRequest, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults, Error>; fn call(&self, Self::Metadata, CallRequest, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults>;
/// Executes all given calls and returns a number of possible traces for each of it. /// Executes all given calls and returns a number of possible traces for each of it.
#[rpc(meta, name = "trace_callMany")] #[rpc(meta, name = "trace_callMany")]
fn call_many(&self, Self::Metadata, Vec<(CallRequest, TraceOptions)>, Trailing<BlockNumber>) -> Result<Vec<TraceResults>, Error>; fn call_many(&self, Self::Metadata, Vec<(CallRequest, TraceOptions)>, Trailing<BlockNumber>) -> Result<Vec<TraceResults>>;
/// Executes the given raw transaction and returns a number of possible traces for it. /// Executes the given raw transaction and returns a number of possible traces for it.
#[rpc(name = "trace_rawTransaction")] #[rpc(name = "trace_rawTransaction")]
fn raw_transaction(&self, Bytes, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults, Error>; fn raw_transaction(&self, Bytes, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults>;
/// Executes the transaction with the given hash and returns a number of possible traces for it. /// Executes the transaction with the given hash and returns a number of possible traces for it.
#[rpc(name = "trace_replayTransaction")] #[rpc(name = "trace_replayTransaction")]
fn replay_transaction(&self, H256, TraceOptions) -> Result<TraceResults, Error>; fn replay_transaction(&self, H256, TraceOptions) -> Result<TraceResults>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Web3 rpc interface. //! Web3 rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::types::{H256, Bytes}; use v1::types::{H256, Bytes};
@ -24,10 +24,10 @@ build_rpc_trait! {
pub trait Web3 { pub trait Web3 {
/// Returns current client version. /// Returns current client version.
#[rpc(name = "web3_clientVersion")] #[rpc(name = "web3_clientVersion")]
fn client_version(&self) -> Result<String, Error>; fn client_version(&self) -> Result<String>;
/// Returns sha3 of the given data /// Returns sha3 of the given data
#[rpc(name = "web3_sha3")] #[rpc(name = "web3_sha3")]
fn sha3(&self, Bytes) -> Result<H256, Error>; fn sha3(&self, Bytes) -> Result<H256>;
} }
} }

View File

@ -14,7 +14,7 @@ serde_json = "1.0"
url = "1.2.0" url = "1.2.0"
matches = "0.1" matches = "0.1"
parking_lot = "0.4" parking_lot = "0.4"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
parity-rpc = { path = "../rpc" } parity-rpc = { path = "../rpc" }
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }

View File

@ -33,10 +33,12 @@ use serde_json::{
use futures::{Canceled, Complete, Future, oneshot, done}; use futures::{Canceled, Complete, Future, oneshot, done};
use jsonrpc_core::{BoxFuture, Id, Version, Params, Error as JsonRpcError}; use jsonrpc_core::{Id, Version, Params, Error as JsonRpcError};
use jsonrpc_core::request::MethodCall; use jsonrpc_core::request::MethodCall;
use jsonrpc_core::response::{Output, Success, Failure}; use jsonrpc_core::response::{Output, Success, Failure};
use BoxFuture;
/// The actual websocket connection handler, passed into the /// The actual websocket connection handler, passed into the
/// event loop of ws-rs /// event loop of ws-rs
struct RpcHandler { struct RpcHandler {

View File

@ -9,7 +9,7 @@ extern crate parking_lot;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate url; extern crate url;
extern crate hash; extern crate keccak_hash as hash;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -18,6 +18,8 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate matches; extern crate matches;
/// Boxed future response.
pub type BoxFuture<T, E> = Box<futures::Future<Item=T, Error=E> + Send>;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View File

@ -4,7 +4,7 @@ use serde;
use serde_json::{Value as JsonValue, to_value}; use serde_json::{Value as JsonValue, to_value};
use std::path::PathBuf; use std::path::PathBuf;
use futures::{Canceled}; use futures::{Canceled};
use jsonrpc_core::BoxFuture; use {BoxFuture};
pub struct SignerRpc { pub struct SignerRpc {
rpc: Rpc, rpc: Rpc,

View File

@ -24,15 +24,17 @@ tokio-proto = "0.1"
url = "1.0" url = "1.0"
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
ethcore-devtools = { path = "../devtools" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-bigint = { path = "../util/bigint" } ethcore-bigint = { path = "../util/bigint" }
ethsync = { path = "../sync" } ethsync = { path = "../sync" }
kvdb = { path = "../util/kvdb" } kvdb = { path = "../util/kvdb" }
kvdb-rocksdb = { path = "../util/kvdb-rocksdb" } kvdb-rocksdb = { path = "../util/kvdb-rocksdb" }
hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
ethcore-logger = { path = "../logger" } ethcore-logger = { path = "../logger" }
ethcrypto = { path = "../ethcrypto" } ethcrypto = { path = "../ethcrypto" }
ethkey = { path = "../ethkey" } ethkey = { path = "../ethkey" }
native-contracts = { path = "../ethcore/native_contracts" } native-contracts = { path = "../ethcore/native_contracts" }
lazy_static = "0.2" lazy_static = "0.2"
[dev-dependencies]
tempdir = "0.3"

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::collections::BTreeSet;
use std::thread; use std::thread;
use std::sync::Arc; use std::sync::Arc;
use std::sync::mpsc; use std::sync::mpsc;
@ -26,9 +27,9 @@ use super::acl_storage::AclStorage;
use super::key_storage::KeyStorage; use super::key_storage::KeyStorage;
use super::key_server_set::KeyServerSet; use super::key_server_set::KeyServerSet;
use key_server_cluster::{math, ClusterCore}; use key_server_cluster::{math, ClusterCore};
use traits::{ServerKeyGenerator, DocumentKeyServer, MessageSigner, KeyServer, NodeKeyPair}; use traits::{AdminSessionsServer, ServerKeyGenerator, DocumentKeyServer, MessageSigner, KeyServer, NodeKeyPair};
use types::all::{Error, Public, RequestSignature, ServerKeyId, EncryptedDocumentKey, EncryptedDocumentKeyShadow, use types::all::{Error, Public, RequestSignature, ServerKeyId, EncryptedDocumentKey, EncryptedDocumentKeyShadow,
ClusterConfiguration, MessageHash, EncryptedMessageSignature}; ClusterConfiguration, MessageHash, EncryptedMessageSignature, NodeId};
use key_server_cluster::{ClusterClient, ClusterConfiguration as NetClusterConfiguration}; use key_server_cluster::{ClusterClient, ClusterConfiguration as NetClusterConfiguration};
/// Secret store key server implementation /// Secret store key server implementation
@ -60,6 +61,14 @@ impl KeyServerImpl {
impl KeyServer for KeyServerImpl {} impl KeyServer for KeyServerImpl {}
impl AdminSessionsServer for KeyServerImpl {
fn change_servers_set(&self, old_set_signature: RequestSignature, new_set_signature: RequestSignature, new_servers_set: BTreeSet<NodeId>) -> Result<(), Error> {
let servers_set_change_session = self.data.lock().cluster
.new_servers_set_change_session(None, new_servers_set, old_set_signature, new_set_signature)?;
servers_set_change_session.wait().map_err(Into::into)
}
}
impl ServerKeyGenerator for KeyServerImpl { impl ServerKeyGenerator for KeyServerImpl {
fn generate_key(&self, key_id: &ServerKeyId, signature: &RequestSignature, threshold: usize) -> Result<Public, Error> { fn generate_key(&self, key_id: &ServerKeyId, signature: &RequestSignature, threshold: usize) -> Result<Public, Error> {
// recover requestor' public key from signature // recover requestor' public key from signature
@ -153,7 +162,7 @@ impl KeyServerCore {
allow_connecting_to_higher_nodes: config.allow_connecting_to_higher_nodes, allow_connecting_to_higher_nodes: config.allow_connecting_to_higher_nodes,
acl_storage: acl_storage, acl_storage: acl_storage,
key_storage: key_storage, key_storage: key_storage,
admin_public: None, admin_public: config.admin_public.clone(),
}; };
let (stop, stopped) = futures::oneshot(); let (stop, stopped) = futures::oneshot();
@ -191,6 +200,7 @@ impl Drop for KeyServerCore {
#[cfg(test)] #[cfg(test)]
pub mod tests { pub mod tests {
use std::collections::BTreeSet;
use std::time; use std::time;
use std::sync::Arc; use std::sync::Arc;
use std::net::SocketAddr; use std::net::SocketAddr;
@ -204,14 +214,20 @@ pub mod tests {
use key_server_cluster::math; use key_server_cluster::math;
use bigint::hash::H256; use bigint::hash::H256;
use types::all::{Error, Public, ClusterConfiguration, NodeAddress, RequestSignature, ServerKeyId, use types::all::{Error, Public, ClusterConfiguration, NodeAddress, RequestSignature, ServerKeyId,
EncryptedDocumentKey, EncryptedDocumentKeyShadow, MessageHash, EncryptedMessageSignature}; EncryptedDocumentKey, EncryptedDocumentKeyShadow, MessageHash, EncryptedMessageSignature, NodeId};
use traits::{ServerKeyGenerator, DocumentKeyServer, MessageSigner, KeyServer}; use traits::{AdminSessionsServer, ServerKeyGenerator, DocumentKeyServer, MessageSigner, KeyServer};
use super::KeyServerImpl; use super::KeyServerImpl;
pub struct DummyKeyServer; pub struct DummyKeyServer;
impl KeyServer for DummyKeyServer {} impl KeyServer for DummyKeyServer {}
impl AdminSessionsServer for DummyKeyServer {
fn change_servers_set(&self, _old_set_signature: RequestSignature, _new_set_signature: RequestSignature, _new_servers_set: BTreeSet<NodeId>) -> Result<(), Error> {
unimplemented!()
}
}
impl ServerKeyGenerator for DummyKeyServer { impl ServerKeyGenerator for DummyKeyServer {
fn generate_key(&self, _key_id: &ServerKeyId, _signature: &RequestSignature, _threshold: usize) -> Result<Public, Error> { fn generate_key(&self, _key_id: &ServerKeyId, _signature: &RequestSignature, _threshold: usize) -> Result<Public, Error> {
unimplemented!() unimplemented!()
@ -444,4 +460,9 @@ pub mod tests {
// check signature // check signature
assert_eq!(math::verify_signature(&server_public, &(signature_c, signature_s), &message_hash), Ok(true)); assert_eq!(math::verify_signature(&server_public, &(signature_c, signature_s), &message_hash), Ok(true));
} }
#[test]
fn servers_set_change_session_works_over_network() {
// TODO
}
} }

Some files were not shown because too many files have changed in this diff Show More