Skip to content

Commit

Permalink
chore: handle all revm errors (#14574)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Feb 19, 2025
1 parent 3570f6b commit cec1c11
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions crates/rpc/rpc-eth-types/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,13 @@ impl From<InvalidTransaction> 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 }
Expand All @@ -561,18 +568,12 @@ impl From<InvalidTransaction> 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,
}
}
}
Expand Down

0 comments on commit cec1c11

Please sign in to comment.