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

Commit f9dd71b

Browse files
fix: state error unavailable contract address format
commit-id:def3bf73
1 parent 8737930 commit f9dd71b

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ target
99

1010
tmp_venv/*
1111

12+
.spr.yml

crates/blockifier/src/state/error_format_test.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use starknet_api::core::ClassHash;
1+
use starknet_api::core::{ClassHash, ContractAddress};
22
use starknet_types_core::felt::Felt;
33

44
use crate::state::errors::StateError;
@@ -12,3 +12,13 @@ fn test_error_undeclared_class_hash_format() {
1212
not declared."
1313
);
1414
}
15+
16+
#[test]
17+
fn test_error_unavailable_contract_address_format() {
18+
let error = StateError::UnavailableContractAddress(ContractAddress::from(10_u128));
19+
assert_eq!(
20+
error.to_string(),
21+
"Requested 0x000000000000000000000000000000000000000000000000000000000000000a is \
22+
unavailable for deployment."
23+
);
24+
}

crates/blockifier/src/state/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub enum StateError {
1919
OutOfRangeContractAddress,
2020
#[error(transparent)]
2121
ProgramError(#[from] ProgramError),
22-
#[error("Requested {0:?} is unavailable for deployment.")]
22+
#[error("Requested {:#064x} is unavailable for deployment.",***.0)]
2323
UnavailableContractAddress(ContractAddress),
2424
#[error("Class with hash {:#064x} is not declared.", **.0)]
2525
UndeclaredClassHash(ClassHash),

0 commit comments

Comments
 (0)