Fixed Base problem and sload/sstore

pull/150/head
obscuren 11 years ago
parent 1c85d8c66b
commit ee7c16a8d9
  1. 7
      ethchain/vm.go

@ -121,7 +121,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
} else { } else {
mult = ethutil.Big1 mult = ethutil.Big1
} }
useGas(base.Mul(mult, GasSStore)) useGas(new(big.Int).Mul(mult, GasSStore))
case oBALANCE: case oBALANCE:
useGas(GasBalance) useGas(GasBalance)
case oCREATE: case oCREATE:
@ -156,6 +156,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
x, y := stack.Popn() x, y := stack.Popn()
// (x + y) % 2 ** 256 // (x + y) % 2 ** 256
base.Add(x, y) base.Add(x, y)
fmt.Println(x, y, base)
// Pop result back on the stack // Pop result back on the stack
stack.Push(base) stack.Push(base)
case oSUB: case oSUB:
@ -317,8 +318,8 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case oCALLDATALOAD: case oCALLDATALOAD:
require(1) require(1)
offset := stack.Pop().Int64() offset := stack.Pop().Int64()
fmt.Println(closure.Args) val := closure.Args[offset : offset+32]
val := closure.Args[offset : offset+31] fmt.Println(ethutil.BigD(val))
stack.Push(ethutil.BigD(val)) stack.Push(ethutil.BigD(val))
case oCALLDATASIZE: case oCALLDATASIZE:

Loading…
Cancel
Save