Fix ecrecover builtin (#11623)
* Upgrade parity-crypto to 0.6 * More fixes * Upgrade ethabi and ethabi-derive * Fix lockfile * Patch ethabi from master * quickfix for ethash * Update forkid * Add secret store back * Fetch ethabi from crates * fetch secret-store from the right place * update to keccak-hash 0.5.1 * ethash: upgrade keccak-hash * ethash: sneaky spaces * ethash: use overlapping bytes after all * revert submodule update * wip * Use new method to impl ecrecover builtin * Fetch patches from git * Sort out todo * Remove patches Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
parent
90c0be0231
commit
4b5e9ddfa6
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -3241,9 +3241,9 @@ checksum = "16b56e3a2420138bdb970f84dfb9c774aea80fa0e7371549eedec0d80c209c67"
|
||||
|
||||
[[package]]
|
||||
name = "parity-crypto"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97cb113593965e4ece813a49f8ff669728dfb4feb76af8208ea73d81d58aee42"
|
||||
checksum = "2b7f19c1acc7fc6c5256a2f4f0c5af022044b9bdfdd0a218ff79f8cbb29779a5"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"aes-ctr",
|
||||
|
@ -52,7 +52,7 @@ num_cpus = "1.2"
|
||||
number_prefix = "0.2"
|
||||
panic_hook = { path = "util/panic-hook" }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-daemonize = "0.3"
|
||||
parity-hash-fetch = { path = "updater/hash-fetch" }
|
||||
parity-local-store = { path = "miner/local-store" }
|
||||
|
@ -10,7 +10,7 @@ edition = "2018"
|
||||
ethkey = { path = "ethkey" }
|
||||
ethstore = { path = "ethstore" }
|
||||
log = "0.4"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parking_lot = "0.10.0"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
|
@ -9,5 +9,5 @@ edit-distance = "2.0"
|
||||
log = "0.4"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-wordlist = "1.3.1"
|
||||
|
@ -9,7 +9,7 @@ docopt = "1.0"
|
||||
env_logger = "0.5"
|
||||
ethkey = { path = "../" }
|
||||
panic_hook = { path = "../../../util/panic-hook" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-wordlist= "1.3.1"
|
||||
rustc-hex = "2.1.0"
|
||||
serde = "1.0"
|
||||
|
@ -17,7 +17,7 @@ rustc-hex = "2.1.0"
|
||||
tiny-keccak = "2.0.2"
|
||||
time = "0.1.34"
|
||||
parking_lot = "0.10.0"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
ethereum-types = "0.9.0"
|
||||
dir = { path = "../../util/dir" }
|
||||
smallvec = "1.2.0"
|
||||
|
@ -14,7 +14,7 @@ serde_derive = "1.0"
|
||||
parking_lot = "0.10.0"
|
||||
ethstore = { path = "../" }
|
||||
ethkey = { path = "../../ethkey" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
dir = { path = '../../../util/dir' }
|
||||
panic_hook = { path = "../../../util/panic-hook" }
|
||||
|
||||
|
@ -42,7 +42,7 @@ parity-bytes = "0.1"
|
||||
parking_lot = "0.10.0"
|
||||
pod = { path = "pod", optional = true }
|
||||
trie-db = "0.20.0"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"], optional = true }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"], optional = true }
|
||||
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
||||
rand = "0.7.3"
|
||||
rand_xorshift = "0.2.0"
|
||||
@ -75,7 +75,7 @@ env_logger = "0.5"
|
||||
ethcore-accounts = { path = "../accounts" }
|
||||
ethcore-builtin = { path = "./builtin" }
|
||||
ethjson = { path = "../json", features = ["test-helpers"] }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
fetch = { path = "../util/fetch" }
|
||||
kvdb-memorydb = "0.5.0"
|
||||
kvdb-rocksdb = "0.7.0"
|
||||
|
@ -29,7 +29,7 @@ triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.5"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
rustc-hex = "2.1.0"
|
||||
tempfile = "3.1"
|
||||
kvdb-memorydb = "0.5.0"
|
||||
|
@ -16,7 +16,7 @@ keccak-hash = "0.5.0"
|
||||
log = "0.4"
|
||||
num = { version = "0.1", default-features = false, features = ["bigint"] }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.2.1"
|
||||
|
@ -30,7 +30,7 @@ use std::{
|
||||
use byteorder::{BigEndian, LittleEndian, ReadBytesExt};
|
||||
use common_types::errors::EthcoreError;
|
||||
use ethereum_types::{H256, U256};
|
||||
use parity_crypto::publickey::{Signature, recover as ec_recover};
|
||||
use parity_crypto::publickey::{recover_allowing_all_zero_message, Signature, ZeroesAllowedMessage};
|
||||
use keccak_hash::keccak;
|
||||
use log::{warn, trace};
|
||||
use num::{BigUint, Zero, One};
|
||||
@ -420,7 +420,13 @@ impl Implementation for EcRecover {
|
||||
|
||||
let s = Signature::from_rsv(&r, &s, bit);
|
||||
if s.is_valid() {
|
||||
if let Ok(p) = ec_recover(&s, &hash) {
|
||||
// The builtin allows/requires all-zero messages to be valid to
|
||||
// recover the public key. Use of such messages is disallowed in
|
||||
// `rust-secp256k1` and this is a workaround for that. It is not an
|
||||
// openethereum-level error to fail here; instead we return all
|
||||
// zeroes and let the caller interpret that outcome.
|
||||
let recovery_message = ZeroesAllowedMessage(hash);
|
||||
if let Ok(p) = recover_allowing_all_zero_message(&s, recovery_message) {
|
||||
let r = keccak(p);
|
||||
output.write(0, &[0; 12]);
|
||||
output.write(12, &r.as_bytes()[12..]);
|
||||
|
@ -13,7 +13,7 @@ bytes = { package = "parity-bytes", version = "0.1.0" }
|
||||
client-traits = { path = "../client-traits" }
|
||||
common-types = { path = "../types" }
|
||||
ethereum-types = "0.9.0"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
machine = { path = "../machine" }
|
||||
vm = { path = "../vm" }
|
||||
|
||||
|
@ -17,7 +17,7 @@ ethabi-contract = "11.0"
|
||||
ethabi-derive = "12.0"
|
||||
ethereum-types = "0.9.0"
|
||||
ethjson = { path = "../../../json" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
engine = { path = "../../engine" }
|
||||
io = { package = "ethcore-io", path = "../../../util/io" }
|
||||
itertools = "0.8.2"
|
||||
|
@ -12,7 +12,7 @@ common-types = { path = "../../types" }
|
||||
engine = { path = "../../engine" }
|
||||
ethereum-types = "0.9.0"
|
||||
ethjson = { path = "../../../json" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
log = "0.4.8"
|
||||
machine = { path = "../../machine" }
|
||||
parking_lot = "0.10.0"
|
||||
|
@ -11,7 +11,7 @@ client-traits = { path = "../../client-traits" }
|
||||
common-types = { path = "../../types" }
|
||||
ethereum-types = "0.9.0"
|
||||
ethjson = { path = "../../../json" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
engine = { path = "../../engine" }
|
||||
keccak-hash = "0.5.0"
|
||||
lazy_static = "1.3.0"
|
||||
|
@ -38,7 +38,7 @@ env_logger = "0.6.2"
|
||||
ethcore = { path = "../..", features = ["test-helpers"] }
|
||||
rustc-hex = "2.1.0"
|
||||
keccak-hash = "0.5.0"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
spec = { path = "../../spec" }
|
||||
|
||||
[features]
|
||||
|
@ -28,7 +28,7 @@ vm = { path = "../vm" }
|
||||
[dev-dependencies]
|
||||
env_logger = "0.5"
|
||||
ethcore = { path = "..", features = ["test-helpers"] }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
evm = { path = "../evm" }
|
||||
keccak-hash = "0.5.0"
|
||||
pod = { path = "../pod" }
|
||||
|
@ -43,7 +43,7 @@ criterion = "0.3"
|
||||
ethcore = { path = "../", features = ["test-helpers"] }
|
||||
ethcore-io = { path = "../../util/io" }
|
||||
ethjson = { path = "../../json" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
hex-literal = "0.2.1"
|
||||
spec = { path = "../spec" }
|
||||
tempfile = "3.1"
|
||||
|
@ -31,7 +31,7 @@ log = "0.4"
|
||||
machine = { path = "../machine" }
|
||||
journaldb = { path = "../../util/journaldb" }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parking_lot = "0.10.0"
|
||||
trie-db = "0.20.0"
|
||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||
|
@ -27,7 +27,7 @@ kvdb = "0.5.0"
|
||||
kvdb-rocksdb = "0.7.0"
|
||||
log = "0.4.8"
|
||||
parking_lot = "0.10.0"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
rand = "0.7.3"
|
||||
rand_xorshift = "0.2.0"
|
||||
rlp = "0.4.5"
|
||||
|
@ -26,7 +26,7 @@ light = { package = "ethcore-light", path = "../light" }
|
||||
log = "0.4"
|
||||
network = { package = "ethcore-network", path = "../../util/network" }
|
||||
parity-runtime = "0.1.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-util-mem = "0.6.0"
|
||||
rand = "0.7.3"
|
||||
parking_lot = "0.10.0"
|
||||
|
@ -12,7 +12,7 @@ ethereum-types = "0.9.0"
|
||||
ethjson = { path = "../../json" }
|
||||
keccak-hash = "0.5.0"
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-util-mem = "0.6.0"
|
||||
parity-snappy = "0.1"
|
||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||
|
@ -35,7 +35,7 @@ unexpected = { path = "../../util/unexpected" }
|
||||
common-types = { path = "../types", features = ["test-helpers"] }
|
||||
criterion = "0.3"
|
||||
ethcore = { path = "../", features = ["test-helpers"] }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
machine = { path = "../machine" }
|
||||
null-engine = { path = "../engines/null-engine" }
|
||||
spec = { path = "../spec" }
|
||||
|
@ -39,7 +39,7 @@ transaction-pool = "2.0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.5"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
rustc-hex = "2.1.0"
|
||||
|
||||
[features]
|
||||
|
@ -17,5 +17,5 @@ serde_json = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
ethkey = { path = "../../accounts/ethkey" }
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
kvdb-memorydb = "0.5.0"
|
||||
|
@ -49,7 +49,7 @@ ethereum-types = "0.9.0"
|
||||
fastmap = { path = "../util/fastmap" }
|
||||
machine = { path = "../ethcore/machine" }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
|
||||
eip-712 = { path = "../util/EIP-712" }
|
||||
ethjson = { path = "../json" }
|
||||
|
@ -24,7 +24,7 @@ mio = "0.6.8"
|
||||
natpmp = "0.2"
|
||||
network = { package = "ethcore-network", path = "../network" }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-path = "0.1"
|
||||
parity-snappy = "0.1"
|
||||
parking_lot = "0.10.0"
|
||||
|
@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
derive_more = "0.99"
|
||||
parity-crypto = { version = "0.6.0", features = ["publickey"] }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
ethcore-io = { path = "../io" }
|
||||
ethereum-types = "0.9.0"
|
||||
ipnetwork = "0.12.6"
|
||||
|
Loading…
Reference in New Issue
Block a user