Skip to content

Commit

Permalink
eip4762: move CALL BASIC_DATA charging before reservation
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Oct 10, 2024
1 parent 51dca93 commit 1fe1124
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
}
}

if interpreter.evm.chainRules.IsEIP4762 && !chargeCallVariantEIP4762(interpreter.evm, scope) {
return nil, ErrOutOfGas
}

var err error
interpreter.evm.callGasTemp, err = callGas(interpreter.evm.chainRules.IsEIP150, scope.Contract.Gas, 0, scope.Stack.Back(0))
if err != nil {
Expand All @@ -801,10 +805,6 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
return nil, ErrOutOfGas
}

if interpreter.evm.chainRules.IsEIP4762 && !chargeCallVariantEIP4762(interpreter.evm, scope) {
return nil, ErrOutOfGas
}

stack := scope.Stack
// Pop gas. The actual gas in interpreter.evm.callGasTemp.
// We can use this as a temporary value
Expand Down

0 comments on commit 1fe1124

Please sign in to comment.