diff --git a/evm/src/generation/outputs.rs b/evm/src/generation/outputs.rs index 2402d78cd4..60785e6dda 100644 --- a/evm/src/generation/outputs.rs +++ b/evm/src/generation/outputs.rs @@ -77,7 +77,7 @@ fn account_trie_record_to_output( .inputs .contract_code .get(&account.code_hash) - .unwrap_or_else(|| panic!("Code not found: {:?}", account.code_hash)) + .ok_or_else(|| ProgramError::UnknownContractCode)? .clone(); Ok(AccountOutput { diff --git a/evm/src/witness/errors.rs b/evm/src/witness/errors.rs index 2e543ac326..3ad10d17d7 100644 --- a/evm/src/witness/errors.rs +++ b/evm/src/witness/errors.rs @@ -16,6 +16,7 @@ pub enum ProgramError { InterpreterError, IntegerTooLarge, ProverInputError(ProverInputError), + UnknownContractCode, } #[allow(clippy::enum_variant_names)]