mirror of https://github.com/poanetwork/quorum.git
Vm logging on diff
This commit is contained in:
parent
50bc838047
commit
2784e256f1
|
@ -196,7 +196,7 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) {
|
||||||
fmt.Printf("## %x %x ##\n", block.Hash(), block.Number)
|
fmt.Printf("## %x %x ##\n", block.Hash(), block.Number)
|
||||||
}
|
}
|
||||||
|
|
||||||
receipts, err := sm.ApplyDiff(state, parent, block)
|
_, err = sm.ApplyDiff(state, parent, block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,10 +232,6 @@ func (self *Receipt) Cmp(other *Receipt) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.CumulativeGasUsed.Cmp(other.CumulativeGasUsed) != 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,8 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
|
||||||
var mult *big.Int
|
var mult *big.Int
|
||||||
y, x := stack.Peekn()
|
y, x := stack.Peekn()
|
||||||
val := closure.GetStorage(x)
|
val := closure.GetStorage(x)
|
||||||
if val.IsEmpty() && len(y.Bytes()) > 0 {
|
//if val.IsEmpty() && len(y.Bytes()) > 0 {
|
||||||
|
if val.BigInt().Cmp(ethutil.Big0) == 0 && len(y.Bytes()) > 0 {
|
||||||
mult = ethutil.Big2
|
mult = ethutil.Big2
|
||||||
} else if !val.IsEmpty() && len(y.Bytes()) == 0 {
|
} else if !val.IsEmpty() && len(y.Bytes()) == 0 {
|
||||||
mult = ethutil.Big0
|
mult = ethutil.Big0
|
||||||
|
@ -482,7 +483,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
|
||||||
case ORIGIN:
|
case ORIGIN:
|
||||||
stack.Push(ethutil.BigD(vm.vars.Origin))
|
stack.Push(ethutil.BigD(vm.vars.Origin))
|
||||||
|
|
||||||
vm.Printf(" => %v", vm.vars.Origin)
|
vm.Printf(" => %x", vm.vars.Origin)
|
||||||
case CALLER:
|
case CALLER:
|
||||||
caller := closure.caller.Address()
|
caller := closure.caller.Address()
|
||||||
stack.Push(ethutil.BigD(caller))
|
stack.Push(ethutil.BigD(caller))
|
||||||
|
@ -550,10 +551,10 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
code := closure.Script[cOff : cOff+l]
|
code := closure.Script[cOff : cOff+l]
|
||||||
fmt.Println("len:", l, "code off:", cOff, "mem off:", mOff)
|
//fmt.Println("len:", l, "code off:", cOff, "mem off:", mOff)
|
||||||
|
|
||||||
mem.Set(mOff, l, code)
|
mem.Set(mOff, l, code)
|
||||||
fmt.Println(Code(mem.Get(mOff, l)))
|
//fmt.Println(Code(mem.Get(mOff, l)))
|
||||||
case GASPRICE:
|
case GASPRICE:
|
||||||
stack.Push(closure.Price)
|
stack.Push(closure.Price)
|
||||||
|
|
||||||
|
@ -743,6 +744,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
|
||||||
|
|
||||||
if closure.object.Amount.Cmp(value) < 0 {
|
if closure.object.Amount.Cmp(value) < 0 {
|
||||||
vmlogger.Debugf("Insufficient funds to transfer value. Req %v, has %v", value, closure.object.Amount)
|
vmlogger.Debugf("Insufficient funds to transfer value. Req %v, has %v", value, closure.object.Amount)
|
||||||
|
|
||||||
closure.ReturnGas(gas, nil, nil)
|
closure.ReturnGas(gas, nil, nil)
|
||||||
|
|
||||||
stack.Push(ethutil.BigFalse)
|
stack.Push(ethutil.BigFalse)
|
||||||
|
|
|
@ -190,6 +190,19 @@ func (val *Value) Get(idx int) *Value {
|
||||||
return NewValue(nil)
|
return NewValue(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Value) Copy() *Value {
|
||||||
|
switch val := self.Val.(type) {
|
||||||
|
case *big.Int:
|
||||||
|
return NewValue(new(big.Int).Set(val))
|
||||||
|
case []byte:
|
||||||
|
return NewValue(CopyBytes(val))
|
||||||
|
default:
|
||||||
|
return NewValue(self.Val)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (val *Value) Cmp(o *Value) bool {
|
func (val *Value) Cmp(o *Value) bool {
|
||||||
return reflect.DeepEqual(val.Val, o.Val)
|
return reflect.DeepEqual(val.Val, o.Val)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue