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

fix: state error unavailable contract address format #2078

Draft
wants to merge 1 commit into
base: main-v0.13.2
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ target

tmp_venv/*

.spr.yml
12 changes: 11 additions & 1 deletion crates/blockifier/src/state/error_format_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet_api::core::ClassHash;
use starknet_api::core::{ClassHash, ContractAddress};
use starknet_types_core::felt::Felt;

use crate::state::errors::StateError;
Expand All @@ -12,3 +12,13 @@ fn test_error_undeclared_class_hash_format() {
not declared."
);
}

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