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: replace some revm deps #11579

Merged
merged 1 commit into from
Oct 8, 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
7 changes: 3 additions & 4 deletions crates/primitives/benches/validate_blob_tx.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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");
Expand All @@ -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);
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/alloy_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,8 @@ impl TryFrom<WithOtherFields<alloy_rpc_types::Transaction>> 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() {
Expand Down
12 changes: 4 additions & 8 deletions crates/primitives/src/transaction/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::Signature;
use alloy_primitives::Address;
use revm_primitives::B256;

#[cfg(feature = "secp256k1")]
pub(crate) mod secp256k1 {
Expand All @@ -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.
///
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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());
Expand Down
Loading