[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

@@ -26,11 +26,13 @@ import (
type ContractRef interface {
ReturnGas(*big.Int, *big.Int)
Address() common.Address
SetAddress(common.Address)
Value() *big.Int
SetCode([]byte)
}
// Contract represents an ethereum contract in the state database. It contains
// the the contract code, calling arguments. Contract implements ContractReg
// the the contract code, calling arguments. Contract implements ContractRef
type Contract struct {
caller ContractRef
self ContractRef
@@ -44,6 +46,8 @@ type Contract struct {
value, Gas, UsedGas, Price *big.Int
Args []byte
DelegateCall bool
}
// Create a new context for the given data items.
@@ -113,6 +117,16 @@ func (c *Contract) Address() common.Address {
return c.self.Address()
}
// SetAddress sets the contracts address
func (c *Contract) SetAddress(addr common.Address) {
c.self.SetAddress(addr)
}
// Value returns the contracts value (sent to it from it's caller)
func (c *Contract) Value() *big.Int {
return c.value
}
// SetCode sets the code to the contract
func (self *Contract) SetCode(code []byte) {
self.Code = code