Skip to content

Commit b7e3dfc

Browse files
authored
Merge pull request #2754 from ethereum/release/1.4
Geth 1.4.9 "The network strikes back"
2 parents 98be7cd + 3e1dbc3 commit b7e3dfc

File tree

15 files changed

+11
-475
lines changed

15 files changed

+11
-475
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.8
1+
1.4.9

cmd/evm/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ type ruleSet struct{}
220220

221221
func (ruleSet) IsHomestead(*big.Int) bool { return true }
222222

223-
func (self *VMEnv) MarkCodeHash(common.Hash) {}
224223
func (self *VMEnv) RuleSet() vm.RuleSet { return ruleSet{} }
225224
func (self *VMEnv) Vm() vm.Vm { return self.evm }
226225
func (self *VMEnv) Db() vm.Database { return self.state }

cmd/geth/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const (
5050
clientIdentifier = "Geth" // Client identifier to advertise over the network
5151
versionMajor = 1 // Major version component of the current release
5252
versionMinor = 4 // Minor version component of the current release
53-
versionPatch = 8 // Patch version component of the current release
53+
versionPatch = 9 // Patch version component of the current release
5454
versionMeta = "stable" // Version metadata to append to the version string
5555

5656
versionOracle = "0xfa7b9770ca4cb04296cac84f37736d4041251cdf" // Ethereum address of the Geth release oracle
@@ -169,7 +169,6 @@ participating.
169169
utils.MiningGPUFlag,
170170
utils.AutoDAGFlag,
171171
utils.TargetGasLimitFlag,
172-
utils.DAOSoftForkFlag,
173172
utils.NATFlag,
174173
utils.NatspecEnabledFlag,
175174
utils.NoDiscoverFlag,

cmd/geth/usage.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ var AppHelpFlagGroups = []flagGroup{
128128
utils.TargetGasLimitFlag,
129129
utils.GasPriceFlag,
130130
utils.ExtraDataFlag,
131-
utils.DAOSoftForkFlag,
132131
},
133132
},
134133
{

cmd/utils/flags.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,6 @@ var (
181181
Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine",
182182
Value: params.GenesisGasLimit.String(),
183183
}
184-
DAOSoftForkFlag = cli.BoolFlag{
185-
Name: "dao-soft-fork",
186-
Usage: "Vote for the DAO soft-fork, temporarilly decreasing the gas limits",
187-
}
188184
AutoDAGFlag = cli.BoolFlag{
189185
Name: "autodag",
190186
Usage: "Enable automatic DAG pregeneration",
@@ -681,9 +677,6 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
681677
// Configure the Ethereum service
682678
accman := MakeAccountManager(ctx)
683679

684-
// Handle some miner strategies arrising from the DAO fiasco
685-
core.DAOSoftFork = ctx.GlobalBool(DAOSoftForkFlag.Name)
686-
687680
// initialise new random number generator
688681
rand := rand.New(rand.NewSource(time.Now().UnixNano()))
689682
// get enabled jit flag

core/block_validator.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,5 @@ func CalcGasLimit(parent *types.Block) *big.Int {
371371
gl.Add(parent.GasLimit(), decay)
372372
gl.Set(common.BigMin(gl, params.TargetGasLimit))
373373
}
374-
// Temporary special case: if DAO rupture is requested, cap the gas limit
375-
if DAOSoftFork && parent.NumberU64() <= ruptureBlock && gl.Cmp(ruptureTarget) > 0 {
376-
gl.Sub(parent.GasLimit(), decay)
377-
gl.Set(common.BigMax(gl, ruptureTarget))
378-
}
379374
return gl
380375
}

core/dao_test.go

Lines changed: 0 additions & 358 deletions
This file was deleted.

core/execution.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ func exec(env vm.Environment, caller vm.ContractRef, address, codeAddr *common.A
8484
address = &addr
8585
createAccount = true
8686
}
87-
// Mark all contracts doing outbound value transfers to allow DAO filtering.
88-
if value.Cmp(common.Big0) > 0 {
89-
env.MarkCodeHash(env.Db().GetCodeHash(caller.Address()))
90-
}
87+
9188
snapshotPreTransfer := env.MakeSnapshot()
9289
var (
9390
from = env.Db().GetAccount(caller.Address())
@@ -146,10 +143,7 @@ func execDelegateCall(env vm.Environment, caller vm.ContractRef, originAddr, toA
146143
caller.ReturnGas(gas, gasPrice)
147144
return nil, common.Address{}, vm.DepthError
148145
}
149-
// Mark all contracts doing outbound value transfers to allow DAO filtering.
150-
if value.Cmp(common.Big0) > 0 {
151-
env.MarkCodeHash(env.Db().GetCodeHash(caller.Address()))
152-
}
146+
153147
snapshot := env.MakeSnapshot()
154148

155149
var to vm.Account

core/state/statedb.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,6 @@ func (self *StateDB) GetCode(addr common.Address) []byte {
161161
return nil
162162
}
163163

164-
func (self *StateDB) GetCodeHash(addr common.Address) common.Hash {
165-
stateObject := self.GetStateObject(addr)
166-
if stateObject != nil {
167-
return common.BytesToHash(stateObject.codeHash)
168-
}
169-
return common.Hash{}
170-
}
171-
172164
func (self *StateDB) GetState(a common.Address, b common.Hash) common.Hash {
173165
stateObject := self.GetStateObject(a)
174166
if stateObject != nil {

core/state_processor.go

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
package core
1818

1919
import (
20-
"errors"
2120
"math/big"
2221

23-
"github.com/ethereum/go-ethereum/common"
2422
"github.com/ethereum/go-ethereum/core/state"
2523
"github.com/ethereum/go-ethereum/core/types"
2624
"github.com/ethereum/go-ethereum/core/vm"
@@ -30,25 +28,8 @@ import (
3028
)
3129

3230
var (
33-
big8 = big.NewInt(8)
34-
big32 = big.NewInt(32)
35-
blockedCodeHashErr = errors.New("core: blocked code-hash found during execution")
36-
37-
// DAO attack chain rupture mechanism
38-
DAOSoftFork bool // Flag whether to vote for DAO rupture
39-
40-
ruptureBlock = uint64(1800000) // Block number of the voted soft fork
41-
ruptureTarget = big.NewInt(3141592) // Gas target (hard) for miners voting to fork
42-
ruptureThreshold = big.NewInt(4000000) // Gas threshold for passing a fork vote
43-
ruptureGasCache = make(map[common.Hash]*big.Int) // Amount of gas in the point of rupture
44-
ruptureCodeHashes = map[common.Hash]struct{}{
45-
common.HexToHash("6a5d24750f78441e56fec050dc52fe8e911976485b7472faac7464a176a67caa"): struct{}{},
46-
}
47-
ruptureWhitelist = map[common.Address]bool{
48-
common.HexToAddress("Da4a4626d3E16e094De3225A751aAb7128e96526"): true, // multisig
49-
common.HexToAddress("2ba9D006C1D72E67A70b5526Fc6b4b0C0fd6D334"): true, // attack contract
50-
}
51-
ruptureCacheLimit = 30000 // 1 epoch, 0.5 per possible fork
31+
big8 = big.NewInt(8)
32+
big32 = big.NewInt(32)
5233
)
5334

5435
// StateProcessor is a basic Processor, which takes care of transitioning
@@ -105,56 +86,11 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
10586
// ApplyTransactions returns the generated receipts and vm logs during the
10687
// execution of the state transition phase.
10788
func ApplyTransaction(config *ChainConfig, bc *BlockChain, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *big.Int, cfg vm.Config) (*types.Receipt, vm.Logs, *big.Int, error) {
108-
env := NewEnv(statedb, config, bc, tx, header, cfg)
109-
_, gas, err := ApplyMessage(env, tx, gp)
89+
_, gas, err := ApplyMessage(NewEnv(statedb, config, bc, tx, header, cfg), tx, gp)
11090
if err != nil {
11191
return nil, nil, nil, err
11292
}
11393

114-
// Check whether the DAO needs to be blocked or not
115-
if bc != nil { // Test chain maker uses nil to construct the potential chain
116-
blockRuptureCodes := false
117-
118-
if number := header.Number.Uint64(); number >= ruptureBlock {
119-
// We're past the rupture point, find the vote result on this chain and apply it
120-
ancestry := []common.Hash{header.Hash(), header.ParentHash}
121-
for _, ok := ruptureGasCache[ancestry[len(ancestry)-1]]; !ok && number >= ruptureBlock+uint64(len(ancestry)); {
122-
ancestry = append(ancestry, bc.GetHeader(ancestry[len(ancestry)-1]).ParentHash)
123-
}
124-
decider := ancestry[len(ancestry)-1]
125-
126-
vote, ok := ruptureGasCache[decider]
127-
if !ok {
128-
// We've reached the rupture point, retrieve the vote
129-
vote = bc.GetHeader(decider).GasLimit
130-
ruptureGasCache[decider] = vote
131-
}
132-
// Cache the vote result for all ancestors and check the DAO
133-
for _, hash := range ancestry {
134-
ruptureGasCache[hash] = vote
135-
}
136-
if ruptureGasCache[ancestry[0]].Cmp(ruptureThreshold) <= 0 {
137-
blockRuptureCodes = true
138-
}
139-
// Make sure we don't OOM long run due to too many votes caching up
140-
for len(ruptureGasCache) > ruptureCacheLimit {
141-
for hash, _ := range ruptureGasCache {
142-
delete(ruptureGasCache, hash)
143-
break
144-
}
145-
}
146-
}
147-
// Verify if the DAO soft fork kicks in
148-
if blockRuptureCodes {
149-
if recipient := tx.To(); recipient == nil || !ruptureWhitelist[*recipient] {
150-
for hash, _ := range env.GetMarkedCodeHashes() {
151-
if _, blocked := ruptureCodeHashes[hash]; blocked {
152-
return nil, nil, nil, blockedCodeHashErr
153-
}
154-
}
155-
}
156-
}
157-
}
15894
// Update the state with pending changes
15995
usedGas.Add(usedGas, gas)
16096
receipt := types.NewReceipt(statedb.IntermediateRoot().Bytes(), usedGas)

0 commit comments

Comments
 (0)