chore: move tx errors (#13288)

This commit is contained in:
Matthias Seitz
2024-12-11 13:25:51 +01:00
committed by GitHub
parent 394f973acd
commit b6e682ef73
4 changed files with 17 additions and 16 deletions

View File

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

View File

@ -3,6 +3,8 @@
pub mod execute;
pub mod signed;
pub mod error;
use crate::{InMemorySize, MaybeArbitrary, MaybeCompact, MaybeSerde};
use core::{fmt, hash::Hash};

View File

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

View File

@ -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};
use alloc::vec::Vec;