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:
Anton Gavrilov
2019-10-23 13:03:46 +02:00
committed by GitHub
parent 81ca599f2a
commit 834585d61b
176 changed files with 579 additions and 2376 deletions

View File

@@ -34,7 +34,7 @@ use client_traits::EngineClient;
use ethereum_types::{H256, H520};
use parking_lot::RwLock;
use engine::{Engine, ConstructedVerifier, signer::EngineSigner};
use ethkey::{self, Signature};
use parity_crypto::publickey::Signature;
use ethjson;
use log::trace;
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> {
// Check if the signature belongs to a validator, can depend on parent state.
let sig = Rlp::new(&header.seal()[0]).as_val::<H520>()?;
let signer = ethkey::public_to_address(&ethkey::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 {
return Err(EngineError::NotAuthorized(*header.author()).into())
@@ -201,7 +201,7 @@ impl Engine for BasicAuthority {
fn sign(&self, hash: H256) -> Result<Signature, Error> {
Ok(self.signer.read()
.as_ref()
.ok_or_else(|| ethkey::Error::InvalidAddress)?
.ok_or_else(|| parity_crypto::publickey::Error::InvalidAddress)?
.sign(hash)?
)
}