aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-02 05:05:38 +0800
committerobscuren <geffobscura@gmail.com>2014-12-02 05:05:38 +0800
commita052357872217d5e99e7ee1a7a4b524b53addcdd (patch)
treee6b22d92ca0939a2d0a44bc04c6d83c600de23e7 /vm
parenta22056db5988bfa2b1354e0092eabb734c30701c (diff)
downloadgo-tangerine-a052357872217d5e99e7ee1a7a4b524b53addcdd.tar.gz
go-tangerine-a052357872217d5e99e7ee1a7a4b524b53addcdd.tar.zst
go-tangerine-a052357872217d5e99e7ee1a7a4b524b53addcdd.zip
Fixed EXP gas
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_debug.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/vm/vm_debug.go b/vm/vm_debug.go
index 4daa3ab5b..ea94987d1 100644
--- a/vm/vm_debug.go
+++ b/vm/vm_debug.go
@@ -172,12 +172,13 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
case EXP:
require(2)
- expGas := ethutil.FirstBitSet(stack.data[stack.Len()-2])
- expGas.Div(expGas, u256(8))
- expGas.Sub(u256(32), expGas)
- expGas.Add(expGas, u256(1))
-
- gas.Set(expGas)
+ exp := new(big.Int).Set(stack.data[stack.Len()-2])
+ nbytes := 0
+ for exp.Cmp(ethutil.Big0) > 0 {
+ nbytes += 1
+ exp.Rsh(exp, 8)
+ }
+ gas.Set(big.NewInt(int64(nbytes + 1)))
// Gas only
case STOP:
gas.Set(ethutil.Big0)