mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Update secp256k1 and remove unrequired usage (#3502)
* Update secp256k1 and remove unrequired usage * Rename missed old crate names * Enable required feature
This commit is contained in:
Generated
+66
-12
@@ -2688,6 +2688,17 @@ dependencies = [
|
||||
"hmac 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac-drbg"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1"
|
||||
dependencies = [
|
||||
"digest 0.9.0",
|
||||
"generic-array 0.14.4",
|
||||
"hmac 0.8.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hostname"
|
||||
version = "0.3.1"
|
||||
@@ -3363,7 +3374,6 @@ dependencies = [
|
||||
"frame-system-rpc-runtime-api",
|
||||
"frame-try-runtime",
|
||||
"hex-literal",
|
||||
"libsecp256k1",
|
||||
"log",
|
||||
"pallet-authority-discovery",
|
||||
"pallet-authorship",
|
||||
@@ -3582,7 +3592,7 @@ dependencies = [
|
||||
"futures 0.3.15",
|
||||
"futures-timer 3.0.2",
|
||||
"lazy_static",
|
||||
"libsecp256k1",
|
||||
"libsecp256k1 0.3.5",
|
||||
"log",
|
||||
"multihash",
|
||||
"multistream-select",
|
||||
@@ -3984,13 +3994,61 @@ dependencies = [
|
||||
"arrayref",
|
||||
"crunchy",
|
||||
"digest 0.8.1",
|
||||
"hmac-drbg",
|
||||
"hmac-drbg 0.2.0",
|
||||
"rand 0.7.3",
|
||||
"sha2 0.8.2",
|
||||
"subtle 2.2.3",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"base64 0.12.3",
|
||||
"digest 0.9.0",
|
||||
"hmac-drbg 0.3.0",
|
||||
"libsecp256k1-core",
|
||||
"libsecp256k1-gen-ecmult",
|
||||
"libsecp256k1-gen-genmult",
|
||||
"rand 0.7.3",
|
||||
"serde",
|
||||
"sha2 0.9.2",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-core"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
"digest 0.9.0",
|
||||
"subtle 2.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-gen-ecmult"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3"
|
||||
dependencies = [
|
||||
"libsecp256k1-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-gen-genmult"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d"
|
||||
dependencies = [
|
||||
"libsecp256k1-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.0.25"
|
||||
@@ -4736,7 +4794,7 @@ dependencies = [
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"hex",
|
||||
"libsecp256k1",
|
||||
"libsecp256k1 0.3.5",
|
||||
"log",
|
||||
"pallet-beefy",
|
||||
"pallet-mmr",
|
||||
@@ -6733,7 +6791,6 @@ dependencies = [
|
||||
"frame-system-rpc-runtime-api",
|
||||
"frame-try-runtime",
|
||||
"hex-literal",
|
||||
"libsecp256k1",
|
||||
"log",
|
||||
"pallet-authority-discovery",
|
||||
"pallet-authorship",
|
||||
@@ -6810,7 +6867,7 @@ dependencies = [
|
||||
"frame-system",
|
||||
"hex-literal",
|
||||
"impl-trait-for-tuples",
|
||||
"libsecp256k1",
|
||||
"libsecp256k1 0.6.0",
|
||||
"log",
|
||||
"pallet-authorship",
|
||||
"pallet-babe",
|
||||
@@ -6863,7 +6920,6 @@ dependencies = [
|
||||
"frame-system",
|
||||
"futures 0.3.15",
|
||||
"hex-literal",
|
||||
"libsecp256k1",
|
||||
"log",
|
||||
"pallet-authority-discovery",
|
||||
"pallet-authorship",
|
||||
@@ -7143,7 +7199,6 @@ dependencies = [
|
||||
"frame-system",
|
||||
"frame-system-rpc-runtime-api",
|
||||
"hex-literal",
|
||||
"libsecp256k1",
|
||||
"log",
|
||||
"pallet-authority-discovery",
|
||||
"pallet-authorship",
|
||||
@@ -8522,7 +8577,7 @@ source = "git+https://github.com/paritytech/substrate?branch=master#bfca1a91f760
|
||||
dependencies = [
|
||||
"derive_more",
|
||||
"lazy_static",
|
||||
"libsecp256k1",
|
||||
"libsecp256k1 0.3.5",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
"parity-wasm 0.42.2",
|
||||
@@ -9789,7 +9844,7 @@ dependencies = [
|
||||
"hex",
|
||||
"impl-serde",
|
||||
"lazy_static",
|
||||
"libsecp256k1",
|
||||
"libsecp256k1 0.3.5",
|
||||
"log",
|
||||
"merlin",
|
||||
"num-traits",
|
||||
@@ -9885,7 +9940,7 @@ source = "git+https://github.com/paritytech/substrate?branch=master#bfca1a91f760
|
||||
dependencies = [
|
||||
"futures 0.3.15",
|
||||
"hash-db",
|
||||
"libsecp256k1",
|
||||
"libsecp256k1 0.3.5",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
"parking_lot 0.11.1",
|
||||
@@ -11988,7 +12043,6 @@ dependencies = [
|
||||
"frame-system-rpc-runtime-api",
|
||||
"frame-try-runtime",
|
||||
"hex-literal",
|
||||
"libsecp256k1",
|
||||
"log",
|
||||
"pallet-authority-discovery",
|
||||
"pallet-authorship",
|
||||
|
||||
@@ -41,7 +41,7 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch =
|
||||
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features=false, optional = true }
|
||||
|
||||
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
|
||||
libsecp256k1 = { version = "0.3.5", default-features = false }
|
||||
libsecp256k1 = { version = "0.6.0", default-features = false }
|
||||
runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false }
|
||||
|
||||
slot-range-helper = { path = "slot_range_helper", default-features = false }
|
||||
@@ -59,7 +59,7 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "m
|
||||
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
trie-db = "0.22.3"
|
||||
serde_json = "1.0.61"
|
||||
libsecp256k1 = "0.3.5"
|
||||
libsecp256k1 = "0.6.0"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -99,6 +99,7 @@ std = [
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"libsecp256k1/hmac",
|
||||
"libsecp256k1/static-context",
|
||||
"frame-benchmarking",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
|
||||
@@ -618,19 +618,18 @@ impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T> where
|
||||
#[cfg(any(test, feature = "runtime-benchmarks"))]
|
||||
mod secp_utils {
|
||||
use super::*;
|
||||
use secp256k1;
|
||||
|
||||
pub fn public(secret: &secp256k1::SecretKey) -> secp256k1::PublicKey {
|
||||
secp256k1::PublicKey::from_secret_key(secret)
|
||||
pub fn public(secret: &libsecp256k1::SecretKey) -> libsecp256k1::PublicKey {
|
||||
libsecp256k1::PublicKey::from_secret_key(secret)
|
||||
}
|
||||
pub fn eth(secret: &secp256k1::SecretKey) -> EthereumAddress {
|
||||
pub fn eth(secret: &libsecp256k1::SecretKey) -> EthereumAddress {
|
||||
let mut res = EthereumAddress::default();
|
||||
res.0.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]);
|
||||
res
|
||||
}
|
||||
pub fn sig<T: Config>(secret: &secp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature {
|
||||
pub fn sig<T: Config>(secret: &libsecp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature {
|
||||
let msg = keccak_256(&<super::Pallet<T>>::ethereum_signable_message(&to_ascii_hex(what)[..], extra));
|
||||
let (sig, recovery_id) = secp256k1::sign(&secp256k1::Message::parse(&msg), secret);
|
||||
let (sig, recovery_id) = libsecp256k1::sign(&libsecp256k1::Message::parse(&msg), secret);
|
||||
let mut r = [0u8; 65];
|
||||
r[0..64].copy_from_slice(&sig.serialize()[..]);
|
||||
r[64] = recovery_id.serialize();
|
||||
@@ -640,7 +639,6 @@ mod secp_utils {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use secp256k1;
|
||||
use hex_literal::hex;
|
||||
use super::*;
|
||||
use secp_utils::*;
|
||||
@@ -751,20 +749,20 @@ mod tests {
|
||||
type WeightInfo = TestWeightInfo;
|
||||
}
|
||||
|
||||
fn alice() -> secp256k1::SecretKey {
|
||||
secp256k1::SecretKey::parse(&keccak_256(b"Alice")).unwrap()
|
||||
fn alice() -> libsecp256k1::SecretKey {
|
||||
libsecp256k1::SecretKey::parse(&keccak_256(b"Alice")).unwrap()
|
||||
}
|
||||
fn bob() -> secp256k1::SecretKey {
|
||||
secp256k1::SecretKey::parse(&keccak_256(b"Bob")).unwrap()
|
||||
fn bob() -> libsecp256k1::SecretKey {
|
||||
libsecp256k1::SecretKey::parse(&keccak_256(b"Bob")).unwrap()
|
||||
}
|
||||
fn dave() -> secp256k1::SecretKey {
|
||||
secp256k1::SecretKey::parse(&keccak_256(b"Dave")).unwrap()
|
||||
fn dave() -> libsecp256k1::SecretKey {
|
||||
libsecp256k1::SecretKey::parse(&keccak_256(b"Dave")).unwrap()
|
||||
}
|
||||
fn eve() -> secp256k1::SecretKey {
|
||||
secp256k1::SecretKey::parse(&keccak_256(b"Eve")).unwrap()
|
||||
fn eve() -> libsecp256k1::SecretKey {
|
||||
libsecp256k1::SecretKey::parse(&keccak_256(b"Eve")).unwrap()
|
||||
}
|
||||
fn frank() -> secp256k1::SecretKey {
|
||||
secp256k1::SecretKey::parse(&keccak_256(b"Frank")).unwrap()
|
||||
fn frank() -> libsecp256k1::SecretKey {
|
||||
libsecp256k1::SecretKey::parse(&keccak_256(b"Frank")).unwrap()
|
||||
}
|
||||
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
@@ -1196,7 +1194,7 @@ mod benchmarking {
|
||||
const VALUE: u32 = 1_000_000;
|
||||
|
||||
fn create_claim<T: Config>(input: u32) -> DispatchResult {
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
super::Pallet::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, None)?;
|
||||
@@ -1204,7 +1202,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
fn create_claim_attest<T: Config>(input: u32) -> DispatchResult {
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
super::Pallet::<T>::mint_claim(
|
||||
@@ -1227,7 +1225,7 @@ mod benchmarking {
|
||||
create_claim_attest::<T>(u32::MAX - c)?;
|
||||
}
|
||||
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&c.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
@@ -1272,7 +1270,7 @@ mod benchmarking {
|
||||
|
||||
// Crate signature
|
||||
let attest_c = u32::MAX - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
@@ -1300,7 +1298,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
let attest_c = u32::MAX - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
@@ -1338,10 +1336,10 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
let attest_c = u32::MAX - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
|
||||
let new_secret_key = secp256k1::SecretKey::parse(&keccak_256(&(u32::MAX/2).encode())).unwrap();
|
||||
let new_secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&(u32::MAX/2).encode())).unwrap();
|
||||
let new_eth_address = eth(&new_secret_key);
|
||||
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
@@ -1371,7 +1369,7 @@ mod benchmarking {
|
||||
eth_recover {
|
||||
let i in 0 .. 1_000;
|
||||
// Crate signature
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&i.encode())).unwrap();
|
||||
let secret_key = libsecp256k1::SecretKey::parse(&keccak_256(&i.encode())).unwrap();
|
||||
let account: T::AccountId = account("user", i, SEED);
|
||||
let signature = sig::<T>(&secret_key, &account.encode(), &[][..]);
|
||||
let data = account.using_encoded(to_ascii_hex);
|
||||
|
||||
@@ -90,7 +90,6 @@ xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
libsecp256k1 = "0.3.5"
|
||||
tiny-keccak = "2.0.2"
|
||||
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -38,7 +38,6 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch =
|
||||
xcm = { package = "xcm", path = "../../xcm", default-features = false }
|
||||
xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false }
|
||||
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
|
||||
libsecp256k1 = { version = "0.3.5", default-features = false, optional = true }
|
||||
|
||||
rand = { version = "0.8.3", default-features = false }
|
||||
rand_chacha = { version = "0.3.1", default-features = false }
|
||||
@@ -54,7 +53,6 @@ pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate",
|
||||
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
serde_json = "1.0.61"
|
||||
libsecp256k1 = "0.3.5"
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -90,7 +88,6 @@ std = [
|
||||
"log/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"libsecp256k1/hmac",
|
||||
"frame-benchmarking",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
|
||||
@@ -80,7 +80,6 @@ primitives = { package = "polkadot-primitives", path = "../../primitives", defau
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
libsecp256k1 = "0.3.5"
|
||||
tiny-keccak = "2.0.2"
|
||||
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -60,7 +60,6 @@ polkadot-runtime-parachains = { path = "../parachains", default-features = false
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
libsecp256k1 = "0.3.5"
|
||||
tiny-keccak = "2.0.2"
|
||||
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -88,7 +88,6 @@ xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
libsecp256k1 = "0.3.5"
|
||||
tiny-keccak = "2.0.2"
|
||||
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
Reference in New Issue
Block a user