PoC 7 updates

* Bloom
* Block restructure
* Receipts
This commit is contained in:
obscuren
2014-10-29 10:34:40 +01:00
parent 665a44646e
commit fb4113dab4
14 changed files with 218 additions and 134 deletions

View File

@ -1,9 +1,38 @@
package vm
import "math/big"
import "github.com/ethereum/go-ethereum/ethutil"
type Log struct {
Address []byte
Topics []*big.Int
Topics [][]byte
Data []byte
}
func NewLogFromValue(decoder *ethutil.Value) Log {
log := Log{
Address: decoder.Get(0).Bytes(),
Data: decoder.Get(2).Bytes(),
}
it := decoder.Get(1).NewIterator()
for it.Next() {
log.Topics = append(log.Topics, it.Value().Bytes())
}
return log
}
func (self Log) RlpData() interface{} {
return []interface{}{self.Address, ethutil.ByteSliceToInterface(self.Topics), self.Data}
}
type Logs []Log
func (self Logs) RlpData() interface{} {
data := make([]interface{}, len(self))
for i, log := range self {
data[i] = log.RlpData()
}
return data
}

View File

@ -704,11 +704,11 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
self.Printf(" => [%d] %x [0] %x", n, x.Bytes(), y.Bytes())
case LOG0, LOG1, LOG2, LOG3, LOG4:
n := int(op - LOG0)
topics := make([]*big.Int, n)
topics := make([][]byte, n)
mSize, mStart := stack.Pop().Int64(), stack.Pop().Int64()
data := mem.Geti(mStart, mSize)
for i := 0; i < n; i++ {
topics[i] = stack.Pop()
topics[i] = stack.Pop().Bytes()
}
self.env.AddLog(Log{closure.Address(), topics, data})
case MLOAD: