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 21, 2024
1 parent 8fc30ed commit ccdb668
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/katana/pool/src/validation/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ pub enum InvalidTransactionError {

/// Error when a Declare transaction is trying to declare a class that has already been
/// declared.
#[error("Class with hash {class_hash:#x} already exists.")]
ClassAlreadyExists { class_hash: ClassHash },
#[error("Class with hash {class_hash:#x} has already been declared.")]
ClassAlreadyDeclared { class_hash: ClassHash },
}
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 @@ -110,7 +110,7 @@ impl Validator for TxValidator {

// Return an error if the class already exists.
if class.is_some() {
let error = InvalidTransactionError::ClassAlreadyExists { class_hash };
let error = InvalidTransactionError::ClassAlreadyDeclared { class_hash };
return Ok(ValidationOutcome::Invalid { tx, error });
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/katana/rpc/rpc-types/src/error/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl From<Box<InvalidTransactionError>> for StarknetApiError {
fn from(error: Box<InvalidTransactionError>) -> Self {
match error.as_ref() {
InvalidTransactionError::InsufficientFunds { .. } => Self::InsufficientAccountBalance,
InvalidTransactionError::ClassAlreadyExists { .. } => Self::ClassAlreadyDeclared,
InvalidTransactionError::ClassAlreadyDeclared { .. } => Self::ClassAlreadyDeclared,
InvalidTransactionError::IntrinsicFeeTooLow { .. } => Self::InsufficientMaxFee,
InvalidTransactionError::NonAccount { .. } => Self::NonAccount,
InvalidTransactionError::InvalidNonce { .. } => {
Expand Down

0 comments on commit ccdb668

Please sign in to comment.