aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-03-02 06:32:43 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-04-01 07:01:10 +0800
commitf0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c (patch)
tree02e31a0e31040980e30e3a835ff9eba73e419439 /accounts
parent10d3466c934bd425a8c941270749a652a588527d (diff)
downloadgo-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar
go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.gz
go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.bz2
go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.lz
go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.xz
go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.zst
go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.zip
core: added basic chain configuration
Added chain configuration options and write out during genesis database insertion. If no "config" was found, nothing is written to the database. Configurations are written on a per genesis base. This means that any chain (which is identified by it's genesis hash) can have their own chain settings.
Diffstat (limited to 'accounts')
-rw-r--r--accounts/abi/bind/backends/simulated.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go
index 18e8481c5..43d490988 100644
--- a/accounts/abi/bind/backends/simulated.go
+++ b/accounts/abi/bind/backends/simulated.go
@@ -24,10 +24,15 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/params"
)
+// Default chain configuration which sets homestead phase at block 0 (i.e. no frontier)
+var chainConfig = &core.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock}
+
// This nil assignment ensures compile time that SimulatedBackend implements bind.ContractBackend.
var _ bind.ContractBackend = (*SimulatedBackend)(nil)
@@ -46,7 +51,7 @@ type SimulatedBackend struct {
func NewSimulatedBackend(accounts ...core.GenesisAccount) *SimulatedBackend {
database, _ := ethdb.NewMemDatabase()
core.WriteGenesisBlockForTesting(database, accounts...)
- blockchain, _ := core.NewBlockChain(database, new(core.FakePow), new(event.TypeMux))
+ blockchain, _ := core.NewBlockChain(database, chainConfig, new(core.FakePow), new(event.TypeMux))
backend := &SimulatedBackend{
database: database,
@@ -102,7 +107,7 @@ func (b *SimulatedBackend) ContractCall(contract common.Address, data []byte, pe
data: data,
}
// Execute the call and return
- vmenv := core.NewEnv(statedb, b.blockchain, msg, block.Header(), nil)
+ vmenv := core.NewEnv(statedb, chainConfig, b.blockchain, msg, block.Header(), vm.Config{})
gaspool := new(core.GasPool).AddGas(common.MaxBig)
out, _, err := core.ApplyMessage(vmenv, msg, gaspool)
@@ -145,7 +150,7 @@ func (b *SimulatedBackend) EstimateGasLimit(sender common.Address, contract *com
data: data,
}
// Execute the call and return
- vmenv := core.NewEnv(statedb, b.blockchain, msg, block.Header(), nil)
+ vmenv := core.NewEnv(statedb, chainConfig, b.blockchain, msg, block.Header(), vm.Config{})
gaspool := new(core.GasPool).AddGas(common.MaxBig)
_, gas, err := core.ApplyMessage(vmenv, msg, gaspool)