diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-03-02 06:32:43 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-04-01 07:01:10 +0800 |
commit | f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c (patch) | |
tree | 02e31a0e31040980e30e3a835ff9eba73e419439 /cmd/evm/main.go | |
parent | 10d3466c934bd425a8c941270749a652a588527d (diff) | |
download | go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.gz 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 'cmd/evm/main.go')
-rw-r--r-- | cmd/evm/main.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 2cc70d81b..7d9b3a6c3 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -33,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" ) var ( @@ -106,9 +105,6 @@ func init() { } func run(ctx *cli.Context) { - vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name) - vm.EnableJit = !ctx.GlobalBool(DisableJitFlag.Name) - glog.SetToStderr(true) glog.SetV(ctx.GlobalInt(VerbosityFlag.Name)) @@ -118,8 +114,10 @@ func run(ctx *cli.Context) { receiver := statedb.CreateAccount(common.StringToAddress("receiver")) receiver.SetCode(common.Hex2Bytes(ctx.GlobalString(CodeFlag.Name))) - vmenv := NewEnv(statedb, common.StringToAddress("evmuser"), common.Big(ctx.GlobalString(ValueFlag.Name)), &vm.Config{ - Debug: ctx.GlobalBool(DebugFlag.Name), + vmenv := NewEnv(statedb, common.StringToAddress("evmuser"), common.Big(ctx.GlobalString(ValueFlag.Name)), vm.Config{ + Debug: ctx.GlobalBool(DebugFlag.Name), + ForceJit: ctx.GlobalBool(ForceJitFlag.Name), + EnableJit: !ctx.GlobalBool(DisableJitFlag.Name), }) tstart := time.Now() @@ -180,8 +178,7 @@ type VMEnv struct { evm *vm.EVM } -func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int, cfg *vm.Config) *VMEnv { - params.HomesteadBlock = new(big.Int) +func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int, cfg vm.Config) *VMEnv { env := &VMEnv{ state: state, transactor: &transactor, @@ -194,6 +191,12 @@ func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int, cfg return env } +// ruleSet implements vm.RuleSet and will always default to the homestead rule set. +type ruleSet struct{} + +func (ruleSet) IsHomestead(*big.Int) bool { return true } + +func (self *VMEnv) RuleSet() vm.RuleSet { return ruleSet{} } func (self *VMEnv) Vm() vm.Vm { return self.evm } func (self *VMEnv) Db() vm.Database { return self.state } func (self *VMEnv) MakeSnapshot() vm.Database { return self.state.Copy() } |