diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-03 12:01:10 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-03 12:01:10 +0800 |
commit | faa54e59c1c276d153299c73afdea246941ec952 (patch) | |
tree | 1b16db58ab83fb67ca13ff20b9a26c51edaf1aee | |
parent | 93ae7bb0d2a9cfc907eec342050210ba98848d5e (diff) | |
download | go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.tar go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.tar.gz go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.tar.bz2 go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.tar.lz go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.tar.xz go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.tar.zst go-tangerine-faa54e59c1c276d153299c73afdea246941ec952.zip |
Make sure that CALL addr is always 20 bytes
-rw-r--r-- | vm/vm.go | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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 { |