From 1a6c81ed7a5f50e6b24a9ba7a37d1d37bc5488c9 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 19 Feb 2024 23:46:15 +0100 Subject: [PATCH] chore: improve DatabaseError error messages --- crates/cheatcodes/src/json.rs | 2 +- crates/evm/core/src/backend/error.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/cheatcodes/src/json.rs b/crates/cheatcodes/src/json.rs index aa27a446d0e11..758d4616088a4 100644 --- a/crates/cheatcodes/src/json.rs +++ b/crates/cheatcodes/src/json.rs @@ -192,7 +192,7 @@ impl Cheatcode for serializeBytes32_0Call { impl Cheatcode for serializeString_0Call { fn apply(&self, state: &mut Cheatcodes) -> Result { let Self { objectKey, valueKey, value } = self; - serialize_json(state, objectKey, Some(valueKey), &value.to_string()) + serialize_json(state, objectKey, Some(valueKey), value) } } diff --git a/crates/evm/core/src/backend/error.rs b/crates/evm/core/src/backend/error.rs index df5b094a63f86..2b69bf9c26510 100644 --- a/crates/evm/core/src/backend/error.rs +++ b/crates/evm/core/src/backend/error.rs @@ -15,11 +15,11 @@ pub type DatabaseResult = Result; pub enum DatabaseError { #[error("{0}")] Message(String), - #[error("no cheats available for {0}")] + #[error("cheatcodes are not enabled for {0}; see `vm.allowCheatcodes(address)`")] NoCheats(Address), - #[error("failed to fetch AccountInfo {0}")] + #[error("failed to fetch account info for {0}")] MissingAccount(Address), - #[error("code should already be loaded: {0}")] + #[error("missing bytecode for hash: {0}")] MissingCode(B256), #[error(transparent)] Recv(#[from] RecvError),