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

Commit

Permalink
Merge branch 'master' into dp/chore/ensure-we-ignore-old-snapshots
Browse files Browse the repository at this point in the history
* master:
  Type annotation for next_key() matching of json filter options (#11192)
  Crypto primitives removed from ethkey (#11174)
  • Loading branch information
dvdplm committed Oct 24, 2019
2 parents a2a3257 + acf7c48 commit c543a46
Show file tree
Hide file tree
Showing 178 changed files with 618 additions and 2,382 deletions.
174 changes: 87 additions & 87 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ num_cpus = "1.2"
number_prefix = "0.2"
panic_hook = { path = "util/panic-hook" }
parity-bytes = "0.1"
parity-crypto = { version = "0.4.2", features = ["publickey"] }
parity-daemonize = "0.3"
parity-hash-fetch = { path = "updater/hash-fetch" }
parity-ipfs-api = { path = "ipfs" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ To start Parity Ethereum as a regular user using `systemd` init:
## 4. Testing <a id="chapter-004"></a>
You can run tests with the following commands:
Download the required test files: `git submodule update --init --recursive`. You can run tests with the following commands:
* **All** packages
```
Expand Down
1 change: 1 addition & 0 deletions accounts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ edition = "2018"
ethkey = { path = "ethkey" }
ethstore = { path = "ethstore" }
log = "0.4"
parity-crypto = { version = "0.4.2", features = ["publickey"] }
parking_lot = "0.9"
serde = "1.0"
serde_derive = "1.0"
Expand Down
14 changes: 3 additions & 11 deletions accounts/ethkey/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
[package]
description = "Parity Ethereum Keys Generator"
name = "ethkey"
version = "0.3.0"
version = "0.4.0"
authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
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"
parity-wordlist = "1.3"
quick-error = "1.2.2"
rand = "0.7"
rustc-hex = "1.0"
serde = "1.0"
serde_derive = "1.0"
tiny-keccak = "1.4"
zeroize = "0.9.1"
parity-crypto = { version = "0.4.2", features = ["publickey"] }
parity-wordlist = "1.3"
1 change: 1 addition & 0 deletions accounts/ethkey/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ docopt = "1.0"
env_logger = "0.5"
ethkey = { path = "../" }
panic_hook = { path = "../../../util/panic-hook" }
parity-crypto = { version = "0.4.2", features = ["publickey"] }
parity-wordlist="1.2"
rustc-hex = "1.0"
serde = "1.0"
Expand Down
10 changes: 6 additions & 4 deletions accounts/ethkey/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern crate env_logger;
extern crate ethkey;
extern crate panic_hook;
extern crate parity_wordlist;
extern crate parity_crypto;
extern crate rustc_hex;
extern crate serde;
extern crate threadpool;
Expand All @@ -30,7 +31,8 @@ use std::num::ParseIntError;
use std::{env, fmt, process, io, sync};

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};

const USAGE: &'static str = r#"
Expand Down Expand Up @@ -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");
(keypair, Some(phrase_info))
} 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)
};
Ok(display(result, display_mode))
Expand Down Expand Up @@ -241,15 +243,15 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
};
Ok(display(result, display_mode))
} 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 signature = sign(&secret, &message)?;
Ok(format!("{}", signature))
} else if args.cmd_verify {
let signature = args.arg_signature.parse().map_err(|_| EthkeyError::InvalidSignature)?;
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
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)?
} else if args.cmd_address {
let address = args.arg_address.parse().map_err(|_| EthkeyError::InvalidAddress)?;
Expand Down
12 changes: 7 additions & 5 deletions accounts/ethkey/src/brain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
// 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 keccak::Keccak256;
use super::{KeyPair, Generator, Secret};
use std::convert::Infallible;
use parity_crypto::publickey::{KeyPair, Generator, Secret};
use parity_crypto::Keccak256;
use parity_wordlist;

/// Simple brainwallet.
Expand All @@ -32,7 +33,7 @@ impl Brain {
}

impl Generator for Brain {
type Error = ::Void;
type Error = Infallible;

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

#[cfg(test)]
mod tests {
use {Brain, Generator};
use Brain;
use parity_crypto::publickey::Generator;

#[test]
fn test_brain() {
Expand Down
6 changes: 4 additions & 2 deletions accounts/ethkey/src/brain_prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
// 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::{Generator, KeyPair, Error, Brain};
use super::Brain;
use parity_crypto::publickey::{Generator, KeyPair, Error};
use parity_wordlist as wordlist;

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

#[cfg(test)]
mod tests {
use {Generator, BrainPrefix};
use BrainPrefix;
use parity_crypto::publickey::Generator;

#[test]
fn prefix_generator() {
Expand Down
3 changes: 2 additions & 1 deletion accounts/ethkey/src/brain_recover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use std::collections::HashSet;
use edit_distance::edit_distance;
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
/// of expected words and a partial phrase.
Expand Down
189 changes: 0 additions & 189 deletions accounts/ethkey/src/crypto.rs

This file was deleted.

Loading

0 comments on commit c543a46

Please sign in to comment.