From 61c3eae3211d680540529f50248f4e54b2f9d6b6 Mon Sep 17 00:00:00 2001 From: Arun Dhyani Date: Thu, 11 Jan 2024 20:52:58 +0800 Subject: [PATCH] fix value for Delegate call --- core/vm/evm.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/vm/evm.go b/core/vm/evm.go index 6a3bd13f3de..fcd6f347262 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -172,6 +172,12 @@ func (evm *EVM) call(typ OpCode, caller ContractRef, addr libcommon.Address, inp v := value if typ == STATICCALL { v = nil + } else if typ == DELEGATECALL { + // NOTE: caller must, at all times be a contract. It should never happen + // that caller is something other than a Contract. + parent := caller.(*Contract) + // DELEGATECALL inherits value from parent call + v = parent.value } evm.captureBegin(depth == 0, typ, caller.Address(), addr, isPrecompile, input, gas, v, code) defer func(startGas uint64) {