aboutsummaryrefslogtreecommitdiff
path: root/core/vm/gas.go
diff options
context:
space:
mode:
authorTed Yin <tederminant@gmail.com>2020-09-18 13:14:29 -0400
committerGitHub <noreply@github.com>2020-09-18 13:14:29 -0400
commitd048937c48753d9eaef771bf71820cf95d79df26 (patch)
tree1a7f65fcd72e77092525ab01625b8b9d365e3e40 /core/vm/gas.go
parent7d1388c743b4ec8f4a86bea95bfada785dee83f7 (diff)
parent7d8c85cf8895b0f998d8eafb02f99d5b689fcd59 (diff)
Merge pull request #34 from ava-labs/devv0.3.0-rc.5
Dev
Diffstat (limited to 'core/vm/gas.go')
-rw-r--r--core/vm/gas.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/vm/gas.go b/core/vm/gas.go
index bd8b4f1..5cf1d85 100644
--- a/core/vm/gas.go
+++ b/core/vm/gas.go
@@ -17,7 +17,7 @@
package vm
import (
- "math/big"
+ "github.com/holiman/uint256"
)
// Gas costs
@@ -30,23 +30,23 @@ const (
GasExtStep uint64 = 20
)
-// calcGas returns the actual gas cost of the call.
+// callGas returns the actual gas cost of the call.
//
// The cost of gas was changed during the homestead price change HF.
// As part of EIP 150 (TangerineWhistle), the returned gas is gas - base * 63 / 64.
-func callGas(isEip150 bool, availableGas, base uint64, callCost *big.Int) (uint64, error) {
+func callGas(isEip150 bool, availableGas, base uint64, callCost *uint256.Int) (uint64, error) {
if isEip150 {
availableGas = availableGas - base
gas := availableGas - availableGas/64
// If the bit length exceeds 64 bit we know that the newly calculated "gas" for EIP150
- // is smaller than the requested amount. Therefor we return the new gas instead
+ // is smaller than the requested amount. Therefore we return the new gas instead
// of returning an error.
if !callCost.IsUint64() || gas < callCost.Uint64() {
return gas, nil
}
}
if !callCost.IsUint64() {
- return 0, errGasUintOverflow
+ return 0, ErrGasUintOverflow
}
return callCost.Uint64(), nil