primitives: rm alloy Signature reexport (#12313)

This commit is contained in:
Thomas Coratger
2024-11-05 05:15:15 +01:00
committed by GitHub
parent d5f0103601
commit 967cbc4e97
24 changed files with 55 additions and 61 deletions

View File

@ -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};
@ -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::{

View File

@ -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,

View File

@ -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;

View File

@ -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]

View File

@ -1,4 +1,4 @@
use alloy_primitives::B256;
use alloy_primitives::{Signature, B256};
use reth_eth_wire::{GetPooledTransactions, PooledTransactions};
use reth_network::{
test_utils::{NetworkEventStream, Testnet},
@ -6,7 +6,7 @@ use reth_network::{
};
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},

View File

@ -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::{
@ -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

View File

@ -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};

View File

@ -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,
};

View File

@ -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;

View File

@ -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 _;

View File

@ -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,
};

View File

@ -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};
@ -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;
@ -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;

View File

@ -7,7 +7,7 @@ use super::{
TxEip7702,
};
use crate::{
BlobTransaction, BlobTransactionSidecar, Signature, Transaction, TransactionSigned,
BlobTransaction, BlobTransactionSidecar, Transaction, TransactionSigned,
TransactionSignedEcRecovered,
};
use alloy_consensus::{
@ -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};

View File

@ -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};

View File

@ -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.
///
@ -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]

View File

@ -1,5 +1,4 @@
use crate::Signature;
use alloy_primitives::Address;
use alloy_primitives::{Address, Signature};
#[cfg(feature = "secp256k1")]
pub(crate) mod secp256k1 {

View File

@ -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;

View File

@ -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,
@ -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;

View File

@ -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).
@ -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 {
@ -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.

View File

@ -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;

View File

@ -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};

View File

@ -12,7 +12,7 @@ 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},
@ -20,7 +20,7 @@ use rand::{
};
use reth_primitives::{
transaction::TryFromRecoveredTransactionError, BlobTransactionSidecar,
BlobTransactionValidationError, PooledTransactionsElementEcRecovered, Signature, Transaction,
BlobTransactionValidationError, PooledTransactionsElementEcRecovered, Transaction,
TransactionSigned, TransactionSignedEcRecovered, TxType,
};

View File

@ -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() {

View File

@ -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]