Skip to content

Commit

Permalink
rename error for better clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Oct 13, 2024
1 parent 6311c8e commit 1dcac62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions crates/katana/pool/src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,22 @@ pub enum InvalidTransactionError {
balance: Felt,
},

/// Error when the specified transaction fee is insufficient to cover the minimum fee required.
#[error("The specified tx max fee is insufficient")]
InsufficientMaxFee { min_fee: u128, max_fee: u128 },
/// Error when the specified transaction fee is insufficient to cover the minimum fee required
/// to start the invocation (including the account's validation logic).
///
/// It is a static check that is performed before the transaction is invoked to ensure the
/// transaction can cover the DA cost, etc.
///
/// This is different from an error due to transaction runs out of gas during execution ie.
/// the specified max fee is lower than the amount needed to finish the transaction execution
/// (either validation or execution).
#[error("Intrinsic transaction fee is too low")]
IntrinsicFeeTooLow {
/// The minimum required for the transaction to be executed.
min: u128,
/// The specified transaction fee.
max_fee: u128,
},

/// Error when the account's validation logic fails (ie __validate__ function).
#[error("{error}")]
Expand All @@ -45,7 +58,7 @@ pub enum InvalidTransactionError {
},

/// Error when the transaction's sender is not an account contract.
#[error("sender is not an account")]
#[error("Sender is not an account")]
NonAccount {
/// The address of the contract that is not an account.
address: ContractAddress,
Expand Down
2 changes: 1 addition & 1 deletion crates/katana/pool/src/validation/stateful.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ fn map_invalid_tx_err(
TransactionFeeError::MaxFeeTooLow { min_fee, max_fee } => {
let max_fee = max_fee.0;
let min_fee = min_fee.0;
Ok(InvalidTransactionError::InsufficientMaxFee { max_fee, min_fee })
Ok(InvalidTransactionError::IntrinsicFeeTooLow { max_fee, min: min_fee })
}

_ => Err(Box::new(err)),
Expand Down

0 comments on commit 1dcac62

Please sign in to comment.