From cec1c11ece5f6da30215c06a7e3f61c737020f65 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 19 Feb 2025 02:28:39 +0100 Subject: [PATCH] chore: handle all revm errors (#14574) --- crates/rpc/rpc-eth-types/src/error/mod.rs | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/crates/rpc/rpc-eth-types/src/error/mod.rs b/crates/rpc/rpc-eth-types/src/error/mod.rs index 1327625fd9ff..da1e34af1a9d 100644 --- a/crates/rpc/rpc-eth-types/src/error/mod.rs +++ b/crates/rpc/rpc-eth-types/src/error/mod.rs @@ -538,6 +538,13 @@ impl From for RpcInvalidTransactionError { // tx.gas < cost Self::GasTooLow } + InvalidTransaction::GasFloorMoreThanGasLimit => { + // Post prague EIP-7623 tx floor calldata gas cost > tx.gas_limit + // where floor gas is the minimum amount of gas that will be spent + // In other words, the tx's gas limit is lower that the minimum gas requirements of + // the tx's calldata + Self::GasTooLow + } InvalidTransaction::RejectCallerWithCode => Self::SenderNoEOA, InvalidTransaction::LackOfFundForMaxFee { fee, balance } => { Self::InsufficientFunds { cost: *fee, balance: *balance } @@ -561,18 +568,12 @@ impl From for RpcInvalidTransactionError { InvalidTransaction::AuthorizationListNotSupported => { Self::AuthorizationListNotSupported } - InvalidTransaction::AuthorizationListInvalidFields => { - Self::AuthorizationListInvalidFields - } - #[allow(unreachable_patterns)] - err => { - error!(target: "rpc", - ?err, - "unexpected transaction error" - ); - - Self::other(internal_rpc_err(format!("unexpected transaction error: {err}"))) - } + InvalidTransaction::AuthorizationListInvalidFields | + InvalidTransaction::EmptyAuthorizationList => Self::AuthorizationListInvalidFields, + InvalidTransaction::Eip2930NotSupported | + InvalidTransaction::Eip1559NotSupported | + InvalidTransaction::Eip4844NotSupported | + InvalidTransaction::Eip7702NotSupported => Self::TxTypeNotSupported, } } }