From 01886f80bfebd42c4bab5e17bfcba4f165238511 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 15 Jul 2024 14:00:32 -0700 Subject: [PATCH] [bugfix] Include code in the witness on GetCodeHash --- core/state/intra_block_state.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/state/intra_block_state.go b/core/state/intra_block_state.go index a4682215282..b79bf96dfdc 100644 --- a/core/state/intra_block_state.go +++ b/core/state/intra_block_state.go @@ -260,6 +260,10 @@ func (sdb *IntraBlockState) GetCodeHash(addr libcommon.Address) libcommon.Hash { if stateObject == nil || stateObject.deleted { return libcommon.Hash{} } + + // Plonky2: if the code is not nil, we need to include code in the witness by calling GetCodeSize + sdb.GetCodeSize(addr) + return libcommon.BytesToHash(stateObject.CodeHash()) }