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

Commit f8878b9

Browse files
fix: declare transaction error format
commit-id:5ae2b059
1 parent 920cb3e commit f8878b9

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

crates/blockifier/src/transaction/error_format_test.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use starknet_api::core::ClassHash;
2+
use starknet_api::hash::StarkHash;
13
use starknet_api::transaction::TransactionVersion;
24

35
use crate::transaction::errors::TransactionExecutionError;
@@ -13,3 +15,15 @@ fn test_contract_class_version_mismatch() {
1315
"Declare transaction version 1 must have a contract class of Cairo version 2."
1416
);
1517
}
18+
19+
#[test]
20+
fn test_declare_transaction_error_format() {
21+
let error = TransactionExecutionError::DeclareTransactionError {
22+
class_hash: ClassHash(StarkHash::THREE),
23+
};
24+
assert_eq!(
25+
error.to_string(),
26+
"Class with hash 0x0000000000000000000000000000000000000000000000000000000000000003 is \
27+
already declared."
28+
);
29+
}

crates/blockifier/src/transaction/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub enum TransactionExecutionError {
5959
String::from(gen_transaction_execution_error_trace(self))
6060
)]
6161
ContractConstructorExecutionFailed(#[from] ConstructorEntryPointExecutionError),
62-
#[error("Class with hash {class_hash:?} is already declared.")]
62+
#[error("Class with hash {:#064x} is already declared.", **class_hash)]
6363
DeclareTransactionError { class_hash: ClassHash },
6464
#[error(
6565
"Transaction execution has failed:\n{}",

0 commit comments

Comments
 (0)