forked from cerc-io/plugeth
sort tests for evm
This commit is contained in:
parent
f298ffdbb8
commit
bff5999efa
1
cmd/evm/code.txt
Normal file
1
cmd/evm/code.txt
Normal file
@ -0,0 +1 @@
|
||||
60006102ff5360003560001a60008114156103395760013560405260216040516020025990590160009052606052604051602002816060513760405160200281019050506002604051121561005957604051602002606051f35b604051602002599059016000905260a052600060c052604051602002599059016000905260e0526000610100526001610120525b604051610120511215610109576060515161012051602002606051015112156100d8576101205160200260605101516101005160200260e051015260016101005101610100526100f9565b61012051602002606051015160c05160200260a0510152600160c0510160c0525b600161012051016101205261008d565b60216020599059016000905260c051808252806020028301925050602082015990590160009052600081538151600182015260218101825160200260a0518260005b8381101561016657808301518186015260208101905061014b565b50505050825160200281019050604059905901600090526102405281610240515283602061024051015261024051905090509050905060c05160200280599059016000905281816020850151855160003060195a03f1508090509050905060a05260216020599059016000905261010051808252806020028301925050602082015990590160009052600081538151600182015260218101825160200260e0518260005b8381101561022557808301518186015260208101905061020a565b50505050825160200281019050604059905901600090526102c052816102c051528360206102c05101526102c05190509050905090506101005160200280599059016000905281816020850151855160003060195a03f1508090509050905060e05260405160200259905901600090526102e0526000610120525b610100516101205112156102d7576101205160200260e0510151610120516020026102e051015260016101205101610120526102a0565b60605151610100516020026102e05101526000610120525b60c05161012051121561032d576101205160200260a05101516101205160016101005101016020026102e051015260016101205101610120526102ef565b6040516020026102e051f35b50
|
1
cmd/evm/input.txt
Normal file
1
cmd/evm/input.txt
Normal file
File diff suppressed because one or more lines are too long
@ -45,7 +45,7 @@ import (
|
||||
var (
|
||||
code = flag.String("code", "", "evm code")
|
||||
loglevel = flag.Int("log", 4, "log level")
|
||||
gas = flag.String("gas", "1000000", "gas amount")
|
||||
gas = flag.String("gas", "1000000000", "gas amount")
|
||||
price = flag.String("price", "0", "gas price")
|
||||
value = flag.String("value", "0", "tx value")
|
||||
dump = flag.Bool("dump", false, "dump state after run")
|
||||
@ -68,7 +68,8 @@ func main() {
|
||||
statedb := state.New(trie.New(db, ""))
|
||||
sender := statedb.NewStateObject([]byte("sender"))
|
||||
receiver := statedb.NewStateObject([]byte("receiver"))
|
||||
receiver.SetCode([]byte(*code))
|
||||
//receiver.SetCode([]byte(*code))
|
||||
receiver.SetCode(ethutil.Hex2Bytes(*code))
|
||||
|
||||
vmenv := NewEnv(statedb, []byte("evmuser"), ethutil.Big(*value))
|
||||
|
||||
@ -100,7 +101,7 @@ num gc: %d
|
||||
}
|
||||
|
||||
type VMEnv struct {
|
||||
state *state.State
|
||||
state *state.StateDB
|
||||
block *types.Block
|
||||
|
||||
transactor []byte
|
||||
@ -111,7 +112,7 @@ type VMEnv struct {
|
||||
time int64
|
||||
}
|
||||
|
||||
func NewEnv(state *state.State, transactor []byte, value *big.Int) *VMEnv {
|
||||
func NewEnv(state *state.StateDB, transactor []byte, value *big.Int) *VMEnv {
|
||||
return &VMEnv{
|
||||
state: state,
|
||||
transactor: transactor,
|
||||
@ -120,7 +121,7 @@ func NewEnv(state *state.State, transactor []byte, value *big.Int) *VMEnv {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *VMEnv) State() *state.State { return self.state }
|
||||
func (self *VMEnv) State() *state.StateDB { return self.state }
|
||||
func (self *VMEnv) Origin() []byte { return self.transactor }
|
||||
func (self *VMEnv) BlockNumber() *big.Int { return ethutil.Big0 }
|
||||
func (self *VMEnv) PrevHash() []byte { return make([]byte, 32) }
|
||||
@ -130,7 +131,7 @@ func (self *VMEnv) Difficulty() *big.Int { return ethutil.Big1 }
|
||||
func (self *VMEnv) BlockHash() []byte { return make([]byte, 32) }
|
||||
func (self *VMEnv) Value() *big.Int { return self.value }
|
||||
func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) }
|
||||
func (self *VMEnv) Depth() int { return self.depth }
|
||||
func (self *VMEnv) Depth() int { return 0 }
|
||||
func (self *VMEnv) SetDepth(i int) { self.depth = i }
|
||||
func (self *VMEnv) AddLog(log *state.Log) {
|
||||
self.state.AddLog(log)
|
||||
|
@ -152,7 +152,6 @@ done:
|
||||
st := NewStateTransition(cb, tx, state, block)
|
||||
err = st.TransitionState()
|
||||
if err != nil {
|
||||
statelogger.Infoln(err)
|
||||
switch {
|
||||
case IsNonceErr(err):
|
||||
err = nil // ignore error
|
||||
|
@ -35,7 +35,7 @@ func NewDebugVm(env Environment) *DebugVm {
|
||||
lt = LogTyDiff
|
||||
}
|
||||
|
||||
return &DebugVm{env: env, logTy: lt, Recoverable: true}
|
||||
return &DebugVm{env: env, logTy: lt, Recoverable: false}
|
||||
}
|
||||
|
||||
func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *big.Int, callData []byte) (ret []byte, err error) {
|
||||
@ -631,7 +631,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
|
||||
|
||||
mem.Set(mOff, l, code)
|
||||
|
||||
self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, code[cOff:cOff+l])
|
||||
self.Printf(" => [%v, %v, %v] %x", mOff, cOff, l, callData[cOff:cOff+l])
|
||||
case CODESIZE, EXTCODESIZE:
|
||||
var code []byte
|
||||
if op == EXTCODESIZE {
|
||||
|
Loading…
Reference in New Issue
Block a user