refactor: rm dupe InvalidTransactionErrors (#2737)

This commit is contained in:
Bjerg
2023-05-19 10:13:33 +02:00
committed by GitHub
parent 1c60e680f9
commit 7b7805a4cc
4 changed files with 29 additions and 29 deletions

View File

@ -5,41 +5,43 @@ use crate::U256;
#[allow(missing_docs)]
#[derive(Debug, Clone, Eq, PartialEq, thiserror::Error)]
pub enum InvalidTransactionError {
#[error("Transaction eip1559 priority fee is more then max fee.")]
PriorityFeeMoreThenMaxFee,
#[error("Account does not have enough funds ({available_funds:?}) to cover transaction cost: {cost:?}.")]
/// The sender does not have enough funds to cover the transaction fees
#[error("Sender does not have enough funds ({available_funds:?}) to cover transaction fees: {cost:?}.")]
InsufficientFunds { cost: U256, available_funds: U256 },
/// The nonce is lower than the account's nonce, or there is a nonce gap present.
#[error("Transaction nonce is not consistent.")]
NonceNotConsistent,
#[error("Old legacy transaction before Spurious Dragon should not have chain_id.")]
/// The transaction is before Spurious Dragon and has a chain ID
#[error("Transactions before Spurious Dragon should not have a chain ID.")]
OldLegacyChainId,
#[error("Transaction chain_id does not match.")]
/// The chain ID in the transaction does not match the current network configuration.
#[error("Transaction's chain ID does not match.")]
ChainIdMismatch,
#[error("Transaction max fee is less them block base fee.")]
MaxFeeLessThenBaseFee,
#[error("Eip2930 transaction is enabled after berlin hardfork.")]
/// The transaction requires EIP-2930 which is not enabled currently.
#[error("EIP-2930 transactions are not valid before Berlin.")]
Eip2930Disabled,
#[error("Eip2930 transaction is enabled after london hardfork.")]
/// The transaction requires EIP-1559 which is not enabled currently.
#[error("EIP-1559 transactions are not valid before London.")]
Eip1559Disabled,
/// Thrown when calculating gas usage
#[error("gas uint64 overflow")]
GasUintOverflow,
/// returned if the transaction is specified to use less gas than required to start the
/// invocation.
#[error("intrinsic gas too low")]
GasTooLow,
/// returned if the transaction gas exceeds the limit
#[error("intrinsic gas too high")]
GasTooHigh,
/// thrown if a transaction is not supported in the current network configuration.
#[error("transaction type not supported")]
/// Thrown if a transaction is not supported in the current network configuration.
#[error("Transaction type not supported")]
TxTypeNotSupported,
/// The calculated gas of the transaction exceeds `u64::MAX`.
#[error("Gas overflow (maximum of u64)")]
GasUintOverflow,
/// The transaction is specified to use less gas than required to start the
/// invocation.
#[error("Intrinsic gas too low")]
GasTooLow,
/// The transaction gas exceeds the limit
#[error("Intrinsic gas too high")]
GasTooHigh,
/// Thrown to ensure no one is able to specify a transaction with a tip higher than the total
/// fee cap.
#[error("max priority fee per gas higher than max fee per gas")]
#[error("Max priority fee per gas higher than max fee per gas")]
TipAboveFeeCap,
/// Thrown post London if the transaction's fee is less than the base fee of the block
#[error("max fee per gas less than block base fee")]
#[error("Max fee per gas less than block base fee")]
FeeCapTooLow,
/// Thrown if the sender of a transaction is a contract.
#[error("Transaction signer has bytecode set.")]