Numerous fixes for consensus.

* Removed (buged) C++ specific gas specification for LOG*
* Fixed LOG* where mstart went after msize
*
This commit is contained in:
obscuren
2014-11-13 18:12:12 +01:00
parent 60cdb1148c
commit 20d518ee95
8 changed files with 48 additions and 14 deletions

View File

@ -169,6 +169,8 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
gas.Set(GasLog)
addStepGasUsage(new(big.Int).Mul(big.NewInt(int64(n)), GasLog))
addStepGasUsage(new(big.Int).Add(mSize, mStart))
// BUG in C++
//gas.Set(ethutil.Big1)
// Gas only
case STOP:
gas.Set(ethutil.Big0)
@ -732,12 +734,16 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
case LOG0, LOG1, LOG2, LOG3, LOG4:
n := int(op - LOG0)
topics := make([][]byte, n)
mSize, mStart := stack.Pop().Int64(), stack.Pop().Int64()
mStart, mSize := stack.Pop().Int64(), stack.Pop().Int64()
data := mem.Geti(mStart, mSize)
for i := 0; i < n; i++ {
topics[i] = stack.Pop().Bytes()
}
self.env.AddLog(&state.Log{closure.Address(), topics, data})
log := &state.Log{closure.Address(), topics, data}
self.env.AddLog(log)
self.Printf(" => %v", log)
case MLOAD:
offset := stack.Pop()
val := ethutil.BigD(mem.Get(offset.Int64(), 32))