aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/vm.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-23 17:51:04 +0800
committerobscuren <geffobscura@gmail.com>2014-04-23 17:51:04 +0800
commit3a9a252f6e44abb0f45f57a46c0fa91e2f73c545 (patch)
tree677575939c8f22c30a9601c205450a0d5b98c3ab /ethchain/vm.go
parent61cd1594b52514244efcb47bd93722aaec0fe456 (diff)
downloadgo-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar
go-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.gz
go-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.bz2
go-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.lz
go-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.xz
go-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.tar.zst
go-tangerine-3a9a252f6e44abb0f45f57a46c0fa91e2f73c545.zip
Fixed minor issue with gas and added state object init
Diffstat (limited to 'ethchain/vm.go')
-rw-r--r--ethchain/vm.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/ethchain/vm.go b/ethchain/vm.go
index c249adfeb..33541cb3b 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -84,11 +84,9 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
// The base for all big integer arithmetic
base := new(big.Int)
- /*
- if ethutil.Config.Debug {
- ethutil.Config.Log.Debugf("# op\n")
- }
- */
+ if ethutil.Config.Debug {
+ ethutil.Config.Log.Debugf("# op\n")
+ }
for {
step++
@@ -96,11 +94,9 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
val := closure.Get(pc)
// Get the opcode (it must be an opcode!)
op := OpCode(val.Uint())
- /*
- if ethutil.Config.Debug {
- ethutil.Config.Log.Debugf("%-3d %-4s", pc, op.String())
- }
- */
+ if ethutil.Config.Debug {
+ ethutil.Config.Log.Debugf("%-3d %-4s", pc, op.String())
+ }
gas := new(big.Int)
useGas := func(amount *big.Int) {
@@ -316,10 +312,12 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case oCALLVALUE:
// FIXME: Original value of the call, not the current value
stack.Push(closure.Value)
- case oCALLDATA:
+ case oCALLDATALOAD:
require(1)
- offset := stack.Pop()
- mem.Set(offset.Int64(), int64(len(closure.Args)), closure.Args)
+ offset := stack.Pop().Int64()
+ val := closure.Args[offset : offset+31]
+
+ stack.Push(ethutil.BigD(val))
case oCALLDATASIZE:
stack.Push(big.NewInt(int64(len(closure.Args))))
case oGASPRICE: