From f9dd71b3cff77ebdda8a97407b74926f2bd1c1bd Mon Sep 17 00:00:00 2001 From: AvivYossef-starkware Date: Sun, 14 Jul 2024 09:49:05 +0300 Subject: [PATCH] fix: state error unavailable contract address format commit-id:def3bf73 --- .gitignore | 1 + crates/blockifier/src/state/error_format_test.rs | 12 +++++++++++- crates/blockifier/src/state/errors.rs | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e21a6d4230..834ac4ea55 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ target tmp_venv/* +.spr.yml diff --git a/crates/blockifier/src/state/error_format_test.rs b/crates/blockifier/src/state/error_format_test.rs index fe7bf81fb0..f320c7b32a 100644 --- a/crates/blockifier/src/state/error_format_test.rs +++ b/crates/blockifier/src/state/error_format_test.rs @@ -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; @@ -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." + ); +} diff --git a/crates/blockifier/src/state/errors.rs b/crates/blockifier/src/state/errors.rs index 5347d182f7..becefb11fc 100644 --- a/crates/blockifier/src/state/errors.rs +++ b/crates/blockifier/src/state/errors.rs @@ -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),