@@ -232,6 +232,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
232232 // The contract is a scoped environment for this execution context only.
233233 code := evm .StateDB .ResolveCode (addr )
234234 if witness := evm .StateDB .Witness (); witness != nil {
235+ witness .AddCode (evm .StateDB .GetCode (addr ))
235236 witness .AddCode (code )
236237 }
237238 if len (code ) == 0 {
@@ -302,6 +303,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
302303 // The contract is a scoped environment for this execution context only.
303304 contract := NewContract (caller , AccountRef (caller .Address ()), value , gas )
304305 if witness := evm .StateDB .Witness (); witness != nil {
306+ witness .AddCode (evm .StateDB .GetCode (addrCopy ))
305307 witness .AddCode (evm .StateDB .ResolveCode (addrCopy ))
306308 }
307309 contract .SetCallCode (& addrCopy , evm .StateDB .ResolveCodeHash (addrCopy ), evm .StateDB .ResolveCode (addrCopy ))
@@ -352,6 +354,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
352354 // Initialise a new contract and make initialise the delegate values
353355 contract := NewContract (caller , AccountRef (caller .Address ()), nil , gas ).AsDelegate ()
354356 if witness := evm .StateDB .Witness (); witness != nil {
357+ witness .AddCode (evm .StateDB .GetCode (addrCopy ))
355358 witness .AddCode (evm .StateDB .ResolveCode (addrCopy ))
356359 }
357360 contract .SetCallCode (& addrCopy , evm .StateDB .ResolveCodeHash (addrCopy ), evm .StateDB .ResolveCode (addrCopy ))
@@ -410,6 +413,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
410413 // The contract is a scoped environment for this execution context only.
411414 contract := NewContract (caller , AccountRef (addrCopy ), new (uint256.Int ), gas )
412415 if witness := evm .StateDB .Witness (); witness != nil {
416+ witness .AddCode (evm .StateDB .GetCode (addrCopy ))
413417 witness .AddCode (evm .StateDB .ResolveCode (addrCopy ))
414418 }
415419 contract .SetCallCode (& addrCopy , evm .StateDB .ResolveCodeHash (addrCopy ), evm .StateDB .ResolveCode (addrCopy ))
0 commit comments