aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-23 07:01:26 +0800
committerobscuren <geffobscura@gmail.com>2014-10-23 07:01:26 +0800
commit29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1 (patch)
treecd850fc126869e382ceb56f546aa579b37f7b63d /tests
parent51ecab6967a15b82f9285cd0ffd3352607dc8612 (diff)
downloaddexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.tar
dexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.tar.gz
dexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.tar.bz2
dexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.tar.lz
dexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.tar.xz
dexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.tar.zst
dexon-29b8a0bc5ffa7a674a06a211e1c8bdd1b6ed07b1.zip
Updated the VM & VM tests
* Stack Error shouldn't revert to previous state * Updated VM Test tool * Added Transfer method to VM Env
Diffstat (limited to 'tests')
-rw-r--r--tests/ethtest/main.go2
-rw-r--r--tests/helper/vm.go5
-rw-r--r--tests/vm/gh_test.go1
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/ethtest/main.go b/tests/ethtest/main.go
index 3e85891e4..e19892557 100644
--- a/tests/ethtest/main.go
+++ b/tests/ethtest/main.go
@@ -22,7 +22,7 @@ type Account struct {
func StateObjectFromAccount(addr string, account Account) *ethstate.StateObject {
obj := ethstate.NewStateObject(ethutil.Hex2Bytes(addr))
- obj.Balance = ethutil.Big(account.Balance)
+ obj.SetBalance(ethutil.Big(account.Balance))
if ethutil.IsHex(account.Code) {
account.Code = account.Code[2:]
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index 06c3d4eca..f70ce48a6 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -51,17 +51,16 @@ func (self *Env) BlockHash() []byte { return nil }
func (self *Env) State() *ethstate.State { return self.state }
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
- return nil
+ return vm.Transfer(from, to, amount)
}
func RunVm(state *ethstate.State, env, exec map[string]string) ([]byte, *big.Int, error) {
address := FromHex(exec["address"])
caller := state.GetOrNewStateObject(FromHex(exec["caller"]))
- caller.SetBalance(ethutil.Big(exec["value"]))
evm := vm.New(NewEnvFromMap(state, env, exec), vm.DebugVmTy)
-
execution := vm.NewExecution(evm, address, FromHex(exec["data"]), ethutil.Big(exec["gas"]), ethutil.Big(exec["gasPrice"]), ethutil.Big(exec["value"]))
+ execution.SkipTransfer = true
ret, err := execution.Exec(address, caller)
return ret, execution.Gas, err
diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go
index 64f279d8d..a86831d9e 100644
--- a/tests/vm/gh_test.go
+++ b/tests/vm/gh_test.go
@@ -89,6 +89,7 @@ func TestVMArithmetic(t *testing.T) {
}
func TestVMSystemOperation(t *testing.T) {
+ //helper.Logger.SetLogLevel(5)
const fn = "../files/vmtests/vmSystemOperationsTest.json"
RunVmTest(fn, t)
}