From 84adf77bf3492351de82f0ec820a1d280e85a5cd Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Thu, 29 Jan 2015 13:10:34 +0100
Subject: Added RPC "Call" for JS calls to contracts

---
 vm/vm.go | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'vm/vm.go')

diff --git a/vm/vm.go b/vm/vm.go
index 37e4249f5..4364b1cb9 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -634,6 +634,8 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 				continue
 			}
 
+			self.Printf(" ~> false")
+
 		case JUMPDEST:
 		case PC:
 			stack.Push(big.NewInt(int64(pc)))
-- 
cgit v1.2.3


From faa54e59c1c276d153299c73afdea246941ec952 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Mon, 2 Feb 2015 20:01:10 -0800
Subject: Make sure that CALL addr is always 20 bytes

---
 vm/vm.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'vm/vm.go')

diff --git a/vm/vm.go b/vm/vm.go
index 4364b1cb9..69e061e54 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -516,7 +516,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 		case BLOCKHASH:
 			num := stack.Pop()
 
-			n := U256(new(big.Int).Sub(self.env.BlockNumber(), ethutil.Big257))
+			n := new(big.Int).Sub(self.env.BlockNumber(), ethutil.Big257)
 			if num.Cmp(n) > 0 && num.Cmp(self.env.BlockNumber()) < 0 {
 				stack.Push(ethutil.BigD(self.env.GetHash(num.Uint64())))
 			} else {
@@ -681,8 +681,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 				self.Dbg.SetCode(context.Code)
 			}
 		case CALL, CALLCODE:
-			self.Endl()
-
 			gas := stack.Pop()
 			// Pop gas and value of the stack.
 			value, addr := stack.Popn()
@@ -691,6 +689,9 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 			// Pop return size and offset
 			retSize, retOffset := stack.Popn()
 
+			address := ethutil.Address(addr.Bytes())
+			self.Printf(" => %x", address).Endl()
+
 			// Get the arguments from the memory
 			args := mem.Get(inOffset.Int64(), inSize.Int64())
 
@@ -699,9 +700,9 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 				err error
 			)
 			if op == CALLCODE {
-				ret, err = self.env.CallCode(context, addr.Bytes(), args, gas, price, value)
+				ret, err = self.env.CallCode(context, address, args, gas, price, value)
 			} else {
-				ret, err = self.env.Call(context, addr.Bytes(), args, gas, price, value)
+				ret, err = self.env.Call(context, address, args, gas, price, value)
 			}
 
 			if err != nil {
-- 
cgit v1.2.3


From 3f03197daebace568a61bf69c06c97e30080a749 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Wed, 4 Feb 2015 07:39:02 -0800
Subject: Updated tests

---
 vm/vm.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'vm/vm.go')

diff --git a/vm/vm.go b/vm/vm.go
index 69e061e54..2b8c90428 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -510,7 +510,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 		case GASPRICE:
 			stack.Push(context.Price)
 
-			self.Printf(" => %v", context.Price)
+			self.Printf(" => %x", context.Price)
 
 			// 0x40 range
 		case BLOCKHASH:
@@ -643,6 +643,8 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 			stack.Push(big.NewInt(int64(mem.Len())))
 		case GAS:
 			stack.Push(context.Gas)
+
+			self.Printf(" => %x", context.Gas)
 			// 0x60 range
 		case CREATE:
 
@@ -653,6 +655,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 				gas          = new(big.Int).Set(context.Gas)
 				addr         []byte
 			)
+			self.Endl()
 
 			context.UseGas(context.Gas)
 			ret, suberr, ref := self.env.Create(context, nil, input, gas, price, value)
@@ -673,7 +676,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 
 				stack.Push(ethutil.BigD(addr))
 
-				self.Printf(" (*) %x", addr)
 			}
 
 			// Debug hook
-- 
cgit v1.2.3


From 3f6baa45a7fb1ae5fd7966d2763a2a776a65eb96 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Wed, 11 Feb 2015 23:46:45 +0100
Subject: Documented methods & removed old manifest

---
 vm/vm.go | 11 -----------
 1 file changed, 11 deletions(-)

(limited to 'vm/vm.go')

diff --git a/vm/vm.go b/vm/vm.go
index 2b8c90428..29e1ade54 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -38,13 +38,6 @@ func New(env Environment) *Vm {
 func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.Int, callData []byte) (ret []byte, err error) {
 	self.env.SetDepth(self.env.Depth() + 1)
 
-	msg := self.env.State().Manifest().AddMessage(&state.Message{
-		To: me.Address(), From: caller.Address(),
-		Input:     callData,
-		Origin:    self.env.Origin(),
-		Timestamp: self.env.Time(), Coinbase: self.env.Coinbase(), Number: self.env.BlockNumber(),
-		Value: value,
-	})
 	context := NewContext(caller, me, code, gas, price)
 
 	vmlogger.Debugf("(%d) (%x) %x (code=%d) gas: %v (d) %x\n", self.env.Depth(), caller.Address()[:4], context.Address(), len(code), context.Gas, callData)
@@ -618,8 +611,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 			val, loc := stack.Popn()
 			statedb.SetState(context.Address(), loc.Bytes(), val)
 
-			msg.AddStorageChange(loc.Bytes())
-
 			self.Printf(" {0x%x : 0x%x}", loc.Bytes(), val.Bytes())
 		case JUMP:
 			jump(pc, stack.Pop())
@@ -670,7 +661,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 				dataGas.Mul(dataGas, GasCreateByte)
 				if context.UseGas(dataGas) {
 					ref.SetCode(ret)
-					msg.Output = ret
 				}
 				addr = ref.Address()
 
@@ -713,7 +703,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
 				vmlogger.Debugln(err)
 			} else {
 				stack.Push(ethutil.BigTrue)
-				msg.Output = ret
 
 				mem.Set(retOffset.Uint64(), retSize.Uint64(), ret)
 			}
-- 
cgit v1.2.3