aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-29 17:34:40 +0800
committerobscuren <geffobscura@gmail.com>2014-10-29 17:34:40 +0800
commitfb4113dab4df8480c77bdcb707fa6b5408755b79 (patch)
treeb369bb26e7b96826120fb08ff61739326add0e92 /vm
parent665a44646e9453e37c8a73bdd2c94ba7dc1e7c0a (diff)
downloadgo-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.tar
go-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.tar.gz
go-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.tar.bz2
go-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.tar.lz
go-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.tar.xz
go-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.tar.zst
go-tangerine-fb4113dab4df8480c77bdcb707fa6b5408755b79.zip
PoC 7 updates
* Bloom * Block restructure * Receipts
Diffstat (limited to 'vm')
-rw-r--r--vm/log.go33
-rw-r--r--vm/vm_debug.go4
2 files changed, 33 insertions, 4 deletions
diff --git a/vm/log.go b/vm/log.go
index 954d2ec91..bc72a0423 100644
--- a/vm/log.go
+++ b/vm/log.go
@@ -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
+}
diff --git a/vm/vm_debug.go b/vm/vm_debug.go
index 1e45813bc..b3fbfe341 100644
--- a/vm/vm_debug.go
+++ b/vm/vm_debug.go
@@ -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: