diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-02-04 06:46:27 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-03-24 06:02:42 +0800 |
commit | 14013372aeca2d7f1d8c3a87b7df7c27868314be (patch) | |
tree | d4951dbe1d7f1b25b4bbde786b14b5b0b6107bcc /cmd/evm/main.go | |
parent | 342ae7ce7dfd7a0eab2dd06bfa65199825279f05 (diff) | |
download | dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.gz dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.bz2 dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.lz dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.xz dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.zst dexon-14013372aeca2d7f1d8c3a87b7df7c27868314be.zip |
core: Added EVM configuration options
The EVM is now initialised with an additional configured object that
allows you to turn on debugging options.
Diffstat (limited to 'cmd/evm/main.go')
-rw-r--r-- | cmd/evm/main.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 0ba6820e0..2cc70d81b 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -106,7 +106,6 @@ func init() { } func run(ctx *cli.Context) { - vm.Debug = ctx.GlobalBool(DebugFlag.Name) vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name) vm.EnableJit = !ctx.GlobalBool(DisableJitFlag.Name) @@ -119,7 +118,9 @@ 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))) + vmenv := NewEnv(statedb, common.StringToAddress("evmuser"), common.Big(ctx.GlobalString(ValueFlag.Name)), &vm.Config{ + Debug: ctx.GlobalBool(DebugFlag.Name), + }) tstart := time.Now() ret, e := vmenv.Call( @@ -176,10 +177,10 @@ type VMEnv struct { time *big.Int logs []vm.StructLog - evm *vm.Vm + evm *vm.EVM } -func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int) *VMEnv { +func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int, cfg *vm.Config) *VMEnv { params.HomesteadBlock = new(big.Int) env := &VMEnv{ state: state, @@ -187,11 +188,13 @@ func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int) *VM value: value, time: big.NewInt(time.Now().Unix()), } - env.evm = vm.EVM(env) + cfg.Logger.Collector = env + + env.evm = vm.New(env, cfg) return env } -func (self *VMEnv) Vm() *vm.Vm { return self.evm } +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() } func (self *VMEnv) SetSnapshot(db vm.Database) { self.state.Set(db.(*state.StateDB)) } |