Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(katana-pool): rename error for clarity #2528

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading