From 0b78135cac1f6d083a17d0c1b9fd456ae12c1b1d Mon Sep 17 00:00:00 2001 From: publicqi Date: Thu, 26 Sep 2024 14:07:07 -0700 Subject: [PATCH] fix empty codehash --- crates/revm/src/context/inner_evm_context.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/revm/src/context/inner_evm_context.rs b/crates/revm/src/context/inner_evm_context.rs index 8ce88ef030..9c4ea85720 100644 --- a/crates/revm/src/context/inner_evm_context.rs +++ b/crates/revm/src/context/inner_evm_context.rs @@ -225,7 +225,10 @@ impl InnerEvmContext { ) -> Result, ::Error> { let acc = self.journaled_state.load_code(address, &mut self.db)?; if acc.is_empty() { - return Ok(Eip7702CodeLoad::new_not_delegated(B256::ZERO, acc.is_cold)); + return Ok(Eip7702CodeLoad::new_not_delegated( + KECCAK_EMPTY, + acc.is_cold, + )); } // SAFETY: safe to unwrap as load_code will insert code if it is empty. let code = acc.info.code.as_ref().unwrap(); @@ -238,7 +241,7 @@ impl InnerEvmContext { let delegated_account = self.journaled_state.load_code(address, &mut self.db)?; let hash = if delegated_account.is_empty() { - B256::ZERO + KECCAK_EMPTY } else if delegated_account.info.code.as_ref().unwrap().is_eof() { EOF_MAGIC_HASH } else {