[release/1.3.4] parmas, crypto, core, core/vm: homestead consensus protocol changes

* change gas cost for contract creating txs
* invalidate signature with s value greater than secp256k1 N / 2
* OOG contract creation if not enough gas to store code
* new difficulty adjustment algorithm
* new DELEGATECALL op code

Conflicts:
	core/vm/environment.go
	crypto/crypto.go
	crypto/secp256k1/secp256.go
	eth/api.go
This commit is contained in:
Gustav Simonsson
2015-11-27 15:40:29 +01:00
committed by Jeffrey Wilcke
parent 300f1e2abf
commit 61404979ed
54 changed files with 25877 additions and 11223 deletions

View File

@ -234,6 +234,11 @@ 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
}
@ -260,6 +265,13 @@ func (self *StateObject) Nonce() uint64 {
return self.nonce
}
// Never called, but must be present to allow StateObject to be used
// as a vm.Account interface that also satisfies the vm.ContractRef
// interface. Interfaces are awesome.
func (self *StateObject) Value() *big.Int {
return nil
}
func (self *StateObject) EachStorage(cb func(key, value []byte)) {
// When iterating over the storage check the cache first
for h, v := range self.storage {

View File

@ -85,6 +85,18 @@ 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 {
@ -93,6 +105,11 @@ 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)
}