diff --git a/bridges/bin/rialto/runtime/Cargo.toml b/bridges/bin/rialto/runtime/Cargo.toml index 8f4f4ef30e7ab..d44d8797e34f8 100644 --- a/bridges/bin/rialto/runtime/Cargo.toml +++ b/bridges/bin/rialto/runtime/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] } hex-literal = "0.3" -libsecp256k1 = { version = "0.3.4", optional = true, default-features = false, features = ["hmac"] } +libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] } log = { version = "0.4.14", default-features = false } serde = { version = "1.0", optional = true, features = ["derive"] } @@ -72,7 +72,7 @@ polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", bran polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } [dev-dependencies] -libsecp256k1 = { version = "0.3.4", features = ["hmac"] } +libsecp256k1 = { version = "0.7", features = ["hmac"] } [build-dependencies] substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/bridges/bin/rialto/runtime/src/exchange.rs b/bridges/bin/rialto/runtime/src/exchange.rs index 9f34707848fea..f940287ff76a2 100644 --- a/bridges/bin/rialto/runtime/src/exchange.rs +++ b/bridges/bin/rialto/runtime/src/exchange.rs @@ -162,7 +162,7 @@ pub(crate) fn prepare_ethereum_transaction( // chain id is 0x11 // sender secret is 0x4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7 let chain_id = 0x11; - let signer = secp256k1::SecretKey::parse(&hex!( + let signer = libsecp256k1::SecretKey::parse(&hex!( "4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7" )) .unwrap(); diff --git a/bridges/modules/ethereum/Cargo.toml b/bridges/modules/ethereum/Cargo.toml index 275747eb329a0..ce890fa2abb78 100644 --- a/bridges/modules/ethereum/Cargo.toml +++ b/bridges/modules/ethereum/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"], optional = true } +libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac"], optional = true } log = { version = "0.4.14", default-features = false } serde = { version = "1.0", optional = true } @@ -26,7 +26,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } [dev-dependencies] -libsecp256k1 = { version = "0.3.4", features = ["hmac"] } +libsecp256k1 = { version = "0.7", features = ["hmac"] } hex-literal = "0.3" [features] diff --git a/bridges/modules/ethereum/src/import.rs b/bridges/modules/ethereum/src/import.rs index 31e8642d51096..3777432457770 100644 --- a/bridges/modules/ethereum/src/import.rs +++ b/bridges/modules/ethereum/src/import.rs @@ -180,7 +180,7 @@ mod tests { validators::ValidatorsSource, BlocksToPrune, BridgeStorage, Headers, PruningRange, }; - use secp256k1::SecretKey; + use libsecp256k1::SecretKey; const TOTAL_VALIDATORS: usize = 3; diff --git a/bridges/modules/ethereum/src/mock.rs b/bridges/modules/ethereum/src/mock.rs index e0439444020c7..877f7a9dc11f8 100644 --- a/bridges/modules/ethereum/src/mock.rs +++ b/bridges/modules/ethereum/src/mock.rs @@ -28,7 +28,7 @@ use crate::{ }; use bp_eth_poa::{Address, AuraHeader, H256, U256}; use frame_support::{parameter_types, traits::GenesisBuild, weights::Weight}; -use secp256k1::SecretKey; +use libsecp256k1::SecretKey; use sp_runtime::{ testing::Header as SubstrateHeader, traits::{BlakeTwo256, IdentityLookup}, diff --git a/bridges/modules/ethereum/src/test_utils.rs b/bridges/modules/ethereum/src/test_utils.rs index 343c7b1cb3646..414445f3aaccb 100644 --- a/bridges/modules/ethereum/src/test_utils.rs +++ b/bridges/modules/ethereum/src/test_utils.rs @@ -34,7 +34,7 @@ use bp_eth_poa::{ signatures::{secret_to_address, sign, SignHeader}, Address, AuraHeader, Bloom, Receipt, SealedEmptyStep, H256, U256, }; -use secp256k1::SecretKey; +use libsecp256k1::SecretKey; use sp_std::prelude::*; /// Gas limit valid in test environment. diff --git a/bridges/modules/ethereum/src/verification.rs b/bridges/modules/ethereum/src/verification.rs index af7b33fc80bbb..c708a6ba2d0b3 100644 --- a/bridges/modules/ethereum/src/verification.rs +++ b/bridges/modules/ethereum/src/verification.rs @@ -401,7 +401,7 @@ mod tests { }; use bp_eth_poa::{compute_merkle_root, rlp_encode, TransactionOutcome, H520, U256}; use hex_literal::hex; - use secp256k1::SecretKey; + use libsecp256k1::SecretKey; use sp_runtime::transaction_validity::TransactionTag; const GENESIS_STEP: u64 = 42; diff --git a/bridges/primitives/ethereum-poa/Cargo.toml b/bridges/primitives/ethereum-poa/Cargo.toml index 5843b041c5708..e7acd80eff23d 100644 --- a/bridges/primitives/ethereum-poa/Cargo.toml +++ b/bridges/primitives/ethereum-poa/Cargo.toml @@ -13,7 +13,7 @@ fixed-hash = { version = "0.7", default-features = false } hash-db = { version = "0.15.2", default-features = false } impl-rlp = { version = "0.3", default-features = false } impl-serde = { version = "0.3.1", optional = true } -libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] } +libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac", "static-context"] } parity-bytes = { version = "0.1", default-features = false } plain_hasher = { version = "0.2.2", default-features = false } primitive-types = { version = "0.10", default-features = false, features = ["codec", "rlp"] } diff --git a/bridges/primitives/ethereum-poa/src/signatures.rs b/bridges/primitives/ethereum-poa/src/signatures.rs index aaa5a980b2e20..26371f2166ad5 100644 --- a/bridges/primitives/ethereum-poa/src/signatures.rs +++ b/bridges/primitives/ethereum-poa/src/signatures.rs @@ -20,14 +20,14 @@ //! Used for testing and benchmarking. // reexport to avoid direct secp256k1 deps by other crates -pub use secp256k1::SecretKey; +pub use libsecp256k1::SecretKey; use crate::{ public_to_address, rlp_encode, step_validator, Address, AuraHeader, RawTransaction, UnsignedTransaction, H256, H520, U256, }; -use secp256k1::{Message, PublicKey}; +use libsecp256k1::{Message, PublicKey}; /// Utilities for signing headers. pub trait SignHeader { @@ -81,7 +81,7 @@ impl SignTransaction for UnsignedTransaction { /// Return author's signature over given message. pub fn sign(author: &SecretKey, message: H256) -> H520 { let (signature, recovery_id) = - secp256k1::sign(&Message::parse(message.as_fixed_bytes()), author); + libsecp256k1::sign(&Message::parse(message.as_fixed_bytes()), author); let mut raw_signature = [0u8; 65]; raw_signature[..64].copy_from_slice(&signature.serialize()); raw_signature[64] = recovery_id.serialize(); diff --git a/bridges/relays/bin-ethereum/Cargo.toml b/bridges/relays/bin-ethereum/Cargo.toml index baf927b42a4f6..080608a26f8c6 100644 --- a/bridges/relays/bin-ethereum/Cargo.toml +++ b/bridges/relays/bin-ethereum/Cargo.toml @@ -17,7 +17,7 @@ ethabi-derive = { git = "https://github.com/svyatonik/ethabi.git", branch = "bum futures = "0.3.12" hex = "0.4" hex-literal = "0.3" -libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] } +libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac"] } log = "0.4.14" num-traits = "0.2" serde_json = "1.0.64" diff --git a/bridges/relays/bin-ethereum/src/main.rs b/bridges/relays/bin-ethereum/src/main.rs index cb64dc40d935e..86b749872913e 100644 --- a/bridges/relays/bin-ethereum/src/main.rs +++ b/bridges/relays/bin-ethereum/src/main.rs @@ -34,11 +34,11 @@ use ethereum_sync_loop::EthereumSyncParams; use headers_relay::sync::TargetTransactionMode; use hex_literal::hex; use instances::{BridgeInstance, Kovan, RialtoPoA}; +use libsecp256k1::SecretKey; use relay_utils::{ initialize::initialize_relay, metrics::{MetricsAddress, MetricsParams}, }; -use secp256k1::SecretKey; use sp_core::crypto::Pair; use substrate_sync_loop::SubstrateSyncParams; diff --git a/bridges/relays/bin-substrate/Cargo.toml b/bridges/relays/bin-substrate/Cargo.toml index 0f9e2792139fa..a28c61262f403 100644 --- a/bridges/relays/bin-substrate/Cargo.toml +++ b/bridges/relays/bin-substrate/Cargo.toml @@ -75,5 +75,5 @@ polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", hex-literal = "0.3" pallet-bridge-grandpa = { path = "../../modules/grandpa" } sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } -tempdir = "0.3" +tempfile = "3.2" finality-grandpa = { version = "0.14.0" } diff --git a/bridges/relays/bin-substrate/src/cli/mod.rs b/bridges/relays/bin-substrate/src/cli/mod.rs index b50fd20ea94fd..c35c2b87dd8fb 100644 --- a/bridges/relays/bin-substrate/src/cli/mod.rs +++ b/bridges/relays/bin-substrate/src/cli/mod.rs @@ -573,7 +573,7 @@ mod tests { let bob_with_alice_password = sp_core::sr25519::Pair::from_string(BOB, Some(ALICE_PASSWORD)).unwrap(); - let temp_dir = tempdir::TempDir::new("reads_suri_from_file").unwrap(); + let temp_dir = tempfile::tempdir().unwrap(); let mut suri_file_path = temp_dir.path().to_path_buf(); let mut password_file_path = temp_dir.path().to_path_buf(); suri_file_path.push("suri"); diff --git a/bridges/relays/client-ethereum/Cargo.toml b/bridges/relays/client-ethereum/Cargo.toml index 6d56eb94dbd71..4263055d01b4e 100644 --- a/bridges/relays/client-ethereum/Cargo.toml +++ b/bridges/relays/client-ethereum/Cargo.toml @@ -12,7 +12,7 @@ headers-relay = { path = "../headers" } hex-literal = "0.3" jsonrpsee-proc-macros = "0.3.1" jsonrpsee-ws-client = "0.3.1" -libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] } +libsecp256k1 = { version = "0.7", default-features = false, features = ["hmac"] } log = "0.4.11" relay-utils = { path = "../utils" } tokio = "1.8" diff --git a/bridges/relays/client-ethereum/src/sign.rs b/bridges/relays/client-ethereum/src/sign.rs index 0d9a8d032ee2e..86ddcc871c40e 100644 --- a/bridges/relays/client-ethereum/src/sign.rs +++ b/bridges/relays/client-ethereum/src/sign.rs @@ -20,7 +20,7 @@ use crate::{ }; use bp_eth_poa::signatures::{secret_to_address, SignTransaction}; use hex_literal::hex; -use secp256k1::SecretKey; +use libsecp256k1::SecretKey; /// Ethereum signing params. #[derive(Clone, Debug)]