mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
use caller in isSystemCall for future-proofiness
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
This commit is contained in:
parent
35313fd50a
commit
3ad0d18d9d
1 changed files with 4 additions and 4 deletions
|
|
@ -170,8 +170,8 @@ func (evm *EVM) Interpreter() *EVMInterpreter {
|
||||||
return evm.interpreter
|
return evm.interpreter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (evm *EVM) isSystemCall() bool {
|
func isSystemCall(caller ContractRef) bool {
|
||||||
return evm.TxContext.Origin == params.SystemAddress
|
return caller.Address() == params.SystemAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call executes the contract associated with the addr with the given input as
|
// Call executes the contract associated with the addr with the given input as
|
||||||
|
|
@ -198,7 +198,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
|
||||||
p, isPrecompile := evm.precompile(addr)
|
p, isPrecompile := evm.precompile(addr)
|
||||||
|
|
||||||
if !evm.StateDB.Exist(addr) {
|
if !evm.StateDB.Exist(addr) {
|
||||||
if !isPrecompile && evm.chainRules.IsEIP4762 && !evm.isSystemCall() {
|
if !isPrecompile && evm.chainRules.IsEIP4762 && !isSystemCall(caller) {
|
||||||
// add proof of absence to witness
|
// add proof of absence to witness
|
||||||
wgas := evm.AccessEvents.AddAccount(addr, false)
|
wgas := evm.AccessEvents.AddAccount(addr, false)
|
||||||
if gas < wgas {
|
if gas < wgas {
|
||||||
|
|
@ -229,7 +229,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
|
||||||
// If the account has no code, we can abort here
|
// If the account has no code, we can abort here
|
||||||
// The depth-check is already done, and precompiles handled above
|
// The depth-check is already done, and precompiles handled above
|
||||||
contract := NewContract(caller, AccountRef(addrCopy), value, gas)
|
contract := NewContract(caller, AccountRef(addrCopy), value, gas)
|
||||||
contract.IsSystemCall = evm.isSystemCall()
|
contract.IsSystemCall = isSystemCall(caller)
|
||||||
contract.SetCallCode(&addrCopy, evm.resolveCodeHash(addrCopy), code)
|
contract.SetCallCode(&addrCopy, evm.resolveCodeHash(addrCopy), code)
|
||||||
ret, err = evm.interpreter.Run(contract, input, false)
|
ret, err = evm.interpreter.Run(contract, input, false)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue