diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-30 20:32:50 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-30 20:32:50 +0800 |
commit | df5603de0a34e80a1af6ad03e37ce43728baad35 (patch) | |
tree | 5d9a71ad887c243b781b1c2d6077336bed82057b /vm | |
parent | fa890c8c0140dac1e02038a6134db0d83bb85af9 (diff) | |
download | go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.tar go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.gz go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.bz2 go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.lz go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.xz go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.tar.zst go-tangerine-df5603de0a34e80a1af6ad03e37ce43728baad35.zip |
Moved logging to state, proper structured block
* Moved logs to state so it's subject to snapshotting
* Split up block header
* Removed logs from transactions and made them receipts only
Diffstat (limited to 'vm')
-rw-r--r-- | vm/environment.go | 6 | ||||
-rw-r--r-- | vm/log.go | 38 | ||||
-rw-r--r-- | vm/vm_debug.go | 3 |
3 files changed, 7 insertions, 40 deletions
diff --git a/vm/environment.go b/vm/environment.go index b8013856e..deb46b77f 100644 --- a/vm/environment.go +++ b/vm/environment.go @@ -20,7 +20,7 @@ type Environment interface { BlockHash() []byte GasLimit() *big.Int Transfer(from, to Account, amount *big.Int) error - AddLog(Log) + AddLog(ethstate.Log) } type Object interface { @@ -43,5 +43,9 @@ func Transfer(from, to Account, amount *big.Int) error { from.SubBalance(amount) to.AddBalance(amount) + // Add default LOG. Default = big(sender.addr) + 1 + //addr := ethutil.BigD(receiver.Address()) + //tx.addLog(vm.Log{sender.Address(), [][]byte{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes()}, nil}) + return nil } diff --git a/vm/log.go b/vm/log.go deleted file mode 100644 index bc72a0423..000000000 --- a/vm/log.go +++ /dev/null @@ -1,38 +0,0 @@ -package vm - -import "github.com/ethereum/go-ethereum/ethutil" - -type Log struct { - Address []byte - 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 b3fbfe341..7afc7e79a 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/ethcrypto" + "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" ) @@ -710,7 +711,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) { for i := 0; i < n; i++ { topics[i] = stack.Pop().Bytes() } - self.env.AddLog(Log{closure.Address(), topics, data}) + self.env.AddLog(ethstate.Log{closure.Address(), topics, data}) case MLOAD: offset := stack.Pop() val := ethutil.BigD(mem.Get(offset.Int64(), 32)) |