diff --git a/crates/primitives/src/transaction/error.rs b/crates/primitives-traits/src/transaction/error.rs similarity index 91% rename from crates/primitives/src/transaction/error.rs rename to crates/primitives-traits/src/transaction/error.rs index 78f6cf5e5fd3..15d1d44ac594 100644 --- a/crates/primitives/src/transaction/error.rs +++ b/crates/primitives-traits/src/transaction/error.rs @@ -1,8 +1,9 @@ +//! Various error variants that can happen when working with transactions. + use crate::GotExpectedBoxed; use alloy_primitives::U256; -/// Represents error variants that can happen when trying to validate a -/// [Transaction](crate::Transaction) +/// Represents error variants that can happen when trying to validate a transaction. #[derive(Debug, Clone, Eq, PartialEq, derive_more::Display)] pub enum InvalidTransactionError { /// The sender does not have enough funds to cover the transaction fees @@ -64,19 +65,17 @@ pub enum InvalidTransactionError { impl core::error::Error for InvalidTransactionError {} -/// Represents error variants that can happen when trying to convert a transaction to -/// [`PooledTransactionsElement`](crate::PooledTransactionsElement) +/// Represents error variants that can happen when trying to convert a transaction to pooled +/// transaction. #[derive(Debug, Clone, Eq, PartialEq, derive_more::Display, derive_more::Error)] pub enum TransactionConversionError { - /// This error variant is used when a transaction cannot be converted into a - /// [`PooledTransactionsElement`](crate::PooledTransactionsElement) because it is not supported - /// for P2P network. + /// This error variant is used when a transaction cannot be converted into a pooled transaction + /// because it is not supported for P2P network. #[display("Transaction is not supported for p2p")] UnsupportedForP2P, } -/// Represents error variants than can happen when trying to convert a -/// [`RecoveredTx`](crate::RecoveredTx) transaction. +/// Represents error variants than can happen when trying to convert a recovered transaction. #[derive(Debug, Clone, Eq, PartialEq, derive_more::Display)] pub enum TryFromRecoveredTransactionError { /// Thrown if the transaction type is unsupported. diff --git a/crates/primitives-traits/src/transaction/mod.rs b/crates/primitives-traits/src/transaction/mod.rs index b67e51024bf6..619f8c1a926f 100644 --- a/crates/primitives-traits/src/transaction/mod.rs +++ b/crates/primitives-traits/src/transaction/mod.rs @@ -4,6 +4,8 @@ pub mod execute; pub mod signed; pub mod tx_type; +pub mod error; + use crate::{InMemorySize, MaybeArbitrary, MaybeCompact, MaybeSerde}; use core::{fmt, hash::Hash}; diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index 4732ba8024c3..9a04730be516 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -32,12 +32,14 @@ use signature::decode_with_eip155_chain_id; use std::sync::{LazyLock, OnceLock}; pub use compat::FillTxEnv; -pub use error::{ - InvalidTransactionError, TransactionConversionError, TryFromRecoveredTransactionError, -}; pub use meta::TransactionMeta; pub use pooled::{PooledTransactionsElement, PooledTransactionsElementEcRecovered}; -pub use reth_primitives_traits::WithEncoded; +pub use reth_primitives_traits::{ + transaction::error::{ + InvalidTransactionError, TransactionConversionError, TryFromRecoveredTransactionError, + }, + WithEncoded, +}; pub use sidecar::BlobTransaction; pub use signature::{recover_signer, recover_signer_unchecked}; pub use tx_type::TxType; @@ -49,7 +51,6 @@ pub mod util; pub(crate) mod access_list; mod compat; -mod error; mod meta; mod pooled; mod sidecar; diff --git a/crates/primitives/src/transaction/pooled.rs b/crates/primitives/src/transaction/pooled.rs index b4790d028290..233f868f82db 100644 --- a/crates/primitives/src/transaction/pooled.rs +++ b/crates/primitives/src/transaction/pooled.rs @@ -2,8 +2,7 @@ //! response to `GetPooledTransactions`. use super::{ - error::TransactionConversionError, recover_signer_unchecked, signature::recover_signer, - TxEip7702, + recover_signer_unchecked, signature::recover_signer, TransactionConversionError, TxEip7702, }; use crate::{BlobTransaction, RecoveredTx, Transaction, TransactionSigned, TxType}; use alloc::vec::Vec;