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

primitives: rm alloy Signature reexport #12313

Merged
merged 1 commit into from
Nov 5, 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
6 changes: 3 additions & 3 deletions crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ mod tests {
use alloy_consensus::{TxEip1559, EMPTY_ROOT_HASH};
use alloy_eips::eip1559::INITIAL_BASE_FEE;
use alloy_genesis::{Genesis, GenesisAccount};
use alloy_primitives::{keccak256, Address, Sealable, B256};
use alloy_primitives::{keccak256, Address, Sealable, Signature, B256};
use assert_matches::assert_matches;
use linked_hash_set::LinkedHashSet;
use reth_chainspec::{ChainSpecBuilder, MAINNET, MIN_TRANSACTION_GAS};
Expand All @@ -1389,8 +1389,8 @@ mod tests {
use reth_primitives::{
proofs::{calculate_receipt_root, calculate_transaction_root},
revm_primitives::AccountInfo,
Account, BlockBody, Header, Signature, Transaction, TransactionSigned,
TransactionSignedEcRecovered, Withdrawals,
Account, BlockBody, Header, Transaction, TransactionSigned, TransactionSignedEcRecovered,
Withdrawals,
};
use reth_provider::{
test_utils::{
Expand Down
4 changes: 2 additions & 2 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ mod tests {
use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_primitives::{
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, U256,
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, Signature, U256,
};
use mockall::mock;
use rand::Rng;
use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{
proofs, Account, BlockBody, Signature, Transaction, TransactionSigned, Withdrawals,
proofs, Account, BlockBody, Transaction, TransactionSigned, Withdrawals,
};
use reth_storage_api::{
errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider,
Expand Down
4 changes: 2 additions & 2 deletions crates/net/eth-wire-types/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ mod tests {
};
use alloy_consensus::TxLegacy;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{hex, Parity, TxKind, U256};
use alloy_primitives::{hex, Parity, Signature, TxKind, U256};
use alloy_rlp::{Decodable, Encodable};
use reth_primitives::{Header, Signature, Transaction, TransactionSigned};
use reth_primitives::{Header, Transaction, TransactionSigned};
use std::str::FromStr;

use super::BlockBody;
Expand Down
4 changes: 2 additions & 2 deletions crates/net/eth-wire-types/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ impl FromIterator<PooledTransactionsElement> for PooledTransactions {
mod tests {
use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions};
use alloy_consensus::{TxEip1559, TxLegacy};
use alloy_primitives::{hex, Parity, TxKind, U256};
use alloy_primitives::{hex, Parity, Signature, TxKind, U256};
use alloy_rlp::{Decodable, Encodable};
use reth_chainspec::MIN_TRANSACTION_GAS;
use reth_primitives::{PooledTransactionsElement, Signature, Transaction, TransactionSigned};
use reth_primitives::{PooledTransactionsElement, Transaction, TransactionSigned};
use std::str::FromStr;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/net/network/tests/it/big_pooled_txs_req.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use alloy_primitives::B256;
use alloy_primitives::{Signature, B256};
use reth_eth_wire::{GetPooledTransactions, PooledTransactions};
use reth_network::{
test_utils::{NetworkEventStream, Testnet},
NetworkEventListenerProvider, PeerRequest,
};
use reth_network_api::{NetworkInfo, Peers};
use reth_network_p2p::sync::{NetworkSyncUpdater, SyncState};
use reth_primitives::{Signature, TransactionSigned};
use reth_primitives::TransactionSigned;
use reth_provider::test_utils::MockEthProvider;
use reth_transaction_pool::{
test_utils::{testing_pool, MockTransaction},
Expand Down
4 changes: 2 additions & 2 deletions crates/net/network/tests/it/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::sync::Arc;

use alloy_consensus::TxEip2930;
use alloy_primitives::{Bytes, Parity, TxKind, U256};
use alloy_primitives::{Bytes, Parity, Signature, TxKind, U256};
use rand::Rng;
use reth_eth_wire::HeadersDirection;
use reth_network::{
Expand All @@ -16,7 +16,7 @@ use reth_network_p2p::{
bodies::client::BodiesClient,
headers::client::{HeadersClient, HeadersRequest},
};
use reth_primitives::{Block, Header, Signature, Transaction, TransactionSigned};
use reth_primitives::{Block, Header, Transaction, TransactionSigned};
use reth_provider::test_utils::MockEthProvider;

/// Returns a new [`TransactionSigned`] with some random parameters
Expand Down
4 changes: 2 additions & 2 deletions crates/net/network/tests/it/txgossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use std::sync::Arc;

use alloy_consensus::TxLegacy;
use alloy_primitives::U256;
use alloy_primitives::{Signature, U256};
use futures::StreamExt;
use rand::thread_rng;
use reth_network::{test_utils::Testnet, NetworkEvent, NetworkEventListenerProvider};
use reth_network_api::PeersInfo;
use reth_primitives::{Signature, TransactionSigned};
use reth_primitives::TransactionSigned;
use reth_provider::test_utils::{ExtendedAccount, MockEthProvider};
use reth_transaction_pool::{test_utils::TransactionGenerator, PoolTransaction, TransactionPool};

Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ mod tests {
use super::*;
use crate::OpChainSpec;
use alloy_consensus::TxEip1559;
use alloy_primitives::{b256, Address, StorageKey, StorageValue};
use alloy_primitives::{b256, Address, Signature, StorageKey, StorageValue};
use op_alloy_consensus::TxDeposit;
use reth_chainspec::MIN_TRANSACTION_GAS;
use reth_evm::execute::{BasicBlockExecutorProvider, BatchExecutor, BlockExecutorProvider};
use reth_optimism_chainspec::OpChainSpecBuilder;
use reth_primitives::{Account, Block, BlockBody, Signature, Transaction, TransactionSigned};
use reth_primitives::{Account, Block, BlockBody, Transaction, TransactionSigned};
use reth_revm::{
database::StateProviderDatabase, test_utils::StateProviderTest, L1_BLOCK_CONTRACT,
};
Expand Down
3 changes: 1 addition & 2 deletions crates/optimism/node/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,8 @@ pub struct OpL1BlockInfo {
mod tests {
use crate::txpool::OpTransactionValidator;
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{TxKind, U256};
use alloy_primitives::{Signature, TxKind, U256};
use op_alloy_consensus::TxDeposit;
use reth::primitives::Signature;
use reth_chainspec::MAINNET;
use reth_primitives::{Transaction, TransactionSigned, TransactionSignedEcRecovered};
use reth_provider::test_utils::MockEthProvider;
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/alloy_compat.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Common conversions from alloy types.

use crate::{
transaction::extract_chain_id, Block, BlockBody, Signature, Transaction, TransactionSigned,
transaction::extract_chain_id, Block, BlockBody, Transaction, TransactionSigned,
TransactionSignedEcRecovered, TransactionSignedNoHash, TxType,
};
use alloc::{string::ToString, vec::Vec};
use alloy_consensus::{
constants::EMPTY_TRANSACTIONS, Transaction as _, TxEip1559, TxEip2930, TxEip4844, TxLegacy,
};
use alloy_primitives::{Parity, TxKind};
use alloy_primitives::{Parity, Signature, TxKind};
use alloy_rlp::Error as RlpError;
use alloy_serde::WithOtherFields;
use op_alloy_rpc_types as _;
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub use transaction::BlobTransactionValidationError;

pub use transaction::{
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
InvalidTransactionError, Signature, Transaction, TransactionMeta, TransactionSigned,
InvalidTransactionError, Transaction, TransactionMeta, TransactionSigned,
TransactionSignedEcRecovered, TransactionSignedNoHash, TxHashOrNumber, TxType,
};

Expand Down
12 changes: 6 additions & 6 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use alloy_eips::{
eip2930::AccessList,
eip7702::SignedAuthorization,
};
use alloy_primitives::{keccak256, Address, Bytes, ChainId, TxHash, TxKind, B256, U256};
use alloy_primitives::{keccak256, Address, Bytes, ChainId, Signature, TxHash, TxKind, B256, U256};
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header};
use core::mem;
use derive_more::{AsRef, Deref};
Expand All @@ -36,9 +36,7 @@ pub use sidecar::BlobTransactionValidationError;
pub use sidecar::{BlobTransaction, BlobTransactionSidecar};

pub use compat::FillTxEnv;
pub use signature::{
extract_chain_id, legacy_parity, recover_signer, recover_signer_unchecked, Signature,
};
pub use signature::{extract_chain_id, legacy_parity, recover_signer, recover_signer_unchecked};
pub use tx_type::TxType;
pub use variant::TransactionSignedVariant;

Expand Down Expand Up @@ -2016,12 +2014,14 @@ pub mod serde_bincode_compat {
#[cfg(test)]
mod tests {
use crate::{
transaction::{signature::Signature, TxEip1559, TxKind, TxLegacy},
transaction::{TxEip1559, TxKind, TxLegacy},
Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
};
use alloy_consensus::Transaction as _;
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
use alloy_primitives::{address, b256, bytes, hex, Address, Bytes, Parity, B256, U256};
use alloy_primitives::{
address, b256, bytes, hex, Address, Bytes, Parity, Signature, B256, U256,
};
use alloy_rlp::{Decodable, Encodable, Error as RlpError};
use reth_chainspec::MIN_TRANSACTION_GAS;
use reth_codecs::Compact;
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/transaction/pooled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{
TxEip7702,
};
use crate::{
BlobTransaction, BlobTransactionSidecar, Signature, Transaction, TransactionSigned,
BlobTransaction, BlobTransactionSidecar, Transaction, TransactionSigned,
TransactionSignedEcRecovered,
};
use alloy_consensus::{
Expand All @@ -16,7 +16,7 @@ use alloy_consensus::{
SignableTransaction, TxEip4844WithSidecar,
};
use alloy_eips::eip2718::{Decodable2718, Eip2718Result, Encodable2718};
use alloy_primitives::{Address, TxHash, B256};
use alloy_primitives::{Address, Signature, TxHash, B256};
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header};
use bytes::Buf;
use derive_more::{AsRef, Deref};
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/transaction/sidecar.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(docsrs, doc(cfg(feature = "c-kzg")))]

use crate::{Signature, Transaction, TransactionSigned};
use crate::{Transaction, TransactionSigned};
use alloy_consensus::{constants::EIP4844_TX_TYPE_ID, TxEip4844WithSidecar};
use alloy_primitives::TxHash;
use alloy_primitives::{Signature, TxHash};
use alloy_rlp::Header;
use serde::{Deserialize, Serialize};

Expand Down
13 changes: 4 additions & 9 deletions crates/primitives/src/transaction/signature.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use crate::transaction::util::secp256k1;
use alloy_primitives::{Address, Parity, B256, U256};
use alloy_primitives::{Address, Parity, Signature, B256, U256};
use alloy_rlp::{Decodable, Error as RlpError};

pub use alloy_primitives::Signature;

/// The order of the secp256k1 curve, divided by two. Signatures that should be checked according
/// to EIP-2 should have an S value less than or equal to this.
///
Expand Down Expand Up @@ -111,14 +109,11 @@ pub const fn extract_chain_id(v: u64) -> alloy_rlp::Result<(bool, Option<u64>)>

#[cfg(test)]
mod tests {
use crate::{
transaction::signature::{
legacy_parity, recover_signer, recover_signer_unchecked, SECP256K1N_HALF,
},
Signature,
use crate::transaction::signature::{
legacy_parity, recover_signer, recover_signer_unchecked, SECP256K1N_HALF,
};
use alloy_eips::eip2718::Decodable2718;
use alloy_primitives::{hex, Address, Parity, B256, U256};
use alloy_primitives::{hex, Address, Parity, Signature, B256, U256};
use std::str::FromStr;

#[test]
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/transaction/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::Signature;
use alloy_primitives::Address;
use alloy_primitives::{Address, Signature};

#[cfg(feature = "secp256k1")]
pub(crate) mod secp256k1 {
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-api/src/helpers/signer.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! An abstraction over ethereum signers.

use alloy_dyn_abi::TypedData;
use alloy_primitives::Address;
use alloy_primitives::{Address, Signature};
use alloy_rpc_types_eth::TransactionRequest;
use dyn_clone::DynClone;
use reth_primitives::{Signature, TransactionSigned};
use reth_primitives::TransactionSigned;
use reth_rpc_eth_types::SignError;
use std::result;

Expand Down
5 changes: 2 additions & 3 deletions crates/rpc/rpc-eth-types/src/simulate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Utilities for serving `eth_simulateV1`

use alloy_consensus::{Transaction as _, TxEip4844Variant, TxType, TypedTransaction};
use alloy_primitives::Parity;
use alloy_primitives::{Parity, Signature};
use alloy_rpc_types::{
simulate::{SimCallResult, SimulateError, SimulatedBlock},
Block, BlockTransactionsKind,
Expand All @@ -10,8 +10,7 @@ use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee_types::ErrorObject;
use reth_primitives::{
proofs::{calculate_receipt_root, calculate_transaction_root},
BlockBody, BlockWithSenders, Receipt, Signature, Transaction, TransactionSigned,
TransactionSignedNoHash,
BlockBody, BlockWithSenders, Receipt, Transaction, TransactionSigned, TransactionSignedNoHash,
};
use reth_revm::database::StateProviderDatabase;
use reth_rpc_server_types::result::rpc_err;
Expand Down
10 changes: 5 additions & 5 deletions crates/rpc/rpc-types-compat/src/transaction/signature.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use alloy_primitives::U256;
use alloy_primitives::{Signature as PrimitiveSignature, U256};
use alloy_rpc_types::{Parity, Signature};
use reth_primitives::{transaction::legacy_parity, Signature as PrimitiveSignature, TxType};
use reth_primitives::{transaction::legacy_parity, TxType};

/// Creates a new rpc signature from a legacy [primitive
/// signature](reth_primitives::Signature), using the give chain id to compute the signature's
/// signature](alloy_primitives::Signature), using the give chain id to compute the signature's
/// recovery id.
///
/// If the chain id is `Some`, the recovery id is computed according to [EIP-155](https://eips.ethereum.org/EIPS/eip-155).
Expand All @@ -20,7 +20,7 @@ pub fn from_legacy_primitive_signature(
}

/// Creates a new rpc signature from a non-legacy [primitive
/// signature](reth_primitives::Signature). This sets the `v` value to `0` or `1` depending on
/// signature](alloy_primitives::Signature). This sets the `v` value to `0` or `1` depending on
/// the signature's `odd_y_parity`.
pub fn from_typed_primitive_signature(signature: PrimitiveSignature) -> Signature {
Signature {
Expand All @@ -32,7 +32,7 @@ pub fn from_typed_primitive_signature(signature: PrimitiveSignature) -> Signatur
}

/// Creates a new rpc signature from a legacy [primitive
/// signature](reth_primitives::Signature).
/// signature](alloy_primitives::Signature).
///
/// The tx type is used to determine whether or not to use the `chain_id` to compute the
/// signature's recovery id.
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc/src/eth/helpers/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::EthApi;
use alloy_dyn_abi::TypedData;
use alloy_eips::eip2718::Decodable2718;
use alloy_network::{eip2718::Encodable2718, EthereumWallet, TransactionBuilder};
use alloy_primitives::{eip191_hash_message, Address, B256};
use alloy_primitives::{eip191_hash_message, Address, Signature, B256};
use alloy_rpc_types_eth::TransactionRequest;
use alloy_signer::SignerSync;
use alloy_signer_local::PrivateKeySigner;
use reth_primitives::{Signature, TransactionSigned};
use reth_primitives::TransactionSigned;
use reth_rpc_eth_api::helpers::{signer::Result, AddDevSigners, EthSigner};
use reth_rpc_eth_types::SignError;

Expand Down
3 changes: 2 additions & 1 deletion crates/storage/provider/src/test_utils/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ use alloy_primitives::{
};

use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::Signature;
use reth_db::tables;
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
use reth_node_types::NodeTypes;
use reth_primitives::{
Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
Signature, Transaction, TransactionSigned, TxType, Withdrawals,
Transaction, TransactionSigned, TxType, Withdrawals,
};
use reth_trie::root::{state_root_unhashed, storage_root_unhashed};
use revm::{db::BundleState, primitives::AccountInfo};
Expand Down
4 changes: 2 additions & 2 deletions crates/transaction-pool/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ use alloy_consensus::{
TxEip1559, TxEip2930, TxEip4844, TxLegacy,
};
use alloy_eips::{eip1559::MIN_PROTOCOL_BASE_FEE, eip2930::AccessList, eip4844::DATA_GAS_PER_BLOB};
use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256};
use alloy_primitives::{Address, Bytes, ChainId, Signature, TxHash, TxKind, B256, U256};
use paste::paste;
use rand::{
distributions::{Uniform, WeightedIndex},
prelude::Distribution,
};
use reth_primitives::{
transaction::TryFromRecoveredTransactionError, BlobTransactionSidecar,
BlobTransactionValidationError, PooledTransactionsElementEcRecovered, Signature, Transaction,
BlobTransactionValidationError, PooledTransactionsElementEcRecovered, Transaction,
TransactionSigned, TransactionSignedEcRecovered, TxType,
};

Expand Down
3 changes: 2 additions & 1 deletion crates/transaction-pool/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,8 @@ mod tests {
use super::*;
use alloy_consensus::{TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy};
use alloy_eips::eip4844::DATA_GAS_PER_BLOB;
use reth_primitives::{Signature, TransactionSigned};
use alloy_primitives::Signature;
use reth_primitives::TransactionSigned;

#[test]
fn test_pool_size_invariants() {
Expand Down
4 changes: 2 additions & 2 deletions testing/testing-utils/src/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ mod tests {
use super::*;
use alloy_consensus::TxEip1559;
use alloy_eips::eip2930::AccessList;
use alloy_primitives::{hex, Parity};
use reth_primitives::{public_key_to_address, Signature};
use alloy_primitives::{hex, Parity, Signature};
use reth_primitives::public_key_to_address;
use std::str::FromStr;

#[test]
Expand Down
Loading