Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
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