Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix: declare transaction error format
Browse files Browse the repository at this point in the history
commit-id:5ae2b059
  • Loading branch information
AvivYossef-starkware committed Jul 14, 2024
1 parent 85d7b78 commit 410b547
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions crates/blockifier/src/transaction/error_format_test.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use starknet_api::core::ClassHash;
use starknet_api::hash::StarkHash;
use starknet_api::transaction::TransactionVersion;

use crate::transaction::errors::TransactionExecutionError;
Expand All @@ -13,3 +15,15 @@ fn test_contract_class_version_mismatch() {
"Declare transaction version 1 must have a contract class of Cairo version 2."
);
}

#[test]
fn test_declare_transaction_error_format() {
let error = TransactionExecutionError::DeclareTransactionError {
class_hash: ClassHash(StarkHash::THREE),
};
assert_eq!(
error.to_string(),
"Class with hash 0x0000000000000000000000000000000000000000000000000000000000000003 is \
already declared."
);
}
2 changes: 1 addition & 1 deletion crates/blockifier/src/transaction/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub enum TransactionExecutionError {
String::from(gen_transaction_execution_error_trace(self))
)]
ContractConstructorExecutionFailed(#[from] ConstructorEntryPointExecutionError),
#[error("Class with hash {class_hash:?} is already declared.")]
#[error("Class with hash {:#064x} is already declared.", **class_hash)]
DeclareTransactionError { class_hash: ClassHash },
#[error(
"Transaction execution has failed:\n{}",
Expand Down

0 comments on commit 410b547

Please sign in to comment.