[release/1.3.4] core, core/vm, crypto: fixes for homestead

* Removed some strange code that didn't apply state reverting properly
* Refactored code setting from vm & state transition to the executioner
* Updated tests

Conflicts:
	common/registrar/ethreg/api.go
	core/tx_pool.go
	core/vm/jit_test.go
This commit is contained in:
Jeffrey Wilcke
2016-01-19 23:50:00 +01:00
parent 7bb496f737
commit 587bafaa9f
23 changed files with 233 additions and 205 deletions

View File

@ -28,6 +28,7 @@ type Account struct {
Nonce uint64 `json:"nonce"`
Root string `json:"root"`
CodeHash string `json:"codeHash"`
Code string `json:"code"`
Storage map[string]string `json:"storage"`
}
@ -47,7 +48,7 @@ func (self *StateDB) RawDump() World {
addr := self.trie.GetKey(it.Key)
stateObject := NewStateObjectFromBytes(common.BytesToAddress(addr), it.Value, self.db)
account := Account{Balance: stateObject.balance.String(), Nonce: stateObject.nonce, Root: common.Bytes2Hex(stateObject.Root()), CodeHash: common.Bytes2Hex(stateObject.codeHash)}
account := Account{Balance: stateObject.balance.String(), Nonce: stateObject.nonce, Root: common.Bytes2Hex(stateObject.Root()), CodeHash: common.Bytes2Hex(stateObject.codeHash), Code: common.Bytes2Hex(stateObject.Code())}
account.Storage = make(map[string]string)
storageIt := stateObject.trie.Iterator()

View File

@ -234,11 +234,6 @@ func (c *StateObject) Address() common.Address {
return c.address
}
// Sets the address of the contract/account
func (c *StateObject) SetAddress(addr common.Address) {
c.address = addr
}
func (self *StateObject) Trie() *trie.SecureTrie {
return self.trie
}
@ -269,7 +264,7 @@ func (self *StateObject) Nonce() uint64 {
// as a vm.Account interface that also satisfies the vm.ContractRef
// interface. Interfaces are awesome.
func (self *StateObject) Value() *big.Int {
return nil
panic("Value on StateObject should never be called")
}
func (self *StateObject) EachStorage(cb func(key, value []byte)) {

View File

@ -85,18 +85,6 @@ func (self *StateDB) GetLogs(hash common.Hash) vm.Logs {
return self.logs[hash]
}
func (self *StateDB) GetAllLogs() *map[common.Hash]vm.Logs {
copy := make(map[common.Hash]vm.Logs, len(self.logs))
for k, v := range self.logs {
copy[k] = v
}
return &copy
}
func (self *StateDB) SetAllLogs(logs *map[common.Hash]vm.Logs) {
self.logs = *logs
}
func (self *StateDB) Logs() vm.Logs {
var logs vm.Logs
for _, lgs := range self.logs {
@ -105,11 +93,6 @@ func (self *StateDB) Logs() vm.Logs {
return logs
}
// TODO: this may not be the most proper thing
func (self *StateDB) GetDB() ethdb.Database {
return self.db
}
func (self *StateDB) AddRefund(gas *big.Int) {
self.refund.Add(self.refund, gas)
}