Chnged to use GetOp instead & added error + checking

This commit is contained in:
obscuren
2014-10-23 14:04:00 +02:00
parent 91c876831a
commit feef194829
4 changed files with 58 additions and 6 deletions

View File

@@ -107,7 +107,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
step++
// Get the memory location of pc
op = OpCode(closure.Get(pc).Uint())
op = closure.GetOp(int(pc.Uint64()))
// XXX Leave this Println intact. Don't change this to the log system.
// Used for creating diffs between implementations
@@ -246,11 +246,11 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
if !closure.UseGas(gas) {
self.Endl()
err := fmt.Errorf("Insufficient gas for %v. req %v has %v", op, gas, closure.Gas)
tmp := new(big.Int).Set(closure.Gas)
closure.UseGas(closure.Gas)
return closure.Return(nil), err
return closure.Return(nil), OOG(gas, tmp)
}
mem.Resize(newMemSize.Uint64())