Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump enr, discv5, secp256k1 #7000

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 28 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,8 @@ reth-trie-parallel = { path = "crates/trie-parallel" }
reth-node-events = { path = "crates/node/events" }

# revm
revm = { version = "8.0.0", features = [
"std",
"secp256k1",
], default-features = false }
revm-primitives = { version = "3.1.0", features = [
"std",
], default-features = false }
revm = { version = "8.0.0", features = ["std", "secp256k1"], default-features = false }
revm-primitives = { version = "3.1.0", features = ["std"], default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "dc614ee" }

# eth
Expand Down Expand Up @@ -358,7 +353,7 @@ http = "0.2.8"
http-body = "0.4.5"

# p2p
discv5 = { git = "https://github.com/sigp/discv5", rev = "04ac004" }
discv5 = "0.6.0"
igd-next = "0.14.3"

# rpc
Expand All @@ -367,11 +362,12 @@ jsonrpsee-core = "0.22"
jsonrpsee-types = "0.22"

# crypto
secp256k1 = { version = "0.27.0", default-features = false, features = [
secp256k1 = { version = "0.28", default-features = false, features = [
"global-context",
"recovery",
] }
enr = { version = "=0.10.0", default-features = false, features = ["k256"] }
# TODO: Remove `k256` feature: https://github.com/sigp/enr/pull/74
enr = { version = "0.12.0", default-features = false, features = ["k256", "rust-secp256k1"] }

# for eip-4844
c-kzg = "1.0.0"
Expand Down
14 changes: 7 additions & 7 deletions crates/interfaces/src/test_utils/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use reth_primitives::{
proofs, sign_message, Account, Address, BlockNumber, Bytes, Header, Log, Receipt, SealedBlock,
SealedHeader, StorageEntry, Transaction, TransactionSigned, TxKind, TxLegacy, B256, U256,
};
use secp256k1::{KeyPair, Secp256k1};
use secp256k1::{Keypair, Secp256k1};
DaniPopes marked this conversation as resolved.
Show resolved Hide resolved
use std::{
cmp::{max, min},
collections::{hash_map::DefaultHasher, BTreeMap},
Expand Down Expand Up @@ -91,22 +91,22 @@ pub fn random_tx<R: Rng>(rng: &mut R) -> Transaction {
/// - There is no guarantee that the nonce is not used twice for the same account
pub fn random_signed_tx<R: Rng>(rng: &mut R) -> TransactionSigned {
let secp = Secp256k1::new();
let key_pair = KeyPair::new(&secp, rng);
let key_pair = Keypair::new(&secp, rng);
let tx = random_tx(rng);
sign_tx_with_key_pair(key_pair, tx)
}

/// Signs the [Transaction] with the given key pair.
pub fn sign_tx_with_key_pair(key_pair: KeyPair, tx: Transaction) -> TransactionSigned {
pub fn sign_tx_with_key_pair(key_pair: Keypair, tx: Transaction) -> TransactionSigned {
let signature =
sign_message(B256::from_slice(&key_pair.secret_bytes()[..]), tx.signature_hash()).unwrap();
TransactionSigned::from_transaction_and_signature(tx, signature)
}

/// Generates a set of [KeyPair]s based on the desired count.
pub fn generate_keys<R: Rng>(rng: &mut R, count: usize) -> Vec<KeyPair> {
/// Generates a set of [Keypair]s based on the desired count.
pub fn generate_keys<R: Rng>(rng: &mut R, count: usize) -> Vec<Keypair> {
let secp = Secp256k1::new();
(0..count).map(|_| KeyPair::new(&secp, rng)).collect()
(0..count).map(|_| Keypair::new(&secp, rng)).collect()
}

/// Generate a random block filled with signed transactions (generated using
Expand Down Expand Up @@ -404,7 +404,7 @@ mod tests {
let signature_hash = tx.signature_hash();

for _ in 0..100 {
let key_pair = KeyPair::new(&secp, &mut rand::thread_rng());
let key_pair = Keypair::new(&secp, &mut rand::thread_rng());

let signature =
sign_message(B256::from_slice(&key_pair.secret_bytes()[..]), signature_hash)
Expand Down
3 changes: 1 addition & 2 deletions crates/net/discv4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ reth-net-nat.workspace = true
alloy-rlp = { workspace = true, features = ["derive"] }
discv5.workspace = true
secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery", "serde"] }
enr = { workspace = true, default-features = false, features = ["rust-secp256k1"] }
rlp = "0.5" # needed for enr
enr.workspace = true
# async/futures
tokio = { workspace = true, features = ["io-util", "net", "time"] }
tokio-stream.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/net/discv4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use discv5::{
};
use enr::Enr;
use parking_lot::Mutex;
use proto::{EnrRequest, EnrResponse, EnrWrapper};
use proto::{EnrRequest, EnrResponse};
use reth_primitives::{bytes::Bytes, hex, ForkId, PeerId, B256};
use secp256k1::SecretKey;
use std::{
Expand Down Expand Up @@ -1279,7 +1279,7 @@ impl Discv4Service {
self.send_packet(
Message::EnrResponse(EnrResponse {
request_hash,
enr: EnrWrapper::new(self.local_eip_868_enr.clone()),
enr: self.local_eip_868_enr.clone(),
}),
remote_addr,
);
Expand Down
Loading
Loading