mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-10 11:57:30 +00:00
core/vm: fix gas usage
This commit is contained in:
parent
778326725b
commit
ce91d227c2
1 changed files with 4 additions and 4 deletions
|
|
@ -767,7 +767,7 @@ func opCall(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) {
|
|||
if !value.IsZero() {
|
||||
gas += params.CallStipend
|
||||
}
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas (incl. stipend)
|
||||
ret, returnGas, childGasUsed, err := evm.Call(scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}, &value)
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -802,7 +802,7 @@ func opCallCode(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) {
|
|||
gas += params.CallStipend
|
||||
}
|
||||
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas (incl. stipend)
|
||||
ret, returnGas, childGasUsed, err := evm.CallCode(scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}, &value)
|
||||
if err != nil {
|
||||
temp.Clear()
|
||||
|
|
@ -832,7 +832,7 @@ func opDelegateCall(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) {
|
|||
// Get arguments from the memory.
|
||||
args := scope.Memory.GetPtr(inOffset.Uint64(), inSize.Uint64())
|
||||
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas
|
||||
ret, returnGas, childGasUsed, err := evm.DelegateCall(scope.Contract.Caller(), scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas}, scope.Contract.value)
|
||||
if err != nil {
|
||||
temp.Clear()
|
||||
|
|
@ -862,7 +862,7 @@ func opStaticCall(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) {
|
|||
// Get arguments from the memory.
|
||||
args := scope.Memory.GetPtr(inOffset.Uint64(), inSize.Uint64())
|
||||
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas
|
||||
regularGasUsed := scope.Contract.GasUsed.RegularGas - gas // exclude forwarded gas
|
||||
ret, returnGas, childGasUsed, err := evm.StaticCall(scope.Contract.Address(), toAddr, args, GasCosts{RegularGas: gas, StateGas: scope.Contract.Gas.StateGas})
|
||||
if err != nil {
|
||||
temp.Clear()
|
||||
|
|
|
|||
Loading…
Reference in a new issue