From e06a4e0c5c37a783698c130c6fe7b27ba65bcf1e Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Wed, 6 Dec 2023 19:56:16 +0800 Subject: [PATCH] fetch account code in extcodehash to ensure account leaf appears in the witness --- core/vm/instructions.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 27d53c073b..32cf7b752a 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -422,6 +422,7 @@ func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) if interpreter.evm.StateDB.Empty(address) { slot.Clear() } else { + _ = interpreter.evm.StateDB.GetCode(address) // ensure the account leaf is fetched and included in the witnessgi interpreter.evm.StateDB.GetWitness().AddCodeHash(interpreter.evm.StateDB.GetCodeHash(address)) slot.SetBytes(interpreter.evm.StateDB.GetCodeHash(address).Bytes()) }