mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-15 09:25:33 -05:00
chore(deps): bump enr, discv5, secp256k1 (#7000)
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ mod allocator {
|
||||
use alloy_genesis::GenesisAccount;
|
||||
use secp256k1::{
|
||||
rand::{thread_rng, RngCore},
|
||||
KeyPair, Secp256k1,
|
||||
Keypair, Secp256k1,
|
||||
};
|
||||
use std::collections::{hash_map::Entry, BTreeMap, HashMap};
|
||||
|
||||
@@ -73,9 +73,9 @@ mod allocator {
|
||||
/// Add a funded account to the genesis alloc.
|
||||
///
|
||||
/// Returns the key pair for the account and the account's address.
|
||||
pub fn new_funded_account(&mut self, balance: U256) -> (KeyPair, Address) {
|
||||
pub fn new_funded_account(&mut self, balance: U256) -> (Keypair, Address) {
|
||||
let secp = Secp256k1::new();
|
||||
let pair = KeyPair::new(&secp, &mut self.rng);
|
||||
let pair = Keypair::new(&secp, &mut self.rng);
|
||||
let address = public_key_to_address(pair.public_key());
|
||||
|
||||
self.alloc.insert(address, GenesisAccount::default().with_balance(balance));
|
||||
@@ -90,9 +90,9 @@ mod allocator {
|
||||
&mut self,
|
||||
balance: U256,
|
||||
code: Bytes,
|
||||
) -> (KeyPair, Address) {
|
||||
) -> (Keypair, Address) {
|
||||
let secp = Secp256k1::new();
|
||||
let pair = KeyPair::new(&secp, &mut self.rng);
|
||||
let pair = Keypair::new(&secp, &mut self.rng);
|
||||
let address = public_key_to_address(pair.public_key());
|
||||
|
||||
self.alloc.insert(
|
||||
@@ -110,9 +110,9 @@ mod allocator {
|
||||
&mut self,
|
||||
balance: U256,
|
||||
storage: BTreeMap<B256, B256>,
|
||||
) -> (KeyPair, Address) {
|
||||
) -> (Keypair, Address) {
|
||||
let secp = Secp256k1::new();
|
||||
let pair = KeyPair::new(&secp, &mut self.rng);
|
||||
let pair = Keypair::new(&secp, &mut self.rng);
|
||||
let address = public_key_to_address(pair.public_key());
|
||||
|
||||
self.alloc.insert(
|
||||
@@ -130,9 +130,9 @@ mod allocator {
|
||||
&mut self,
|
||||
code: Bytes,
|
||||
storage: BTreeMap<B256, B256>,
|
||||
) -> (KeyPair, Address) {
|
||||
) -> (Keypair, Address) {
|
||||
let secp = Secp256k1::new();
|
||||
let pair = KeyPair::new(&secp, &mut self.rng);
|
||||
let pair = Keypair::new(&secp, &mut self.rng);
|
||||
let address = public_key_to_address(pair.public_key());
|
||||
|
||||
self.alloc.insert(
|
||||
@@ -146,9 +146,9 @@ mod allocator {
|
||||
/// Adds an account with code to the genesis alloc.
|
||||
///
|
||||
/// Returns the key pair for the account and the account's address.
|
||||
pub fn new_account_with_code(&mut self, code: Bytes) -> (KeyPair, Address) {
|
||||
pub fn new_account_with_code(&mut self, code: Bytes) -> (Keypair, Address) {
|
||||
let secp = Secp256k1::new();
|
||||
let pair = KeyPair::new(&secp, &mut self.rng);
|
||||
let pair = Keypair::new(&secp, &mut self.rng);
|
||||
let address = public_key_to_address(pair.public_key());
|
||||
|
||||
self.alloc.insert(address, GenesisAccount::default().with_code(Some(code)));
|
||||
@@ -169,7 +169,7 @@ mod allocator {
|
||||
/// Returns the key pair for the account and the account's address.
|
||||
pub fn add_account(&mut self, account: GenesisAccount) -> Address {
|
||||
let secp = Secp256k1::new();
|
||||
let pair = KeyPair::new(&secp, &mut self.rng);
|
||||
let pair = Keypair::new(&secp, &mut self.rng);
|
||||
let address = public_key_to_address(pair.public_key());
|
||||
|
||||
self.alloc.insert(address, account);
|
||||
|
||||
@@ -1755,7 +1755,7 @@ mod tests {
|
||||
use alloy_primitives::{address, b256, bytes};
|
||||
use alloy_rlp::{Decodable, Encodable, Error as RlpError};
|
||||
use reth_codecs::Compact;
|
||||
use secp256k1::{KeyPair, Secp256k1};
|
||||
use secp256k1::{Keypair, Secp256k1};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
@@ -2048,7 +2048,7 @@ mod tests {
|
||||
tx.set_chain_id(chain_id % (u64::MAX / 2 - 36));
|
||||
}
|
||||
|
||||
let key_pair = KeyPair::new(&secp, &mut rng);
|
||||
let key_pair = Keypair::new(&secp, &mut rng);
|
||||
|
||||
let signature =
|
||||
sign_message(B256::from_slice(&key_pair.secret_bytes()[..]), tx.signature_hash()).unwrap();
|
||||
|
||||
@@ -18,7 +18,7 @@ pub(crate) mod secp256k1 {
|
||||
let sig =
|
||||
RecoverableSignature::from_compact(&sig[0..64], RecoveryId::from_i32(sig[64] as i32)?)?;
|
||||
|
||||
let public = SECP256K1.recover_ecdsa(&Message::from_slice(&msg[..32])?, &sig)?;
|
||||
let public = SECP256K1.recover_ecdsa(&Message::from_digest(*msg), &sig)?;
|
||||
Ok(public_key_to_address(public))
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) mod secp256k1 {
|
||||
/// Returns the corresponding signature.
|
||||
pub fn sign_message(secret: B256, message: B256) -> Result<Signature, secp256k1::Error> {
|
||||
let sec = SecretKey::from_slice(secret.as_ref())?;
|
||||
let s = SECP256K1.sign_ecdsa_recoverable(&Message::from_slice(&message[..])?, &sec);
|
||||
let s = SECP256K1.sign_ecdsa_recoverable(&Message::from_digest(message.0), &sec);
|
||||
let (rec_id, data) = s.serialize_compact();
|
||||
|
||||
let signature = Signature {
|
||||
|
||||
Reference in New Issue
Block a user