From c13ab7a292ab65ee1a1ed5724de1b2aacfa9b87e Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 8 Oct 2024 16:23:56 +0200 Subject: [PATCH] chore: replace some revm deps (#11579) --- crates/primitives/benches/validate_blob_tx.rs | 7 +++---- crates/primitives/src/alloy_compat.rs | 3 +-- crates/primitives/src/transaction/util.rs | 12 ++++-------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/crates/primitives/benches/validate_blob_tx.rs b/crates/primitives/benches/validate_blob_tx.rs index 61fe161f2..50498a942 100644 --- a/crates/primitives/benches/validate_blob_tx.rs +++ b/crates/primitives/benches/validate_blob_tx.rs @@ -1,7 +1,7 @@ #![allow(missing_docs)] use alloy_consensus::TxEip4844; -use alloy_eips::eip4844::env_settings::EnvKzgSettings; +use alloy_eips::eip4844::{env_settings::EnvKzgSettings, MAX_BLOBS_PER_BLOCK}; use alloy_primitives::hex; use criterion::{ criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, @@ -13,7 +13,6 @@ use proptest::{ }; use proptest_arbitrary_interop::arb; use reth_primitives::BlobTransactionSidecar; -use revm_primitives::MAX_BLOB_NUMBER_PER_BLOCK; // constant seed to use for the rng const SEED: [u8; 32] = hex!("1337133713371337133713371337133713371337133713371337133713371337"); @@ -22,9 +21,9 @@ const SEED: [u8; 32] = hex!("133713371337133713371337133713371337133713371337133 fn blob_validation(c: &mut Criterion) { let mut group = c.benchmark_group("Blob Transaction KZG validation"); - for num_blobs in 1..=MAX_BLOB_NUMBER_PER_BLOCK { + for num_blobs in 1..=MAX_BLOBS_PER_BLOCK { println!("Benchmarking validation for tx with {num_blobs} blobs"); - validate_blob_tx(&mut group, "ValidateBlob", num_blobs, EnvKzgSettings::Default); + validate_blob_tx(&mut group, "ValidateBlob", num_blobs as u64, EnvKzgSettings::Default); } } diff --git a/crates/primitives/src/alloy_compat.rs b/crates/primitives/src/alloy_compat.rs index bf7f557b7..f43af019e 100644 --- a/crates/primitives/src/alloy_compat.rs +++ b/crates/primitives/src/alloy_compat.rs @@ -278,9 +278,8 @@ impl TryFrom> for TransactionSigne #[cfg(feature = "optimism")] mod tests { use super::*; - use alloy_primitives::{B256, U256}; + use alloy_primitives::{address, Address, B256, U256}; use alloy_rpc_types::Transaction as AlloyTransaction; - use revm_primitives::{address, Address}; #[test] fn optimism_deposit_tx_conversion_no_mint() { diff --git a/crates/primitives/src/transaction/util.rs b/crates/primitives/src/transaction/util.rs index 6205ec886..7569400e9 100644 --- a/crates/primitives/src/transaction/util.rs +++ b/crates/primitives/src/transaction/util.rs @@ -1,6 +1,5 @@ use crate::Signature; use alloy_primitives::Address; -use revm_primitives::B256; #[cfg(feature = "secp256k1")] pub(crate) mod secp256k1 { @@ -20,8 +19,7 @@ mod impl_secp256k1 { ecdsa::{RecoverableSignature, RecoveryId}, Message, PublicKey, SecretKey, SECP256K1, }; - use alloy_primitives::{keccak256, Parity}; - use revm_primitives::U256; + use alloy_primitives::{keccak256, Parity, B256, U256}; /// Recovers the address of the sender using secp256k1 pubkey recovery. /// @@ -65,10 +63,9 @@ mod impl_secp256k1 { #[cfg_attr(feature = "secp256k1", allow(unused, unreachable_pub))] mod impl_k256 { use super::*; - use alloy_primitives::{keccak256, Parity}; + use alloy_primitives::{keccak256, Parity, B256, U256}; pub(crate) use k256::ecdsa::Error; use k256::ecdsa::{RecoveryId, SigningKey, VerifyingKey}; - use revm_primitives::U256; /// Recovers the address of the sender using secp256k1 pubkey recovery. /// @@ -117,11 +114,12 @@ mod impl_k256 { #[cfg(test)] mod tests { + use alloy_primitives::{keccak256, B256}; + #[cfg(feature = "secp256k1")] #[test] fn sanity_ecrecover_call_secp256k1() { use super::impl_secp256k1::*; - use revm_primitives::{keccak256, B256}; let (secret, public) = secp256k1::generate_keypair(&mut rand::thread_rng()); let signer = public_key_to_address(public); @@ -143,7 +141,6 @@ mod tests { #[test] fn sanity_ecrecover_call_k256() { use super::impl_k256::*; - use revm_primitives::{keccak256, B256}; let secret = k256::ecdsa::SigningKey::random(&mut rand::thread_rng()); let public = *secret.verifying_key(); @@ -165,7 +162,6 @@ mod tests { #[test] fn sanity_secp256k1_k256_compat() { use super::{impl_k256, impl_secp256k1}; - use revm_primitives::{keccak256, B256}; let (secp256k1_secret, secp256k1_public) = secp256k1::generate_keypair(&mut rand::thread_rng());