aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
Diffstat (limited to 'vm')
-rw-r--r--vm/common.go2
-rw-r--r--vm/virtual_machine.go1
-rw-r--r--vm/vm_debug.go19
3 files changed, 8 insertions, 14 deletions
diff --git a/vm/common.go b/vm/common.go
index 5fd512687..592d44ccd 100644
--- a/vm/common.go
+++ b/vm/common.go
@@ -20,7 +20,7 @@ const (
var (
GasStep = big.NewInt(1)
- GasSha = big.NewInt(20)
+ GasSha = big.NewInt(10)
GasSLoad = big.NewInt(20)
GasSStore = big.NewInt(100)
GasSStoreRefund = big.NewInt(100)
diff --git a/vm/virtual_machine.go b/vm/virtual_machine.go
index 5738075fb..3b6f98ab2 100644
--- a/vm/virtual_machine.go
+++ b/vm/virtual_machine.go
@@ -5,7 +5,6 @@ import "math/big"
type VirtualMachine interface {
Env() Environment
Run(me, caller ClosureRef, code []byte, value, gas, price *big.Int, data []byte) ([]byte, error)
- Depth() int
Printf(string, ...interface{}) VirtualMachine
Endl() VirtualMachine
}
diff --git a/vm/vm_debug.go b/vm/vm_debug.go
index 5b7258cc5..e9139ae19 100644
--- a/vm/vm_debug.go
+++ b/vm/vm_debug.go
@@ -25,8 +25,6 @@ type DebugVm struct {
Fn string
Recoverable bool
-
- depth int
}
func NewDebugVm(env Environment) *DebugVm {
@@ -116,7 +114,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
return closure.Return(nil), nil
}
- vmlogger.Debugf("(%d) %x gas: %v (d) %x\n", self.depth, closure.Address(), closure.Gas, callData)
+ vmlogger.Debugf("(%d) %x gas: %v (d) %x\n", self.env.Depth(), closure.Address(), closure.Gas, callData)
for {
prevStep = step
@@ -867,14 +865,16 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
// Get the arguments from the memory
args := mem.Get(inOffset.Int64(), inSize.Int64())
- var executeAddr []byte
+ var (
+ ret []byte
+ err error
+ )
if op == CALLCODE {
- executeAddr = closure.Address()
+ ret, err = self.env.CallCode(closure, addr.Bytes(), args, gas, price, value)
} else {
- executeAddr = addr.Bytes()
+ ret, err = self.env.Call(closure, addr.Bytes(), args, gas, price, value)
}
- ret, err := self.env.Call(closure, executeAddr, args, gas, price, value)
if err != nil {
stack.Push(ethutil.BigFalse)
@@ -914,7 +914,6 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
default:
vmlogger.Debugf("(pc) %-3v Invalid opcode %x\n", pc, op)
- //panic(fmt.Sprintf("Invalid opcode %x", op))
closure.ReturnGas(big.NewInt(1), nil)
return closure.Return(nil), fmt.Errorf("Invalid opcode %x", op)
@@ -963,7 +962,3 @@ func (self *DebugVm) Endl() VirtualMachine {
func (self *DebugVm) Env() Environment {
return self.env
}
-
-func (self *DebugVm) Depth() int {
- return self.depth
-}