aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-25 23:58:07 +0800
committerzelig <viktor.tron@gmail.com>2014-06-25 23:58:07 +0800
commit98f1ee9442d3b3d744e25dbddd9b54dc60180ad1 (patch)
treef05f7be355838fd104f227714082bd9ea89cb591 /ethchain
parenta02edf7a9306c9c0b2f0208152347b47f1a4e689 (diff)
parentb0dc50c2a0e25bf88901f3dd481f14bc3375adc5 (diff)
downloaddexon-98f1ee9442d3b3d744e25dbddd9b54dc60180ad1.tar.gz
dexon-98f1ee9442d3b3d744e25dbddd9b54dc60180ad1.tar.zst
dexon-98f1ee9442d3b3d744e25dbddd9b54dc60180ad1.zip
merge upstream
Diffstat (limited to 'ethchain')
-rw-r--r--ethchain/state_object.go1
-rw-r--r--ethchain/vm.go11
2 files changed, 7 insertions, 5 deletions
diff --git a/ethchain/state_object.go b/ethchain/state_object.go
index 26ad3e982..480b4055d 100644
--- a/ethchain/state_object.go
+++ b/ethchain/state_object.go
@@ -91,7 +91,6 @@ func (c *StateObject) SetAddr(addr []byte, value interface{}) {
func (c *StateObject) SetStorage(num *big.Int, val *ethutil.Value) {
addr := ethutil.BigToBytes(num, 256)
- // FIXME This should be handled in the Trie it self
if val.BigInt().Cmp(ethutil.Big0) == 0 {
c.state.trie.Delete(string(addr))
diff --git a/ethchain/vm.go b/ethchain/vm.go
index 66005e814..4c1821f56 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -109,11 +109,11 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
require := func(m int) {
if stack.Len() < m {
isRequireError = true
- panic(fmt.Sprintf("stack = %d, req = %d", stack.Len(), m))
+ panic(fmt.Sprintf("stack err = %d, req = %d", stack.Len(), m))
}
}
- // Instruction pointer
+ // Program counter
pc := big.NewInt(0)
// Current step count
step := 0
@@ -596,16 +596,18 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
// Generate a new address
addr := ethutil.CreateAddress(closure.caller.Address(), closure.caller.N())
+
+ vm.Printf(" (*) %x", addr).Endl()
+
// Create a new contract
contract := vm.state.NewStateObject(addr)
contract.Amount = value
// Set the init script
- contract.initScript = mem.Get(offset.Int64(), size.Int64())
+ contract.initScript = ethutil.BigD(mem.Get(offset.Int64(), size.Int64())).Bytes()
// Transfer all remaining gas to the new
// contract so it may run the init script
gas := new(big.Int).Set(closure.Gas)
- //closure.UseGas(gas)
// Create the closure
c := NewClosure(closure.caller,
@@ -616,6 +618,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
closure.Price)
// Call the closure and set the return value as
// main script.
+ var err error
c.Script, gas, err = c.Call(vm, nil, hook)
if err != nil {