Skip to content

Commit

Permalink
Explicitly pass readOnly flag
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Feb 7, 2024
1 parent 74993c4 commit e083090
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,10 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
}

if p, isPrecompile := evm.precompile(addr); isPrecompile {
ret, gas, err = RunStatefulPrecompiledContract(p, evm, caller.Address(), addr, input, gas, evm.interpreter.readOnly)
// Explicitly pass readOnly as true for StaticCall OpCode.
// Precompile implementation is responsible for honoring readOnly flag.
// No state should be modified, return an error instead.
ret, gas, err = RunStatefulPrecompiledContract(p, evm, caller.Address(), addr, input, gas, true)
} else {
// At this point, we use a copy of address. If we don't, the go compiler will
// leak the 'contract' to the outer scope, and make allocation for 'contract'
Expand Down

0 comments on commit e083090

Please sign in to comment.