Crypto primitives removed from ethkey (#11174)
* Crypto utils removed from ethkey * Fix ethkey lib * Switch ethsore to new crypto * Accounts crate fixed * Secret store crate switched to new crypto * Ethcore builtin fixed * Accounts crate fixed * Ethcore crate fixed * Util network fixed * Util network-devp2p fixed * Private tx fixed * Ethcore sync fixed * Secret store fixed * Rpc fixed * Parity fixed * Ethkey cli fixed * Local store fixed * Ethcore blockchain fixed * Cargo.lock pushed; doc comment added for reversed nonce * Ethstore tests fixed * Ethstore cli fixed * Miner fixed * Snapshot tests are fixed * Single brackets removed * Machine fixed * Verification fixed * Executive state fixed * More single brackets removed * Update version of parity-crypto * Use published version 0.4.2 of parity-crypto * New test in tx_filter fixed
This commit is contained in:
parent
81ca599f2a
commit
834585d61b
174
Cargo.lock
generated
174
Cargo.lock
generated
@ -130,6 +130,11 @@ dependencies = [
|
|||||||
"nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arrayvec"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ascii"
|
name = "ascii"
|
||||||
version = "0.7.1"
|
version = "0.7.1"
|
||||||
@ -174,7 +179,6 @@ dependencies = [
|
|||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.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)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -182,6 +186,7 @@ dependencies = [
|
|||||||
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"macros 0.1.0",
|
"macros 0.1.0",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -203,7 +208,7 @@ version = "0.3.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
"backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -214,7 +219,7 @@ name = "backtrace-sys"
|
|||||||
version = "0.1.24"
|
version = "0.1.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -251,10 +256,10 @@ dependencies = [
|
|||||||
"ethcore-accounts 0.1.0",
|
"ethcore-accounts 0.1.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"spec 0.1.0",
|
"spec 0.1.0",
|
||||||
@ -440,7 +445,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.28"
|
version = "1.0.46"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -450,7 +455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.9"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -535,13 +540,13 @@ dependencies = [
|
|||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"macros 0.1.0",
|
"macros 0.1.0",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -564,7 +569,7 @@ name = "cmake"
|
|||||||
version = "0.1.35"
|
version = "0.1.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -588,9 +593,9 @@ dependencies = [
|
|||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"patricia-trie-ethereum 0.1.0",
|
"patricia-trie-ethereum 0.1.0",
|
||||||
@ -658,7 +663,7 @@ version = "0.7.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -683,7 +688,7 @@ name = "crossbeam-utils"
|
|||||||
version = "0.6.5"
|
version = "0.6.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -878,10 +883,11 @@ dependencies = [
|
|||||||
"ethcore-blockchain 0.1.0",
|
"ethcore-blockchain 0.1.0",
|
||||||
"ethcore-builtin 0.1.0",
|
"ethcore-builtin 0.1.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vm 0.1.0",
|
"vm 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -925,17 +931,6 @@ dependencies = [
|
|||||||
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "eth-secp256k1"
|
|
||||||
version = "0.5.7"
|
|
||||||
source = "git+https://github.com/paritytech/rust-secp256k1#246aefeef6337d208d820936e8e868f11d80e98c"
|
|
||||||
dependencies = [
|
|
||||||
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethabi"
|
name = "ethabi"
|
||||||
version = "9.0.1"
|
version = "9.0.1"
|
||||||
@ -1044,7 +1039,6 @@ dependencies = [
|
|||||||
"ethcore-stratum 1.12.0",
|
"ethcore-stratum 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"evm 0.1.0",
|
"evm 0.1.0",
|
||||||
"executive-state 0.1.0",
|
"executive-state 0.1.0",
|
||||||
"fetch 0.1.0",
|
"fetch 0.1.0",
|
||||||
@ -1062,6 +1056,7 @@ dependencies = [
|
|||||||
"macros 0.1.0",
|
"macros 0.1.0",
|
||||||
"memory-cache 0.1.0",
|
"memory-cache 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-runtime 0.1.0",
|
"parity-runtime 0.1.0",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"patricia-trie-ethereum 0.1.0",
|
"patricia-trie-ethereum 0.1.0",
|
||||||
@ -1097,9 +1092,10 @@ name = "ethcore-accounts"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"ethstore 0.2.1",
|
"ethstore 0.2.1",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1117,13 +1113,13 @@ dependencies = [
|
|||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-db 0.1.0",
|
"ethcore-db 0.1.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.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)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"kvdb-memorydb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb-memorydb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1153,13 +1149,12 @@ dependencies = [
|
|||||||
"eip-152 0.1.0",
|
"eip-152 0.1.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1278,13 +1273,13 @@ dependencies = [
|
|||||||
"ethash 1.12.0",
|
"ethash 1.12.0",
|
||||||
"ethcore-call-contract 0.1.0",
|
"ethcore-call-contract 0.1.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"fetch 0.1.0",
|
"fetch 0.1.0",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-runtime 0.1.0",
|
"parity-runtime 0.1.0",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1308,11 +1303,10 @@ dependencies = [
|
|||||||
"derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1331,7 +1325,6 @@ dependencies = [
|
|||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-network 1.12.0",
|
"ethcore-network 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"igd 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"igd 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipnetwork 0.12.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1340,7 +1333,7 @@ dependencies = [
|
|||||||
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1373,7 +1366,6 @@ dependencies = [
|
|||||||
"ethcore-miner 1.12.0",
|
"ethcore-miner 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"fetch 0.1.0",
|
"fetch 0.1.0",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1384,7 +1376,7 @@ dependencies = [
|
|||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"patricia-trie-ethereum 0.1.0",
|
"patricia-trie-ethereum 0.1.0",
|
||||||
@ -1422,7 +1414,7 @@ dependencies = [
|
|||||||
"ethcore-call-contract 0.1.0",
|
"ethcore-call-contract 0.1.0",
|
||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"jsonrpc-server-utils 14.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"jsonrpc-server-utils 14.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1432,7 +1424,7 @@ dependencies = [
|
|||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-runtime 0.1.0",
|
"parity-runtime 0.1.0",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1503,7 +1495,6 @@ dependencies = [
|
|||||||
"ethcore-network-devp2p 1.12.0",
|
"ethcore-network-devp2p 1.12.0",
|
||||||
"ethcore-private-tx 1.0.0",
|
"ethcore-private-tx 1.0.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"fastmap 0.1.0",
|
"fastmap 0.1.0",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1512,6 +1503,7 @@ dependencies = [
|
|||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"macros 0.1.0",
|
"macros 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-runtime 0.1.0",
|
"parity-runtime 0.1.0",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1551,22 +1543,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethkey"
|
name = "ethkey"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"edit-distance 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"edit-distance 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)",
|
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"zeroize 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1575,8 +1559,9 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"panic_hook 0.1.0",
|
"panic_hook 0.1.0",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-wordlist 1.3.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-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1590,12 +1575,12 @@ version = "0.2.1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"dir 0.1.2",
|
"dir 0.1.2",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.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)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-wordlist 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1616,9 +1601,11 @@ dependencies = [
|
|||||||
"dir 0.1.2",
|
"dir 0.1.2",
|
||||||
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ethkey 0.4.0",
|
||||||
"ethstore 0.2.1",
|
"ethstore 0.2.1",
|
||||||
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"panic_hook 0.1.0",
|
"panic_hook 0.1.0",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.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-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1680,7 +1667,6 @@ dependencies = [
|
|||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"evm 0.1.0",
|
"evm 0.1.0",
|
||||||
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1689,6 +1675,7 @@ dependencies = [
|
|||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"patricia-trie-ethereum 0.1.0",
|
"patricia-trie-ethereum 0.1.0",
|
||||||
"pod 0.1.0",
|
"pod 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)",
|
||||||
@ -1881,7 +1868,7 @@ name = "getrandom"
|
|||||||
version = "0.1.11"
|
version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -2198,7 +2185,7 @@ name = "jemalloc-sys"
|
|||||||
version = "0.1.8"
|
version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -2450,7 +2437,7 @@ name = "libloading"
|
|||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2491,7 +2478,7 @@ name = "log"
|
|||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2548,13 +2535,13 @@ dependencies = [
|
|||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"evm 0.1.0",
|
"evm 0.1.0",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"macros 0.1.0",
|
"macros 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (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)",
|
||||||
@ -2633,11 +2620,6 @@ name = "memory_units"
|
|||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memzero"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "migration-rocksdb"
|
name = "migration-rocksdb"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -2765,7 +2747,7 @@ name = "net2"
|
|||||||
version = "0.2.33"
|
version = "0.2.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -2935,21 +2917,26 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-crypto"
|
name = "parity-crypto"
|
||||||
version = "0.4.0"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"block-modes 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"block-modes 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memzero 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-secp256k1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"scrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"scrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"subtle 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2993,7 +2980,7 @@ dependencies = [
|
|||||||
"ethcore-service 0.1.0",
|
"ethcore-service 0.1.0",
|
||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"ethstore 0.2.1",
|
"ethstore 0.2.1",
|
||||||
"fake-fetch 0.0.1",
|
"fake-fetch 0.0.1",
|
||||||
"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)",
|
||||||
@ -3011,6 +2998,7 @@ dependencies = [
|
|||||||
"number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"panic_hook 0.1.0",
|
"panic_hook 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-daemonize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-daemonize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-hash-fetch 1.12.0",
|
"parity-hash-fetch 1.12.0",
|
||||||
"parity-ipfs-api 1.12.0",
|
"parity-ipfs-api 1.12.0",
|
||||||
@ -3091,10 +3079,11 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"common-types 0.1.0",
|
"common-types 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"kvdb-memorydb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb-memorydb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -3150,7 +3139,7 @@ dependencies = [
|
|||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"ethstore 0.2.1",
|
"ethstore 0.2.1",
|
||||||
"fake-fetch 0.0.1",
|
"fake-fetch 0.0.1",
|
||||||
"fastmap 0.1.0",
|
"fastmap 0.1.0",
|
||||||
@ -3170,7 +3159,7 @@ dependencies = [
|
|||||||
"multihash 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"multihash 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-runtime 0.1.0",
|
"parity-runtime 0.1.0",
|
||||||
"parity-updater 1.12.0",
|
"parity-updater 1.12.0",
|
||||||
"parity-version 2.7.0",
|
"parity-version 2.7.0",
|
||||||
@ -3234,6 +3223,17 @@ dependencies = [
|
|||||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parity-secp256k1"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-snappy"
|
name = "parity-snappy"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -3301,7 +3301,7 @@ name = "parity-util-mem"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"elastic-array 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"elastic-array 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"jemallocator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"jemallocator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -3376,7 +3376,7 @@ version = "0.6.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -3929,7 +3929,7 @@ name = "ring"
|
|||||||
version = "0.14.6"
|
version = "0.14.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -4229,7 +4229,7 @@ dependencies = [
|
|||||||
"ethcore-db 0.1.0",
|
"ethcore-db 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.4.0",
|
||||||
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hash-db 0.15.0 (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)",
|
||||||
"journaldb 0.2.0",
|
"journaldb 0.2.0",
|
||||||
@ -4276,7 +4276,6 @@ dependencies = [
|
|||||||
"ethcore-db 0.1.0",
|
"ethcore-db 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"journaldb 0.2.0",
|
"journaldb 0.2.0",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -4286,6 +4285,7 @@ dependencies = [
|
|||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"patricia-trie-ethereum 0.1.0",
|
"patricia-trie-ethereum 0.1.0",
|
||||||
@ -4305,7 +4305,7 @@ name = "socket2"
|
|||||||
version = "0.3.8"
|
version = "0.3.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -5057,7 +5057,6 @@ dependencies = [
|
|||||||
"ethcore-call-contract 0.1.0",
|
"ethcore-call-contract 0.1.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"executive-state 0.1.0",
|
"executive-state 0.1.0",
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -5066,6 +5065,7 @@ dependencies = [
|
|||||||
"machine 0.1.0",
|
"machine 0.1.0",
|
||||||
"memory-cache 0.1.0",
|
"memory-cache 0.1.0",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -5118,7 +5118,6 @@ dependencies = [
|
|||||||
"ethcore-call-contract 0.1.0",
|
"ethcore-call-contract 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
|
||||||
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"len-caching-lock 0.1.1",
|
"len-caching-lock 0.1.1",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -5126,6 +5125,7 @@ dependencies = [
|
|||||||
"null-engine 0.1.0",
|
"null-engine 0.1.0",
|
||||||
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -5322,15 +5322,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zeroize"
|
name = "zeroize"
|
||||||
version = "0.9.1"
|
version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zeroize_derive"
|
name = "zeroize_derive"
|
||||||
version = "0.9.0"
|
version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -5350,6 +5350,7 @@ dependencies = [
|
|||||||
"checksum app_dirs 1.2.1 (git+https://github.com/paritytech/app-dirs-rs)" = "<none>"
|
"checksum app_dirs 1.2.1 (git+https://github.com/paritytech/app-dirs-rs)" = "<none>"
|
||||||
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
|
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
|
||||||
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
|
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
|
||||||
|
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
||||||
"checksum ascii 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae7d751998c189c1d4468cf0a39bb2eae052a9c58d50ebb3b9591ee3813ad50"
|
"checksum ascii 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae7d751998c189c1d4468cf0a39bb2eae052a9c58d50ebb3b9591ee3813ad50"
|
||||||
"checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5"
|
"checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5"
|
||||||
"checksum attohttpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eaf0ec4b0e00f61ee75556ca027485b7b354f4a714d88cc03f4468abd9378c86"
|
"checksum attohttpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eaf0ec4b0e00f61ee75556ca027485b7b354f4a714d88cc03f4468abd9378c86"
|
||||||
@ -5380,9 +5381,9 @@ dependencies = [
|
|||||||
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
|
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
|
||||||
"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
|
"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
|
||||||
"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
|
"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
|
||||||
"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749"
|
"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c"
|
||||||
"checksum cesu8 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
"checksum cesu8 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
||||||
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
|
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
|
||||||
"checksum cid 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0e37fba0087d9f3f4e269827a55dc511abf3e440cc097a0c154ff4e6584f988"
|
"checksum cid 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0e37fba0087d9f3f4e269827a55dc511abf3e440cc097a0c154ff4e6584f988"
|
||||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||||
@ -5418,7 +5419,6 @@ dependencies = [
|
|||||||
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
|
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
|
||||||
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
|
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
|
||||||
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
||||||
"checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "<none>"
|
|
||||||
"checksum ethabi 9.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "965126c64662832991f5a748893577630b558e47fa94e7f35aefcd20d737cef7"
|
"checksum ethabi 9.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "965126c64662832991f5a748893577630b558e47fa94e7f35aefcd20d737cef7"
|
||||||
"checksum ethabi-contract 9.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf407dce0290374bfbb1528493bc14320e663f75856b73a5b76262d8e2cec3c9"
|
"checksum ethabi-contract 9.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf407dce0290374bfbb1528493bc14320e663f75856b73a5b76262d8e2cec3c9"
|
||||||
"checksum ethabi-derive 9.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bd0753d4f9e1dba99450da5f2400b20527702ae8ce0309a5f7c239d305539884"
|
"checksum ethabi-derive 9.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bd0753d4f9e1dba99450da5f2400b20527702ae8ce0309a5f7c239d305539884"
|
||||||
@ -5515,7 +5515,6 @@ dependencies = [
|
|||||||
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
|
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
|
||||||
"checksum memory-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a688133a81c915553c1dd9c3e859949f43a854cb8f8773e690e849b53b1f89f0"
|
"checksum memory-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a688133a81c915553c1dd9c3e859949f43a854cb8f8773e690e849b53b1f89f0"
|
||||||
"checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882"
|
"checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882"
|
||||||
"checksum memzero 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "93c0d11ac30a033511ae414355d80f70d9f29a44a49140face477117a1ee90db"
|
|
||||||
"checksum mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "0a907b83e7b9e987032439a387e187119cddafc92d5c2aaeb1d92580a793f630"
|
"checksum mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "0a907b83e7b9e987032439a387e187119cddafc92d5c2aaeb1d92580a793f630"
|
||||||
"checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed"
|
"checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed"
|
||||||
"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23"
|
"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23"
|
||||||
@ -5543,12 +5542,13 @@ dependencies = [
|
|||||||
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
|
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
|
||||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||||
"checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c"
|
"checksum parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5168b4cf41f3835e4bc6ffb32f51bc9365dc50cb351904595b3931d917fd0c"
|
||||||
"checksum parity-crypto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ded773d0b20caeb099708dcfddf85d75d34ecdba80fcdb573a69af334535d51d"
|
"checksum parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "27a9c2b525c93d717a234eb220c26474f8d97b08ac50d79faeac4cb6c74bf0b9"
|
||||||
"checksum parity-daemonize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69b1910b2793ff52713fca0a4ee92544ebec59ccd218ea74560be6f947b4ca77"
|
"checksum parity-daemonize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69b1910b2793ff52713fca0a4ee92544ebec59ccd218ea74560be6f947b4ca77"
|
||||||
"checksum parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5962540f99d3895d9addf535f37ab1397886bc2c68e59efd040ef458e5f8c3f7"
|
"checksum parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5962540f99d3895d9addf535f37ab1397886bc2c68e59efd040ef458e5f8c3f7"
|
||||||
"checksum parity-rocksdb 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d17caf6640e24b70242f3f48615e3f0764f98871e8c7aea25584e29833eb5a8"
|
"checksum parity-rocksdb 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d17caf6640e24b70242f3f48615e3f0764f98871e8c7aea25584e29833eb5a8"
|
||||||
"checksum parity-rocksdb-sys 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9581e6b8c63f3808500638372ee56faaaffb57c4d349974bff591606b94d5f57"
|
"checksum parity-rocksdb-sys 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9581e6b8c63f3808500638372ee56faaaffb57c4d349974bff591606b94d5f57"
|
||||||
"checksum parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65582b5c02128a4b0fa60fb3e070216e9c84be3e4a8f1b74bc37e15a25e58daf"
|
"checksum parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65582b5c02128a4b0fa60fb3e070216e9c84be3e4a8f1b74bc37e15a25e58daf"
|
||||||
|
"checksum parity-secp256k1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4fca4f82fccae37e8bbdaeb949a4a218a1bbc485d11598f193d2a908042e5fc1"
|
||||||
"checksum parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c5f9d149b13134b8b354d93a92830efcbee6fe5b73a2e6e540fe70d4dd8a63"
|
"checksum parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c5f9d149b13134b8b354d93a92830efcbee6fe5b73a2e6e540fe70d4dd8a63"
|
||||||
"checksum parity-snappy-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1a413d51e5e1927320c9de992998e4a279dffb8c8a7363570198bd8383e66f1b"
|
"checksum parity-snappy-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1a413d51e5e1927320c9de992998e4a279dffb8c8a7363570198bd8383e66f1b"
|
||||||
"checksum parity-tokio-ipc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8281bf4f1d6429573f89589bf68d89451c46750977a8264f8ea3edbabeba7947"
|
"checksum parity-tokio-ipc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8281bf4f1d6429573f89589bf68d89451c46750977a8264f8ea3edbabeba7947"
|
||||||
@ -5741,5 +5741,5 @@ dependencies = [
|
|||||||
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"
|
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"
|
||||||
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
||||||
"checksum xmltree 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eaee9d17062850f1e6163b509947969242990ee59a35801af437abe041e70"
|
"checksum xmltree 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eaee9d17062850f1e6163b509947969242990ee59a35801af437abe041e70"
|
||||||
"checksum zeroize 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2ea4afc22e9497e26b42bf047083c30f7e3ca566f3bcd7187f83d18b327043"
|
"checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86"
|
||||||
"checksum zeroize_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afd1469e4bbca3b96606d26ba6e9bd6d3aed3b1299c82b92ec94377d22d78dbc"
|
"checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e"
|
||||||
|
@ -48,6 +48,7 @@ num_cpus = "1.2"
|
|||||||
number_prefix = "0.2"
|
number_prefix = "0.2"
|
||||||
panic_hook = { path = "util/panic-hook" }
|
panic_hook = { path = "util/panic-hook" }
|
||||||
parity-bytes = "0.1"
|
parity-bytes = "0.1"
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
parity-daemonize = "0.3"
|
parity-daemonize = "0.3"
|
||||||
parity-hash-fetch = { path = "updater/hash-fetch" }
|
parity-hash-fetch = { path = "updater/hash-fetch" }
|
||||||
parity-ipfs-api = { path = "ipfs" }
|
parity-ipfs-api = { path = "ipfs" }
|
||||||
|
@ -11,6 +11,7 @@ edition = "2018"
|
|||||||
ethkey = { path = "ethkey" }
|
ethkey = { path = "ethkey" }
|
||||||
ethstore = { path = "ethstore" }
|
ethstore = { path = "ethstore" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
@ -1,21 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
description = "Parity Ethereum Keys Generator"
|
description = "Parity Ethereum Keys Generator"
|
||||||
name = "ethkey"
|
name = "ethkey"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
edit-distance = "2.0"
|
edit-distance = "2.0"
|
||||||
parity-crypto = "0.4.0"
|
|
||||||
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" }
|
|
||||||
ethereum-types = "0.8.0"
|
|
||||||
lazy_static = "1.0"
|
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
parity-wordlist = "1.3"
|
|
||||||
quick-error = "1.2.2"
|
|
||||||
rand = "0.7"
|
|
||||||
rustc-hex = "1.0"
|
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
tiny-keccak = "1.4"
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
zeroize = "0.9.1"
|
parity-wordlist = "1.3"
|
||||||
|
@ -9,6 +9,7 @@ docopt = "1.0"
|
|||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
ethkey = { path = "../" }
|
ethkey = { path = "../" }
|
||||||
panic_hook = { path = "../../../util/panic-hook" }
|
panic_hook = { path = "../../../util/panic-hook" }
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
parity-wordlist="1.2"
|
parity-wordlist="1.2"
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
@ -19,6 +19,7 @@ extern crate env_logger;
|
|||||||
extern crate ethkey;
|
extern crate ethkey;
|
||||||
extern crate panic_hook;
|
extern crate panic_hook;
|
||||||
extern crate parity_wordlist;
|
extern crate parity_wordlist;
|
||||||
|
extern crate parity_crypto;
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
extern crate threadpool;
|
extern crate threadpool;
|
||||||
@ -30,7 +31,8 @@ use std::num::ParseIntError;
|
|||||||
use std::{env, fmt, process, io, sync};
|
use std::{env, fmt, process, io, sync};
|
||||||
|
|
||||||
use docopt::Docopt;
|
use docopt::Docopt;
|
||||||
use ethkey::{KeyPair, Random, Brain, BrainPrefix, Prefix, Error as EthkeyError, Generator, sign, verify_public, verify_address, brain_recover};
|
use ethkey::{Brain, BrainPrefix, Prefix, brain_recover};
|
||||||
|
use parity_crypto::publickey::{KeyPair, Random, Error as EthkeyError, Generator, sign, verify_public, verify_address};
|
||||||
use rustc_hex::{FromHex, FromHexError};
|
use rustc_hex::{FromHex, FromHexError};
|
||||||
|
|
||||||
const USAGE: &'static str = r#"
|
const USAGE: &'static str = r#"
|
||||||
@ -200,7 +202,7 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
|
|||||||
let keypair = Brain::new(phrase).generate().expect("Brain wallet generator is infallible; qed");
|
let keypair = Brain::new(phrase).generate().expect("Brain wallet generator is infallible; qed");
|
||||||
(keypair, Some(phrase_info))
|
(keypair, Some(phrase_info))
|
||||||
} else {
|
} else {
|
||||||
let secret = args.arg_secret_or_phrase.parse().map_err(|_| EthkeyError::InvalidSecret)?;
|
let secret = args.arg_secret_or_phrase.parse().map_err(|_| EthkeyError::InvalidSecretKey)?;
|
||||||
(KeyPair::from_secret(secret)?, None)
|
(KeyPair::from_secret(secret)?, None)
|
||||||
};
|
};
|
||||||
Ok(display(result, display_mode))
|
Ok(display(result, display_mode))
|
||||||
@ -241,7 +243,7 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
|
|||||||
};
|
};
|
||||||
Ok(display(result, display_mode))
|
Ok(display(result, display_mode))
|
||||||
} else if args.cmd_sign {
|
} else if args.cmd_sign {
|
||||||
let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecret)?;
|
let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecretKey)?;
|
||||||
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
|
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
|
||||||
let signature = sign(&secret, &message)?;
|
let signature = sign(&secret, &message)?;
|
||||||
Ok(format!("{}", signature))
|
Ok(format!("{}", signature))
|
||||||
@ -249,7 +251,7 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
|
|||||||
let signature = args.arg_signature.parse().map_err(|_| EthkeyError::InvalidSignature)?;
|
let signature = args.arg_signature.parse().map_err(|_| EthkeyError::InvalidSignature)?;
|
||||||
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
|
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
|
||||||
let ok = if args.cmd_public {
|
let ok = if args.cmd_public {
|
||||||
let public = args.arg_public.parse().map_err(|_| EthkeyError::InvalidPublic)?;
|
let public = args.arg_public.parse().map_err(|_| EthkeyError::InvalidPublicKey)?;
|
||||||
verify_public(&public, &signature, &message)?
|
verify_public(&public, &signature, &message)?
|
||||||
} else if args.cmd_address {
|
} else if args.cmd_address {
|
||||||
let address = args.arg_address.parse().map_err(|_| EthkeyError::InvalidAddress)?;
|
let address = args.arg_address.parse().map_err(|_| EthkeyError::InvalidAddress)?;
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use keccak::Keccak256;
|
use std::convert::Infallible;
|
||||||
use super::{KeyPair, Generator, Secret};
|
use parity_crypto::publickey::{KeyPair, Generator, Secret};
|
||||||
|
use parity_crypto::Keccak256;
|
||||||
use parity_wordlist;
|
use parity_wordlist;
|
||||||
|
|
||||||
/// Simple brainwallet.
|
/// Simple brainwallet.
|
||||||
@ -32,7 +33,7 @@ impl Brain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Generator for Brain {
|
impl Generator for Brain {
|
||||||
type Error = ::Void;
|
type Error = Infallible;
|
||||||
|
|
||||||
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
||||||
let seed = self.0.clone();
|
let seed = self.0.clone();
|
||||||
@ -45,7 +46,7 @@ impl Generator for Brain {
|
|||||||
match i > 16384 {
|
match i > 16384 {
|
||||||
false => i += 1,
|
false => i += 1,
|
||||||
true => {
|
true => {
|
||||||
if let Ok(pair) = Secret::from_unsafe_slice(&secret)
|
if let Ok(pair) = Secret::import_key(&secret)
|
||||||
.and_then(KeyPair::from_secret)
|
.and_then(KeyPair::from_secret)
|
||||||
{
|
{
|
||||||
if pair.address()[0] == 0 {
|
if pair.address()[0] == 0 {
|
||||||
@ -61,7 +62,8 @@ impl Generator for Brain {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use {Brain, Generator};
|
use Brain;
|
||||||
|
use parity_crypto::publickey::Generator;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_brain() {
|
fn test_brain() {
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
// 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 Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use super::{Generator, KeyPair, Error, Brain};
|
use super::Brain;
|
||||||
|
use parity_crypto::publickey::{Generator, KeyPair, Error};
|
||||||
use parity_wordlist as wordlist;
|
use parity_wordlist as wordlist;
|
||||||
|
|
||||||
/// Tries to find brain-seed keypair with address starting with given prefix.
|
/// Tries to find brain-seed keypair with address starting with given prefix.
|
||||||
@ -59,7 +60,8 @@ impl Generator for BrainPrefix {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use {Generator, BrainPrefix};
|
use BrainPrefix;
|
||||||
|
use parity_crypto::publickey::Generator;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn prefix_generator() {
|
fn prefix_generator() {
|
||||||
|
@ -19,7 +19,8 @@ use std::collections::HashSet;
|
|||||||
use edit_distance::edit_distance;
|
use edit_distance::edit_distance;
|
||||||
use parity_wordlist;
|
use parity_wordlist;
|
||||||
|
|
||||||
use super::{Address, Brain, Generator};
|
use super::Brain;
|
||||||
|
use parity_crypto::publickey::{Address, Generator};
|
||||||
|
|
||||||
/// Tries to find a phrase for address, given the number
|
/// Tries to find a phrase for address, given the number
|
||||||
/// of expected words and a partial phrase.
|
/// of expected words and a partial phrase.
|
||||||
|
@ -1,189 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use secp256k1;
|
|
||||||
use std::io;
|
|
||||||
use parity_crypto::error::SymmError;
|
|
||||||
|
|
||||||
quick_error! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Error {
|
|
||||||
Secp(e: secp256k1::Error) {
|
|
||||||
display("secp256k1 error: {}", e)
|
|
||||||
cause(e)
|
|
||||||
from()
|
|
||||||
}
|
|
||||||
Io(e: io::Error) {
|
|
||||||
display("i/o error: {}", e)
|
|
||||||
cause(e)
|
|
||||||
from()
|
|
||||||
}
|
|
||||||
InvalidMessage {
|
|
||||||
display("invalid message")
|
|
||||||
}
|
|
||||||
Symm(e: SymmError) {
|
|
||||||
cause(e)
|
|
||||||
from()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ECDH functions
|
|
||||||
pub mod ecdh {
|
|
||||||
use secp256k1::{self, ecdh, key};
|
|
||||||
use super::Error;
|
|
||||||
use {Secret, Public, SECP256K1};
|
|
||||||
|
|
||||||
/// Agree on a shared secret
|
|
||||||
pub fn agree(secret: &Secret, public: &Public) -> Result<Secret, Error> {
|
|
||||||
let context = &SECP256K1;
|
|
||||||
let pdata = {
|
|
||||||
let mut temp = [4u8; 65];
|
|
||||||
(&mut temp[1..65]).copy_from_slice(&public[0..64]);
|
|
||||||
temp
|
|
||||||
};
|
|
||||||
|
|
||||||
let publ = key::PublicKey::from_slice(context, &pdata)?;
|
|
||||||
let sec = key::SecretKey::from_slice(context, secret.as_bytes())?;
|
|
||||||
let shared = ecdh::SharedSecret::new_raw(context, &publ, &sec);
|
|
||||||
|
|
||||||
Secret::from_unsafe_slice(&shared[0..32])
|
|
||||||
.map_err(|_| Error::Secp(secp256k1::Error::InvalidSecretKey))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ECIES function
|
|
||||||
pub mod ecies {
|
|
||||||
use parity_crypto::{aes, digest, hmac, is_equal};
|
|
||||||
use ethereum_types::H128;
|
|
||||||
use super::{ecdh, Error};
|
|
||||||
use {Random, Generator, Public, Secret};
|
|
||||||
|
|
||||||
/// Encrypt a message with a public key, writing an HMAC covering both
|
|
||||||
/// the plaintext and authenticated data.
|
|
||||||
///
|
|
||||||
/// Authenticated data may be empty.
|
|
||||||
pub fn encrypt(public: &Public, auth_data: &[u8], plain: &[u8]) -> Result<Vec<u8>, Error> {
|
|
||||||
let r = Random.generate()?;
|
|
||||||
let z = ecdh::agree(r.secret(), public)?;
|
|
||||||
let mut key = [0u8; 32];
|
|
||||||
kdf(&z, &[0u8; 0], &mut key);
|
|
||||||
|
|
||||||
let ekey = &key[0..16];
|
|
||||||
let mkey = hmac::SigKey::sha256(&digest::sha256(&key[16..32]));
|
|
||||||
|
|
||||||
let mut msg = vec![0u8; 1 + 64 + 16 + plain.len() + 32];
|
|
||||||
msg[0] = 0x04u8;
|
|
||||||
{
|
|
||||||
let msgd = &mut msg[1..];
|
|
||||||
msgd[0..64].copy_from_slice(r.public().as_bytes());
|
|
||||||
let iv = H128::random();
|
|
||||||
msgd[64..80].copy_from_slice(iv.as_bytes());
|
|
||||||
{
|
|
||||||
let cipher = &mut msgd[(64 + 16)..(64 + 16 + plain.len())];
|
|
||||||
aes::encrypt_128_ctr(ekey, iv.as_bytes(), plain, cipher)?;
|
|
||||||
}
|
|
||||||
let mut hmac = hmac::Signer::with(&mkey);
|
|
||||||
{
|
|
||||||
let cipher_iv = &msgd[64..(64 + 16 + plain.len())];
|
|
||||||
hmac.update(cipher_iv);
|
|
||||||
}
|
|
||||||
hmac.update(auth_data);
|
|
||||||
let sig = hmac.sign();
|
|
||||||
msgd[(64 + 16 + plain.len())..].copy_from_slice(&sig);
|
|
||||||
}
|
|
||||||
Ok(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Decrypt a message with a secret key, checking HMAC for ciphertext
|
|
||||||
/// and authenticated data validity.
|
|
||||||
pub fn decrypt(secret: &Secret, auth_data: &[u8], encrypted: &[u8]) -> Result<Vec<u8>, Error> {
|
|
||||||
let meta_len = 1 + 64 + 16 + 32;
|
|
||||||
if encrypted.len() < meta_len || encrypted[0] < 2 || encrypted[0] > 4 {
|
|
||||||
return Err(Error::InvalidMessage); //invalid message: publickey
|
|
||||||
}
|
|
||||||
|
|
||||||
let e = &encrypted[1..];
|
|
||||||
let p = Public::from_slice(&e[0..64]);
|
|
||||||
let z = ecdh::agree(secret, &p)?;
|
|
||||||
let mut key = [0u8; 32];
|
|
||||||
kdf(&z, &[0u8; 0], &mut key);
|
|
||||||
|
|
||||||
let ekey = &key[0..16];
|
|
||||||
let mkey = hmac::SigKey::sha256(&digest::sha256(&key[16..32]));
|
|
||||||
|
|
||||||
let clen = encrypted.len() - meta_len;
|
|
||||||
let cipher_with_iv = &e[64..(64+16+clen)];
|
|
||||||
let cipher_iv = &cipher_with_iv[0..16];
|
|
||||||
let cipher_no_iv = &cipher_with_iv[16..];
|
|
||||||
let msg_mac = &e[(64+16+clen)..];
|
|
||||||
|
|
||||||
// Verify tag
|
|
||||||
let mut hmac = hmac::Signer::with(&mkey);
|
|
||||||
hmac.update(cipher_with_iv);
|
|
||||||
hmac.update(auth_data);
|
|
||||||
let mac = hmac.sign();
|
|
||||||
|
|
||||||
if !is_equal(&mac.as_ref()[..], msg_mac) {
|
|
||||||
return Err(Error::InvalidMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut msg = vec![0u8; clen];
|
|
||||||
aes::decrypt_128_ctr(ekey, cipher_iv, cipher_no_iv, &mut msg[..])?;
|
|
||||||
Ok(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn kdf(secret: &Secret, s1: &[u8], dest: &mut [u8]) {
|
|
||||||
// SEC/ISO/Shoup specify counter size SHOULD be equivalent
|
|
||||||
// to size of hash output, however, it also notes that
|
|
||||||
// the 4 bytes is okay. NIST specifies 4 bytes.
|
|
||||||
let mut ctr = 1u32;
|
|
||||||
let mut written = 0usize;
|
|
||||||
while written < dest.len() {
|
|
||||||
let mut hasher = digest::Hasher::sha256();
|
|
||||||
let ctrs = [(ctr >> 24) as u8, (ctr >> 16) as u8, (ctr >> 8) as u8, ctr as u8];
|
|
||||||
hasher.update(&ctrs);
|
|
||||||
hasher.update(secret.as_bytes());
|
|
||||||
hasher.update(s1);
|
|
||||||
let d = hasher.finish();
|
|
||||||
&mut dest[written..(written + 32)].copy_from_slice(&d);
|
|
||||||
written += 32;
|
|
||||||
ctr += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::ecies;
|
|
||||||
use {Random, Generator};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn ecies_shared() {
|
|
||||||
let kp = Random.generate().unwrap();
|
|
||||||
let message = b"So many books, so little time";
|
|
||||||
|
|
||||||
let shared = b"shared";
|
|
||||||
let wrong_shared = b"incorrect";
|
|
||||||
let encrypted = ecies::encrypt(kp.public(), shared, message).unwrap();
|
|
||||||
assert!(encrypted[..] != message[..]);
|
|
||||||
assert_eq!(encrypted[0], 0x04);
|
|
||||||
|
|
||||||
assert!(ecies::decrypt(kp.secret(), wrong_shared, &encrypted).is_err());
|
|
||||||
let decrypted = ecies::decrypt(kp.secret(), shared, &encrypted).unwrap();
|
|
||||||
assert_eq!(decrypted[..message.len()], message[..]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use std::{fmt, error};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
/// Crypto error
|
|
||||||
pub enum Error {
|
|
||||||
/// Invalid secret key
|
|
||||||
InvalidSecret,
|
|
||||||
/// Invalid public key
|
|
||||||
InvalidPublic,
|
|
||||||
/// Invalid address
|
|
||||||
InvalidAddress,
|
|
||||||
/// Invalid EC signature
|
|
||||||
InvalidSignature,
|
|
||||||
/// Invalid AES message
|
|
||||||
InvalidMessage,
|
|
||||||
/// IO Error
|
|
||||||
Io(::std::io::Error),
|
|
||||||
/// Custom
|
|
||||||
Custom(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
let msg = match *self {
|
|
||||||
Error::InvalidSecret => "Invalid secret".into(),
|
|
||||||
Error::InvalidPublic => "Invalid public".into(),
|
|
||||||
Error::InvalidAddress => "Invalid address".into(),
|
|
||||||
Error::InvalidSignature => "Invalid EC signature".into(),
|
|
||||||
Error::InvalidMessage => "Invalid AES message".into(),
|
|
||||||
Error::Io(ref err) => format!("I/O error: {}", err),
|
|
||||||
Error::Custom(ref s) => s.clone(),
|
|
||||||
};
|
|
||||||
|
|
||||||
f.write_fmt(format_args!("Crypto error ({})", msg))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl error::Error for Error {
|
|
||||||
fn description(&self) -> &str {
|
|
||||||
"Crypto error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Into<String> for Error {
|
|
||||||
fn into(self) -> String {
|
|
||||||
format!("{}", self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<::secp256k1::Error> for Error {
|
|
||||||
fn from(e: ::secp256k1::Error) -> Error {
|
|
||||||
match e {
|
|
||||||
::secp256k1::Error::InvalidMessage => Error::InvalidMessage,
|
|
||||||
::secp256k1::Error::InvalidPublicKey => Error::InvalidPublic,
|
|
||||||
::secp256k1::Error::InvalidSecretKey => Error::InvalidSecret,
|
|
||||||
_ => Error::InvalidSignature,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<::std::io::Error> for Error {
|
|
||||||
fn from(err: ::std::io::Error) -> Error {
|
|
||||||
Error::Io(err)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,517 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! Extended keys
|
|
||||||
|
|
||||||
use secret::Secret;
|
|
||||||
use Public;
|
|
||||||
use ethereum_types::H256;
|
|
||||||
pub use self::derivation::Error as DerivationError;
|
|
||||||
|
|
||||||
/// Represents label that can be stored as a part of key derivation
|
|
||||||
pub trait Label {
|
|
||||||
/// Length of the data that label occupies
|
|
||||||
fn len() -> usize;
|
|
||||||
|
|
||||||
/// Store label data to the key derivation sequence
|
|
||||||
/// Must not use more than `len()` bytes from slice
|
|
||||||
fn store(&self, target: &mut [u8]);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Label for u32 {
|
|
||||||
fn len() -> usize { 4 }
|
|
||||||
|
|
||||||
fn store(&self, target: &mut [u8]) {
|
|
||||||
let bytes = self.to_be_bytes();
|
|
||||||
target[0..4].copy_from_slice(&bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Key derivation over generic label `T`
|
|
||||||
pub enum Derivation<T: Label> {
|
|
||||||
/// Soft key derivation (allow proof of parent)
|
|
||||||
Soft(T),
|
|
||||||
/// Hard key derivation (does not allow proof of parent)
|
|
||||||
Hard(T),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<u32> for Derivation<u32> {
|
|
||||||
fn from(index: u32) -> Self {
|
|
||||||
if index < (2 << 30) {
|
|
||||||
Derivation::Soft(index)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Derivation::Hard(index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Label for H256 {
|
|
||||||
fn len() -> usize { 32 }
|
|
||||||
|
|
||||||
fn store(&self, target: &mut [u8]) {
|
|
||||||
(&mut target[0..32]).copy_from_slice(self.as_bytes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Extended secret key, allows deterministic derivation of subsequent keys.
|
|
||||||
pub struct ExtendedSecret {
|
|
||||||
secret: Secret,
|
|
||||||
chain_code: H256,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ExtendedSecret {
|
|
||||||
/// New extended key from given secret and chain code.
|
|
||||||
pub fn with_code(secret: Secret, chain_code: H256) -> ExtendedSecret {
|
|
||||||
ExtendedSecret {
|
|
||||||
secret: secret,
|
|
||||||
chain_code: chain_code,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// New extended key from given secret with the random chain code.
|
|
||||||
pub fn new_random(secret: Secret) -> ExtendedSecret {
|
|
||||||
ExtendedSecret::with_code(secret, H256::random())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// New extended key from given secret.
|
|
||||||
/// Chain code will be derived from the secret itself (in a deterministic way).
|
|
||||||
pub fn new(secret: Secret) -> ExtendedSecret {
|
|
||||||
let chain_code = derivation::chain_code(*secret);
|
|
||||||
ExtendedSecret::with_code(secret, chain_code)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Derive new private key
|
|
||||||
pub fn derive<T>(&self, index: Derivation<T>) -> ExtendedSecret where T: Label {
|
|
||||||
let (derived_key, next_chain_code) = derivation::private(*self.secret, self.chain_code, index);
|
|
||||||
|
|
||||||
let derived_secret = Secret::from(derived_key.0);
|
|
||||||
|
|
||||||
ExtendedSecret::with_code(derived_secret, next_chain_code)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Private key component of the extended key.
|
|
||||||
pub fn as_raw(&self) -> &Secret {
|
|
||||||
&self.secret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Extended public key, allows deterministic derivation of subsequent keys.
|
|
||||||
pub struct ExtendedPublic {
|
|
||||||
public: Public,
|
|
||||||
chain_code: H256,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ExtendedPublic {
|
|
||||||
/// New extended public key from known parent and chain code
|
|
||||||
pub fn new(public: Public, chain_code: H256) -> Self {
|
|
||||||
ExtendedPublic { public: public, chain_code: chain_code }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create new extended public key from known secret
|
|
||||||
pub fn from_secret(secret: &ExtendedSecret) -> Result<Self, DerivationError> {
|
|
||||||
Ok(
|
|
||||||
ExtendedPublic::new(
|
|
||||||
derivation::point(**secret.as_raw())?,
|
|
||||||
secret.chain_code.clone(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Derive new public key
|
|
||||||
/// Operation is defined only for index belongs [0..2^31)
|
|
||||||
pub fn derive<T>(&self, index: Derivation<T>) -> Result<Self, DerivationError> where T: Label {
|
|
||||||
let (derived_key, next_chain_code) = derivation::public(self.public, self.chain_code, index)?;
|
|
||||||
Ok(ExtendedPublic::new(derived_key, next_chain_code))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn public(&self) -> &Public {
|
|
||||||
&self.public
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ExtendedKeyPair {
|
|
||||||
secret: ExtendedSecret,
|
|
||||||
public: ExtendedPublic,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ExtendedKeyPair {
|
|
||||||
pub fn new(secret: Secret) -> Self {
|
|
||||||
let extended_secret = ExtendedSecret::new(secret);
|
|
||||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
|
||||||
.expect("Valid `Secret` always produces valid public; qed");
|
|
||||||
ExtendedKeyPair {
|
|
||||||
secret: extended_secret,
|
|
||||||
public: extended_public,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_code(secret: Secret, public: Public, chain_code: H256) -> Self {
|
|
||||||
ExtendedKeyPair {
|
|
||||||
secret: ExtendedSecret::with_code(secret, chain_code.clone()),
|
|
||||||
public: ExtendedPublic::new(public, chain_code),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_secret(secret: Secret, chain_code: H256) -> Self {
|
|
||||||
let extended_secret = ExtendedSecret::with_code(secret, chain_code);
|
|
||||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
|
||||||
.expect("Valid `Secret` always produces valid public; qed");
|
|
||||||
ExtendedKeyPair {
|
|
||||||
secret: extended_secret,
|
|
||||||
public: extended_public,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_seed(seed: &[u8]) -> Result<ExtendedKeyPair, DerivationError> {
|
|
||||||
let (master_key, chain_code) = derivation::seed_pair(seed);
|
|
||||||
Ok(ExtendedKeyPair::with_secret(
|
|
||||||
Secret::from_unsafe_slice(master_key.as_bytes()).map_err(|_| DerivationError::InvalidSeed)?,
|
|
||||||
chain_code,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn secret(&self) -> &ExtendedSecret {
|
|
||||||
&self.secret
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn public(&self) -> &ExtendedPublic {
|
|
||||||
&self.public
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn derive<T>(&self, index: Derivation<T>) -> Result<Self, DerivationError> where T: Label {
|
|
||||||
let derived = self.secret.derive(index);
|
|
||||||
|
|
||||||
Ok(ExtendedKeyPair {
|
|
||||||
public: ExtendedPublic::from_secret(&derived)?,
|
|
||||||
secret: derived,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Derivation functions for private and public keys
|
|
||||||
// Work is based on BIP0032
|
|
||||||
// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
|
||||||
mod derivation {
|
|
||||||
use parity_crypto::hmac;
|
|
||||||
use ethereum_types::{BigEndianHash, U256, U512, H512, H256};
|
|
||||||
use secp256k1::key::{SecretKey, PublicKey};
|
|
||||||
use SECP256K1;
|
|
||||||
use keccak;
|
|
||||||
use math::curve_order;
|
|
||||||
use super::{Label, Derivation};
|
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Error {
|
|
||||||
InvalidHardenedUse,
|
|
||||||
InvalidPoint,
|
|
||||||
MissingIndex,
|
|
||||||
InvalidSeed,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deterministic derivation of the key using secp256k1 elliptic curve.
|
|
||||||
// Derivation can be either hardened or not.
|
|
||||||
// For hardened derivation, pass u32 index at least 2^31 or custom Derivation::Hard(T) enum
|
|
||||||
//
|
|
||||||
// Can panic if passed `private_key` is not a valid secp256k1 private key
|
|
||||||
// (outside of (0..curve_order()]) field
|
|
||||||
pub fn private<T>(private_key: H256, chain_code: H256, index: Derivation<T>) -> (H256, H256) where T: Label {
|
|
||||||
match index {
|
|
||||||
Derivation::Soft(index) => private_soft(private_key, chain_code, index),
|
|
||||||
Derivation::Hard(index) => private_hard(private_key, chain_code, index),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn hmac_pair(data: &[u8], private_key: H256, chain_code: H256) -> (H256, H256) {
|
|
||||||
let private: U256 = private_key.into_uint();
|
|
||||||
|
|
||||||
// produces 512-bit derived hmac (I)
|
|
||||||
let skey = hmac::SigKey::sha512(chain_code.as_bytes());
|
|
||||||
let i_512 = hmac::sign(&skey, &data[..]);
|
|
||||||
|
|
||||||
// left most 256 bits are later added to original private key
|
|
||||||
let hmac_key: U256 = H256::from_slice(&i_512[0..32]).into_uint();
|
|
||||||
// right most 256 bits are new chain code for later derivations
|
|
||||||
let next_chain_code = H256::from_slice(&i_512[32..64]);
|
|
||||||
|
|
||||||
let child_key = BigEndianHash::from_uint(&private_add(hmac_key, private));
|
|
||||||
(child_key, next_chain_code)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can panic if passed `private_key` is not a valid secp256k1 private key
|
|
||||||
// (outside of (0..curve_order()]) field
|
|
||||||
fn private_soft<T>(private_key: H256, chain_code: H256, index: T) -> (H256, H256) where T: Label {
|
|
||||||
let mut data = vec![0u8; 33 + T::len()];
|
|
||||||
|
|
||||||
let sec_private = SecretKey::from_slice(&SECP256K1, private_key.as_bytes())
|
|
||||||
.expect("Caller should provide valid private key");
|
|
||||||
let sec_public = PublicKey::from_secret_key(&SECP256K1, &sec_private)
|
|
||||||
.expect("Caller should provide valid private key");
|
|
||||||
let public_serialized = sec_public.serialize_vec(&SECP256K1, true);
|
|
||||||
|
|
||||||
// curve point (compressed public key) -- index
|
|
||||||
// 0.33 -- 33..end
|
|
||||||
data[0..33].copy_from_slice(&public_serialized);
|
|
||||||
index.store(&mut data[33..]);
|
|
||||||
|
|
||||||
hmac_pair(&data, private_key, chain_code)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deterministic derivation of the key using secp256k1 elliptic curve
|
|
||||||
// This is hardened derivation and does not allow to associate
|
|
||||||
// corresponding public keys of the original and derived private keys
|
|
||||||
fn private_hard<T>(private_key: H256, chain_code: H256, index: T) -> (H256, H256) where T: Label {
|
|
||||||
let mut data: Vec<u8> = vec![0u8; 33 + T::len()];
|
|
||||||
let private: U256 = private_key.into_uint();
|
|
||||||
|
|
||||||
// 0x00 (padding) -- private_key -- index
|
|
||||||
// 0 -- 1..33 -- 33..end
|
|
||||||
private.to_big_endian(&mut data[1..33]);
|
|
||||||
index.store(&mut data[33..(33 + T::len())]);
|
|
||||||
|
|
||||||
hmac_pair(&data, private_key, chain_code)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn private_add(k1: U256, k2: U256) -> U256 {
|
|
||||||
let sum = U512::from(k1) + U512::from(k2);
|
|
||||||
modulo(sum, curve_order())
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: surely can be optimized
|
|
||||||
fn modulo(u1: U512, u2: U256) -> U256 {
|
|
||||||
let m = u1 % U512::from(u2);
|
|
||||||
m.try_into().expect("U512 modulo U256 should fit into U256; qed")
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn public<T>(public_key: H512, chain_code: H256, derivation: Derivation<T>) -> Result<(H512, H256), Error> where T: Label {
|
|
||||||
let index = match derivation {
|
|
||||||
Derivation::Soft(index) => index,
|
|
||||||
Derivation::Hard(_) => { return Err(Error::InvalidHardenedUse); }
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut public_sec_raw = [0u8; 65];
|
|
||||||
public_sec_raw[0] = 4;
|
|
||||||
public_sec_raw[1..65].copy_from_slice(public_key.as_bytes());
|
|
||||||
let public_sec = PublicKey::from_slice(&SECP256K1, &public_sec_raw).map_err(|_| Error::InvalidPoint)?;
|
|
||||||
let public_serialized = public_sec.serialize_vec(&SECP256K1, true);
|
|
||||||
|
|
||||||
let mut data = vec![0u8; 33 + T::len()];
|
|
||||||
// curve point (compressed public key) -- index
|
|
||||||
// 0.33 -- 33..end
|
|
||||||
data[0..33].copy_from_slice(&public_serialized);
|
|
||||||
index.store(&mut data[33..(33 + T::len())]);
|
|
||||||
|
|
||||||
// HMAC512SHA produces [derived private(256); new chain code(256)]
|
|
||||||
let skey = hmac::SigKey::sha512(chain_code.as_bytes());
|
|
||||||
let i_512 = hmac::sign(&skey, &data[..]);
|
|
||||||
|
|
||||||
let new_private = H256::from_slice(&i_512[0..32]);
|
|
||||||
let new_chain_code = H256::from_slice(&i_512[32..64]);
|
|
||||||
|
|
||||||
// Generated private key can (extremely rarely) be out of secp256k1 key field
|
|
||||||
if curve_order() <= new_private.into_uint() { return Err(Error::MissingIndex); }
|
|
||||||
let new_private_sec = SecretKey::from_slice(&SECP256K1, new_private.as_bytes())
|
|
||||||
.expect("Private key belongs to the field [0..CURVE_ORDER) (checked above); So initializing can never fail; qed");
|
|
||||||
let mut new_public = PublicKey::from_secret_key(&SECP256K1, &new_private_sec)
|
|
||||||
.expect("Valid private key produces valid public key");
|
|
||||||
|
|
||||||
// Adding two points on the elliptic curves (combining two public keys)
|
|
||||||
new_public.add_assign(&SECP256K1, &public_sec)
|
|
||||||
.expect("Addition of two valid points produce valid point");
|
|
||||||
|
|
||||||
let serialized = new_public.serialize_vec(&SECP256K1, false);
|
|
||||||
|
|
||||||
Ok((
|
|
||||||
H512::from_slice(&serialized[1..65]),
|
|
||||||
new_chain_code,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sha3(slc: &[u8]) -> H256 {
|
|
||||||
keccak::Keccak256::keccak256(slc).into()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn chain_code(secret: H256) -> H256 {
|
|
||||||
// 10,000 rounds of sha3
|
|
||||||
let mut running_sha3 = sha3(secret.as_bytes());
|
|
||||||
for _ in 0..99999 { running_sha3 = sha3(running_sha3.as_bytes()); }
|
|
||||||
running_sha3
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn point(secret: H256) -> Result<H512, Error> {
|
|
||||||
let sec = SecretKey::from_slice(&SECP256K1, secret.as_bytes())
|
|
||||||
.map_err(|_| Error::InvalidPoint)?;
|
|
||||||
let public_sec = PublicKey::from_secret_key(&SECP256K1, &sec)
|
|
||||||
.map_err(|_| Error::InvalidPoint)?;
|
|
||||||
let serialized = public_sec.serialize_vec(&SECP256K1, false);
|
|
||||||
Ok(H512::from_slice(&serialized[1..65]))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn seed_pair(seed: &[u8]) -> (H256, H256) {
|
|
||||||
let skey = hmac::SigKey::sha512(b"Bitcoin seed");
|
|
||||||
let i_512 = hmac::sign(&skey, seed);
|
|
||||||
|
|
||||||
let master_key = H256::from_slice(&i_512[0..32]);
|
|
||||||
let chain_code = H256::from_slice(&i_512[32..64]);
|
|
||||||
|
|
||||||
(master_key, chain_code)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::{ExtendedSecret, ExtendedPublic, ExtendedKeyPair};
|
|
||||||
use secret::Secret;
|
|
||||||
use std::str::FromStr;
|
|
||||||
use ethereum_types::{H128, H256, H512};
|
|
||||||
use super::{derivation, Derivation};
|
|
||||||
|
|
||||||
fn master_chain_basic() -> (H256, H256) {
|
|
||||||
let seed = H128::from_str("000102030405060708090a0b0c0d0e0f")
|
|
||||||
.expect("Seed should be valid H128")
|
|
||||||
.as_bytes()
|
|
||||||
.to_vec();
|
|
||||||
|
|
||||||
derivation::seed_pair(&*seed)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn test_extended<F>(f: F, test_private: H256) where F: Fn(ExtendedSecret) -> ExtendedSecret {
|
|
||||||
let (private_seed, chain_code) = master_chain_basic();
|
|
||||||
let extended_secret = ExtendedSecret::with_code(Secret::from(private_seed.0), chain_code);
|
|
||||||
let derived = f(extended_secret);
|
|
||||||
assert_eq!(**derived.as_raw(), test_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn smoky() {
|
|
||||||
let secret = Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap();
|
|
||||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), H256::zero());
|
|
||||||
|
|
||||||
// hardened
|
|
||||||
assert_eq!(&**extended_secret.as_raw(), &*secret);
|
|
||||||
assert_eq!(
|
|
||||||
**extended_secret.derive(2147483648.into()).as_raw(),
|
|
||||||
H256::from_str("0927453daed47839608e414a3738dfad10aed17c459bbd9ab53f89b026c834b6").unwrap(),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
**extended_secret.derive(2147483649.into()).as_raw(),
|
|
||||||
H256::from_str("44238b6a29c6dcbe9b401364141ba11e2198c289a5fed243a1c11af35c19dc0f").unwrap(),
|
|
||||||
);
|
|
||||||
|
|
||||||
// normal
|
|
||||||
assert_eq!(**extended_secret.derive(0.into()).as_raw(), H256::from_str("bf6a74e3f7b36fc4c96a1e12f31abc817f9f5904f5a8fc27713163d1f0b713f6").unwrap());
|
|
||||||
assert_eq!(**extended_secret.derive(1.into()).as_raw(), H256::from_str("bd4fca9eb1f9c201e9448c1eecd66e302d68d4d313ce895b8c134f512205c1bc").unwrap());
|
|
||||||
assert_eq!(**extended_secret.derive(2.into()).as_raw(), H256::from_str("86932b542d6cab4d9c65490c7ef502d89ecc0e2a5f4852157649e3251e2a3268").unwrap());
|
|
||||||
|
|
||||||
let extended_public = ExtendedPublic::from_secret(&extended_secret).expect("Extended public should be created");
|
|
||||||
let derived_public = extended_public.derive(0.into()).expect("First derivation of public should succeed");
|
|
||||||
assert_eq!(
|
|
||||||
*derived_public.public(),
|
|
||||||
H512::from_str("f7b3244c96688f92372bfd4def26dc4151529747bab9f188a4ad34e141d47bd66522ff048bc6f19a0a4429b04318b1a8796c000265b4fa200dae5f6dda92dd94").unwrap(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let keypair = ExtendedKeyPair::with_secret(
|
|
||||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap(),
|
|
||||||
H256::from_low_u64_be(64),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
**keypair.derive(2147483648u32.into()).expect("Derivation of keypair should succeed").secret().as_raw(),
|
|
||||||
H256::from_str("edef54414c03196557cf73774bc97a645c9a1df2164ed34f0c2a78d1375a930c").unwrap(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn h256_soft_match() {
|
|
||||||
let secret = Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap();
|
|
||||||
let derivation_secret = H256::from_str("51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015").unwrap();
|
|
||||||
|
|
||||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), H256::zero());
|
|
||||||
let extended_public = ExtendedPublic::from_secret(&extended_secret).expect("Extended public should be created");
|
|
||||||
|
|
||||||
let derived_secret0 = extended_secret.derive(Derivation::Soft(derivation_secret));
|
|
||||||
let derived_public0 = extended_public.derive(Derivation::Soft(derivation_secret)).expect("First derivation of public should succeed");
|
|
||||||
|
|
||||||
let public_from_secret0 = ExtendedPublic::from_secret(&derived_secret0).expect("Extended public should be created");
|
|
||||||
|
|
||||||
assert_eq!(public_from_secret0.public(), derived_public0.public());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn h256_hard() {
|
|
||||||
let secret = Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap();
|
|
||||||
let derivation_secret = H256::from_str("51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015").unwrap();
|
|
||||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), H256::from_low_u64_be(1));
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
**extended_secret.derive(Derivation::Hard(derivation_secret)).as_raw(),
|
|
||||||
H256::from_str("2bc2d696fb744d77ff813b4a1ef0ad64e1e5188b622c54ba917acc5ebc7c5486").unwrap(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn match_() {
|
|
||||||
let secret = Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap();
|
|
||||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), H256::from_low_u64_be(1));
|
|
||||||
let extended_public = ExtendedPublic::from_secret(&extended_secret).expect("Extended public should be created");
|
|
||||||
|
|
||||||
let derived_secret0 = extended_secret.derive(0.into());
|
|
||||||
let derived_public0 = extended_public.derive(0.into()).expect("First derivation of public should succeed");
|
|
||||||
|
|
||||||
let public_from_secret0 = ExtendedPublic::from_secret(&derived_secret0).expect("Extended public should be created");
|
|
||||||
|
|
||||||
assert_eq!(public_from_secret0.public(), derived_public0.public());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_seeds() {
|
|
||||||
let seed = H128::from_str("000102030405060708090a0b0c0d0e0f")
|
|
||||||
.expect("Seed should be valid H128")
|
|
||||||
.as_bytes()
|
|
||||||
.to_vec();
|
|
||||||
|
|
||||||
// private key from bitcoin test vector
|
|
||||||
// xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs
|
|
||||||
let test_private = H256::from_str("e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35")
|
|
||||||
.expect("Private should be decoded ok");
|
|
||||||
|
|
||||||
let (private_seed, _) = derivation::seed_pair(&*seed);
|
|
||||||
|
|
||||||
assert_eq!(private_seed, test_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_vector_1() {
|
|
||||||
// xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7
|
|
||||||
// H(0)
|
|
||||||
test_extended(
|
|
||||||
|secret| secret.derive(2147483648.into()),
|
|
||||||
H256::from_str("edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea")
|
|
||||||
.expect("Private should be decoded ok")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_vector_2() {
|
|
||||||
// xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs
|
|
||||||
// H(0)/1
|
|
||||||
test_extended(
|
|
||||||
|secret| secret.derive(2147483648.into()).derive(1.into()),
|
|
||||||
H256::from_str("3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368")
|
|
||||||
.expect("Private should be decoded ok")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use tiny_keccak::Keccak;
|
|
||||||
|
|
||||||
pub trait Keccak256<T> {
|
|
||||||
fn keccak256(&self) -> T where T: Sized;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Keccak256<[u8; 32]> for [u8] {
|
|
||||||
fn keccak256(&self) -> [u8; 32] {
|
|
||||||
let mut keccak = Keccak::new_keccak256();
|
|
||||||
let mut result = [0u8; 32];
|
|
||||||
keccak.update(self);
|
|
||||||
keccak.finalize(&mut result);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
use secp256k1::key;
|
|
||||||
use super::{Secret, Public, Address, SECP256K1, Error};
|
|
||||||
use parity_crypto::Keccak256 as _;
|
|
||||||
|
|
||||||
pub fn public_to_address(public: &Public) -> Address {
|
|
||||||
let hash = public.keccak256();
|
|
||||||
let mut result = Address::zero();
|
|
||||||
result.as_bytes_mut().copy_from_slice(&hash[12..]);
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
|
||||||
/// secp256k1 key pair
|
|
||||||
pub struct KeyPair {
|
|
||||||
secret: Secret,
|
|
||||||
public: Public,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for KeyPair {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
|
||||||
writeln!(f, "secret: {:x}", self.secret)?;
|
|
||||||
writeln!(f, "public: {:x}", self.public)?;
|
|
||||||
write!(f, "address: {:x}", self.address())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl KeyPair {
|
|
||||||
/// Create a pair from secret key
|
|
||||||
pub fn from_secret(secret: Secret) -> Result<KeyPair, Error> {
|
|
||||||
let context = &SECP256K1;
|
|
||||||
let s: key::SecretKey = key::SecretKey::from_slice(context, &secret[..])?;
|
|
||||||
let pub_key = key::PublicKey::from_secret_key(context, &s)?;
|
|
||||||
let serialized = pub_key.serialize_vec(context, false);
|
|
||||||
|
|
||||||
let mut public = Public::default();
|
|
||||||
public.as_bytes_mut().copy_from_slice(&serialized[1..65]);
|
|
||||||
|
|
||||||
let keypair = KeyPair {
|
|
||||||
secret: secret,
|
|
||||||
public: public,
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(keypair)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_secret_slice(slice: &[u8]) -> Result<KeyPair, Error> {
|
|
||||||
Self::from_secret(Secret::from_unsafe_slice(slice)?)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_keypair(sec: key::SecretKey, publ: key::PublicKey) -> Self {
|
|
||||||
let context = &SECP256K1;
|
|
||||||
let serialized = publ.serialize_vec(context, false);
|
|
||||||
let secret = Secret::from(sec);
|
|
||||||
let mut public = Public::default();
|
|
||||||
public.as_bytes_mut().copy_from_slice(&serialized[1..65]);
|
|
||||||
|
|
||||||
KeyPair {
|
|
||||||
secret: secret,
|
|
||||||
public: public,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn secret(&self) -> &Secret {
|
|
||||||
&self.secret
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn public(&self) -> &Public {
|
|
||||||
&self.public
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn address(&self) -> Address {
|
|
||||||
public_to_address(&self.public)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use std::str::FromStr;
|
|
||||||
use {KeyPair, Secret};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn from_secret() {
|
|
||||||
let secret = Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap();
|
|
||||||
let _ = KeyPair::from_secret(secret).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn keypair_display() {
|
|
||||||
let expected =
|
|
||||||
"secret: a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65
|
|
||||||
public: 8ce0db0b0359ffc5866ba61903cc2518c3675ef2cf380a7e54bde7ea20e6fa1ab45b7617346cd11b7610001ee6ae5b0155c41cad9527cbcdff44ec67848943a4
|
|
||||||
address: 5b073e9233944b5e729e46d618f0d8edf3d9c34a".to_owned();
|
|
||||||
let secret = Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65").unwrap();
|
|
||||||
let kp = KeyPair::from_secret(secret).unwrap();
|
|
||||||
assert_eq!(format!("{}", kp), expected);
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,19 +18,9 @@
|
|||||||
|
|
||||||
extern crate edit_distance;
|
extern crate edit_distance;
|
||||||
extern crate parity_crypto;
|
extern crate parity_crypto;
|
||||||
extern crate ethereum_types;
|
|
||||||
extern crate parity_wordlist;
|
extern crate parity_wordlist;
|
||||||
#[macro_use]
|
|
||||||
extern crate quick_error;
|
|
||||||
extern crate rand;
|
|
||||||
extern crate rustc_hex;
|
|
||||||
extern crate secp256k1;
|
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
extern crate tiny_keccak;
|
|
||||||
extern crate zeroize;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -38,50 +28,13 @@ extern crate serde_derive;
|
|||||||
|
|
||||||
mod brain;
|
mod brain;
|
||||||
mod brain_prefix;
|
mod brain_prefix;
|
||||||
mod error;
|
|
||||||
mod keypair;
|
|
||||||
mod keccak;
|
|
||||||
mod password;
|
mod password;
|
||||||
mod prefix;
|
mod prefix;
|
||||||
mod random;
|
|
||||||
mod signature;
|
|
||||||
mod secret;
|
|
||||||
mod extended;
|
|
||||||
|
|
||||||
pub mod brain_recover;
|
pub mod brain_recover;
|
||||||
pub mod crypto;
|
|
||||||
pub mod math;
|
|
||||||
|
|
||||||
pub use self::parity_wordlist::Error as WordlistError;
|
pub use self::parity_wordlist::Error as WordlistError;
|
||||||
pub use self::brain::Brain;
|
pub use self::brain::Brain;
|
||||||
pub use self::brain_prefix::BrainPrefix;
|
pub use self::brain_prefix::BrainPrefix;
|
||||||
pub use self::error::Error;
|
|
||||||
pub use self::keypair::{KeyPair, public_to_address};
|
|
||||||
pub use self::math::public_is_valid;
|
|
||||||
pub use self::password::Password;
|
pub use self::password::Password;
|
||||||
pub use self::prefix::Prefix;
|
pub use self::prefix::Prefix;
|
||||||
pub use self::random::Random;
|
|
||||||
pub use self::signature::{sign, verify_public, verify_address, recover, Signature};
|
|
||||||
pub use self::secret::Secret;
|
|
||||||
pub use self::extended::{ExtendedPublic, ExtendedSecret, ExtendedKeyPair, DerivationError, Derivation};
|
|
||||||
|
|
||||||
use ethereum_types::H256;
|
|
||||||
|
|
||||||
pub use ethereum_types::{Address, Public};
|
|
||||||
pub type Message = H256;
|
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
pub static ref SECP256K1: secp256k1::Secp256k1 = secp256k1::Secp256k1::new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Uninstantiatable error type for infallible generators.
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Void {}
|
|
||||||
|
|
||||||
/// Generates new keypair.
|
|
||||||
pub trait Generator {
|
|
||||||
type Error;
|
|
||||||
|
|
||||||
/// Should be called to generate new keypair.
|
|
||||||
fn generate(&mut self) -> Result<KeyPair, Self::Error>;
|
|
||||||
}
|
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use super::{SECP256K1, Public, Secret, Error};
|
|
||||||
use secp256k1::key;
|
|
||||||
use secp256k1::constants::{GENERATOR_X, GENERATOR_Y, CURVE_ORDER};
|
|
||||||
use ethereum_types::{BigEndianHash as _, U256, H256};
|
|
||||||
|
|
||||||
/// Whether the public key is valid.
|
|
||||||
pub fn public_is_valid(public: &Public) -> bool {
|
|
||||||
to_secp256k1_public(public).ok()
|
|
||||||
.map_or(false, |p| p.is_valid())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace multiply public key by secret key (EC point * scalar)
|
|
||||||
pub fn public_mul_secret(public: &mut Public, secret: &Secret) -> Result<(), Error> {
|
|
||||||
let key_secret = secret.to_secp256k1_secret()?;
|
|
||||||
let mut key_public = to_secp256k1_public(public)?;
|
|
||||||
key_public.mul_assign(&SECP256K1, &key_secret)?;
|
|
||||||
set_public(public, &key_public);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace add one public key to another (EC point + EC point)
|
|
||||||
pub fn public_add(public: &mut Public, other: &Public) -> Result<(), Error> {
|
|
||||||
let mut key_public = to_secp256k1_public(public)?;
|
|
||||||
let other_public = to_secp256k1_public(other)?;
|
|
||||||
key_public.add_assign(&SECP256K1, &other_public)?;
|
|
||||||
set_public(public, &key_public);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace sub one public key from another (EC point - EC point)
|
|
||||||
pub fn public_sub(public: &mut Public, other: &Public) -> Result<(), Error> {
|
|
||||||
let mut key_neg_other = to_secp256k1_public(other)?;
|
|
||||||
key_neg_other.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
|
||||||
|
|
||||||
let mut key_public = to_secp256k1_public(public)?;
|
|
||||||
key_public.add_assign(&SECP256K1, &key_neg_other)?;
|
|
||||||
set_public(public, &key_public);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Replace public key with its negation (EC point = - EC point)
|
|
||||||
pub fn public_negate(public: &mut Public) -> Result<(), Error> {
|
|
||||||
let mut key_public = to_secp256k1_public(public)?;
|
|
||||||
key_public.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
|
||||||
set_public(public, &key_public);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return base point of secp256k1
|
|
||||||
pub fn generation_point() -> Public {
|
|
||||||
let mut public_sec_raw = [0u8; 65];
|
|
||||||
public_sec_raw[0] = 4;
|
|
||||||
public_sec_raw[1..33].copy_from_slice(&GENERATOR_X);
|
|
||||||
public_sec_raw[33..65].copy_from_slice(&GENERATOR_Y);
|
|
||||||
|
|
||||||
let public_key = key::PublicKey::from_slice(&SECP256K1, &public_sec_raw)
|
|
||||||
.expect("constructing using predefined constants; qed");
|
|
||||||
let mut public = Public::default();
|
|
||||||
set_public(&mut public, &public_key);
|
|
||||||
public
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return secp256k1 elliptic curve order
|
|
||||||
pub fn curve_order() -> U256 {
|
|
||||||
H256::from_slice(&CURVE_ORDER).into_uint()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_secp256k1_public(public: &Public) -> Result<key::PublicKey, Error> {
|
|
||||||
let public_data = {
|
|
||||||
let mut temp = [4u8; 65];
|
|
||||||
(&mut temp[1..65]).copy_from_slice(&public[0..64]);
|
|
||||||
temp
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(key::PublicKey::from_slice(&SECP256K1, &public_data)?)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn set_public(public: &mut Public, key_public: &key::PublicKey) {
|
|
||||||
let key_public_serialized = key_public.serialize_vec(&SECP256K1, false);
|
|
||||||
public.as_bytes_mut().copy_from_slice(&key_public_serialized[1..65]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::super::{Random, Generator};
|
|
||||||
use super::{public_add, public_sub};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn public_addition_is_commutative() {
|
|
||||||
let public1 = Random.generate().unwrap().public().clone();
|
|
||||||
let public2 = Random.generate().unwrap().public().clone();
|
|
||||||
|
|
||||||
let mut left = public1.clone();
|
|
||||||
public_add(&mut left, &public2).unwrap();
|
|
||||||
|
|
||||||
let mut right = public2.clone();
|
|
||||||
public_add(&mut right, &public1).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(left, right);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn public_addition_is_reversible_with_subtraction() {
|
|
||||||
let public1 = Random.generate().unwrap().public().clone();
|
|
||||||
let public2 = Random.generate().unwrap().public().clone();
|
|
||||||
|
|
||||||
let mut sum = public1.clone();
|
|
||||||
public_add(&mut sum, &public2).unwrap();
|
|
||||||
public_sub(&mut sum, &public2).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(sum, public1);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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 Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use super::{Random, Generator, KeyPair, Error};
|
use parity_crypto::publickey::{Random, Generator, KeyPair, Error};
|
||||||
|
|
||||||
/// Tries to find keypair with address starting with given prefix.
|
/// Tries to find keypair with address starting with given prefix.
|
||||||
pub struct Prefix {
|
pub struct Prefix {
|
||||||
@ -48,7 +48,8 @@ impl Generator for Prefix {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use {Generator, Prefix};
|
use Prefix;
|
||||||
|
use parity_crypto::publickey::Generator;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn prefix_generator() {
|
fn prefix_generator() {
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use rand::rngs::OsRng;
|
|
||||||
use super::{Generator, KeyPair, SECP256K1};
|
|
||||||
|
|
||||||
/// Randomly generates new keypair, instantiating the RNG each time.
|
|
||||||
pub struct Random;
|
|
||||||
|
|
||||||
impl Generator for Random {
|
|
||||||
type Error = std::io::Error;
|
|
||||||
|
|
||||||
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
|
||||||
Generator::generate(&mut OsRng).map_err(|void| {
|
|
||||||
match void {} // LLVM unreachable
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Generator for OsRng {
|
|
||||||
type Error = ::Void;
|
|
||||||
|
|
||||||
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
|
||||||
let (sec, publ) = SECP256K1.generate_keypair(self)
|
|
||||||
.expect("context always created with full capabilities; qed");
|
|
||||||
|
|
||||||
Ok(KeyPair::from_keypair(sec, publ))
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,304 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::str::FromStr;
|
|
||||||
use rustc_hex::ToHex;
|
|
||||||
use secp256k1::constants::{SECRET_KEY_SIZE as SECP256K1_SECRET_KEY_SIZE};
|
|
||||||
use secp256k1::key;
|
|
||||||
use ethereum_types::H256;
|
|
||||||
use zeroize::Zeroize;
|
|
||||||
use {Error, SECP256K1};
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
|
||||||
pub struct Secret {
|
|
||||||
inner: H256,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for Secret {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
self.inner.0.zeroize()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToHex for Secret {
|
|
||||||
fn to_hex(&self) -> String {
|
|
||||||
format!("{:x}", self.inner)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::LowerHex for Secret {
|
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
self.inner.fmt(fmt)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Debug for Secret {
|
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
self.inner.fmt(fmt)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for Secret {
|
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(fmt, "Secret: 0x{:x}{:x}..{:x}{:x}", self.inner[0], self.inner[1], self.inner[30], self.inner[31])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Secret {
|
|
||||||
/// Creates a `Secret` from the given slice, returning `None` if the slice length != 32.
|
|
||||||
pub fn from_slice(key: &[u8]) -> Option<Self> {
|
|
||||||
if key.len() != 32 {
|
|
||||||
return None
|
|
||||||
}
|
|
||||||
let mut h = H256::zero();
|
|
||||||
h.as_bytes_mut().copy_from_slice(&key[0..32]);
|
|
||||||
Some(Secret { inner: h })
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates zero key, which is invalid for crypto operations, but valid for math operation.
|
|
||||||
pub fn zero() -> Self {
|
|
||||||
Secret { inner: H256::zero() }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Imports and validates the key.
|
|
||||||
pub fn from_unsafe_slice(key: &[u8]) -> Result<Self, Error> {
|
|
||||||
let secret = key::SecretKey::from_slice(&super::SECP256K1, key)?;
|
|
||||||
Ok(secret.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks validity of this key.
|
|
||||||
pub fn check_validity(&self) -> Result<(), Error> {
|
|
||||||
self.to_secp256k1_secret().map(|_| ())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace add one secret key to another (scalar + scalar)
|
|
||||||
pub fn add(&mut self, other: &Secret) -> Result<(), Error> {
|
|
||||||
match (self.is_zero(), other.is_zero()) {
|
|
||||||
(true, true) | (false, true) => Ok(()),
|
|
||||||
(true, false) => {
|
|
||||||
*self = other.clone();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
(false, false) => {
|
|
||||||
let mut key_secret = self.to_secp256k1_secret()?;
|
|
||||||
let other_secret = other.to_secp256k1_secret()?;
|
|
||||||
key_secret.add_assign(&SECP256K1, &other_secret)?;
|
|
||||||
|
|
||||||
*self = key_secret.into();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace subtract one secret key from another (scalar - scalar)
|
|
||||||
pub fn sub(&mut self, other: &Secret) -> Result<(), Error> {
|
|
||||||
match (self.is_zero(), other.is_zero()) {
|
|
||||||
(true, true) | (false, true) => Ok(()),
|
|
||||||
(true, false) => {
|
|
||||||
*self = other.clone();
|
|
||||||
self.neg()
|
|
||||||
},
|
|
||||||
(false, false) => {
|
|
||||||
let mut key_secret = self.to_secp256k1_secret()?;
|
|
||||||
let mut other_secret = other.to_secp256k1_secret()?;
|
|
||||||
other_secret.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
|
||||||
key_secret.add_assign(&SECP256K1, &other_secret)?;
|
|
||||||
|
|
||||||
*self = key_secret.into();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace decrease secret key (scalar - 1)
|
|
||||||
pub fn dec(&mut self) -> Result<(), Error> {
|
|
||||||
match self.is_zero() {
|
|
||||||
true => {
|
|
||||||
*self = key::MINUS_ONE_KEY.into();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
false => {
|
|
||||||
let mut key_secret = self.to_secp256k1_secret()?;
|
|
||||||
key_secret.add_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
|
||||||
|
|
||||||
*self = key_secret.into();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace multiply one secret key to another (scalar * scalar)
|
|
||||||
pub fn mul(&mut self, other: &Secret) -> Result<(), Error> {
|
|
||||||
match (self.is_zero(), other.is_zero()) {
|
|
||||||
(true, true) | (true, false) => Ok(()),
|
|
||||||
(false, true) => {
|
|
||||||
*self = Self::zero();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
(false, false) => {
|
|
||||||
let mut key_secret = self.to_secp256k1_secret()?;
|
|
||||||
let other_secret = other.to_secp256k1_secret()?;
|
|
||||||
key_secret.mul_assign(&SECP256K1, &other_secret)?;
|
|
||||||
|
|
||||||
*self = key_secret.into();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace negate secret key (-scalar)
|
|
||||||
pub fn neg(&mut self) -> Result<(), Error> {
|
|
||||||
match self.is_zero() {
|
|
||||||
true => Ok(()),
|
|
||||||
false => {
|
|
||||||
let mut key_secret = self.to_secp256k1_secret()?;
|
|
||||||
key_secret.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
|
||||||
|
|
||||||
*self = key_secret.into();
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inplace inverse secret key (1 / scalar)
|
|
||||||
pub fn inv(&mut self) -> Result<(), Error> {
|
|
||||||
let mut key_secret = self.to_secp256k1_secret()?;
|
|
||||||
key_secret.inv_assign(&SECP256K1)?;
|
|
||||||
|
|
||||||
*self = key_secret.into();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compute power of secret key inplace (secret ^ pow).
|
|
||||||
/// This function is not intended to be used with large powers.
|
|
||||||
pub fn pow(&mut self, pow: usize) -> Result<(), Error> {
|
|
||||||
if self.is_zero() {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
match pow {
|
|
||||||
0 => *self = key::ONE_KEY.into(),
|
|
||||||
1 => (),
|
|
||||||
_ => {
|
|
||||||
let c = self.clone();
|
|
||||||
for _ in 1..pow {
|
|
||||||
self.mul(&c)?;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create `secp256k1::key::SecretKey` based on this secret
|
|
||||||
pub fn to_secp256k1_secret(&self) -> Result<key::SecretKey, Error> {
|
|
||||||
Ok(key::SecretKey::from_slice(&SECP256K1, &self[..])?)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromStr for Secret {
|
|
||||||
type Err = Error;
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
Ok(H256::from_str(s).map_err(|e| Error::Custom(format!("{:?}", e)))?.into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<[u8; 32]> for Secret {
|
|
||||||
fn from(k: [u8; 32]) -> Self {
|
|
||||||
Secret { inner: H256(k) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<H256> for Secret {
|
|
||||||
fn from(s: H256) -> Self {
|
|
||||||
s.0.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&'static str> for Secret {
|
|
||||||
fn from(s: &'static str) -> Self {
|
|
||||||
s.parse().expect(&format!("invalid string literal for {}: '{}'", stringify!(Self), s))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<key::SecretKey> for Secret {
|
|
||||||
fn from(key: key::SecretKey) -> Self {
|
|
||||||
let mut a = [0; SECP256K1_SECRET_KEY_SIZE];
|
|
||||||
a.copy_from_slice(&key[0 .. SECP256K1_SECRET_KEY_SIZE]);
|
|
||||||
a.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Deref for Secret {
|
|
||||||
type Target = H256;
|
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
|
||||||
&self.inner
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use std::str::FromStr;
|
|
||||||
use super::super::{Random, Generator};
|
|
||||||
use super::Secret;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn multiplicating_secret_inversion_with_secret_gives_one() {
|
|
||||||
let secret = Random.generate().unwrap().secret().clone();
|
|
||||||
let mut inversion = secret.clone();
|
|
||||||
inversion.inv().unwrap();
|
|
||||||
inversion.mul(&secret).unwrap();
|
|
||||||
assert_eq!(inversion, Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn secret_inversion_is_reversible_with_inversion() {
|
|
||||||
let secret = Random.generate().unwrap().secret().clone();
|
|
||||||
let mut inversion = secret.clone();
|
|
||||||
inversion.inv().unwrap();
|
|
||||||
inversion.inv().unwrap();
|
|
||||||
assert_eq!(inversion, secret);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn secret_pow() {
|
|
||||||
let secret = Random.generate().unwrap().secret().clone();
|
|
||||||
|
|
||||||
let mut pow0 = secret.clone();
|
|
||||||
pow0.pow(0).unwrap();
|
|
||||||
assert_eq!(pow0, Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap());
|
|
||||||
|
|
||||||
let mut pow1 = secret.clone();
|
|
||||||
pow1.pow(1).unwrap();
|
|
||||||
assert_eq!(pow1, secret);
|
|
||||||
|
|
||||||
let mut pow2 = secret.clone();
|
|
||||||
pow2.pow(2).unwrap();
|
|
||||||
let mut pow2_expected = secret.clone();
|
|
||||||
pow2_expected.mul(&secret).unwrap();
|
|
||||||
assert_eq!(pow2, pow2_expected);
|
|
||||||
|
|
||||||
let mut pow3 = secret.clone();
|
|
||||||
pow3.pow(3).unwrap();
|
|
||||||
let mut pow3_expected = secret.clone();
|
|
||||||
pow3_expected.mul(&secret).unwrap();
|
|
||||||
pow3_expected.mul(&secret).unwrap();
|
|
||||||
assert_eq!(pow3, pow3_expected);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,314 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use std::ops::{Deref, DerefMut};
|
|
||||||
use std::cmp::PartialEq;
|
|
||||||
use std::fmt;
|
|
||||||
use std::str::FromStr;
|
|
||||||
use std::hash::{Hash, Hasher};
|
|
||||||
use secp256k1::{Message as SecpMessage, RecoverableSignature, RecoveryId, Error as SecpError};
|
|
||||||
use secp256k1::key::{SecretKey, PublicKey};
|
|
||||||
use rustc_hex::{ToHex, FromHex};
|
|
||||||
use ethereum_types::{H520, H256};
|
|
||||||
use {Secret, Public, SECP256K1, Error, Message, public_to_address, Address};
|
|
||||||
|
|
||||||
/// Signature encoded as RSV components
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct Signature([u8; 65]);
|
|
||||||
|
|
||||||
impl Signature {
|
|
||||||
/// Get a slice into the 'r' portion of the data.
|
|
||||||
pub fn r(&self) -> &[u8] {
|
|
||||||
&self.0[0..32]
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a slice into the 's' portion of the data.
|
|
||||||
pub fn s(&self) -> &[u8] {
|
|
||||||
&self.0[32..64]
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the recovery byte.
|
|
||||||
pub fn v(&self) -> u8 {
|
|
||||||
self.0[64]
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Encode the signature into RSV array (V altered to be in "Electrum" notation).
|
|
||||||
pub fn into_electrum(mut self) -> [u8; 65] {
|
|
||||||
self.0[64] += 27;
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parse bytes as a signature encoded as RSV (V in "Electrum" notation).
|
|
||||||
/// May return empty (invalid) signature if given data has invalid length.
|
|
||||||
pub fn from_electrum(data: &[u8]) -> Self {
|
|
||||||
if data.len() != 65 || data[64] < 27 {
|
|
||||||
// fallback to empty (invalid) signature
|
|
||||||
return Signature::default();
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut sig = [0u8; 65];
|
|
||||||
sig.copy_from_slice(data);
|
|
||||||
sig[64] -= 27;
|
|
||||||
Signature(sig)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a signature object from the sig.
|
|
||||||
pub fn from_rsv(r: &H256, s: &H256, v: u8) -> Self {
|
|
||||||
let mut sig = [0u8; 65];
|
|
||||||
sig[0..32].copy_from_slice(r.as_ref());
|
|
||||||
sig[32..64].copy_from_slice(s.as_ref());
|
|
||||||
sig[64] = v;
|
|
||||||
Signature(sig)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if this is a "low" signature.
|
|
||||||
pub fn is_low_s(&self) -> bool {
|
|
||||||
// "7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0"
|
|
||||||
const MASK: H256 = H256([
|
|
||||||
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0x5D, 0x57, 0x6E, 0x73, 0x57, 0xA4, 0x50, 0x1D,
|
|
||||||
0xDF, 0xE9, 0x2F, 0x46, 0x68, 0x1B, 0x20, 0xA0,
|
|
||||||
]);
|
|
||||||
H256::from_slice(self.s()) <= MASK
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if each component of the signature is in range.
|
|
||||||
pub fn is_valid(&self) -> bool {
|
|
||||||
// "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
|
|
||||||
const MASK: H256 = H256([
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
|
|
||||||
0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b,
|
|
||||||
0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41,
|
|
||||||
]);
|
|
||||||
const ONE: H256 = H256([
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
|
||||||
]);
|
|
||||||
let r = H256::from_slice(self.r());
|
|
||||||
let s = H256::from_slice(self.s());
|
|
||||||
self.v() <= 1 &&
|
|
||||||
r < MASK && r >= ONE &&
|
|
||||||
s < MASK && s >= ONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// manual implementation large arrays don't have trait impls by default.
|
|
||||||
// remove when integer generics exist
|
|
||||||
impl PartialEq for Signature {
|
|
||||||
fn eq(&self, other: &Self) -> bool {
|
|
||||||
&self.0[..] == &other.0[..]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// manual implementation required in Rust 1.13+, see `std::cmp::AssertParamIsEq`.
|
|
||||||
impl Eq for Signature { }
|
|
||||||
|
|
||||||
// also manual for the same reason, but the pretty printing might be useful.
|
|
||||||
impl fmt::Debug for Signature {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
|
||||||
f.debug_struct("Signature")
|
|
||||||
.field("r", &self.0[0..32].to_hex())
|
|
||||||
.field("s", &self.0[32..64].to_hex())
|
|
||||||
.field("v", &self.0[64..65].to_hex())
|
|
||||||
.finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for Signature {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
|
||||||
write!(f, "{}", self.to_hex())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromStr for Signature {
|
|
||||||
type Err = Error;
|
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
match s.from_hex() {
|
|
||||||
Ok(ref hex) if hex.len() == 65 => {
|
|
||||||
let mut data = [0; 65];
|
|
||||||
data.copy_from_slice(&hex[0..65]);
|
|
||||||
Ok(Signature(data))
|
|
||||||
},
|
|
||||||
_ => Err(Error::InvalidSignature)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Signature {
|
|
||||||
fn default() -> Self {
|
|
||||||
Signature([0; 65])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hash for Signature {
|
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
|
||||||
H520::from(self.0).hash(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Clone for Signature {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
Signature(self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<[u8; 65]> for Signature {
|
|
||||||
fn from(s: [u8; 65]) -> Self {
|
|
||||||
Signature(s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Into<[u8; 65]> for Signature {
|
|
||||||
fn into(self) -> [u8; 65] {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Signature> for H520 {
|
|
||||||
fn from(s: Signature) -> Self {
|
|
||||||
H520::from(s.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<H520> for Signature {
|
|
||||||
fn from(bytes: H520) -> Self {
|
|
||||||
Signature(bytes.into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Deref for Signature {
|
|
||||||
type Target = [u8; 65];
|
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
|
||||||
&self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DerefMut for Signature {
|
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
||||||
&mut self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sign(secret: &Secret, message: &Message) -> Result<Signature, Error> {
|
|
||||||
let context = &SECP256K1;
|
|
||||||
let sec = SecretKey::from_slice(context, secret.as_ref())?;
|
|
||||||
let s = context.sign_recoverable(&SecpMessage::from_slice(&message[..])?, &sec)?;
|
|
||||||
let (rec_id, data) = s.serialize_compact(context);
|
|
||||||
let mut data_arr = [0; 65];
|
|
||||||
|
|
||||||
// no need to check if s is low, it always is
|
|
||||||
data_arr[0..64].copy_from_slice(&data[0..64]);
|
|
||||||
data_arr[64] = rec_id.to_i32() as u8;
|
|
||||||
Ok(Signature(data_arr))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn verify_public(public: &Public, signature: &Signature, message: &Message) -> Result<bool, Error> {
|
|
||||||
let context = &SECP256K1;
|
|
||||||
let rsig = RecoverableSignature::from_compact(context, &signature[0..64], RecoveryId::from_i32(signature[64] as i32)?)?;
|
|
||||||
let sig = rsig.to_standard(context);
|
|
||||||
|
|
||||||
let pdata: [u8; 65] = {
|
|
||||||
let mut temp = [4u8; 65];
|
|
||||||
temp[1..65].copy_from_slice(public.as_bytes());
|
|
||||||
temp
|
|
||||||
};
|
|
||||||
|
|
||||||
let publ = PublicKey::from_slice(context, &pdata)?;
|
|
||||||
match context.verify(&SecpMessage::from_slice(&message[..])?, &sig, &publ) {
|
|
||||||
Ok(_) => Ok(true),
|
|
||||||
Err(SecpError::IncorrectSignature) => Ok(false),
|
|
||||||
Err(x) => Err(Error::from(x))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn verify_address(address: &Address, signature: &Signature, message: &Message) -> Result<bool, Error> {
|
|
||||||
let public = recover(signature, message)?;
|
|
||||||
let recovered_address = public_to_address(&public);
|
|
||||||
Ok(address == &recovered_address)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn recover(signature: &Signature, message: &Message) -> Result<Public, Error> {
|
|
||||||
let context = &SECP256K1;
|
|
||||||
let rsig = RecoverableSignature::from_compact(context, &signature[0..64], RecoveryId::from_i32(signature[64] as i32)?)?;
|
|
||||||
let pubkey = context.recover(&SecpMessage::from_slice(&message[..])?, &rsig)?;
|
|
||||||
let serialized = pubkey.serialize_vec(context, false);
|
|
||||||
|
|
||||||
let mut public = Public::default();
|
|
||||||
public.as_bytes_mut().copy_from_slice(&serialized[1..65]);
|
|
||||||
Ok(public)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use std::str::FromStr;
|
|
||||||
use {Generator, Random, Message};
|
|
||||||
use super::{sign, verify_public, verify_address, recover, Signature};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn vrs_conversion() {
|
|
||||||
// given
|
|
||||||
let keypair = Random.generate().unwrap();
|
|
||||||
let message = Message::default();
|
|
||||||
let signature = sign(keypair.secret(), &message).unwrap();
|
|
||||||
|
|
||||||
// when
|
|
||||||
let vrs = signature.clone().into_electrum();
|
|
||||||
let from_vrs = Signature::from_electrum(&vrs);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert_eq!(signature, from_vrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn signature_to_and_from_str() {
|
|
||||||
let keypair = Random.generate().unwrap();
|
|
||||||
let message = Message::default();
|
|
||||||
let signature = sign(keypair.secret(), &message).unwrap();
|
|
||||||
let string = format!("{}", signature);
|
|
||||||
let deserialized = Signature::from_str(&string).unwrap();
|
|
||||||
assert_eq!(signature, deserialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn sign_and_recover_public() {
|
|
||||||
let keypair = Random.generate().unwrap();
|
|
||||||
let message = Message::default();
|
|
||||||
let signature = sign(keypair.secret(), &message).unwrap();
|
|
||||||
assert_eq!(keypair.public(), &recover(&signature, &message).unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn sign_and_verify_public() {
|
|
||||||
let keypair = Random.generate().unwrap();
|
|
||||||
let message = Message::default();
|
|
||||||
let signature = sign(keypair.secret(), &message).unwrap();
|
|
||||||
assert!(verify_public(keypair.public(), &signature, &message).unwrap());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn sign_and_verify_address() {
|
|
||||||
let keypair = Random.generate().unwrap();
|
|
||||||
let message = Message::default();
|
|
||||||
let signature = sign(keypair.secret(), &message).unwrap();
|
|
||||||
assert!(verify_address(&keypair.address(), &signature, &message).unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ tiny-keccak = "1.4"
|
|||||||
time = "0.1.34"
|
time = "0.1.34"
|
||||||
itertools = "0.5"
|
itertools = "0.5"
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
parity-crypto = "0.4.0"
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
dir = { path = "../../util/dir" }
|
dir = { path = "../../util/dir" }
|
||||||
smallvec = "0.6"
|
smallvec = "0.6"
|
||||||
|
@ -13,6 +13,8 @@ serde = "1.0"
|
|||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
ethstore = { path = "../" }
|
ethstore = { path = "../" }
|
||||||
|
ethkey = { path = "../../ethkey" }
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
dir = { path = '../../../util/dir' }
|
dir = { path = '../../../util/dir' }
|
||||||
panic_hook = { path = "../../../util/panic-hook" }
|
panic_hook = { path = "../../../util/panic-hook" }
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ use std::sync::Arc;
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
use ethstore::{ethkey::Password, PresaleWallet, Error};
|
use ethstore::{PresaleWallet, Error};
|
||||||
|
use ethkey::Password;
|
||||||
use num_cpus;
|
use num_cpus;
|
||||||
|
|
||||||
pub fn run(passwords: VecDeque<Password>, wallet_path: &str) -> Result<(), Error> {
|
pub fn run(passwords: VecDeque<Password>, wallet_path: &str) -> Result<(), Error> {
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
extern crate dir;
|
extern crate dir;
|
||||||
extern crate docopt;
|
extern crate docopt;
|
||||||
extern crate ethstore;
|
extern crate ethstore;
|
||||||
|
extern crate ethkey;
|
||||||
extern crate num_cpus;
|
extern crate num_cpus;
|
||||||
extern crate panic_hook;
|
extern crate panic_hook;
|
||||||
extern crate parking_lot;
|
extern crate parking_lot;
|
||||||
|
extern crate parity_crypto;
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
|
||||||
@ -34,7 +36,8 @@ use std::{env, process, fs, fmt};
|
|||||||
|
|
||||||
use docopt::Docopt;
|
use docopt::Docopt;
|
||||||
use ethstore::accounts_dir::{KeyDirectory, RootDiskDirectory};
|
use ethstore::accounts_dir::{KeyDirectory, RootDiskDirectory};
|
||||||
use ethstore::ethkey::{Address, Password};
|
use ethkey::Password;
|
||||||
|
use parity_crypto::publickey::Address;
|
||||||
use ethstore::{EthStore, SimpleSecretStore, SecretStore, import_accounts, PresaleWallet, SecretVaultRef, StoreAccountRef};
|
use ethstore::{EthStore, SimpleSecretStore, SecretStore, import_accounts, PresaleWallet, SecretVaultRef, StoreAccountRef};
|
||||||
|
|
||||||
mod crack;
|
mod crack;
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::str;
|
use std::str;
|
||||||
use ethkey::{Password, Secret};
|
use crypto::publickey::Secret;
|
||||||
|
use ethkey::Password;
|
||||||
use {json, Error, crypto};
|
use {json, Error, crypto};
|
||||||
use crypto::Keccak256;
|
use crypto::Keccak256;
|
||||||
use random::Random;
|
use random::Random;
|
||||||
@ -120,7 +121,7 @@ impl Crypto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let secret = self.do_decrypt(password, 32)?;
|
let secret = self.do_decrypt(password, 32)?;
|
||||||
Ok(Secret::from_unsafe_slice(&secret)?)
|
Ok(Secret::import_key(&secret)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to decrypt and return result as is
|
/// Try to decrypt and return result as is
|
||||||
@ -158,7 +159,7 @@ impl Crypto {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ethkey::{Generator, Random};
|
use crypto::publickey::{Generator, Random};
|
||||||
use super::{Crypto, Error};
|
use super::{Crypto, Error};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use ethkey::{self, KeyPair, sign, Address, Password, Signature, Message, Public, Secret};
|
use crypto::publickey::{KeyPair, sign, Address, Signature, Message, Public, Secret};
|
||||||
use ethkey::crypto::ecdh::agree;
|
use ethkey::Password;
|
||||||
|
use crypto::publickey::ecdh::agree;
|
||||||
use {json, Error};
|
use {json, Error};
|
||||||
use account::Version;
|
use account::Version;
|
||||||
use crypto;
|
use crypto;
|
||||||
@ -161,7 +162,7 @@ impl SafeAccount {
|
|||||||
/// Decrypt a message.
|
/// Decrypt a message.
|
||||||
pub fn decrypt(&self, password: &Password, shared_mac: &[u8], message: &[u8]) -> Result<Vec<u8>, Error> {
|
pub fn decrypt(&self, password: &Password, shared_mac: &[u8], message: &[u8]) -> Result<Vec<u8>, Error> {
|
||||||
let secret = self.crypto.secret(password)?;
|
let secret = self.crypto.secret(password)?;
|
||||||
ethkey::crypto::ecies::decrypt(&secret, shared_mac, message).map_err(From::from)
|
crypto::publickey::ecies::decrypt(&secret, shared_mac, message).map_err(From::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Agree on shared key.
|
/// Agree on shared key.
|
||||||
@ -199,7 +200,7 @@ impl SafeAccount {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ethkey::{Generator, Random, verify_public, Message};
|
use crypto::publickey::{Generator, Random, verify_public, Message};
|
||||||
use super::SafeAccount;
|
use super::SafeAccount;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -356,7 +356,7 @@ mod test {
|
|||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
use super::{KeyDirectory, RootDiskDirectory, VaultKey};
|
use super::{KeyDirectory, RootDiskDirectory, VaultKey};
|
||||||
use account::SafeAccount;
|
use account::SafeAccount;
|
||||||
use ethkey::{Random, Generator};
|
use crypto::publickey::{Random, Generator};
|
||||||
use self::tempdir::TempDir;
|
use self::tempdir::TempDir;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use itertools;
|
use itertools;
|
||||||
use ethkey::Address;
|
use crypto::publickey::Address;
|
||||||
|
|
||||||
use {SafeAccount, Error};
|
use {SafeAccount, Error};
|
||||||
use super::KeyDirectory;
|
use super::KeyDirectory;
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
use ethkey::{self, Error as EthKeyError};
|
|
||||||
use crypto::{self, Error as EthCryptoError};
|
use crypto::{self, Error as EthCryptoError};
|
||||||
use ethkey::DerivationError;
|
use crypto::publickey::{Error as EthPublicKeyCryptoError, DerivationError};
|
||||||
|
|
||||||
/// Account-related errors.
|
/// Account-related errors.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -47,12 +46,10 @@ pub enum Error {
|
|||||||
VaultNotFound,
|
VaultNotFound,
|
||||||
/// Account creation failed.
|
/// Account creation failed.
|
||||||
CreationFailed,
|
CreationFailed,
|
||||||
/// `EthKey` error
|
|
||||||
EthKey(EthKeyError),
|
|
||||||
/// `ethkey::crypto::Error`
|
|
||||||
EthKeyCrypto(ethkey::crypto::Error),
|
|
||||||
/// `EthCrypto` error
|
/// `EthCrypto` error
|
||||||
EthCrypto(EthCryptoError),
|
EthCrypto(EthCryptoError),
|
||||||
|
/// `EthPublicKeyCryptoError` error
|
||||||
|
EthPublicKeyCrypto(EthPublicKeyCryptoError),
|
||||||
/// Derivation error
|
/// Derivation error
|
||||||
Derivation(DerivationError),
|
Derivation(DerivationError),
|
||||||
/// Custom error
|
/// Custom error
|
||||||
@ -74,9 +71,8 @@ impl fmt::Display for Error {
|
|||||||
Error::InvalidVaultName => "Invalid vault name".into(),
|
Error::InvalidVaultName => "Invalid vault name".into(),
|
||||||
Error::VaultNotFound => "Vault not found".into(),
|
Error::VaultNotFound => "Vault not found".into(),
|
||||||
Error::CreationFailed => "Account creation failed".into(),
|
Error::CreationFailed => "Account creation failed".into(),
|
||||||
Error::EthKey(ref err) => err.to_string(),
|
|
||||||
Error::EthKeyCrypto(ref err) => err.to_string(),
|
|
||||||
Error::EthCrypto(ref err) => err.to_string(),
|
Error::EthCrypto(ref err) => err.to_string(),
|
||||||
|
Error::EthPublicKeyCrypto(ref err) => err.to_string(),
|
||||||
Error::Derivation(ref err) => format!("Derivation error: {:?}", err),
|
Error::Derivation(ref err) => format!("Derivation error: {:?}", err),
|
||||||
Error::Custom(ref s) => s.clone(),
|
Error::Custom(ref s) => s.clone(),
|
||||||
};
|
};
|
||||||
@ -91,15 +87,9 @@ impl From<IoError> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<EthKeyError> for Error {
|
impl From<EthPublicKeyCryptoError> for Error {
|
||||||
fn from(err: EthKeyError) -> Self {
|
fn from(err: EthPublicKeyCryptoError) -> Self {
|
||||||
Error::EthKey(err)
|
Error::EthPublicKeyCrypto(err)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ethkey::crypto::Error> for Error {
|
|
||||||
fn from(err: ethkey::crypto::Error) -> Self {
|
|
||||||
Error::EthKeyCrypto(err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity Ethereum.
|
|
||||||
|
|
||||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! ethkey reexport to make documentation look pretty.
|
|
||||||
pub use _ethkey::*;
|
|
||||||
use json;
|
|
||||||
|
|
||||||
impl Into<json::H160> for Address {
|
|
||||||
fn into(self) -> json::H160 {
|
|
||||||
let a: [u8; 20] = self.into();
|
|
||||||
From::from(a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<json::H160> for Address {
|
|
||||||
fn from(json: json::H160) -> Self {
|
|
||||||
let a: [u8; 20] = json.into();
|
|
||||||
From::from(a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> From<&'a json::H160> for Address {
|
|
||||||
fn from(json: &'a json::H160) -> Self {
|
|
||||||
let mut a = [0u8; 20];
|
|
||||||
a.copy_from_slice(json);
|
|
||||||
From::from(a)
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,7 +22,8 @@ use std::time::{Instant, Duration};
|
|||||||
|
|
||||||
use crypto::KEY_ITERATIONS;
|
use crypto::KEY_ITERATIONS;
|
||||||
use random::Random;
|
use random::Random;
|
||||||
use ethkey::{self, Signature, Password, Address, Message, Secret, Public, KeyPair, ExtendedKeyPair};
|
use crypto::publickey::{Signature, Address, Message, Secret, Public, KeyPair, ExtendedKeyPair};
|
||||||
|
use ethkey::Password;
|
||||||
use accounts_dir::{KeyDirectory, VaultKeyDirectory, VaultKey, SetKeyError};
|
use accounts_dir::{KeyDirectory, VaultKeyDirectory, VaultKey, SetKeyError};
|
||||||
use account::SafeAccount;
|
use account::SafeAccount;
|
||||||
use presale::PresaleWallet;
|
use presale::PresaleWallet;
|
||||||
@ -442,13 +443,13 @@ impl EthMultiStore {
|
|||||||
Derivation::Hierarchical(path) => {
|
Derivation::Hierarchical(path) => {
|
||||||
for path_item in path {
|
for path_item in path {
|
||||||
extended = extended.derive(
|
extended = extended.derive(
|
||||||
if path_item.soft { ethkey::Derivation::Soft(path_item.index) }
|
if path_item.soft { crypto::publickey::Derivation::Soft(path_item.index) }
|
||||||
else { ethkey::Derivation::Hard(path_item.index) }
|
else { crypto::publickey::Derivation::Hard(path_item.index) }
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Derivation::SoftHash(h256) => { extended = extended.derive(ethkey::Derivation::Soft(h256))?; }
|
Derivation::SoftHash(h256) => { extended = extended.derive(crypto::publickey::Derivation::Soft(h256))?; }
|
||||||
Derivation::HardHash(h256) => { extended = extended.derive(ethkey::Derivation::Hard(h256))?; }
|
Derivation::HardHash(h256) => { extended = extended.derive(crypto::publickey::Derivation::Hard(h256))?; }
|
||||||
}
|
}
|
||||||
Ok(extended)
|
Ok(extended)
|
||||||
}
|
}
|
||||||
@ -479,7 +480,7 @@ impl SimpleSecretStore for EthMultiStore {
|
|||||||
let accounts = self.get_matching(&account_ref, password)?;
|
let accounts = self.get_matching(&account_ref, password)?;
|
||||||
for account in accounts {
|
for account in accounts {
|
||||||
let extended = self.generate(account.crypto.secret(password)?, derivation)?;
|
let extended = self.generate(account.crypto.secret(password)?, derivation)?;
|
||||||
return Ok(ethkey::public_to_address(extended.public().public()));
|
return Ok(crypto::publickey::public_to_address(extended.public().public()));
|
||||||
}
|
}
|
||||||
Err(Error::InvalidPassword)
|
Err(Error::InvalidPassword)
|
||||||
}
|
}
|
||||||
@ -491,7 +492,7 @@ impl SimpleSecretStore for EthMultiStore {
|
|||||||
for account in accounts {
|
for account in accounts {
|
||||||
let extended = self.generate(account.crypto.secret(password)?, derivation)?;
|
let extended = self.generate(account.crypto.secret(password)?, derivation)?;
|
||||||
let secret = extended.secret().as_raw();
|
let secret = extended.secret().as_raw();
|
||||||
return Ok(ethkey::sign(&secret, message)?)
|
return Ok(crypto::publickey::sign(&secret, message)?)
|
||||||
}
|
}
|
||||||
Err(Error::InvalidPassword)
|
Err(Error::InvalidPassword)
|
||||||
}
|
}
|
||||||
@ -690,7 +691,7 @@ mod tests {
|
|||||||
extern crate tempdir;
|
extern crate tempdir;
|
||||||
|
|
||||||
use accounts_dir::{KeyDirectory, MemoryDirectory, RootDiskDirectory};
|
use accounts_dir::{KeyDirectory, MemoryDirectory, RootDiskDirectory};
|
||||||
use ethkey::{Random, Generator, KeyPair};
|
use crypto::publickey::{Random, Generator, KeyPair};
|
||||||
use secret_store::{SimpleSecretStore, SecretStore, SecretVaultRef, StoreAccountRef, Derivation};
|
use secret_store::{SimpleSecretStore, SecretStore, SecretVaultRef, StoreAccountRef, Derivation};
|
||||||
use super::{EthStore, EthMultiStore};
|
use super::{EthStore, EthMultiStore};
|
||||||
use self::tempdir::TempDir;
|
use self::tempdir::TempDir;
|
||||||
|
@ -18,7 +18,7 @@ use std::collections::HashSet;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use ethkey::Address;
|
use crypto::publickey::Address;
|
||||||
use accounts_dir::{KeyDirectory, RootDiskDirectory, DiskKeyFileManager, KeyFileManager};
|
use accounts_dir::{KeyDirectory, RootDiskDirectory, DiskKeyFileManager, KeyFileManager};
|
||||||
use dir;
|
use dir;
|
||||||
use Error;
|
use Error;
|
||||||
|
@ -33,7 +33,7 @@ extern crate tempdir;
|
|||||||
|
|
||||||
extern crate parity_crypto as crypto;
|
extern crate parity_crypto as crypto;
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethkey as _ethkey;
|
extern crate ethkey as ethkey;
|
||||||
extern crate parity_wordlist;
|
extern crate parity_wordlist;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -46,7 +46,6 @@ extern crate serde_derive;
|
|||||||
extern crate matches;
|
extern crate matches;
|
||||||
|
|
||||||
pub mod accounts_dir;
|
pub mod accounts_dir;
|
||||||
pub mod ethkey;
|
|
||||||
|
|
||||||
mod account;
|
mod account;
|
||||||
mod json;
|
mod json;
|
||||||
@ -72,4 +71,30 @@ pub use self::random::random_string;
|
|||||||
pub use self::parity_wordlist::random_phrase;
|
pub use self::parity_wordlist::random_phrase;
|
||||||
|
|
||||||
/// An opaque wrapper for secret.
|
/// An opaque wrapper for secret.
|
||||||
pub struct OpaqueSecret(::ethkey::Secret);
|
pub struct OpaqueSecret(crypto::publickey::Secret);
|
||||||
|
|
||||||
|
// Additional converters for Address
|
||||||
|
use crypto::publickey::Address;
|
||||||
|
|
||||||
|
impl Into<json::H160> for Address {
|
||||||
|
fn into(self) -> json::H160 {
|
||||||
|
let a: [u8; 20] = self.into();
|
||||||
|
From::from(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<json::H160> for Address {
|
||||||
|
fn from(json: json::H160) -> Self {
|
||||||
|
let a: [u8; 20] = json.into();
|
||||||
|
From::from(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> From<&'a json::H160> for Address {
|
||||||
|
fn from(json: &'a json::H160) -> Self {
|
||||||
|
let mut a = [0u8; 20];
|
||||||
|
a.copy_from_slice(json);
|
||||||
|
From::from(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use json;
|
use json;
|
||||||
use ethkey::{Address, Secret, KeyPair, Password};
|
use crypto::publickey::{Address, Secret, KeyPair};
|
||||||
|
use ethkey::Password;
|
||||||
use crypto::{Keccak256, pbkdf2};
|
use crypto::{Keccak256, pbkdf2};
|
||||||
use {crypto, Error};
|
use {crypto, Error};
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ impl PresaleWallet {
|
|||||||
.map_err(|_| Error::InvalidPassword)?;
|
.map_err(|_| Error::InvalidPassword)?;
|
||||||
let unpadded = &key[..len];
|
let unpadded = &key[..len];
|
||||||
|
|
||||||
let secret = Secret::from_unsafe_slice(&unpadded.keccak256())?;
|
let secret = Secret::import_key(&unpadded.keccak256())?;
|
||||||
if let Ok(kp) = KeyPair::from_secret(secret) {
|
if let Ok(kp) = KeyPair::from_secret(secret) {
|
||||||
if kp.address() == self.address {
|
if kp.address() == self.address {
|
||||||
return Ok(kp)
|
return Ok(kp)
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use ethkey::{Address, Message, Signature, Secret, Password, Public};
|
use crypto::publickey::{Address, Message, Signature, Secret, Public};
|
||||||
|
use ethkey::Password;
|
||||||
use Error;
|
use Error;
|
||||||
use json::{Uuid, OpaqueKeyFile};
|
use json::{Uuid, OpaqueKeyFile};
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
@ -110,7 +111,7 @@ pub trait SecretStore: SimpleSecretStore {
|
|||||||
|
|
||||||
/// Signs a message with raw secret.
|
/// Signs a message with raw secret.
|
||||||
fn sign_with_secret(&self, secret: &OpaqueSecret, message: &Message) -> Result<Signature, Error> {
|
fn sign_with_secret(&self, secret: &OpaqueSecret, message: &Message) -> Result<Signature, Error> {
|
||||||
Ok(::ethkey::sign(&secret.0, message)?)
|
Ok(crypto::publickey::sign(&secret.0, message)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Imports presale wallet
|
/// Imports presale wallet
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate ethstore;
|
extern crate ethstore;
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
|
extern crate parity_crypto;
|
||||||
|
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use ethstore::{EthStore, SimpleSecretStore, SecretVaultRef, StoreAccountRef};
|
use ethstore::{EthStore, SimpleSecretStore, SecretVaultRef, StoreAccountRef};
|
||||||
use ethstore::ethkey::{Random, Generator, Secret, KeyPair, verify_address};
|
use parity_crypto::publickey::{Random, Generator, Secret, KeyPair, verify_address};
|
||||||
use ethstore::accounts_dir::RootDiskDirectory;
|
use ethstore::accounts_dir::RootDiskDirectory;
|
||||||
use util::TransientDir;
|
use util::TransientDir;
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
|
@ -21,7 +21,8 @@ use std::{
|
|||||||
time::Instant,
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
use ethkey::{Address, Password};
|
use parity_crypto::publickey::Address;
|
||||||
|
use ethkey::Password;
|
||||||
use serde_derive::{Serialize, Deserialize};
|
use serde_derive::{Serialize, Deserialize};
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ use self::stores::AddressBook;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
||||||
|
|
||||||
use ethkey::{Address, Message, Public, Secret, Password, Random, Generator};
|
use ethkey::Password;
|
||||||
|
use parity_crypto::publickey::{Address, Message, Public, Secret, Random, Generator, Signature};
|
||||||
use ethstore::accounts_dir::MemoryDirectory;
|
use ethstore::accounts_dir::MemoryDirectory;
|
||||||
use ethstore::{
|
use ethstore::{
|
||||||
SimpleSecretStore, SecretStore, EthStore, EthMultiStore,
|
SimpleSecretStore, SecretStore, EthStore, EthMultiStore,
|
||||||
@ -37,7 +38,6 @@ use ethstore::{
|
|||||||
use log::warn;
|
use log::warn;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
pub use ethkey::Signature;
|
|
||||||
pub use ethstore::{Derivation, IndexDerivation, KeyFile, Error};
|
pub use ethstore::{Derivation, IndexDerivation, KeyFile, Error};
|
||||||
|
|
||||||
pub use self::account_data::AccountMeta;
|
pub use self::account_data::AccountMeta;
|
||||||
@ -503,7 +503,7 @@ impl AccountProvider {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::{AccountProvider, Unlock};
|
use super::{AccountProvider, Unlock};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use ethkey::{Generator, Random, Address};
|
use parity_crypto::publickey::{Generator, Random, Address};
|
||||||
use ethstore::{StoreAccountRef, Derivation};
|
use ethstore::{StoreAccountRef, Derivation};
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use std::{fs, fmt, hash, ops};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use ethkey::Address;
|
use parity_crypto::publickey::Address;
|
||||||
use log::{trace, warn};
|
use log::{trace, warn};
|
||||||
|
|
||||||
use crate::AccountMeta;
|
use crate::AccountMeta;
|
||||||
|
@ -17,7 +17,6 @@ engine = { path = "./engine" }
|
|||||||
env_logger = { version = "0.5", optional = true }
|
env_logger = { version = "0.5", optional = true }
|
||||||
ethash = { path = "../ethash", optional = true }
|
ethash = { path = "../ethash", optional = true }
|
||||||
ethjson = { path = "../json", optional = true }
|
ethjson = { path = "../json", optional = true }
|
||||||
ethkey = { path = "../accounts/ethkey", optional = true }
|
|
||||||
ethcore-blockchain = { path = "./blockchain" }
|
ethcore-blockchain = { path = "./blockchain" }
|
||||||
ethcore-call-contract = { path = "./call-contract" }
|
ethcore-call-contract = { path = "./call-contract" }
|
||||||
ethcore-db = { path = "./db" }
|
ethcore-db = { path = "./db" }
|
||||||
@ -44,6 +43,7 @@ parity-bytes = "0.1"
|
|||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
pod = { path = "pod", optional = true }
|
pod = { path = "pod", optional = true }
|
||||||
trie-db = "0.15.0"
|
trie-db = "0.15.0"
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"], optional = true }
|
||||||
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rand_xorshift = "0.2"
|
rand_xorshift = "0.2"
|
||||||
@ -76,7 +76,7 @@ ethash = { path = "../ethash" }
|
|||||||
ethcore-accounts = { path = "../accounts" }
|
ethcore-accounts = { path = "../accounts" }
|
||||||
ethcore-builtin = { path = "./builtin" }
|
ethcore-builtin = { path = "./builtin" }
|
||||||
ethjson = { path = "../json", features = ["test-helpers"] }
|
ethjson = { path = "../json", features = ["test-helpers"] }
|
||||||
ethkey = { path = "../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
fetch = { path = "../util/fetch" }
|
fetch = { path = "../util/fetch" }
|
||||||
kvdb-memorydb = "0.1.2"
|
kvdb-memorydb = "0.1.2"
|
||||||
kvdb-rocksdb = "0.1.5"
|
kvdb-rocksdb = "0.1.5"
|
||||||
@ -124,7 +124,7 @@ test-heavy = []
|
|||||||
test-helpers = [
|
test-helpers = [
|
||||||
"blooms-db",
|
"blooms-db",
|
||||||
"ethjson/test-helpers",
|
"ethjson/test-helpers",
|
||||||
"ethkey",
|
"parity-crypto",
|
||||||
"kvdb-memorydb",
|
"kvdb-memorydb",
|
||||||
"kvdb-rocksdb",
|
"kvdb-rocksdb",
|
||||||
"macros",
|
"macros",
|
||||||
|
@ -29,7 +29,7 @@ triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
kvdb-memorydb = "0.1.2"
|
kvdb-memorydb = "0.1.2"
|
||||||
|
@ -1625,7 +1625,7 @@ mod tests {
|
|||||||
use common_types::receipt::{Receipt, TransactionOutcome};
|
use common_types::receipt::{Receipt, TransactionOutcome};
|
||||||
use common_types::transaction::{Transaction, Action};
|
use common_types::transaction::{Transaction, Action};
|
||||||
use crate::generator::{BlockGenerator, BlockBuilder, BlockOptions};
|
use crate::generator::{BlockGenerator, BlockBuilder, BlockOptions};
|
||||||
use ethkey::Secret;
|
use parity_crypto::publickey::Secret;
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
@ -10,13 +10,12 @@ bn = { git = "https://github.com/paritytech/bn", default-features = false }
|
|||||||
common-types = { path = "../types" }
|
common-types = { path = "../types" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethjson = { path = "../../json" }
|
ethjson = { path = "../../json" }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
|
||||||
keccak-hash = "0.4.0"
|
keccak-hash = "0.4.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num = { version = "0.1", default-features = false, features = ["bigint"] }
|
num = { version = "0.1", default-features = false, features = ["bigint"] }
|
||||||
parity-bytes = "0.1"
|
parity-bytes = "0.1"
|
||||||
eip-152 = { path = "../../util/EIP-152" }
|
eip-152 = { path = "../../util/EIP-152" }
|
||||||
parity-crypto = "0.4.0"
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
byteorder = "1.3.2"
|
byteorder = "1.3.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -28,7 +28,7 @@ use byteorder::{BigEndian, LittleEndian, ReadBytesExt};
|
|||||||
use common_types::errors::EthcoreError;
|
use common_types::errors::EthcoreError;
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use ethkey::{Signature, recover as ec_recover};
|
use parity_crypto::publickey::{Signature, recover as ec_recover};
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use log::{warn, trace};
|
use log::{warn, trace};
|
||||||
use num::{BigUint, Zero, One};
|
use num::{BigUint, Zero, One};
|
||||||
|
@ -13,17 +13,19 @@ bytes = { package = "parity-bytes", version = "0.1.0" }
|
|||||||
client-traits = { path = "../client-traits" }
|
client-traits = { path = "../client-traits" }
|
||||||
common-types = { path = "../types" }
|
common-types = { path = "../types" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
machine = { path = "../machine" }
|
machine = { path = "../machine" }
|
||||||
vm = { path = "../vm" }
|
vm = { path = "../vm" }
|
||||||
|
|
||||||
# used from test-helpers
|
# used from test-helpers
|
||||||
accounts = { package = "ethcore-accounts", path = "../../accounts", optional = true }
|
accounts = { package = "ethcore-accounts", path = "../../accounts", optional = true }
|
||||||
log = { version = "0.4.8", optional = true }
|
log = { version = "0.4.8", optional = true }
|
||||||
|
ethkey = { path = "../../accounts/ethkey", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
accounts = { package = "ethcore-accounts", path = "../../accounts" }
|
accounts = { package = "ethcore-accounts", path = "../../accounts" }
|
||||||
|
ethkey = { path = "../../accounts/ethkey" }
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test-helpers = ["accounts", "log"]
|
test-helpers = ["accounts", "log", "ethkey"]
|
||||||
|
@ -37,7 +37,7 @@ use common_types::{
|
|||||||
use client_traits::EngineClient;
|
use client_traits::EngineClient;
|
||||||
|
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use ethkey::Signature;
|
use parity_crypto::publickey::Signature;
|
||||||
use machine::{
|
use machine::{
|
||||||
Machine,
|
Machine,
|
||||||
executed_block::ExecutedBlock,
|
executed_block::ExecutedBlock,
|
||||||
|
@ -17,27 +17,27 @@
|
|||||||
//! A signer used by Engines which need to sign messages.
|
//! A signer used by Engines which need to sign messages.
|
||||||
|
|
||||||
use ethereum_types::{H256, Address};
|
use ethereum_types::{H256, Address};
|
||||||
use ethkey::{self, Signature};
|
use parity_crypto::publickey::{Signature, KeyPair, Error};
|
||||||
|
|
||||||
/// Everything that an Engine needs to sign messages.
|
/// Everything that an Engine needs to sign messages.
|
||||||
pub trait EngineSigner: Send + Sync {
|
pub trait EngineSigner: Send + Sync {
|
||||||
/// Sign a consensus message hash.
|
/// Sign a consensus message hash.
|
||||||
fn sign(&self, hash: H256) -> Result<Signature, ethkey::Error>;
|
fn sign(&self, hash: H256) -> Result<Signature, Error>;
|
||||||
|
|
||||||
/// Signing address
|
/// Signing address
|
||||||
fn address(&self) -> Address;
|
fn address(&self) -> Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `EngineSigner` from given key pair.
|
/// Creates a new `EngineSigner` from given key pair.
|
||||||
pub fn from_keypair(keypair: ethkey::KeyPair) -> Box<dyn EngineSigner> {
|
pub fn from_keypair(keypair: KeyPair) -> Box<dyn EngineSigner> {
|
||||||
Box::new(Signer(keypair))
|
Box::new(Signer(keypair))
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Signer(ethkey::KeyPair);
|
struct Signer(KeyPair);
|
||||||
|
|
||||||
impl EngineSigner for Signer {
|
impl EngineSigner for Signer {
|
||||||
fn sign(&self, hash: H256) -> Result<Signature, ethkey::Error> {
|
fn sign(&self, hash: H256) -> Result<Signature, Error> {
|
||||||
ethkey::sign(self.0.secret(), &hash)
|
parity_crypto::publickey::sign(self.0.secret(), &hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn address(&self) -> Address {
|
fn address(&self) -> Address {
|
||||||
|
@ -19,25 +19,26 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ethereum_types::{Address, H256};
|
use ethereum_types::{Address, H256};
|
||||||
use ethkey::{Password, Signature};
|
use ethkey::Password;
|
||||||
|
use parity_crypto::publickey::{Signature, Error};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use accounts::{self, AccountProvider, SignError};
|
use accounts::{self, AccountProvider, SignError};
|
||||||
|
|
||||||
use crate::signer::EngineSigner;
|
use crate::signer::EngineSigner;
|
||||||
|
|
||||||
impl EngineSigner for (Arc<AccountProvider>, Address, Password) {
|
impl EngineSigner for (Arc<AccountProvider>, Address, Password) {
|
||||||
fn sign(&self, hash: H256) -> Result<Signature, ethkey::Error> {
|
fn sign(&self, hash: H256) -> Result<Signature, Error> {
|
||||||
match self.0.sign(self.1, Some(self.2.clone()), hash) {
|
match self.0.sign(self.1, Some(self.2.clone()), hash) {
|
||||||
Err(SignError::NotUnlocked) => unreachable!(),
|
Err(SignError::NotUnlocked) => unreachable!(),
|
||||||
Err(SignError::NotFound) => Err(ethkey::Error::InvalidAddress),
|
Err(SignError::NotFound) => Err(Error::InvalidAddress),
|
||||||
Err(SignError::SStore(accounts::Error::EthKey(err))) => Err(err),
|
Err(SignError::SStore(accounts::Error::EthCrypto(err))) => Err(Error::Custom(err.to_string())),
|
||||||
Err(SignError::SStore(accounts::Error::EthKeyCrypto(err))) => {
|
Err(SignError::SStore(accounts::Error::EthPublicKeyCrypto(err))) => {
|
||||||
warn!("Low level crypto error: {:?}", err);
|
warn!("Low level crypto error: {:?}", err);
|
||||||
Err(ethkey::Error::InvalidSecret)
|
Err(Error::InvalidSecretKey)
|
||||||
},
|
},
|
||||||
Err(SignError::SStore(err)) => {
|
Err(SignError::SStore(err)) => {
|
||||||
warn!("Error signing for engine: {:?}", err);
|
warn!("Error signing for engine: {:?}", err);
|
||||||
Err(ethkey::Error::InvalidSignature)
|
Err(Error::InvalidSignature)
|
||||||
},
|
},
|
||||||
Ok(ok) => Ok(ok),
|
Ok(ok) => Ok(ok),
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ client-traits = { path = "../../client-traits" }
|
|||||||
common-types = { path = "../../types" }
|
common-types = { path = "../../types" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethjson = { path = "../../../json" }
|
ethjson = { path = "../../../json" }
|
||||||
ethkey = { path = "../../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
engine = { path = "../../engine" }
|
engine = { path = "../../engine" }
|
||||||
io = { package = "ethcore-io", path = "../../../util/io" }
|
io = { package = "ethcore-io", path = "../../../util/io" }
|
||||||
itertools = "0.5"
|
itertools = "0.5"
|
||||||
|
@ -51,7 +51,7 @@ use macros::map;
|
|||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use log::{info, debug, error, trace, warn};
|
use log::{info, debug, error, trace, warn};
|
||||||
use engine::signer::EngineSigner;
|
use engine::signer::EngineSigner;
|
||||||
use ethkey::{self, Signature};
|
use parity_crypto::publickey::Signature;
|
||||||
use io::{IoContext, IoHandler, TimerToken, IoService};
|
use io::{IoContext, IoHandler, TimerToken, IoService};
|
||||||
use itertools::{self, Itertools};
|
use itertools::{self, Itertools};
|
||||||
use rlp::{encode, Decodable, DecoderError, Encodable, RlpStream, Rlp};
|
use rlp::{encode, Decodable, DecoderError, Encodable, RlpStream, Rlp};
|
||||||
@ -385,14 +385,14 @@ impl EmptyStep {
|
|||||||
let message = keccak(empty_step_rlp(self.step, &self.parent_hash));
|
let message = keccak(empty_step_rlp(self.step, &self.parent_hash));
|
||||||
let correct_proposer = step_proposer(validators, &self.parent_hash, self.step);
|
let correct_proposer = step_proposer(validators, &self.parent_hash, self.step);
|
||||||
|
|
||||||
ethkey::verify_address(&correct_proposer, &self.signature.into(), &message)
|
parity_crypto::publickey::verify_address(&correct_proposer, &self.signature.into(), &message)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn author(&self) -> Result<Address, Error> {
|
fn author(&self) -> Result<Address, Error> {
|
||||||
let message = keccak(empty_step_rlp(self.step, &self.parent_hash));
|
let message = keccak(empty_step_rlp(self.step, &self.parent_hash));
|
||||||
let public = ethkey::recover(&self.signature.into(), &message)?;
|
let public = parity_crypto::publickey::recover(&self.signature.into(), &message)?;
|
||||||
Ok(ethkey::public_to_address(&public))
|
Ok(parity_crypto::publickey::public_to_address(&public))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sealed(&self) -> SealedEmptyStep {
|
fn sealed(&self) -> SealedEmptyStep {
|
||||||
@ -673,7 +673,7 @@ fn verify_external(header: &Header, validators: &dyn ValidatorSet, empty_steps_t
|
|||||||
};
|
};
|
||||||
|
|
||||||
let header_seal_hash = header_seal_hash(header, empty_steps_rlp);
|
let header_seal_hash = header_seal_hash(header, empty_steps_rlp);
|
||||||
!ethkey::verify_address(&correct_proposer, &proposer_signature, &header_seal_hash)?
|
!parity_crypto::publickey::verify_address(&correct_proposer, &proposer_signature, &header_seal_hash)?
|
||||||
};
|
};
|
||||||
|
|
||||||
if is_invalid_proposer {
|
if is_invalid_proposer {
|
||||||
@ -1663,7 +1663,7 @@ impl Engine for AuthorityRound {
|
|||||||
fn sign(&self, hash: H256) -> Result<Signature, Error> {
|
fn sign(&self, hash: H256) -> Result<Signature, Error> {
|
||||||
Ok(self.signer.read()
|
Ok(self.signer.read()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(ethkey::Error::InvalidAddress)?
|
.ok_or(parity_crypto::publickey::Error::InvalidAddress)?
|
||||||
.sign(hash)?
|
.sign(hash)?
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -1703,7 +1703,7 @@ mod tests {
|
|||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use accounts::AccountProvider;
|
use accounts::AccountProvider;
|
||||||
use ethereum_types::{Address, H520, H256, U256};
|
use ethereum_types::{Address, H520, H256, U256};
|
||||||
use ethkey::Signature;
|
use parity_crypto::publickey::Signature;
|
||||||
use common_types::{
|
use common_types::{
|
||||||
header::Header,
|
header::Header,
|
||||||
engines::{Seal, params::CommonParams},
|
engines::{Seal, params::CommonParams},
|
||||||
@ -2112,7 +2112,7 @@ mod tests {
|
|||||||
SealedEmptyStep { signature, step }
|
SealedEmptyStep { signature, step }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_empty_steps_seal(header: &mut Header, step: u64, block_signature: ðkey::Signature, empty_steps: &[SealedEmptyStep]) {
|
fn set_empty_steps_seal(header: &mut Header, step: u64, block_signature: &Signature, empty_steps: &[SealedEmptyStep]) {
|
||||||
header.set_seal(vec![
|
header.set_seal(vec![
|
||||||
encode(&(step as usize)),
|
encode(&(step as usize)),
|
||||||
encode(&(&**block_signature as &[u8])),
|
encode(&(&**block_signature as &[u8])),
|
||||||
|
@ -12,7 +12,7 @@ common-types = { path = "../../types" }
|
|||||||
engine = { path = "../../engine" }
|
engine = { path = "../../engine" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethjson = { path = "../../../json" }
|
ethjson = { path = "../../../json" }
|
||||||
ethkey = { path = "../../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
machine = { path = "../../machine" }
|
machine = { path = "../../machine" }
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
|
@ -34,7 +34,7 @@ use client_traits::EngineClient;
|
|||||||
use ethereum_types::{H256, H520};
|
use ethereum_types::{H256, H520};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use engine::{Engine, ConstructedVerifier, signer::EngineSigner};
|
use engine::{Engine, ConstructedVerifier, signer::EngineSigner};
|
||||||
use ethkey::{self, Signature};
|
use parity_crypto::publickey::Signature;
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
use machine::{Machine, executed_block::ExecutedBlock};
|
use machine::{Machine, executed_block::ExecutedBlock};
|
||||||
@ -69,7 +69,7 @@ impl engine::EpochVerifier for EpochVerifier {
|
|||||||
fn verify_external(header: &Header, validators: &dyn ValidatorSet) -> Result<(), Error> {
|
fn verify_external(header: &Header, validators: &dyn ValidatorSet) -> Result<(), Error> {
|
||||||
// Check if the signature belongs to a validator, can depend on parent state.
|
// Check if the signature belongs to a validator, can depend on parent state.
|
||||||
let sig = Rlp::new(&header.seal()[0]).as_val::<H520>()?;
|
let sig = Rlp::new(&header.seal()[0]).as_val::<H520>()?;
|
||||||
let signer = ethkey::public_to_address(ðkey::recover(&sig.into(), &header.bare_hash())?);
|
let signer = parity_crypto::publickey::public_to_address(&parity_crypto::publickey::recover(&sig.into(), &header.bare_hash())?);
|
||||||
|
|
||||||
if *header.author() != signer {
|
if *header.author() != signer {
|
||||||
return Err(EngineError::NotAuthorized(*header.author()).into())
|
return Err(EngineError::NotAuthorized(*header.author()).into())
|
||||||
@ -201,7 +201,7 @@ impl Engine for BasicAuthority {
|
|||||||
fn sign(&self, hash: H256) -> Result<Signature, Error> {
|
fn sign(&self, hash: H256) -> Result<Signature, Error> {
|
||||||
Ok(self.signer.read()
|
Ok(self.signer.read()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| ethkey::Error::InvalidAddress)?
|
.ok_or_else(|| parity_crypto::publickey::Error::InvalidAddress)?
|
||||||
.sign(hash)?
|
.sign(hash)?
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ client-traits = { path = "../../client-traits" }
|
|||||||
common-types = { path = "../../types" }
|
common-types = { path = "../../types" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethjson = { path = "../../../json" }
|
ethjson = { path = "../../../json" }
|
||||||
ethkey = { path = "../../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
engine = { path = "../../engine" }
|
engine = { path = "../../engine" }
|
||||||
keccak-hash = "0.4.0"
|
keccak-hash = "0.4.0"
|
||||||
lazy_static = "1.3.0"
|
lazy_static = "1.3.0"
|
||||||
|
@ -72,7 +72,7 @@ use engine::{
|
|||||||
signer::EngineSigner,
|
signer::EngineSigner,
|
||||||
};
|
};
|
||||||
use ethereum_types::{Address, H64, H160, H256, U256};
|
use ethereum_types::{Address, H64, H160, H256, U256};
|
||||||
use ethkey::Signature;
|
use parity_crypto::publickey::Signature;
|
||||||
use keccak_hash::KECCAK_EMPTY_LIST_RLP;
|
use keccak_hash::KECCAK_EMPTY_LIST_RLP;
|
||||||
use log::{trace, warn};
|
use log::{trace, warn};
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
|
@ -26,7 +26,7 @@ use ethcore::{
|
|||||||
};
|
};
|
||||||
use engine::Engine;
|
use engine::Engine;
|
||||||
use ethereum_types::{Address, H256};
|
use ethereum_types::{Address, H256};
|
||||||
use ethkey::{Secret, KeyPair};
|
use parity_crypto::publickey::{Secret, KeyPair};
|
||||||
use state_db::StateDB;
|
use state_db::StateDB;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -183,7 +183,7 @@ impl CliqueTester {
|
|||||||
b.header.set_difficulty(difficulty);
|
b.header.set_difficulty(difficulty);
|
||||||
b.header.set_seal(seal);
|
b.header.set_seal(seal);
|
||||||
|
|
||||||
let sign = ethkey::sign(self.signers[&signer].secret(), &b.header.hash()).unwrap();
|
let sign = parity_crypto::publickey::sign(self.signers[&signer].secret(), &b.header.hash()).unwrap();
|
||||||
let mut extra_data = b.header.extra_data().clone();
|
let mut extra_data = b.header.extra_data().clone();
|
||||||
extra_data.extend_from_slice(&*sign);
|
extra_data.extend_from_slice(&*sign);
|
||||||
b.header.set_extra_data(extra_data);
|
b.header.set_extra_data(extra_data);
|
||||||
|
@ -21,7 +21,7 @@ use common_types::{
|
|||||||
errors::{EthcoreError as Error, EngineError},
|
errors::{EthcoreError as Error, EngineError},
|
||||||
};
|
};
|
||||||
use ethereum_types::{Address, H256};
|
use ethereum_types::{Address, H256};
|
||||||
use ethkey::{public_to_address, recover as ec_recover, Signature};
|
use parity_crypto::publickey::{public_to_address, recover as ec_recover, Signature};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
@ -36,7 +36,7 @@ call-contract = { package = "ethcore-call-contract", path = "../../call-contract
|
|||||||
engine = { path = "../../engine", features = ["test-helpers"] }
|
engine = { path = "../../engine", features = ["test-helpers"] }
|
||||||
env_logger = "0.6.2"
|
env_logger = "0.6.2"
|
||||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||||
ethkey = { path = "../../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
keccak-hash = "0.4.0"
|
keccak-hash = "0.4.0"
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
spec = { path = "../../spec" }
|
spec = { path = "../../spec" }
|
||||||
|
@ -168,7 +168,7 @@ mod tests {
|
|||||||
test_helpers::{generate_dummy_client_with_spec, generate_dummy_client_with_spec_and_data},
|
test_helpers::{generate_dummy_client_with_spec, generate_dummy_client_with_spec_and_data},
|
||||||
};
|
};
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
use ethkey::Secret;
|
use parity_crypto::publickey::Secret;
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use spec;
|
use spec;
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ mod tests {
|
|||||||
miner::{self, MinerService},
|
miner::{self, MinerService},
|
||||||
test_helpers::{generate_dummy_client_with_spec, generate_dummy_client_with_spec_and_data}
|
test_helpers::{generate_dummy_client_with_spec, generate_dummy_client_with_spec_and_data}
|
||||||
};
|
};
|
||||||
use ethkey::Secret;
|
use parity_crypto::publickey::Secret;
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
@ -24,7 +24,7 @@ vm = { path = "../vm" }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
ethcore = { path = "..", features = ["test-helpers"] }
|
ethcore = { path = "..", features = ["test-helpers"] }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
evm = { path = "../evm" }
|
evm = { path = "../evm" }
|
||||||
keccak-hash = "0.4.0"
|
keccak-hash = "0.4.0"
|
||||||
pod = { path = "../pod" }
|
pod = { path = "../pod" }
|
||||||
|
@ -270,7 +270,7 @@ mod tests {
|
|||||||
use account_state::{Account, CleanupMode};
|
use account_state::{Account, CleanupMode};
|
||||||
use common_types::transaction::*;
|
use common_types::transaction::*;
|
||||||
use keccak_hash::{keccak, KECCAK_NULL_RLP};
|
use keccak_hash::{keccak, KECCAK_NULL_RLP};
|
||||||
use ethkey::Secret;
|
use parity_crypto::publickey::Secret;
|
||||||
use ethereum_types::{H256, U256, Address, BigEndianHash};
|
use ethereum_types::{H256, U256, Address, BigEndianHash};
|
||||||
use ethcore::{
|
use ethcore::{
|
||||||
test_helpers::{get_temp_state, get_temp_state_db}
|
test_helpers::{get_temp_state, get_temp_state_db}
|
||||||
|
@ -37,7 +37,7 @@ common-types = { path = "../types", features = ["test-helpers"] }
|
|||||||
ethcore = { path = "../", features = ["test-helpers"] }
|
ethcore = { path = "../", features = ["test-helpers"] }
|
||||||
ethcore-io = { path = "../../util/io" }
|
ethcore-io = { path = "../../util/io" }
|
||||||
ethjson = { path = "../../json" }
|
ethjson = { path = "../../json" }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
macros = { path = "../../util/macros" }
|
macros = { path = "../../util/macros" }
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
spec = { path = "../spec" }
|
spec = { path = "../spec" }
|
||||||
|
@ -1233,7 +1233,7 @@ mod tests {
|
|||||||
errors::ExecutionError,
|
errors::ExecutionError,
|
||||||
transaction::{Action, Transaction},
|
transaction::{Action, Transaction},
|
||||||
};
|
};
|
||||||
use ethkey::{Generator, Random};
|
use parity_crypto::publickey::{Generator, Random};
|
||||||
use evm::{Factory, VMType, evm_test, evm_test_ignore};
|
use evm::{Factory, VMType, evm_test, evm_test_ignore};
|
||||||
use macros::vec_into;
|
use macros::vec_into;
|
||||||
use vm::{ActionParams, ActionValue, CallType, EnvInfo, CreateContractAddress};
|
use vm::{ActionParams, ActionValue, CallType, EnvInfo, CreateContractAddress};
|
||||||
|
@ -435,7 +435,7 @@ mod tests {
|
|||||||
header.set_number(15);
|
header.set_number(15);
|
||||||
|
|
||||||
let res = machine.verify_transaction_basic(&transaction, &header);
|
let res = machine.verify_transaction_basic(&transaction, &header);
|
||||||
assert_eq!(res, Err(transaction::Error::InvalidSignature("Crypto error (Invalid EC signature)".into())));
|
assert_eq!(res, Err(transaction::Error::InvalidSignature("invalid EC signature".into())));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -178,7 +178,7 @@ mod test {
|
|||||||
miner::Miner,
|
miner::Miner,
|
||||||
test_helpers,
|
test_helpers,
|
||||||
};
|
};
|
||||||
use ethkey::{Secret, KeyPair};
|
use parity_crypto::publickey::{Secret, KeyPair};
|
||||||
use ethcore_io::IoChannel;
|
use ethcore_io::IoChannel;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
|
|
||||||
@ -200,13 +200,13 @@ mod test {
|
|||||||
Arc::new(Miner::new_for_tests(&spec, None)),
|
Arc::new(Miner::new_for_tests(&spec, None)),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let key1 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000001")).unwrap();
|
let key1 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap()).unwrap();
|
||||||
let key2 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000002")).unwrap();
|
let key2 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000002").unwrap()).unwrap();
|
||||||
let key3 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000003")).unwrap();
|
let key3 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000003").unwrap()).unwrap();
|
||||||
let key4 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000004")).unwrap();
|
let key4 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000004").unwrap()).unwrap();
|
||||||
let key5 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000005")).unwrap();
|
let key5 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000005").unwrap()).unwrap();
|
||||||
let key6 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000006")).unwrap();
|
let key6 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000006").unwrap()).unwrap();
|
||||||
let key7 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000007")).unwrap();
|
let key7 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000007").unwrap()).unwrap();
|
||||||
|
|
||||||
let filter = TransactionFilter::from_params(spec.params()).unwrap();
|
let filter = TransactionFilter::from_params(spec.params()).unwrap();
|
||||||
let mut basic_tx = Transaction::default();
|
let mut basic_tx = Transaction::default();
|
||||||
@ -279,7 +279,7 @@ mod test {
|
|||||||
Arc::new(Miner::new_for_tests(&spec, None)),
|
Arc::new(Miner::new_for_tests(&spec, None)),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let key1 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000001")).unwrap();
|
let key1 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap()).unwrap();
|
||||||
|
|
||||||
// The only difference to version 2 is that the contract now knows the transaction's gas price and data.
|
// The only difference to version 2 is that the contract now knows the transaction's gas price and data.
|
||||||
// So we only test those: The contract allows only transactions with either nonzero gas price or short data.
|
// So we only test those: The contract allows only transactions with either nonzero gas price or short data.
|
||||||
@ -321,10 +321,10 @@ mod test {
|
|||||||
Arc::new(Miner::new_for_tests(&spec, None)),
|
Arc::new(Miner::new_for_tests(&spec, None)),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let key1 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000001")).unwrap();
|
let key1 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001").unwrap()).unwrap();
|
||||||
let key2 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000002")).unwrap();
|
let key2 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000002").unwrap()).unwrap();
|
||||||
let key3 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000003")).unwrap();
|
let key3 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000003").unwrap()).unwrap();
|
||||||
let key4 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000004")).unwrap();
|
let key4 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000004").unwrap()).unwrap();
|
||||||
|
|
||||||
let filter = TransactionFilter::from_params(spec.params()).unwrap();
|
let filter = TransactionFilter::from_params(spec.params()).unwrap();
|
||||||
let mut basic_tx = Transaction::default();
|
let mut basic_tx = Transaction::default();
|
||||||
|
@ -20,7 +20,6 @@ ethcore-io = { path = "../../util/io" }
|
|||||||
ethcore-miner = { path = "../../miner" }
|
ethcore-miner = { path = "../../miner" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethjson = { path = "../../json" }
|
ethjson = { path = "../../json" }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
|
||||||
fetch = { path = "../../util/fetch" }
|
fetch = { path = "../../util/fetch" }
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
parity-util-mem = "0.2.0"
|
parity-util-mem = "0.2.0"
|
||||||
@ -32,7 +31,7 @@ log = "0.4"
|
|||||||
machine = { path = "../machine" }
|
machine = { path = "../machine" }
|
||||||
journaldb = { path = "../../util/journaldb" }
|
journaldb = { path = "../../util/journaldb" }
|
||||||
parity-bytes = "0.1"
|
parity-bytes = "0.1"
|
||||||
parity-crypto = "0.4.0"
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
trie-db = "0.15.0"
|
trie-db = "0.15.0"
|
||||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||||
|
@ -26,7 +26,7 @@ use std::collections::hash_map::Entry;
|
|||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use ethereum_types::{H128, H256, Address};
|
use ethereum_types::{H128, H256, Address};
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use ethkey::{Signature, Public};
|
use crypto::publickey::{Signature, Public};
|
||||||
use crypto;
|
use crypto;
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use fetch::{Fetch, Client as FetchClient, Method, BodyReader, Request};
|
use fetch::{Fetch, Client as FetchClient, Method, BodyReader, Request};
|
||||||
|
@ -23,8 +23,7 @@ use types::{
|
|||||||
errors::{EthcoreError, ExecutionError},
|
errors::{EthcoreError, ExecutionError},
|
||||||
transaction::Error as TransactionError,
|
transaction::Error as TransactionError,
|
||||||
};
|
};
|
||||||
use ethkey::Error as KeyError;
|
use crypto::publickey::Error as CryptoError;
|
||||||
use ethkey::crypto::Error as CryptoError;
|
|
||||||
use txpool::VerifiedTransaction;
|
use txpool::VerifiedTransaction;
|
||||||
use private_transactions::VerifiedPrivateTransaction;
|
use private_transactions::VerifiedPrivateTransaction;
|
||||||
use serde_json::{Error as SerdeError};
|
use serde_json::{Error as SerdeError};
|
||||||
@ -123,9 +122,6 @@ pub enum Error {
|
|||||||
/// VM execution error.
|
/// VM execution error.
|
||||||
#[display(fmt = "VM execution error {}", _0)]
|
#[display(fmt = "VM execution error {}", _0)]
|
||||||
Execution(ExecutionError),
|
Execution(ExecutionError),
|
||||||
/// General signing error.
|
|
||||||
#[display(fmt = "General signing error {}", _0)]
|
|
||||||
Key(KeyError),
|
|
||||||
/// Error of transactions processing.
|
/// Error of transactions processing.
|
||||||
#[display(fmt = "Error of transactions processing {}", _0)]
|
#[display(fmt = "Error of transactions processing {}", _0)]
|
||||||
Transaction(TransactionError),
|
Transaction(TransactionError),
|
||||||
@ -147,7 +143,6 @@ impl error::Error for Error {
|
|||||||
Error::Json(e) => Some(e),
|
Error::Json(e) => Some(e),
|
||||||
Error::Crypto(e) => Some(e),
|
Error::Crypto(e) => Some(e),
|
||||||
Error::Execution(e) => Some(e),
|
Error::Execution(e) => Some(e),
|
||||||
Error::Key(e) => Some(e),
|
|
||||||
Error::Transaction(e) => Some(e),
|
Error::Transaction(e) => Some(e),
|
||||||
Error::Ethcore(e) => Some(e),
|
Error::Ethcore(e) => Some(e),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -167,12 +162,6 @@ impl From<std::io::Error> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<KeyError> for Error {
|
|
||||||
fn from(err: KeyError) -> Self {
|
|
||||||
Error::Key(err).into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<CryptoError> for Error {
|
impl From<CryptoError> for Error {
|
||||||
fn from(err: CryptoError) -> Self {
|
fn from(err: CryptoError) -> Self {
|
||||||
Error::Crypto(err).into()
|
Error::Crypto(err).into()
|
||||||
|
@ -145,7 +145,8 @@ impl KeyProvider for StoringKeyProvider {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use ethkey::{Secret, KeyPair};
|
use std::str::FromStr;
|
||||||
|
use crypto::publickey::{Secret, KeyPair};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use super::*;
|
use super::*;
|
||||||
use registrar::RegistrarClient;
|
use registrar::RegistrarClient;
|
||||||
@ -185,7 +186,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_update_acl_contract() {
|
fn should_update_acl_contract() {
|
||||||
let key = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000011")).unwrap();
|
let key = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000011").unwrap()).unwrap();
|
||||||
let client = DummyRegistryClient::new(Some(key.address()));
|
let client = DummyRegistryClient::new(Some(key.address()));
|
||||||
let keys_data = SecretStoreKeys::new(Arc::new(client), None);
|
let keys_data = SecretStoreKeys::new(Arc::new(client), None);
|
||||||
keys_data.update_acl_contract();
|
keys_data.update_acl_contract();
|
||||||
|
@ -36,7 +36,6 @@ extern crate ethcore_io as io;
|
|||||||
extern crate ethcore_miner;
|
extern crate ethcore_miner;
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethjson;
|
extern crate ethjson;
|
||||||
extern crate ethkey;
|
|
||||||
extern crate fetch;
|
extern crate fetch;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate parity_util_mem;
|
extern crate parity_util_mem;
|
||||||
@ -95,7 +94,7 @@ use hash::keccak;
|
|||||||
use rlp::*;
|
use rlp::*;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethkey::{Signature, recover, public_to_address};
|
use crypto::publickey::{Signature, recover, public_to_address, Message, KeyPair};
|
||||||
use io::{IoChannel, IoHandler, IoContext, TimerToken};
|
use io::{IoChannel, IoHandler, IoContext, TimerToken};
|
||||||
use machine::{
|
use machine::{
|
||||||
executive::{Executive, TransactOptions, contract_address as ethcore_contract_address},
|
executive::{Executive, TransactOptions, contract_address as ethcore_contract_address},
|
||||||
@ -172,7 +171,7 @@ pub trait Signer: Send + Sync {
|
|||||||
/// Decrypt payload using private key of given address.
|
/// Decrypt payload using private key of given address.
|
||||||
fn decrypt(&self, account: Address, shared_mac: &[u8], payload: &[u8]) -> Result<Vec<u8>, Error>;
|
fn decrypt(&self, account: Address, shared_mac: &[u8], payload: &[u8]) -> Result<Vec<u8>, Error>;
|
||||||
/// Sign given hash using provided account.
|
/// Sign given hash using provided account.
|
||||||
fn sign(&self, account: Address, hash: ethkey::Message) -> Result<Signature, Error>;
|
fn sign(&self, account: Address, hash: Message) -> Result<Signature, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Signer implementation that errors on any request.
|
/// Signer implementation that errors on any request.
|
||||||
@ -182,22 +181,22 @@ impl Signer for DummySigner {
|
|||||||
Err("Decrypting is not supported.".to_owned())?
|
Err("Decrypting is not supported.".to_owned())?
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sign(&self, _account: Address, _hash: ethkey::Message) -> Result<Signature, Error> {
|
fn sign(&self, _account: Address, _hash: Message) -> Result<Signature, Error> {
|
||||||
Err("Signing is not supported.".to_owned())?
|
Err("Signing is not supported.".to_owned())?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Signer implementation using multiple keypairs
|
/// Signer implementation using multiple keypairs
|
||||||
pub struct KeyPairSigner(pub Vec<ethkey::KeyPair>);
|
pub struct KeyPairSigner(pub Vec<KeyPair>);
|
||||||
impl Signer for KeyPairSigner {
|
impl Signer for KeyPairSigner {
|
||||||
fn decrypt(&self, account: Address, shared_mac: &[u8], payload: &[u8]) -> Result<Vec<u8>, Error> {
|
fn decrypt(&self, account: Address, shared_mac: &[u8], payload: &[u8]) -> Result<Vec<u8>, Error> {
|
||||||
let kp = self.0.iter().find(|k| k.address() == account).ok_or(ethkey::Error::InvalidAddress)?;
|
let kp = self.0.iter().find(|k| k.address() == account).ok_or(crypto::publickey::Error::InvalidAddress)?;
|
||||||
Ok(ethkey::crypto::ecies::decrypt(kp.secret(), shared_mac, payload)?)
|
Ok(crypto::publickey::ecies::decrypt(kp.secret(), shared_mac, payload)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sign(&self, account: Address, hash: ethkey::Message) -> Result<Signature, Error> {
|
fn sign(&self, account: Address, hash: Message) -> Result<Signature, Error> {
|
||||||
let kp = self.0.iter().find(|k| k.address() == account).ok_or(ethkey::Error::InvalidAddress)?;
|
let kp = self.0.iter().find(|k| k.address() == account).ok_or(crypto::publickey::Error::InvalidAddress)?;
|
||||||
Ok(ethkey::sign(kp.secret(), &hash)?)
|
Ok(crypto::publickey::sign(kp.secret(), &hash)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ use ethereum_types::{H256, U256, Address, BigEndianHash};
|
|||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use rlp::Encodable;
|
use rlp::Encodable;
|
||||||
use ethkey::Signature;
|
use crypto::publickey::Signature;
|
||||||
use types::transaction::signature::{add_chain_replay_protection, check_replay_protection};
|
use types::transaction::signature::{add_chain_replay_protection, check_replay_protection};
|
||||||
|
|
||||||
/// Message with private transaction encrypted
|
/// Message with private transaction encrypted
|
||||||
|
@ -22,7 +22,7 @@ use bytes::Bytes;
|
|||||||
use ethcore_miner::pool;
|
use ethcore_miner::pool;
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use parity_util_mem::MallocSizeOfExt;
|
use parity_util_mem::MallocSizeOfExt;
|
||||||
use ethkey::Signature;
|
use crypto::publickey::Signature;
|
||||||
use messages::PrivateTransaction;
|
use messages::PrivateTransaction;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use types::transaction::{UnverifiedTransaction, SignedTransaction};
|
use types::transaction::{UnverifiedTransaction, SignedTransaction};
|
||||||
|
@ -22,7 +22,7 @@ extern crate env_logger;
|
|||||||
extern crate ethcore;
|
extern crate ethcore;
|
||||||
extern crate ethcore_io;
|
extern crate ethcore_io;
|
||||||
extern crate ethcore_private_tx;
|
extern crate ethcore_private_tx;
|
||||||
extern crate ethkey;
|
extern crate parity_crypto;
|
||||||
extern crate keccak_hash as hash;
|
extern crate keccak_hash as hash;
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
extern crate machine;
|
extern crate machine;
|
||||||
@ -32,6 +32,7 @@ extern crate spec;
|
|||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::str::FromStr;
|
||||||
use rustc_hex::{FromHex, ToHex};
|
use rustc_hex::{FromHex, ToHex};
|
||||||
use types::ids::BlockId;
|
use types::ids::BlockId;
|
||||||
use types::transaction::{Transaction, Action};
|
use types::transaction::{Transaction, Action};
|
||||||
@ -40,7 +41,7 @@ use ethcore::{
|
|||||||
miner::Miner,
|
miner::Miner,
|
||||||
};
|
};
|
||||||
use client_traits::BlockChainClient;
|
use client_traits::BlockChainClient;
|
||||||
use ethkey::{Secret, KeyPair, Signature};
|
use parity_crypto::publickey::{Secret, KeyPair, Signature};
|
||||||
use machine::executive::contract_address;
|
use machine::executive::contract_address;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
|
|
||||||
@ -52,10 +53,10 @@ fn private_contract() {
|
|||||||
let _ = ::env_logger::try_init();
|
let _ = ::env_logger::try_init();
|
||||||
let client = generate_dummy_client(0);
|
let client = generate_dummy_client(0);
|
||||||
let chain_id = client.signing_chain_id();
|
let chain_id = client.signing_chain_id();
|
||||||
let key1 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000011")).unwrap();
|
let key1 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000011").unwrap()).unwrap();
|
||||||
let _key2 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000012")).unwrap();
|
let _key2 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000012").unwrap()).unwrap();
|
||||||
let key3 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000013")).unwrap();
|
let key3 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000013").unwrap()).unwrap();
|
||||||
let key4 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000014")).unwrap();
|
let key4 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000014").unwrap()).unwrap();
|
||||||
|
|
||||||
let signer = Arc::new(ethcore_private_tx::KeyPairSigner(vec![key1.clone(), key3.clone(), key4.clone()]));
|
let signer = Arc::new(ethcore_private_tx::KeyPairSigner(vec![key1.clone(), key3.clone(), key4.clone()]));
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ fn private_contract() {
|
|||||||
let private_state = pm.execute_private_transaction(BlockId::Latest, &private_tx).unwrap();
|
let private_state = pm.execute_private_transaction(BlockId::Latest, &private_tx).unwrap();
|
||||||
let nonced_state_hash = pm.calculate_state_hash(&private_state, private_contract_nonce);
|
let nonced_state_hash = pm.calculate_state_hash(&private_state, private_contract_nonce);
|
||||||
let signatures: Vec<_> = [&key3, &key4].iter().map(|k|
|
let signatures: Vec<_> = [&key3, &key4].iter().map(|k|
|
||||||
Signature::from(::ethkey::sign(&k.secret(), &nonced_state_hash).unwrap().into_electrum())).collect();
|
Signature::from(parity_crypto::publickey::sign(&k.secret(), &nonced_state_hash).unwrap().into_electrum())).collect();
|
||||||
let public_tx = pm.public_transaction(private_state, &private_tx, &signatures, 1.into(), 0.into()).unwrap();
|
let public_tx = pm.public_transaction(private_state, &private_tx, &signatures, 1.into(), 0.into()).unwrap();
|
||||||
let public_tx = public_tx.sign(&key1.secret(), chain_id);
|
let public_tx = public_tx.sign(&key1.secret(), chain_id);
|
||||||
push_block_with_transactions(&client, &[public_tx]);
|
push_block_with_transactions(&client, &[public_tx]);
|
||||||
@ -145,7 +146,7 @@ fn private_contract() {
|
|||||||
let private_state = pm.execute_private_transaction(BlockId::Latest, &private_tx).unwrap();
|
let private_state = pm.execute_private_transaction(BlockId::Latest, &private_tx).unwrap();
|
||||||
let private_state_hash = keccak(&private_state);
|
let private_state_hash = keccak(&private_state);
|
||||||
let signatures: Vec<_> = [&key4].iter().map(|k|
|
let signatures: Vec<_> = [&key4].iter().map(|k|
|
||||||
Signature::from(::ethkey::sign(&k.secret(), &private_state_hash).unwrap().into_electrum())).collect();
|
Signature::from(parity_crypto::publickey::sign(&k.secret(), &private_state_hash).unwrap().into_electrum())).collect();
|
||||||
let public_tx = pm.public_transaction(private_state, &private_tx, &signatures, 2.into(), 0.into()).unwrap();
|
let public_tx = pm.public_transaction(private_state, &private_tx, &signatures, 2.into(), 0.into()).unwrap();
|
||||||
let public_tx = public_tx.sign(&key1.secret(), chain_id);
|
let public_tx = public_tx.sign(&key1.secret(), chain_id);
|
||||||
push_block_with_transactions(&client, &[public_tx]);
|
push_block_with_transactions(&client, &[public_tx]);
|
||||||
@ -191,10 +192,10 @@ fn call_other_private_contract() {
|
|||||||
// Create client and provider
|
// Create client and provider
|
||||||
let client = generate_dummy_client(0);
|
let client = generate_dummy_client(0);
|
||||||
let chain_id = client.signing_chain_id();
|
let chain_id = client.signing_chain_id();
|
||||||
let key1 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000011")).unwrap();
|
let key1 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000011").unwrap()).unwrap();
|
||||||
let _key2 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000012")).unwrap();
|
let _key2 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000012").unwrap()).unwrap();
|
||||||
let key3 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000013")).unwrap();
|
let key3 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000013").unwrap()).unwrap();
|
||||||
let key4 = KeyPair::from_secret(Secret::from("0000000000000000000000000000000000000000000000000000000000000014")).unwrap();
|
let key4 = KeyPair::from_secret(Secret::from_str("0000000000000000000000000000000000000000000000000000000000000014").unwrap()).unwrap();
|
||||||
let signer = Arc::new(ethcore_private_tx::KeyPairSigner(vec![key1.clone(), key3.clone(), key4.clone()]));
|
let signer = Arc::new(ethcore_private_tx::KeyPairSigner(vec![key1.clone(), key3.clone(), key4.clone()]));
|
||||||
|
|
||||||
let config = ProviderConfig{
|
let config = ProviderConfig{
|
||||||
@ -268,7 +269,7 @@ fn call_other_private_contract() {
|
|||||||
let private_state = pm.execute_private_transaction(BlockId::Latest, &private_tx).unwrap();
|
let private_state = pm.execute_private_transaction(BlockId::Latest, &private_tx).unwrap();
|
||||||
let nonced_state_hash = pm.calculate_state_hash(&private_state, private_contract_nonce);
|
let nonced_state_hash = pm.calculate_state_hash(&private_state, private_contract_nonce);
|
||||||
let signatures: Vec<_> = [&key3, &key4].iter().map(|k|
|
let signatures: Vec<_> = [&key3, &key4].iter().map(|k|
|
||||||
Signature::from(::ethkey::sign(&k.secret(), &nonced_state_hash).unwrap().into_electrum())).collect();
|
Signature::from(parity_crypto::publickey::sign(&k.secret(), &nonced_state_hash).unwrap().into_electrum())).collect();
|
||||||
let public_tx = pm.public_transaction(private_state, &private_tx, &signatures, 2.into(), 0.into()).unwrap();
|
let public_tx = pm.public_transaction(private_state, &private_tx, &signatures, 2.into(), 0.into()).unwrap();
|
||||||
let public_tx = public_tx.sign(&key1.secret(), chain_id);
|
let public_tx = public_tx.sign(&key1.secret(), chain_id);
|
||||||
push_block_with_transactions(&client, &[public_tx]);
|
push_block_with_transactions(&client, &[public_tx]);
|
||||||
|
@ -18,7 +18,6 @@ ethcore = { path = "../..", features = ["test-helpers"] }
|
|||||||
ethcore-db = { path = "../../db" }
|
ethcore-db = { path = "../../db" }
|
||||||
ethcore-io = { path = "../../../util/io" }
|
ethcore-io = { path = "../../../util/io" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethkey = { path = "../../../accounts/ethkey" }
|
|
||||||
ethtrie = { package = "patricia-trie-ethereum", path = "../../../util/patricia-trie-ethereum" }
|
ethtrie = { package = "patricia-trie-ethereum", path = "../../../util/patricia-trie-ethereum" }
|
||||||
hash-db = "0.15.0"
|
hash-db = "0.15.0"
|
||||||
journaldb = { path = "../../../util/journaldb" }
|
journaldb = { path = "../../../util/journaldb" }
|
||||||
@ -28,6 +27,7 @@ kvdb = "0.1"
|
|||||||
kvdb-rocksdb = { version = "0.1.5" }
|
kvdb-rocksdb = { version = "0.1.5" }
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rand_xorshift = "0.2"
|
rand_xorshift = "0.2"
|
||||||
rlp = "0.4.2"
|
rlp = "0.4.2"
|
||||||
|
@ -30,7 +30,7 @@ use ethcore::{
|
|||||||
miner::{self, MinerService},
|
miner::{self, MinerService},
|
||||||
};
|
};
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
use ethkey::Secret;
|
use parity_crypto::publickey::Secret;
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
@ -2785,7 +2785,7 @@ mod tests {
|
|||||||
|
|
||||||
use blockchain::{ExtrasInsert, BlockProvider};
|
use blockchain::{ExtrasInsert, BlockProvider};
|
||||||
use client_traits::{BlockChainClient, ChainInfo};
|
use client_traits::{BlockChainClient, ChainInfo};
|
||||||
use ethkey::KeyPair;
|
use parity_crypto::publickey::KeyPair;
|
||||||
use types::{
|
use types::{
|
||||||
encoded,
|
encoded,
|
||||||
engines::ForkChoice,
|
engines::ForkChoice,
|
||||||
|
@ -73,7 +73,7 @@ extern crate ethcore_stratum;
|
|||||||
extern crate ethash;
|
extern crate ethash;
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-helpers"))]
|
#[cfg(any(test, feature = "test-helpers"))]
|
||||||
extern crate ethkey;
|
extern crate parity_crypto;
|
||||||
#[cfg(any(test, feature = "test-helpers"))]
|
#[cfg(any(test, feature = "test-helpers"))]
|
||||||
extern crate ethjson;
|
extern crate ethjson;
|
||||||
#[cfg(any(test, feature = "test-helpers"))]
|
#[cfg(any(test, feature = "test-helpers"))]
|
||||||
|
@ -1509,7 +1509,7 @@ mod tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use accounts::AccountProvider;
|
use accounts::AccountProvider;
|
||||||
use ethkey::{Generator, Random};
|
use parity_crypto::publickey::{Generator, Random};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ use blockchain::{BlockChain, BlockChainDB, BlockChainDBHandler, Config as BlockC
|
|||||||
use blooms_db;
|
use blooms_db;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use ethkey::KeyPair;
|
use parity_crypto::publickey::KeyPair;
|
||||||
use evm::Factory as EvmFactory;
|
use evm::Factory as EvmFactory;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
|
@ -28,7 +28,7 @@ use bytes::Bytes;
|
|||||||
use db::{NUM_COLUMNS, COL_STATE};
|
use db::{NUM_COLUMNS, COL_STATE};
|
||||||
use ethcore_miner::pool::VerifiedTransaction;
|
use ethcore_miner::pool::VerifiedTransaction;
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use ethkey::{Generator, Random};
|
use parity_crypto::publickey::{Generator, Random};
|
||||||
use ethtrie;
|
use ethtrie;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
@ -19,7 +19,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use account_state::state::StateInfo;
|
use account_state::state::StateInfo;
|
||||||
use ethereum_types::{U256, Address};
|
use ethereum_types::{U256, Address};
|
||||||
use ethkey::KeyPair;
|
use parity_crypto::publickey::KeyPair;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Client tests of tracing
|
//! Client tests of tracing
|
||||||
|
|
||||||
use ethkey::KeyPair;
|
use parity_crypto::publickey::KeyPair;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use block::*;
|
use block::*;
|
||||||
use ethereum_types::{U256, Address};
|
use ethereum_types::{U256, Address};
|
||||||
|
@ -17,7 +17,6 @@ enum_primitive = "0.1.1"
|
|||||||
ethcore-io = { path = "../../util/io" }
|
ethcore-io = { path = "../../util/io" }
|
||||||
ethcore-private-tx = { path = "../private-tx" }
|
ethcore-private-tx = { path = "../private-tx" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
|
||||||
fastmap = { path = "../../util/fastmap" }
|
fastmap = { path = "../../util/fastmap" }
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
keccak-hash = "0.4.0"
|
keccak-hash = "0.4.0"
|
||||||
@ -26,6 +25,7 @@ log = "0.4"
|
|||||||
macros = { path = "../../util/macros" }
|
macros = { path = "../../util/macros" }
|
||||||
network = { package = "ethcore-network", path = "../../util/network" }
|
network = { package = "ethcore-network", path = "../../util/network" }
|
||||||
parity-runtime = { path = "../../util/runtime" }
|
parity-runtime = { path = "../../util/runtime" }
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
parity-util-mem = "0.2.0"
|
parity-util-mem = "0.2.0"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
|
@ -39,7 +39,7 @@ use devp2p::NetworkService;
|
|||||||
use ethcore_io::TimerToken;
|
use ethcore_io::TimerToken;
|
||||||
use ethcore_private_tx::PrivateStateDB;
|
use ethcore_private_tx::PrivateStateDB;
|
||||||
use ethereum_types::{H256, H512, U256};
|
use ethereum_types::{H256, H512, U256};
|
||||||
use ethkey::Secret;
|
use parity_crypto::publickey::Secret;
|
||||||
use futures::sync::mpsc as futures_mpsc;
|
use futures::sync::mpsc as futures_mpsc;
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use light::client::AsLightClient;
|
use light::client::AsLightClient;
|
||||||
|
@ -647,7 +647,7 @@ mod tests {
|
|||||||
use crate::tests::{helpers::TestIo, snapshot::TestSnapshotService};
|
use crate::tests::{helpers::TestIo, snapshot::TestSnapshotService};
|
||||||
|
|
||||||
use ethcore::test_helpers::TestBlockChainClient;
|
use ethcore::test_helpers::TestBlockChainClient;
|
||||||
use ethkey::{Random, Generator};
|
use parity_crypto::publickey::{Random, Generator};
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use rlp::{encode_list, RlpStream};
|
use rlp::{encode_list, RlpStream};
|
||||||
|
@ -1616,7 +1616,7 @@ pub mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn should_add_transactions_to_queue() {
|
fn should_add_transactions_to_queue() {
|
||||||
fn sender(tx: &UnverifiedTransaction) -> Address {
|
fn sender(tx: &UnverifiedTransaction) -> Address {
|
||||||
ethkey::public_to_address(&tx.recover_public().unwrap())
|
parity_crypto::publickey::public_to_address(&tx.recover_public().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
// given
|
// given
|
||||||
|
@ -27,7 +27,7 @@ use ethcore::client::Client;
|
|||||||
use ethcore::miner::{self, MinerService};
|
use ethcore::miner::{self, MinerService};
|
||||||
use ethcore_io::{IoHandler, IoChannel};
|
use ethcore_io::{IoHandler, IoChannel};
|
||||||
use ethereum_types::{U256, Address};
|
use ethereum_types::{U256, Address};
|
||||||
use ethkey::{KeyPair, Secret};
|
use parity_crypto::publickey::{KeyPair, Secret};
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use common_types::{
|
use common_types::{
|
||||||
io_message::ClientIoMessage,
|
io_message::ClientIoMessage,
|
||||||
|
@ -37,7 +37,7 @@ use ethcore_io::{IoHandler, IoChannel};
|
|||||||
use ethcore_private_tx::{
|
use ethcore_private_tx::{
|
||||||
Provider, ProviderConfig, NoopEncryptor, Importer, SignedPrivateTransaction, StoringKeyProvider
|
Provider, ProviderConfig, NoopEncryptor, Importer, SignedPrivateTransaction, StoringKeyProvider
|
||||||
};
|
};
|
||||||
use ethkey::KeyPair;
|
use parity_crypto::publickey::KeyPair;
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use machine::executive::contract_address;
|
use machine::executive::contract_address;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
@ -10,9 +10,9 @@ ethbloom = "0.8.0"
|
|||||||
ethcore-io = { path = "../../util/io" }
|
ethcore-io = { path = "../../util/io" }
|
||||||
ethereum-types = "0.8.0"
|
ethereum-types = "0.8.0"
|
||||||
ethjson = { path = "../../json" }
|
ethjson = { path = "../../json" }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
|
||||||
keccak-hash = "0.4.0"
|
keccak-hash = "0.4.0"
|
||||||
parity-bytes = "0.1"
|
parity-bytes = "0.1"
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
parity-util-mem = "0.2.0"
|
parity-util-mem = "0.2.0"
|
||||||
parity-snappy = "0.1"
|
parity-snappy = "0.1"
|
||||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||||
|
@ -21,7 +21,7 @@ use derive_more::{Display, From};
|
|||||||
use ethereum_types::{U256, U512};
|
use ethereum_types::{U256, U512};
|
||||||
use ethtrie::TrieError;
|
use ethtrie::TrieError;
|
||||||
use parity_snappy::InvalidInput;
|
use parity_snappy::InvalidInput;
|
||||||
use ethkey::Error as EthkeyError;
|
use parity_crypto::publickey::{Error as EthPublicKeyCryptoError};
|
||||||
|
|
||||||
use errors::{BlockError, EngineError, ImportError, SnapshotError};
|
use errors::{BlockError, EngineError, ImportError, SnapshotError};
|
||||||
use transaction::Error as TransactionError;
|
use transaction::Error as TransactionError;
|
||||||
@ -64,7 +64,7 @@ pub enum EthcoreError {
|
|||||||
Engine(EngineError),
|
Engine(EngineError),
|
||||||
/// Ethkey error."
|
/// Ethkey error."
|
||||||
#[display(fmt = "Ethkey error: {}", _0)]
|
#[display(fmt = "Ethkey error: {}", _0)]
|
||||||
Ethkey(EthkeyError),
|
Ethkey(EthPublicKeyCryptoError),
|
||||||
/// RLP decoding errors
|
/// RLP decoding errors
|
||||||
#[display(fmt = "Decoder error: {}", _0)]
|
#[display(fmt = "Decoder error: {}", _0)]
|
||||||
Decoder(rlp::DecoderError),
|
Decoder(rlp::DecoderError),
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
extern crate ethbloom;
|
extern crate ethbloom;
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethjson;
|
extern crate ethjson;
|
||||||
extern crate ethkey;
|
extern crate parity_crypto;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_more;
|
extern crate derive_more;
|
||||||
extern crate keccak_hash as hash;
|
extern crate keccak_hash as hash;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
use std::{fmt, error};
|
use std::{fmt, error};
|
||||||
|
|
||||||
use ethereum_types::U256;
|
use ethereum_types::U256;
|
||||||
use ethkey;
|
use parity_crypto::publickey::{Error as EthPublicKeyCryptoError};
|
||||||
use rlp;
|
use rlp;
|
||||||
use unexpected::OutOfBounds;
|
use unexpected::OutOfBounds;
|
||||||
|
|
||||||
@ -88,8 +88,8 @@ pub enum Error {
|
|||||||
InvalidRlp(String),
|
InvalidRlp(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ethkey::Error> for Error {
|
impl From<EthPublicKeyCryptoError> for Error {
|
||||||
fn from(err: ethkey::Error) -> Self {
|
fn from(err: EthPublicKeyCryptoError) -> Self {
|
||||||
Error::InvalidSignature(format!("{}", err))
|
Error::InvalidSignature(format!("{}", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ use std::ops::Deref;
|
|||||||
|
|
||||||
use ethereum_types::{H256, H160, Address, U256, BigEndianHash};
|
use ethereum_types::{H256, H160, Address, U256, BigEndianHash};
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use ethkey::{self, Signature, Secret, Public, recover, public_to_address};
|
use parity_crypto::publickey::{Signature, Secret, Public, recover, public_to_address};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use parity_util_mem::MallocSizeOf;
|
use parity_util_mem::MallocSizeOf;
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ impl Transaction {
|
|||||||
|
|
||||||
/// Signs the transaction as coming from `sender`.
|
/// Signs the transaction as coming from `sender`.
|
||||||
pub fn sign(self, secret: &Secret, chain_id: Option<u64>) -> SignedTransaction {
|
pub fn sign(self, secret: &Secret, chain_id: Option<u64>) -> SignedTransaction {
|
||||||
let sig = ::ethkey::sign(secret, &self.hash(chain_id))
|
let sig = parity_crypto::publickey::sign(secret, &self.hash(chain_id))
|
||||||
.expect("data is valid and context has signing capabilities; qed");
|
.expect("data is valid and context has signing capabilities; qed");
|
||||||
SignedTransaction::new(self.with_signature(sig, chain_id))
|
SignedTransaction::new(self.with_signature(sig, chain_id))
|
||||||
.expect("secret is valid so it's recoverable")
|
.expect("secret is valid so it's recoverable")
|
||||||
@ -367,9 +367,9 @@ impl UnverifiedTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Checks whether the signature has a low 's' value.
|
/// Checks whether the signature has a low 's' value.
|
||||||
pub fn check_low_s(&self) -> Result<(), ethkey::Error> {
|
pub fn check_low_s(&self) -> Result<(), parity_crypto::publickey::Error> {
|
||||||
if !self.signature().is_low_s() {
|
if !self.signature().is_low_s() {
|
||||||
Err(ethkey::Error::InvalidSignature.into())
|
Err(parity_crypto::publickey::Error::InvalidSignature.into())
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ impl UnverifiedTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Recovers the public key of the sender.
|
/// Recovers the public key of the sender.
|
||||||
pub fn recover_public(&self) -> Result<Public, ethkey::Error> {
|
pub fn recover_public(&self) -> Result<Public, parity_crypto::publickey::Error> {
|
||||||
Ok(recover(&self.signature(), &self.unsigned.hash(self.chain_id()))?)
|
Ok(recover(&self.signature(), &self.unsigned.hash(self.chain_id()))?)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,11 +392,11 @@ impl UnverifiedTransaction {
|
|||||||
}
|
}
|
||||||
// Disallow unsigned transactions in case EIP-86 is disabled.
|
// Disallow unsigned transactions in case EIP-86 is disabled.
|
||||||
if !allow_empty_signature && self.is_unsigned() {
|
if !allow_empty_signature && self.is_unsigned() {
|
||||||
return Err(ethkey::Error::InvalidSignature.into());
|
return Err(parity_crypto::publickey::Error::InvalidSignature.into());
|
||||||
}
|
}
|
||||||
// EIP-86: Transactions of this form MUST have gasprice = 0, nonce = 0, value = 0, and do NOT increment the nonce of account 0.
|
// EIP-86: Transactions of this form MUST have gasprice = 0, nonce = 0, value = 0, and do NOT increment the nonce of account 0.
|
||||||
if allow_empty_signature && self.is_unsigned() && !(self.gas_price.is_zero() && self.value.is_zero() && self.nonce.is_zero()) {
|
if allow_empty_signature && self.is_unsigned() && !(self.gas_price.is_zero() && self.value.is_zero() && self.nonce.is_zero()) {
|
||||||
return Err(ethkey::Error::InvalidSignature.into())
|
return Err(parity_crypto::publickey::Error::InvalidSignature.into())
|
||||||
}
|
}
|
||||||
match (self.chain_id(), chain_id) {
|
match (self.chain_id(), chain_id) {
|
||||||
(None, _) => {},
|
(None, _) => {},
|
||||||
@ -407,7 +407,7 @@ impl UnverifiedTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Try to verify transaction and recover sender.
|
/// Try to verify transaction and recover sender.
|
||||||
pub fn verify_unordered(self) -> Result<SignedTransaction, ethkey::Error> {
|
pub fn verify_unordered(self) -> Result<SignedTransaction, parity_crypto::publickey::Error> {
|
||||||
SignedTransaction::new(self)
|
SignedTransaction::new(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,7 +439,7 @@ impl From<SignedTransaction> for UnverifiedTransaction {
|
|||||||
|
|
||||||
impl SignedTransaction {
|
impl SignedTransaction {
|
||||||
/// Try to verify transaction and recover sender.
|
/// Try to verify transaction and recover sender.
|
||||||
pub fn new(transaction: UnverifiedTransaction) -> Result<Self, ethkey::Error> {
|
pub fn new(transaction: UnverifiedTransaction) -> Result<Self, parity_crypto::publickey::Error> {
|
||||||
if transaction.is_unsigned() {
|
if transaction.is_unsigned() {
|
||||||
Ok(SignedTransaction {
|
Ok(SignedTransaction {
|
||||||
transaction: transaction,
|
transaction: transaction,
|
||||||
@ -591,7 +591,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn signing_eip155_zero_chainid() {
|
fn signing_eip155_zero_chainid() {
|
||||||
use ethkey::{Random, Generator};
|
use parity_crypto::publickey::{Random, Generator};
|
||||||
|
|
||||||
let key = Random.generate().unwrap();
|
let key = Random.generate().unwrap();
|
||||||
let t = Transaction {
|
let t = Transaction {
|
||||||
@ -604,7 +604,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let hash = t.hash(Some(0));
|
let hash = t.hash(Some(0));
|
||||||
let sig = ::ethkey::sign(&key.secret(), &hash).unwrap();
|
let sig = parity_crypto::publickey::sign(&key.secret(), &hash).unwrap();
|
||||||
let u = t.with_signature(sig, Some(0));
|
let u = t.with_signature(sig, Some(0));
|
||||||
|
|
||||||
assert!(SignedTransaction::new(u).is_ok());
|
assert!(SignedTransaction::new(u).is_ok());
|
||||||
@ -612,7 +612,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn signing() {
|
fn signing() {
|
||||||
use ethkey::{Random, Generator};
|
use parity_crypto::publickey::{Random, Generator};
|
||||||
|
|
||||||
let key = Random.generate().unwrap();
|
let key = Random.generate().unwrap();
|
||||||
let t = Transaction {
|
let t = Transaction {
|
||||||
@ -647,7 +647,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_recover_from_chain_specific_signing() {
|
fn should_recover_from_chain_specific_signing() {
|
||||||
use ethkey::{Random, Generator};
|
use parity_crypto::publickey::{Random, Generator};
|
||||||
let key = Random.generate().unwrap();
|
let key = Random.generate().unwrap();
|
||||||
let t = Transaction {
|
let t = Transaction {
|
||||||
action: Action::Create,
|
action: Action::Create,
|
||||||
|
@ -34,7 +34,7 @@ unexpected = { path = "../../util/unexpected" }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
ethcore = { path = "../", features = ["test-helpers"] }
|
ethcore = { path = "../", features = ["test-helpers"] }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
machine = { path = "../machine" }
|
machine = { path = "../machine" }
|
||||||
null-engine = { path = "../engines/null-engine" }
|
null-engine = { path = "../engines/null-engine" }
|
||||||
spec = { path = "../spec" }
|
spec = { path = "../spec" }
|
||||||
|
@ -375,7 +375,7 @@ mod tests {
|
|||||||
use parity_bytes::Bytes;
|
use parity_bytes::Bytes;
|
||||||
use keccak_hash::keccak;
|
use keccak_hash::keccak;
|
||||||
use engine::Engine;
|
use engine::Engine;
|
||||||
use ethkey::{Random, Generator};
|
use parity_crypto::publickey::{Random, Generator};
|
||||||
use spec;
|
use spec;
|
||||||
use ethcore::test_helpers::{
|
use ethcore::test_helpers::{
|
||||||
create_test_block_with_data, create_test_block, TestBlockChainClient
|
create_test_block_with_data, create_test_block, TestBlockChainClient
|
||||||
@ -587,7 +587,7 @@ mod tests {
|
|||||||
bad_header.set_transactions_root(eip86_transactions_root.clone());
|
bad_header.set_transactions_root(eip86_transactions_root.clone());
|
||||||
bad_header.set_uncles_hash(good_uncles_hash.clone());
|
bad_header.set_uncles_hash(good_uncles_hash.clone());
|
||||||
match basic_test(&create_test_block_with_data(&bad_header, &eip86_transactions, &good_uncles), engine) {
|
match basic_test(&create_test_block_with_data(&bad_header, &eip86_transactions, &good_uncles), engine) {
|
||||||
Err(Error::Transaction(ref e)) if e == &::ethkey::Error::InvalidSignature.into() => (),
|
Err(Error::Transaction(ref e)) if e == &parity_crypto::publickey::Error::InvalidSignature.into() => (),
|
||||||
e => panic!("Block verification failed.\nExpected: Transaction Error (Invalid Signature)\nGot: {:?}", e),
|
e => panic!("Block verification failed.\nExpected: Transaction Error (Invalid Signature)\nGot: {:?}", e),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ transaction-pool = "2.0.1"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
ethkey = { path = "../accounts/ethkey" }
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -17,4 +17,5 @@ serde_json = "1.0"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
ethkey = { path = "../../accounts/ethkey" }
|
||||||
|
parity-crypto = { version = "0.4.2", features = ["publickey"] }
|
||||||
kvdb-memorydb = "0.1.2"
|
kvdb-memorydb = "0.1.2"
|
||||||
|
@ -201,7 +201,8 @@ mod tests {
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use common_types::transaction::{Transaction, Condition, PendingTransaction};
|
use common_types::transaction::{Transaction, Condition, PendingTransaction};
|
||||||
use ethkey::{Brain, Generator};
|
use ethkey::Brain;
|
||||||
|
use parity_crypto::publickey::Generator;
|
||||||
|
|
||||||
// we want to test: round-trip of good transactions.
|
// we want to test: round-trip of good transactions.
|
||||||
// failure to roundtrip bad transactions (but that it doesn't panic)
|
// failure to roundtrip bad transactions (but that it doesn't panic)
|
||||||
|
@ -50,7 +50,7 @@ extern crate trace_time;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate ethkey;
|
extern crate parity_crypto;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ impl txpool::Listener<Transaction> for LocalTransactionsList {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ethereum_types::U256;
|
use ethereum_types::U256;
|
||||||
use ethkey::{Random, Generator};
|
use parity_crypto::publickey::{Random, Generator};
|
||||||
use types::transaction;
|
use types::transaction;
|
||||||
use txpool::Listener;
|
use txpool::Listener;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user