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

Commit

Permalink
fix: state error undeclared class hash format
Browse files Browse the repository at this point in the history
  • Loading branch information
AvivYossef-starkware committed Jul 10, 2024
1 parent dde2eab commit 19e3116
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/blockifier/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod cached_state;
#[cfg(test)]
pub mod error_format_test;
pub mod errors;
pub mod global_cache;
pub mod state_api;
14 changes: 14 additions & 0 deletions crates/blockifier/src/state/error_format_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use starknet_api::core::ClassHash;
use starknet_types_core::felt::Felt;

use crate::state::errors::StateError;

#[test]
fn test_error_undeclared_class_hash_format() {
let error = StateError::UndeclaredClassHash(ClassHash(Felt::TWO));
assert_eq!(
error.to_string(),
"Class with hash 0x0000000000000000000000000000000000000000000000000000000000000002 is \
not declared."
);
}
2 changes: 1 addition & 1 deletion crates/blockifier/src/state/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum StateError {
ProgramError(#[from] ProgramError),
#[error("Requested {0:?} is unavailable for deployment.")]
UnavailableContractAddress(ContractAddress),
#[error("Class with hash {0} is not declared.")]
#[error("Class with hash {:#064x} is not declared.", **.0)]
UndeclaredClassHash(ClassHash),
#[error(transparent)]
StarknetApiError(#[from] StarknetApiError),
Expand Down

0 comments on commit 19e3116

Please sign in to comment.