Skip to content

Commit 81d9d7d

Browse files
authored
Merge pull request ethereum#3252 from obscuren/release/1.4
1.4 HF
2 parents ef9265d + 822355f commit 81d9d7d

File tree

938 files changed

+149252
-66362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

938 files changed

+149252
-66362
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.18
1+
1.4.19

accounts/abi/bind/backends/simulated.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ import (
2727
"github.com/ethereum/go-ethereum/core/vm"
2828
"github.com/ethereum/go-ethereum/ethdb"
2929
"github.com/ethereum/go-ethereum/event"
30+
"github.com/ethereum/go-ethereum/params"
3031
)
3132

3233
// Default chain configuration which sets homestead phase at block 0 (i.e. no frontier)
33-
var chainConfig = &core.ChainConfig{HomesteadBlock: big.NewInt(0)}
34+
var chainConfig = &params.ChainConfig{ChainId: new(big.Int), HomesteadBlock: big.NewInt(0), EIP150Block: new(big.Int), EIP158Block: new(big.Int)}
3435

3536
// This nil assignment ensures compile time that SimulatedBackend implements bind.ContractBackend.
3637
var _ bind.ContractBackend = (*SimulatedBackend)(nil)
@@ -72,8 +73,7 @@ func (b *SimulatedBackend) Commit() {
7273

7374
// Rollback aborts all pending transactions, reverting to the last committed state.
7475
func (b *SimulatedBackend) Rollback() {
75-
blocks, _ := core.GenerateChain(nil, b.blockchain.CurrentBlock(), b.database, 1, func(int, *core.BlockGen) {})
76-
76+
blocks, _ := core.GenerateChain(chainConfig, b.blockchain.CurrentBlock(), b.database, 1, func(int, *core.BlockGen) {})
7777
b.pendingBlock = blocks[0]
7878
b.pendingState, _ = state.New(b.pendingBlock.Root(), b.database)
7979
}
@@ -182,7 +182,7 @@ func (b *SimulatedBackend) EstimateGasLimit(sender common.Address, contract *com
182182
// SendTransaction implements ContractTransactor.SendTransaction, delegating the raw
183183
// transaction injection to the remote node.
184184
func (b *SimulatedBackend) SendTransaction(tx *types.Transaction) error {
185-
blocks, _ := core.GenerateChain(nil, b.blockchain.CurrentBlock(), b.database, 1, func(number int, block *core.BlockGen) {
185+
blocks, _ := core.GenerateChain(chainConfig, b.blockchain.CurrentBlock(), b.database, 1, func(number int, block *core.BlockGen) {
186186
for _, tx := range b.pendingBlock.Transactions() {
187187
block.AddTx(tx)
188188
}

cmd/ethtest/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ func runTestWithReader(test string, r io.Reader) error {
7676
case "bk", "block", "blocktest", "blockchaintest", "blocktests", "blockchaintests":
7777
err = tests.RunBlockTestWithReader(params.MainNetHomesteadBlock, params.MainNetDAOForkBlock, params.MainNetHomesteadGasRepriceBlock, r, skipTests)
7878
case "st", "state", "statetest", "statetests":
79-
rs := tests.RuleSet{HomesteadBlock: params.MainNetHomesteadBlock, DAOForkBlock: params.MainNetDAOForkBlock, DAOForkSupport: true}
79+
rs := &params.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock, DAOForkBlock: params.MainNetDAOForkBlock, DAOForkSupport: true, EIP150Block: params.MainNetHomesteadGasRepriceBlock}
8080
err = tests.RunStateTestWithReader(rs, r, skipTests)
8181
case "tx", "transactiontest", "transactiontests":
82-
err = tests.RunTransactionTestsWithReader(r, skipTests)
82+
rs := &params.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock, DAOForkBlock: params.MainNetDAOForkBlock, DAOForkSupport: true, EIP150Block: params.MainNetHomesteadGasRepriceBlock}
83+
err = tests.RunTransactionTestsWithReader(rs, r, skipTests)
8384
case "vm", "vmtest", "vmtests":
8485
err = tests.RunVmTestWithReader(r, skipTests)
8586
case "rlp", "rlptest", "rlptests":

cmd/evm/main.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func run(ctx *cli.Context) error {
158158
vmdone := time.Since(tstart)
159159

160160
if ctx.GlobalBool(DumpFlag.Name) {
161-
statedb.Commit()
161+
statedb.Commit(true)
162162
fmt.Println(string(statedb.Dump()))
163163
}
164164
vm.StdErrFormat(vmenv.StructLogs())
@@ -219,30 +219,30 @@ func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int, cfg
219219
return env
220220
}
221221

222-
// ruleSet implements vm.RuleSet and will always default to the homestead rule set.
222+
// ruleSet implements vm.ChainConfig and will always default to the homestead rule set.
223223
type ruleSet struct{}
224224

225225
func (ruleSet) IsHomestead(*big.Int) bool { return true }
226226
func (ruleSet) GasTable(*big.Int) params.GasTable {
227227
return params.GasTableHomesteadGasRepriceFork
228228
}
229229

230-
func (self *VMEnv) RuleSet() vm.RuleSet { return ruleSet{} }
231-
func (self *VMEnv) Vm() vm.Vm { return self.evm }
232-
func (self *VMEnv) Db() vm.Database { return self.state }
233-
func (self *VMEnv) SnapshotDatabase() int { return self.state.Snapshot() }
234-
func (self *VMEnv) RevertToSnapshot(snap int) { self.state.RevertToSnapshot(snap) }
235-
func (self *VMEnv) Origin() common.Address { return *self.transactor }
236-
func (self *VMEnv) BlockNumber() *big.Int { return common.Big0 }
237-
func (self *VMEnv) Coinbase() common.Address { return *self.transactor }
238-
func (self *VMEnv) Time() *big.Int { return self.time }
239-
func (self *VMEnv) Difficulty() *big.Int { return common.Big1 }
240-
func (self *VMEnv) BlockHash() []byte { return make([]byte, 32) }
241-
func (self *VMEnv) Value() *big.Int { return self.value }
242-
func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) }
243-
func (self *VMEnv) VmType() vm.Type { return vm.StdVmTy }
244-
func (self *VMEnv) Depth() int { return 0 }
245-
func (self *VMEnv) SetDepth(i int) { self.depth = i }
230+
func (self *VMEnv) ChainConfig() *params.ChainConfig { return params.TestChainConfig }
231+
func (self *VMEnv) Vm() vm.Vm { return self.evm }
232+
func (self *VMEnv) Db() vm.Database { return self.state }
233+
func (self *VMEnv) SnapshotDatabase() int { return self.state.Snapshot() }
234+
func (self *VMEnv) RevertToSnapshot(snap int) { self.state.RevertToSnapshot(snap) }
235+
func (self *VMEnv) Origin() common.Address { return *self.transactor }
236+
func (self *VMEnv) BlockNumber() *big.Int { return common.Big0 }
237+
func (self *VMEnv) Coinbase() common.Address { return *self.transactor }
238+
func (self *VMEnv) Time() *big.Int { return self.time }
239+
func (self *VMEnv) Difficulty() *big.Int { return common.Big1 }
240+
func (self *VMEnv) BlockHash() []byte { return make([]byte, 32) }
241+
func (self *VMEnv) Value() *big.Int { return self.value }
242+
func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) }
243+
func (self *VMEnv) VmType() vm.Type { return vm.StdVmTy }
244+
func (self *VMEnv) Depth() int { return 0 }
245+
func (self *VMEnv) SetDepth(i int) { self.depth = i }
246246
func (self *VMEnv) GetHash(n uint64) common.Hash {
247247
if self.block.Number().Cmp(big.NewInt(int64(n))) == 0 {
248248
return self.block.Hash()

cmd/geth/main.go

Lines changed: 1 addition & 1 deletion
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 = 18 // Patch version component of the current release
53+
versionPatch = 19 // 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

cmd/gethrpctest/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626

2727
"github.com/ethereum/go-ethereum/accounts"
2828
"github.com/ethereum/go-ethereum/common"
29-
"github.com/ethereum/go-ethereum/core"
3029
"github.com/ethereum/go-ethereum/crypto"
3130
"github.com/ethereum/go-ethereum/eth"
3231
"github.com/ethereum/go-ethereum/ethdb"
@@ -130,8 +129,7 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node
130129
ethConf := &eth.Config{
131130
TestGenesisState: db,
132131
TestGenesisBlock: test.Genesis,
133-
ChainConfig: &core.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock},
134-
AccountManager: accman,
132+
ChainConfig: &params.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock},
135133
}
136134
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil {
137135
return nil, err

cmd/utils/flags.go

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,17 +769,17 @@ func SetupNetwork(ctx *cli.Context) {
769769
}
770770

771771
// MustMakeChainConfig reads the chain configuration from the database in ctx.Datadir.
772-
func MustMakeChainConfig(ctx *cli.Context) *core.ChainConfig {
772+
func MustMakeChainConfig(ctx *cli.Context) *params.ChainConfig {
773773
db := MakeChainDatabase(ctx)
774774
defer db.Close()
775775

776776
return MustMakeChainConfigFromDb(ctx, db)
777777
}
778778

779779
// MustMakeChainConfigFromDb reads the chain configuration from the given database.
780-
func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainConfig {
780+
func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainConfig {
781781
// If the chain is already initialized, use any existing chain configs
782-
config := new(core.ChainConfig)
782+
config := new(params.ChainConfig)
783783

784784
genesis := core.GetBlock(db, core.GetCanonicalHash(db, 0))
785785
if genesis != nil {
@@ -793,6 +793,9 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
793793
Fatalf("Could not make chain configuration: %v", err)
794794
}
795795
}
796+
if config.ChainId == nil {
797+
config.ChainId = new(big.Int)
798+
}
796799
// Set any missing fields due to them being unset or system upgrade
797800
if config.HomesteadBlock == nil {
798801
if ctx.GlobalBool(TestNetFlag.Name) {
@@ -809,11 +812,39 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
809812
}
810813
config.DAOForkSupport = true
811814
}
812-
if config.HomesteadGasRepriceBlock == nil {
815+
if config.EIP150Block == nil {
816+
if ctx.GlobalBool(TestNetFlag.Name) {
817+
config.EIP150Block = params.TestNetHomesteadGasRepriceBlock
818+
} else {
819+
config.EIP150Block = params.MainNetHomesteadGasRepriceBlock
820+
}
821+
}
822+
if config.EIP150Hash == (common.Hash{}) {
823+
if ctx.GlobalBool(TestNetFlag.Name) {
824+
config.EIP150Hash = params.TestNetHomesteadGasRepriceHash
825+
} else {
826+
config.EIP150Hash = params.MainNetHomesteadGasRepriceHash
827+
}
828+
}
829+
if config.EIP155Block == nil {
830+
if ctx.GlobalBool(TestNetFlag.Name) {
831+
config.EIP150Block = params.TestNetSpuriousDragon
832+
} else {
833+
config.EIP155Block = params.MainNetSpuriousDragon
834+
}
835+
}
836+
if config.EIP158Block == nil {
837+
if ctx.GlobalBool(TestNetFlag.Name) {
838+
config.EIP158Block = params.TestNetSpuriousDragon
839+
} else {
840+
config.EIP158Block = params.MainNetSpuriousDragon
841+
}
842+
}
843+
if config.ChainId.BitLen() == 0 {
813844
if ctx.GlobalBool(TestNetFlag.Name) {
814-
config.HomesteadGasRepriceBlock = params.TestNetHomesteadGasRepriceBlock
845+
config.ChainId = params.TestNetChainID
815846
} else {
816-
config.HomesteadGasRepriceBlock = params.MainNetHomesteadGasRepriceBlock
847+
config.ChainId = params.MainNetChainID
817848
}
818849
}
819850
// Force override any existing configs if explicitly requested

common/registrar/ethreg/api.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ import (
3232
"github.com/ethereum/go-ethereum/ethdb"
3333
"github.com/ethereum/go-ethereum/logger"
3434
"github.com/ethereum/go-ethereum/logger/glog"
35+
"github.com/ethereum/go-ethereum/params"
3536
)
3637

3738
// registryAPIBackend is a backend for an Ethereum Registry.
3839
type registryAPIBackend struct {
39-
config *core.ChainConfig
40+
config *params.ChainConfig
4041
bc *core.BlockChain
4142
chainDb ethdb.Database
4243
txPool *core.TxPool
@@ -45,12 +46,12 @@ type registryAPIBackend struct {
4546

4647
// PrivateRegistarAPI offers various functions to access the Ethereum registry.
4748
type PrivateRegistarAPI struct {
48-
config *core.ChainConfig
49+
config *params.ChainConfig
4950
be *registryAPIBackend
5051
}
5152

5253
// NewPrivateRegistarAPI creates a new PrivateRegistarAPI instance.
53-
func NewPrivateRegistarAPI(config *core.ChainConfig, bc *core.BlockChain, chainDb ethdb.Database, txPool *core.TxPool, am *accounts.Manager) *PrivateRegistarAPI {
54+
func NewPrivateRegistarAPI(config *params.ChainConfig, bc *core.BlockChain, chainDb ethdb.Database, txPool *core.TxPool, am *accounts.Manager) *PrivateRegistarAPI {
5455
return &PrivateRegistarAPI{
5556
config: config,
5657
be: &registryAPIBackend{

console/console_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import (
3030

3131
"github.com/ethereum/go-ethereum/accounts"
3232
"github.com/ethereum/go-ethereum/common"
33-
"github.com/ethereum/go-ethereum/core"
3433
"github.com/ethereum/go-ethereum/eth"
3534
"github.com/ethereum/go-ethereum/internal/jsre"
3635
"github.com/ethereum/go-ethereum/node"
36+
"github.com/ethereum/go-ethereum/params"
3737
)
3838

3939
const (
@@ -100,10 +100,10 @@ func newTester(t *testing.T, confOverride func(*eth.Config)) *tester {
100100
t.Fatalf("failed to create node: %v", err)
101101
}
102102
ethConf := &eth.Config{
103-
ChainConfig: &core.ChainConfig{HomesteadBlock: new(big.Int)},
103+
ChainConfig: &params.ChainConfig{ChainId: new(big.Int), HomesteadBlock: new(big.Int)},
104104
Etherbase: common.HexToAddress(testAddress),
105-
AccountManager: accman,
106105
PowTest: true,
106+
AccountManager: accman,
107107
}
108108
if confOverride != nil {
109109
confOverride(ethConf)

core/bench_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) {
163163
// Generate a chain of b.N blocks using the supplied block
164164
// generator function.
165165
genesis := WriteGenesisBlockForTesting(db, GenesisAccount{benchRootAddr, benchRootFunds})
166-
chain, _ := GenerateChain(nil, genesis, db, b.N, gen)
166+
chain, _ := GenerateChain(params.TestChainConfig, genesis, db, b.N, gen)
167167

168168
// Time the insertion of the new chain.
169169
// State and blocks are stored in the same DB.
170170
evmux := new(event.TypeMux)
171-
chainman, _ := NewBlockChain(db, &ChainConfig{HomesteadBlock: new(big.Int)}, FakePow{}, evmux)
171+
chainman, _ := NewBlockChain(db, &params.ChainConfig{HomesteadBlock: new(big.Int)}, FakePow{}, evmux)
172172
defer chainman.Stop()
173173
b.ReportAllocs()
174174
b.ResetTimer()

0 commit comments

Comments
 (0)