chore: replace some revm deps (#11579)

This commit is contained in:
Matthias Seitz
2024-10-08 16:23:56 +02:00
committed by GitHub
parent c32d4c3f2a
commit c13ab7a292
3 changed files with 8 additions and 14 deletions

View File

@ -1,7 +1,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use alloy_consensus::TxEip4844; 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 alloy_primitives::hex;
use criterion::{ use criterion::{
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
@ -13,7 +13,6 @@ use proptest::{
}; };
use proptest_arbitrary_interop::arb; use proptest_arbitrary_interop::arb;
use reth_primitives::BlobTransactionSidecar; use reth_primitives::BlobTransactionSidecar;
use revm_primitives::MAX_BLOB_NUMBER_PER_BLOCK;
// constant seed to use for the rng // constant seed to use for the rng
const SEED: [u8; 32] = hex!("1337133713371337133713371337133713371337133713371337133713371337"); const SEED: [u8; 32] = hex!("1337133713371337133713371337133713371337133713371337133713371337");
@ -22,9 +21,9 @@ const SEED: [u8; 32] = hex!("133713371337133713371337133713371337133713371337133
fn blob_validation(c: &mut Criterion) { fn blob_validation(c: &mut Criterion) {
let mut group = c.benchmark_group("Blob Transaction KZG validation"); 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"); 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);
} }
} }

View File

@ -278,9 +278,8 @@ impl TryFrom<WithOtherFields<alloy_rpc_types::Transaction>> for TransactionSigne
#[cfg(feature = "optimism")] #[cfg(feature = "optimism")]
mod tests { mod tests {
use super::*; use super::*;
use alloy_primitives::{B256, U256}; use alloy_primitives::{address, Address, B256, U256};
use alloy_rpc_types::Transaction as AlloyTransaction; use alloy_rpc_types::Transaction as AlloyTransaction;
use revm_primitives::{address, Address};
#[test] #[test]
fn optimism_deposit_tx_conversion_no_mint() { fn optimism_deposit_tx_conversion_no_mint() {

View File

@ -1,6 +1,5 @@
use crate::Signature; use crate::Signature;
use alloy_primitives::Address; use alloy_primitives::Address;
use revm_primitives::B256;
#[cfg(feature = "secp256k1")] #[cfg(feature = "secp256k1")]
pub(crate) mod secp256k1 { pub(crate) mod secp256k1 {
@ -20,8 +19,7 @@ mod impl_secp256k1 {
ecdsa::{RecoverableSignature, RecoveryId}, ecdsa::{RecoverableSignature, RecoveryId},
Message, PublicKey, SecretKey, SECP256K1, Message, PublicKey, SecretKey, SECP256K1,
}; };
use alloy_primitives::{keccak256, Parity}; use alloy_primitives::{keccak256, Parity, B256, U256};
use revm_primitives::U256;
/// Recovers the address of the sender using secp256k1 pubkey recovery. /// 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))] #[cfg_attr(feature = "secp256k1", allow(unused, unreachable_pub))]
mod impl_k256 { mod impl_k256 {
use super::*; use super::*;
use alloy_primitives::{keccak256, Parity}; use alloy_primitives::{keccak256, Parity, B256, U256};
pub(crate) use k256::ecdsa::Error; pub(crate) use k256::ecdsa::Error;
use k256::ecdsa::{RecoveryId, SigningKey, VerifyingKey}; use k256::ecdsa::{RecoveryId, SigningKey, VerifyingKey};
use revm_primitives::U256;
/// Recovers the address of the sender using secp256k1 pubkey recovery. /// Recovers the address of the sender using secp256k1 pubkey recovery.
/// ///
@ -117,11 +114,12 @@ mod impl_k256 {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use alloy_primitives::{keccak256, B256};
#[cfg(feature = "secp256k1")] #[cfg(feature = "secp256k1")]
#[test] #[test]
fn sanity_ecrecover_call_secp256k1() { fn sanity_ecrecover_call_secp256k1() {
use super::impl_secp256k1::*; use super::impl_secp256k1::*;
use revm_primitives::{keccak256, B256};
let (secret, public) = secp256k1::generate_keypair(&mut rand::thread_rng()); let (secret, public) = secp256k1::generate_keypair(&mut rand::thread_rng());
let signer = public_key_to_address(public); let signer = public_key_to_address(public);
@ -143,7 +141,6 @@ mod tests {
#[test] #[test]
fn sanity_ecrecover_call_k256() { fn sanity_ecrecover_call_k256() {
use super::impl_k256::*; use super::impl_k256::*;
use revm_primitives::{keccak256, B256};
let secret = k256::ecdsa::SigningKey::random(&mut rand::thread_rng()); let secret = k256::ecdsa::SigningKey::random(&mut rand::thread_rng());
let public = *secret.verifying_key(); let public = *secret.verifying_key();
@ -165,7 +162,6 @@ mod tests {
#[test] #[test]
fn sanity_secp256k1_k256_compat() { fn sanity_secp256k1_k256_compat() {
use super::{impl_k256, impl_secp256k1}; use super::{impl_k256, impl_secp256k1};
use revm_primitives::{keccak256, B256};
let (secp256k1_secret, secp256k1_public) = let (secp256k1_secret, secp256k1_public) =
secp256k1::generate_keypair(&mut rand::thread_rng()); secp256k1::generate_keypair(&mut rand::thread_rng());