Skip to content

Commit aa42e31

Browse files
committed
fix(core/vm): only update depth if evm not nil
1 parent 11be5e7 commit aa42e31

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/vm/contracts.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ func ActivePrecompiles(rules params.Rules) []common.Address {
146146
// - the _remaining_ gas,
147147
// - any error that occurred
148148
func RunPrecompiledContract(p PrecompiledContract, evm *EVM, sender common.Address, callingContract common.Address, input []byte, suppliedGas uint64, value *big.Int, readOnly bool, isFromDelegateCall bool) (ret []byte, remainingGas uint64, err error) {
149-
evm.depth++
150-
defer func() { evm.depth-- }()
149+
if evm != nil {
150+
evm.depth++
151+
defer func() { evm.depth-- }()
152+
}
151153

152154
gasCost := p.RequiredGas(input)
153155
if suppliedGas < gasCost {

0 commit comments

Comments
 (0)