From 7a410643ac5dc7cc297cbdb094539761230440d0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 15 Jul 2014 20:35:55 +0200 Subject: [PATCH] Added/changed logging --- ethchain/state_object.go | 5 +++-- ethchain/vm.go | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ethchain/state_object.go b/ethchain/state_object.go index 5791c6ed1b..889496e91f 100644 --- a/ethchain/state_object.go +++ b/ethchain/state_object.go @@ -143,6 +143,7 @@ func (self *StateObject) getStorage(k []byte) *ethutil.Value { func (self *StateObject) setStorage(k []byte, value *ethutil.Value) { key := ethutil.LeftPadBytes(k, 32) + //fmt.Printf("%x %v\n", key, value) self.storage[string(key)] = value.Copy() } @@ -158,9 +159,9 @@ func (self *StateObject) Sync() { valid, t2 := ethtrie.ParanoiaCheck(self.state.trie) if !valid { - self.state.trie = t2 + statelogger.Infof("Warn: PARANOIA: Different state storage root during copy %x vs %x\n", self.state.trie.Root, t2.Root) - statelogger.Infoln("Warn: PARANOIA: Different state storage root during copy") + self.state.trie = t2 } } diff --git a/ethchain/vm.go b/ethchain/vm.go index 788bde8860..3a956ee83f 100644 --- a/ethchain/vm.go +++ b/ethchain/vm.go @@ -155,6 +155,15 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { // XXX Leave this Println intact. Don't change this to the log system. // Used for creating diffs between implementations if vm.logTy == LogTyDiff { + switch op { + case STOP, RETURN, SUICIDE: + closure.object.Sync() + closure.object.state.EachStorage(func(key string, value *ethutil.Value) { + value.Decode() + fmt.Printf("%x %x\n", new(big.Int).SetBytes([]byte(key)).Bytes(), value.Bytes()) + }) + } + b := pc.Bytes() if len(b) == 0 { b = []byte{0} @@ -184,7 +193,6 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { var mult *big.Int y, x := stack.Peekn() val := closure.GetStorage(x) - //if val.IsEmpty() && len(y.Bytes()) > 0 { if val.BigInt().Cmp(ethutil.Big0) == 0 && len(y.Bytes()) > 0 { mult = ethutil.Big2 } else if !val.IsEmpty() && len(y.Bytes()) == 0 {