@@ -45,7 +45,7 @@ import (
4545var (
4646 code = flag .String ("code" , "" , "evm code" )
4747 loglevel = flag .Int ("log" , 4 , "log level" )
48- gas = flag .String ("gas" , "1000000 " , "gas amount" )
48+ gas = flag .String ("gas" , "1000000000 " , "gas amount" )
4949 price = flag .String ("price" , "0" , "gas price" )
5050 value = flag .String ("value" , "0" , "tx value" )
5151 dump = flag .Bool ("dump" , false , "dump state after run" )
@@ -68,7 +68,8 @@ func main() {
6868 statedb := state .New (trie .New (db , "" ))
6969 sender := statedb .NewStateObject ([]byte ("sender" ))
7070 receiver := statedb .NewStateObject ([]byte ("receiver" ))
71- receiver .SetCode ([]byte (* code ))
71+ //receiver.SetCode([]byte(*code))
72+ receiver .SetCode (ethutil .Hex2Bytes (* code ))
7273
7374 vmenv := NewEnv (statedb , []byte ("evmuser" ), ethutil .Big (* value ))
7475
@@ -100,7 +101,7 @@ num gc: %d
100101}
101102
102103type VMEnv struct {
103- state * state.State
104+ state * state.StateDB
104105 block * types.Block
105106
106107 transactor []byte
@@ -111,7 +112,7 @@ type VMEnv struct {
111112 time int64
112113}
113114
114- func NewEnv (state * state.State , transactor []byte , value * big.Int ) * VMEnv {
115+ func NewEnv (state * state.StateDB , transactor []byte , value * big.Int ) * VMEnv {
115116 return & VMEnv {
116117 state : state ,
117118 transactor : transactor ,
@@ -120,7 +121,7 @@ func NewEnv(state *state.State, transactor []byte, value *big.Int) *VMEnv {
120121 }
121122}
122123
123- func (self * VMEnv ) State () * state.State { return self .state }
124+ func (self * VMEnv ) State () * state.StateDB { return self .state }
124125func (self * VMEnv ) Origin () []byte { return self .transactor }
125126func (self * VMEnv ) BlockNumber () * big.Int { return ethutil .Big0 }
126127func (self * VMEnv ) PrevHash () []byte { return make ([]byte , 32 ) }
@@ -130,7 +131,7 @@ func (self *VMEnv) Difficulty() *big.Int { return ethutil.Big1 }
130131func (self * VMEnv ) BlockHash () []byte { return make ([]byte , 32 ) }
131132func (self * VMEnv ) Value () * big.Int { return self .value }
132133func (self * VMEnv ) GasLimit () * big.Int { return big .NewInt (1000000000 ) }
133- func (self * VMEnv ) Depth () int { return self . depth }
134+ func (self * VMEnv ) Depth () int { return 0 }
134135func (self * VMEnv ) SetDepth (i int ) { self .depth = i }
135136func (self * VMEnv ) AddLog (log * state.Log ) {
136137 self .state .AddLog (log )
0 commit comments