Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 99d5b61

Browse files
committed
Merge branch 'master' into dp/fix/debug-snapshot-start
* master: Type annotation for next_key() matching of json filter options (#11192) Crypto primitives removed from ethkey (#11174) Made ecrecover implementation trait public (#11188) Remove unused macro_use. (#11191) [dependencies]: jsonrpc `14.0.1` (#11183) [receipt]: add `sender` & `receiver` to `RichReceipts` (#11179) [dependencies] bump rand 0.7 (#11022) [ethcore/builtin]: do not panic in blake2pricer on short input (#11180) TxPermissions ver 3: gas price & data (#11170) [ethash] chainspec validate `ecip1017EraRounds` non-zero (#11123) util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175) ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172) Aura: Report malice on sibling blocks from the same validator (#11160)
2 parents 4c8d5dc + acf7c48 commit 99d5b61

File tree

220 files changed

+1380
-2698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+1380
-2698
lines changed

Cargo.lock

Lines changed: 200 additions & 165 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ethstore = { path = "accounts/ethstore" }
3737
fdlimit = "0.1"
3838
futures = "0.1"
3939
journaldb = { path = "util/journaldb" }
40-
jsonrpc-core = "14.0.0"
40+
jsonrpc-core = "14.0.1"
4141
keccak-hash = "0.4.0"
4242
kvdb = "0.1"
4343
kvdb-rocksdb = "0.1.5"
@@ -48,6 +48,7 @@ num_cpus = "1.2"
4848
number_prefix = "0.2"
4949
panic_hook = { path = "util/panic-hook" }
5050
parity-bytes = "0.1"
51+
parity-crypto = { version = "0.4.2", features = ["publickey"] }
5152
parity-daemonize = "0.3"
5253
parity-hash-fetch = { path = "updater/hash-fetch" }
5354
parity-ipfs-api = { path = "ipfs" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ To start Parity Ethereum as a regular user using `systemd` init:
151151

152152
## 4. Testing <a id="chapter-004"></a>
153153

154-
You can run tests with the following commands:
154+
Download the required test files: `git submodule update --init --recursive`. You can run tests with the following commands:
155155

156156
* **All** packages
157157
```

accounts/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ edition = "2018"
1111
ethkey = { path = "ethkey" }
1212
ethstore = { path = "ethstore" }
1313
log = "0.4"
14+
parity-crypto = { version = "0.4.2", features = ["publickey"] }
1415
parking_lot = "0.9"
1516
serde = "1.0"
1617
serde_derive = "1.0"

accounts/ethkey/Cargo.toml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
[package]
22
description = "Parity Ethereum Keys Generator"
33
name = "ethkey"
4-
version = "0.3.0"
4+
version = "0.4.0"
55
authors = ["Parity Technologies <[email protected]>"]
66

77
[dependencies]
88
edit-distance = "2.0"
9-
parity-crypto = "0.4.0"
10-
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" }
11-
ethereum-types = "0.8.0"
12-
lazy_static = "1.0"
139
log = "0.4"
14-
parity-wordlist = "1.3"
15-
quick-error = "1.2.2"
16-
rand = "0.6"
17-
rustc-hex = "1.0"
1810
serde = "1.0"
1911
serde_derive = "1.0"
20-
tiny-keccak = "1.4"
21-
zeroize = "0.9.1"
12+
parity-crypto = { version = "0.4.2", features = ["publickey"] }
13+
parity-wordlist = "1.3"

accounts/ethkey/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ docopt = "1.0"
99
env_logger = "0.5"
1010
ethkey = { path = "../" }
1111
panic_hook = { path = "../../../util/panic-hook" }
12+
parity-crypto = { version = "0.4.2", features = ["publickey"] }
1213
parity-wordlist="1.2"
1314
rustc-hex = "1.0"
1415
serde = "1.0"

accounts/ethkey/cli/src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extern crate env_logger;
1919
extern crate ethkey;
2020
extern crate panic_hook;
2121
extern crate parity_wordlist;
22+
extern crate parity_crypto;
2223
extern crate rustc_hex;
2324
extern crate serde;
2425
extern crate threadpool;
@@ -30,7 +31,8 @@ use std::num::ParseIntError;
3031
use std::{env, fmt, process, io, sync};
3132

3233
use docopt::Docopt;
33-
use ethkey::{KeyPair, Random, Brain, BrainPrefix, Prefix, Error as EthkeyError, Generator, sign, verify_public, verify_address, brain_recover};
34+
use ethkey::{Brain, BrainPrefix, Prefix, brain_recover};
35+
use parity_crypto::publickey::{KeyPair, Random, Error as EthkeyError, Generator, sign, verify_public, verify_address};
3436
use rustc_hex::{FromHex, FromHexError};
3537

3638
const USAGE: &'static str = r#"
@@ -200,7 +202,7 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
200202
let keypair = Brain::new(phrase).generate().expect("Brain wallet generator is infallible; qed");
201203
(keypair, Some(phrase_info))
202204
} else {
203-
let secret = args.arg_secret_or_phrase.parse().map_err(|_| EthkeyError::InvalidSecret)?;
205+
let secret = args.arg_secret_or_phrase.parse().map_err(|_| EthkeyError::InvalidSecretKey)?;
204206
(KeyPair::from_secret(secret)?, None)
205207
};
206208
Ok(display(result, display_mode))
@@ -241,15 +243,15 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
241243
};
242244
Ok(display(result, display_mode))
243245
} else if args.cmd_sign {
244-
let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecret)?;
246+
let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecretKey)?;
245247
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
246248
let signature = sign(&secret, &message)?;
247249
Ok(format!("{}", signature))
248250
} else if args.cmd_verify {
249251
let signature = args.arg_signature.parse().map_err(|_| EthkeyError::InvalidSignature)?;
250252
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
251253
let ok = if args.cmd_public {
252-
let public = args.arg_public.parse().map_err(|_| EthkeyError::InvalidPublic)?;
254+
let public = args.arg_public.parse().map_err(|_| EthkeyError::InvalidPublicKey)?;
253255
verify_public(&public, &signature, &message)?
254256
} else if args.cmd_address {
255257
let address = args.arg_address.parse().map_err(|_| EthkeyError::InvalidAddress)?;

accounts/ethkey/src/brain.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
1616

17-
use keccak::Keccak256;
18-
use super::{KeyPair, Generator, Secret};
17+
use std::convert::Infallible;
18+
use parity_crypto::publickey::{KeyPair, Generator, Secret};
19+
use parity_crypto::Keccak256;
1920
use parity_wordlist;
2021

2122
/// Simple brainwallet.
@@ -32,7 +33,7 @@ impl Brain {
3233
}
3334

3435
impl Generator for Brain {
35-
type Error = ::Void;
36+
type Error = Infallible;
3637

3738
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
3839
let seed = self.0.clone();
@@ -45,7 +46,7 @@ impl Generator for Brain {
4546
match i > 16384 {
4647
false => i += 1,
4748
true => {
48-
if let Ok(pair) = Secret::from_unsafe_slice(&secret)
49+
if let Ok(pair) = Secret::import_key(&secret)
4950
.and_then(KeyPair::from_secret)
5051
{
5152
if pair.address()[0] == 0 {
@@ -61,7 +62,8 @@ impl Generator for Brain {
6162

6263
#[cfg(test)]
6364
mod tests {
64-
use {Brain, Generator};
65+
use Brain;
66+
use parity_crypto::publickey::Generator;
6567

6668
#[test]
6769
fn test_brain() {

accounts/ethkey/src/brain_prefix.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
1616

17-
use super::{Generator, KeyPair, Error, Brain};
17+
use super::Brain;
18+
use parity_crypto::publickey::{Generator, KeyPair, Error};
1819
use parity_wordlist as wordlist;
1920

2021
/// Tries to find brain-seed keypair with address starting with given prefix.
@@ -59,7 +60,8 @@ impl Generator for BrainPrefix {
5960

6061
#[cfg(test)]
6162
mod tests {
62-
use {Generator, BrainPrefix};
63+
use BrainPrefix;
64+
use parity_crypto::publickey::Generator;
6365

6466
#[test]
6567
fn prefix_generator() {

accounts/ethkey/src/brain_recover.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use std::collections::HashSet;
1919
use edit_distance::edit_distance;
2020
use parity_wordlist;
2121

22-
use super::{Address, Brain, Generator};
22+
use super::Brain;
23+
use parity_crypto::publickey::{Address, Generator};
2324

2425
/// Tries to find a phrase for address, given the number
2526
/// of expected words and a partial phrase.

accounts/ethkey/src/crypto.rs

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)