Merge pull request #10 from sei-protocol/fix-delegate-precompile

Send correct sender to precompile in delegatecall
This commit is contained in:
codchen 2024-01-08 11:35:21 +08:00 committed by GitHub
commit db336b3fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -340,7 +340,10 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
// It is allowed to call precompiles, even via delegatecall
if p, isPrecompile := evm.precompile(addr); isPrecompile {
ret, gas, err = RunPrecompiledContract(p, evm, caller.Address(), input, gas)
// NOTE: caller must, at all times be a contract. It should never happen
// that caller is something other than a Contract.
parent := caller.(*Contract)
ret, gas, err = RunPrecompiledContract(p, evm, parent.CallerAddress, input, gas)
} else {
addrCopy := addr
// Initialise a new contract and make initialise the delegate values