aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-02-23 20:05:15 +0800
committerAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-02-23 20:05:15 +0800
commitdea65840186fe861017524c9cb59ae07ac97ed06 (patch)
tree5cb5e339b9ce77a2a3c92cf8a10c4294fcf7965c /vm
parentbb3338df6363d8267a24190584f0908463241a6c (diff)
parentdd086791acf477da7641c168f82de70ed0b2dca6 (diff)
downloadgo-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.tar.gz
go-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.tar.zst
go-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.zip
Merge branch 'develop' into ui
Diffstat (limited to 'vm')
-rw-r--r--vm/environment.go5
-rw-r--r--vm/vm.go13
2 files changed, 12 insertions, 6 deletions
diff --git a/vm/environment.go b/vm/environment.go
index 8507e248f..5b4d6c8f0 100644
--- a/vm/environment.go
+++ b/vm/environment.go
@@ -54,6 +54,7 @@ type Log struct {
address []byte
topics [][]byte
data []byte
+ log uint64
}
func (self *Log) Address() []byte {
@@ -68,6 +69,10 @@ func (self *Log) Data() []byte {
return self.data
}
+func (self *Log) Number() uint64 {
+ return self.log
+}
+
func (self *Log) RlpData() interface{} {
return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topics), self.data}
}
diff --git a/vm/vm.go b/vm/vm.go
index 29e1ade54..f9efeed96 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -266,7 +266,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
base.Sub(Pow256, stack.Pop()).Sub(base, ethutil.Big1)
// Not needed
- //base = U256(base)
+ base = U256(base)
stack.Push(base)
case LT:
@@ -532,7 +532,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
case NUMBER:
number := self.env.BlockNumber()
- stack.Push(number)
+ stack.Push(U256(number))
self.Printf(" => 0x%x", number.Bytes())
case DIFFICULTY:
@@ -578,7 +578,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
}
data := mem.Get(mStart.Int64(), mSize.Int64())
- log := &Log{context.Address(), topics, data}
+ log := &Log{context.Address(), topics, data, self.env.BlockNumber().Uint64()}
self.env.AddLog(log)
self.Printf(" => %v", log)
@@ -676,6 +676,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
gas := stack.Pop()
// Pop gas and value of the stack.
value, addr := stack.Popn()
+ value = U256(value)
// Pop input size and offset
inSize, inOffset := stack.Popn()
// Pop return size and offset
@@ -778,9 +779,9 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
// Stack Check, memory resize & gas phase
switch op {
// Stack checks only
- case ISZERO, CALLDATALOAD, POP, JUMP, NOT: // 1
+ case ISZERO, CALLDATALOAD, POP, JUMP, NOT, EXTCODESIZE, BLOCKHASH: // 1
stack.require(1)
- case JUMPI, ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2
+ case JUMPI, ADD, SUB, DIV, MUL, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2
stack.require(2)
case ADDMOD, MULMOD: // 3
stack.require(3)
@@ -858,7 +859,7 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2])
additionalGas.Set(stack.data[stack.Len()-2])
case CALLDATACOPY:
- stack.require(2)
+ stack.require(3)
newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3])
additionalGas.Set(stack.data[stack.Len()-3])