This repository was archived by the owner on Aug 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
crates/blockifier/src/transaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use starknet_api:: core:: ClassHash ;
2+ use starknet_api:: hash:: StarkHash ;
13use starknet_api:: transaction:: TransactionVersion ;
24
35use 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+ }
Original file line number Diff line number Diff 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 {}" ,
You can’t perform that action at this time.
0 commit comments