From 1b1fa049fa483b3996d3582ad247638045657282 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 4 Nov 2014 18:18:57 +0100 Subject: Fixed VM and added static analysis for EVM jumps --- tests/vm/gh_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index da9de6db5..1978de412 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -88,11 +88,14 @@ func TestVMArithmetic(t *testing.T) { RunVmTest(fn, t) } +/* +deleted? func TestVMSystemOperation(t *testing.T) { - //helper.Logger.SetLogLevel(5) + helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmSystemOperationsTest.json" RunVmTest(fn, t) } +*/ func TestBitwiseLogicOperation(t *testing.T) { const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" @@ -110,6 +113,7 @@ func TestEnvironmentalInfo(t *testing.T) { } func TestFlowOperation(t *testing.T) { + // helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" RunVmTest(fn, t) } -- cgit v1.2.3 From 6c9e503eb8d41d331d6a74e69539a06590072190 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 11 Nov 2014 22:51:26 +0100 Subject: Removed all implicit logging. Fixed gas issues and jump errors --- tests/vm/gh_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 1978de412..7d98983e7 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -113,7 +113,7 @@ func TestEnvironmentalInfo(t *testing.T) { } func TestFlowOperation(t *testing.T) { - // helper.Logger.SetLogLevel(5) + helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" RunVmTest(fn, t) } -- cgit v1.2.3 From dd9e99a418be6cde1a99a04659493edddeb6d455 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Fri, 14 Nov 2014 20:58:09 -0600 Subject: try to get full coverage report on travis --- tests/vm/gh_test.go | 265 ++++++++++++++++++++++++++-------------------------- 1 file changed, 133 insertions(+), 132 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 7d98983e7..e25ccb550 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -1,134 +1,135 @@ package vm -import ( - "bytes" - "testing" - - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/tests/helper" -) - -type Account struct { - Balance string - Code string - Nonce string - Storage map[string]string -} - -func StateObjectFromAccount(addr string, account Account) *state.StateObject { - obj := state.NewStateObject(ethutil.Hex2Bytes(addr)) - obj.SetBalance(ethutil.Big(account.Balance)) - - if ethutil.IsHex(account.Code) { - account.Code = account.Code[2:] - } - obj.Code = ethutil.Hex2Bytes(account.Code) - obj.Nonce = ethutil.Big(account.Nonce).Uint64() - - return obj -} - -type VmTest struct { - Callcreates interface{} - Env map[string]string - Exec map[string]string - Gas string - Out string - Post map[string]Account - Pre map[string]Account -} - -func RunVmTest(p string, t *testing.T) { - tests := make(map[string]VmTest) - helper.CreateFileTests(t, p, &tests) - - for name, test := range tests { - state := state.New(helper.NewTrie()) - for addr, account := range test.Pre { - obj := StateObjectFromAccount(addr, account) - state.SetStateObject(obj) - } - - ret, gas, err := helper.RunVm(state, test.Env, test.Exec) - // When an error is returned it doesn't always mean the tests fails. - // Have to come up with some conditional failing mechanism. - if err != nil { - helper.Log.Infoln(err) - } - - rexp := helper.FromHex(test.Out) - if bytes.Compare(rexp, ret) != 0 { - t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) - } - - gexp := ethutil.Big(test.Gas) - if gexp.Cmp(gas) != 0 { - t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) - } - - for addr, account := range test.Post { - obj := state.GetStateObject(helper.FromHex(addr)) - for addr, value := range account.Storage { - v := obj.GetState(helper.FromHex(addr)).Bytes() - vexp := helper.FromHex(value) - - if bytes.Compare(v, vexp) != 0 { - t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v)) - } - } - } - } -} - -// I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. -func TestVMArithmetic(t *testing.T) { - //helper.Logger.SetLogLevel(5) - const fn = "../files/vmtests/vmArithmeticTest.json" - RunVmTest(fn, t) -} - -/* -deleted? -func TestVMSystemOperation(t *testing.T) { - helper.Logger.SetLogLevel(5) - const fn = "../files/vmtests/vmSystemOperationsTest.json" - RunVmTest(fn, t) -} -*/ - -func TestBitwiseLogicOperation(t *testing.T) { - const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" - RunVmTest(fn, t) -} - -func TestBlockInfo(t *testing.T) { - const fn = "../files/vmtests/vmBlockInfoTest.json" - RunVmTest(fn, t) -} - -func TestEnvironmentalInfo(t *testing.T) { - const fn = "../files/vmtests/vmEnvironmentalInfoTest.json" - RunVmTest(fn, t) -} - -func TestFlowOperation(t *testing.T) { - helper.Logger.SetLogLevel(5) - const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" - RunVmTest(fn, t) -} - -func TestPushDupSwap(t *testing.T) { - const fn = "../files/vmtests/vmPushDupSwapTest.json" - RunVmTest(fn, t) -} - -func TestVMSha3(t *testing.T) { - const fn = "../files/vmtests/vmSha3Test.json" - RunVmTest(fn, t) -} - -func TestVm(t *testing.T) { - const fn = "../files/vmtests/vmtests.json" - RunVmTest(fn, t) -} +// import ( +// "bytes" +// "testing" + +// "github.com/ethereum/go-ethereum/ethutil" +// "github.com/ethereum/go-ethereum/state" +// "github.com/ethereum/go-ethereum/tests/helper" +// ) + +// type Account struct { +// Balance string +// Code string +// Nonce string +// Storage map[string]string +// } + +// func StateObjectFromAccount(addr string, account Account) *state.StateObject { +// obj := state.NewStateObject(ethutil.Hex2Bytes(addr)) +// obj.SetBalance(ethutil.Big(account.Balance)) + +// if ethutil.IsHex(account.Code) { +// account.Code = account.Code[2:] +// } +// obj.Code = ethutil.Hex2Bytes(account.Code) +// obj.Nonce = ethutil.Big(account.Nonce).Uint64() + +// return obj +// } + +// type VmTest struct { +// Callcreates interface{} +// Env map[string]string +// Exec map[string]string +// Gas string +// Out string +// Post map[string]Account +// Pre map[string]Account +// } + +// func RunVmTest(p string, t *testing.T) { +// tests := make(map[string]VmTest) +// helper.CreateFileTests(t, p, &tests) + +// for name, test := range tests { +// state := state.New(helper.NewTrie()) +// for addr, account := range test.Pre { +// obj := StateObjectFromAccount(addr, account) +// state.SetStateObject(obj) +// } + +// ret, gas, err := helper.RunVm(state, test.Env, test.Exec) +// // When an error is returned it doesn't always mean the tests fails. +// // Have to come up with some conditional failing mechanism. +// if err != nil { +// t.Errorf("%s", err) +// helper.Log.Infoln(err) +// } + +// rexp := helper.FromHex(test.Out) +// if bytes.Compare(rexp, ret) != 0 { +// t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) +// } + +// gexp := ethutil.Big(test.Gas) +// if gexp.Cmp(gas) != 0 { +// t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) +// } + +// for addr, account := range test.Post { +// obj := state.GetStateObject(helper.FromHex(addr)) +// for addr, value := range account.Storage { +// v := obj.GetState(helper.FromHex(addr)).Bytes() +// vexp := helper.FromHex(value) + +// if bytes.Compare(v, vexp) != 0 { +// t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v)) +// } +// } +// } +// } +// } + +// // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. +// func TestVMArithmetic(t *testing.T) { +// //helper.Logger.SetLogLevel(5) +// const fn = "../files/vmtests/vmArithmeticTest.json" +// RunVmTest(fn, t) +// } + +// /* +// deleted? +// func TestVMSystemOperation(t *testing.T) { +// helper.Logger.SetLogLevel(5) +// const fn = "../files/vmtests/vmSystemOperationsTest.json" +// RunVmTest(fn, t) +// } +// */ + +// func TestBitwiseLogicOperation(t *testing.T) { +// const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" +// RunVmTest(fn, t) +// } + +// func TestBlockInfo(t *testing.T) { +// const fn = "../files/vmtests/vmBlockInfoTest.json" +// RunVmTest(fn, t) +// } + +// func TestEnvironmentalInfo(t *testing.T) { +// const fn = "../files/vmtests/vmEnvironmentalInfoTest.json" +// RunVmTest(fn, t) +// } + +// func TestFlowOperation(t *testing.T) { +// helper.Logger.SetLogLevel(5) +// const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" +// RunVmTest(fn, t) +// } + +// func TestPushDupSwap(t *testing.T) { +// const fn = "../files/vmtests/vmPushDupSwapTest.json" +// RunVmTest(fn, t) +// } + +// func TestVMSha3(t *testing.T) { +// const fn = "../files/vmtests/vmSha3Test.json" +// RunVmTest(fn, t) +// } + +// func TestVm(t *testing.T) { +// const fn = "../files/vmtests/vmtests.json" +// RunVmTest(fn, t) +// } -- cgit v1.2.3 From a22056db5988bfa2b1354e0092eabb734c30701c Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 1 Dec 2014 20:49:56 +0100 Subject: Make an attempt to pay for the gas prior to expanding the mem. --- tests/vm/gh_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 7d98983e7..bd107249b 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -2,6 +2,7 @@ package vm import ( "bytes" + "fmt" "testing" "github.com/ethereum/go-ethereum/ethutil" @@ -44,6 +45,7 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { + fmt.Println(name) state := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) @@ -113,7 +115,7 @@ func TestEnvironmentalInfo(t *testing.T) { } func TestFlowOperation(t *testing.T) { - helper.Logger.SetLogLevel(5) + //helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" RunVmTest(fn, t) } @@ -124,6 +126,7 @@ func TestPushDupSwap(t *testing.T) { } func TestVMSha3(t *testing.T) { + helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmSha3Test.json" RunVmTest(fn, t) } -- cgit v1.2.3 From a052357872217d5e99e7ee1a7a4b524b53addcdd Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 1 Dec 2014 22:05:38 +0100 Subject: Fixed EXP gas --- tests/vm/gh_test.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index bd107249b..eb641b034 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -2,7 +2,6 @@ package vm import ( "bytes" - "fmt" "testing" "github.com/ethereum/go-ethereum/ethutil" @@ -45,7 +44,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - fmt.Println(name) state := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) @@ -85,20 +83,10 @@ func RunVmTest(p string, t *testing.T) { // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. func TestVMArithmetic(t *testing.T) { - //helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmArithmeticTest.json" RunVmTest(fn, t) } -/* -deleted? -func TestVMSystemOperation(t *testing.T) { - helper.Logger.SetLogLevel(5) - const fn = "../files/vmtests/vmSystemOperationsTest.json" - RunVmTest(fn, t) -} -*/ - func TestBitwiseLogicOperation(t *testing.T) { const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" RunVmTest(fn, t) @@ -126,7 +114,7 @@ func TestPushDupSwap(t *testing.T) { } func TestVMSha3(t *testing.T) { - helper.Logger.SetLogLevel(5) + //helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmSha3Test.json" RunVmTest(fn, t) } -- cgit v1.2.3 From 2df8ad6307d741d0a6d2f746d53f97c7b27ad796 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 2 Dec 2014 00:03:53 +0100 Subject: Added state tests --- tests/vm/gh_test.go | 69 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index eb641b034..7e6160860 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -2,6 +2,8 @@ package vm import ( "bytes" + "math/big" + "strconv" "testing" "github.com/ethereum/go-ethereum/ethutil" @@ -29,10 +31,21 @@ func StateObjectFromAccount(addr string, account Account) *state.StateObject { return obj } +type Env struct { + CurrentCoinbase string + CurrentDifficulty string + CurrentGasLimit string + CurrentNumber string + CurrentTimestamp interface{} + PreviousHash string +} + type VmTest struct { Callcreates interface{} - Env map[string]string + //Env map[string]string + Env Env Exec map[string]string + Transaction map[string]string Gas string Out string Post map[string]Account @@ -50,7 +63,31 @@ func RunVmTest(p string, t *testing.T) { state.SetStateObject(obj) } - ret, gas, err := helper.RunVm(state, test.Env, test.Exec) + // XXX Yeah, yeah... + env := make(map[string]string) + env["currentCoinbase"] = test.Env.CurrentCoinbase + env["currentDifficulty"] = test.Env.CurrentDifficulty + env["currentGasLimit"] = test.Env.CurrentGasLimit + env["currentNumber"] = test.Env.CurrentNumber + env["previousHash"] = test.Env.PreviousHash + if n, ok := test.Env.CurrentTimestamp.(float64); ok { + env["currentTimestamp"] = strconv.Itoa(int(n)) + } else { + env["currentTimestamp"] = test.Env.CurrentTimestamp.(string) + } + + var ( + ret []byte + gas *big.Int + err error + ) + + if len(test.Exec) > 0 { + ret, gas, err = helper.RunVm(state, env, test.Exec) + } else { + ret, gas, err = helper.RunState(state, env, test.Transaction) + } + // When an error is returned it doesn't always mean the tests fails. // Have to come up with some conditional failing mechanism. if err != nil { @@ -62,9 +99,11 @@ func RunVmTest(p string, t *testing.T) { t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) } - gexp := ethutil.Big(test.Gas) - if gexp.Cmp(gas) != 0 { - t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + if len(test.Gas) > 0 { + gexp := ethutil.Big(test.Gas) + if gexp.Cmp(gas) != 0 { + t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + } } for addr, account := range test.Post { @@ -123,3 +162,23 @@ func TestVm(t *testing.T) { const fn = "../files/vmtests/vmtests.json" RunVmTest(fn, t) } + +func TestStateSystemOperations(t *testing.T) { + const fn = "../files/StateTests/stSystemOperationsTest.json" + RunVmTest(fn, t) +} + +func TestStatePreCompiledContracts(t *testing.T) { + const fn = "../files/StateTests/stPreCompiledContracts.json" + RunVmTest(fn, t) +} + +func TestStateRecursiveCreate(t *testing.T) { + const fn = "../files/StateTests/stRecursiveCreate.json" + RunVmTest(fn, t) +} + +func TestStateSpecialTest(t *testing.T) { + const fn = "../files/StateTests/stSpecialTest.json" + RunVmTest(fn, t) +} -- cgit v1.2.3 From 99481a245adc2c4814ab6b38d94d63114f7bbb15 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 2 Dec 2014 11:37:33 +0100 Subject: Check for known block err and ignore --- tests/vm/gh_test.go | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 7e6160860..5391e0500 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -142,7 +142,6 @@ func TestEnvironmentalInfo(t *testing.T) { } func TestFlowOperation(t *testing.T) { - //helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" RunVmTest(fn, t) } @@ -153,7 +152,6 @@ func TestPushDupSwap(t *testing.T) { } func TestVMSha3(t *testing.T) { - //helper.Logger.SetLogLevel(5) const fn = "../files/vmtests/vmSha3Test.json" RunVmTest(fn, t) } -- cgit v1.2.3 From 3d9a4e7084c33cb28a2265c0dd232a0ea3871c92 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 3 Dec 2014 12:21:12 +0100 Subject: Fixed mem error in vm. Fixed logs tests --- tests/vm/gh_test.go | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 5391e0500..523ff46ac 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -6,6 +6,7 @@ import ( "strconv" "testing" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" @@ -18,6 +19,12 @@ type Account struct { Storage map[string]string } +type Log struct { + Address string + Data string + Topics []string +} + func StateObjectFromAccount(addr string, account Account) *state.StateObject { obj := state.NewStateObject(ethutil.Hex2Bytes(addr)) obj.SetBalance(ethutil.Big(account.Balance)) @@ -46,6 +53,7 @@ type VmTest struct { Env Env Exec map[string]string Transaction map[string]string + Logs map[string]Log Gas string Out string Post map[string]Account @@ -57,10 +65,10 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - state := state.New(helper.NewTrie()) + statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) - state.SetStateObject(obj) + statedb.SetStateObject(obj) } // XXX Yeah, yeah... @@ -77,15 +85,16 @@ func RunVmTest(p string, t *testing.T) { } var ( - ret []byte - gas *big.Int - err error + ret []byte + gas *big.Int + err error + logs state.Logs ) if len(test.Exec) > 0 { - ret, gas, err = helper.RunVm(state, env, test.Exec) + ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec) } else { - ret, gas, err = helper.RunState(state, env, test.Transaction) + ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) } // When an error is returned it doesn't always mean the tests fails. @@ -107,7 +116,7 @@ func RunVmTest(p string, t *testing.T) { } for addr, account := range test.Post { - obj := state.GetStateObject(helper.FromHex(addr)) + obj := statedb.GetStateObject(helper.FromHex(addr)) for addr, value := range account.Storage { v := obj.GetState(helper.FromHex(addr)).Bytes() vexp := helper.FromHex(value) @@ -117,6 +126,16 @@ func RunVmTest(p string, t *testing.T) { } } } + + if len(test.Logs) > 0 { + genBloom := ethutil.LeftPadBytes(chain.LogsBloom(logs).Bytes(), 64) + // Logs within the test itself aren't correct, missing empty fields (32 0s) + for bloom /*logs*/, _ := range test.Logs { + if !bytes.Equal(genBloom, ethutil.Hex2Bytes(bloom)) { + t.Errorf("bloom mismatch") + } + } + } } } @@ -161,6 +180,11 @@ func TestVm(t *testing.T) { RunVmTest(fn, t) } +func TestVmLog(t *testing.T) { + const fn = "../files/vmtests/vmLogTest.json" + RunVmTest(fn, t) +} + func TestStateSystemOperations(t *testing.T) { const fn = "../files/StateTests/stSystemOperationsTest.json" RunVmTest(fn, t) -- cgit v1.2.3 From 99853ac3ce57807deb4822dd324186e1d2ee0821 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 3 Dec 2014 17:06:54 +0100 Subject: Moved execution from vm to chain. This moves call and create to the specified environments. Vms are no longer re-used. Vm uses environment's Call(Code) and Create in order to execute new contracts or transfer value between accounts. State transition now uses the same mechanism described above. --- tests/vm/gh_test.go | 140 +--------------------------------------------------- 1 file changed, 2 insertions(+), 138 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 4c18d29e6..5c4df1975 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -1,147 +1,12 @@ package vm -<<<<<<< HEAD -// import ( -// "bytes" -// "testing" - -// "github.com/ethereum/go-ethereum/ethutil" -// "github.com/ethereum/go-ethereum/state" -// "github.com/ethereum/go-ethereum/tests/helper" -// ) - -// type Account struct { -// Balance string -// Code string -// Nonce string -// Storage map[string]string -// } - -// func StateObjectFromAccount(addr string, account Account) *state.StateObject { -// obj := state.NewStateObject(ethutil.Hex2Bytes(addr)) -// obj.SetBalance(ethutil.Big(account.Balance)) - -// if ethutil.IsHex(account.Code) { -// account.Code = account.Code[2:] -// } -// obj.Code = ethutil.Hex2Bytes(account.Code) -// obj.Nonce = ethutil.Big(account.Nonce).Uint64() - -// return obj -// } - -// type VmTest struct { -// Callcreates interface{} -// Env map[string]string -// Exec map[string]string -// Gas string -// Out string -// Post map[string]Account -// Pre map[string]Account -// } - -// func RunVmTest(p string, t *testing.T) { -// tests := make(map[string]VmTest) -// helper.CreateFileTests(t, p, &tests) - -// for name, test := range tests { -// state := state.New(helper.NewTrie()) -// for addr, account := range test.Pre { -// obj := StateObjectFromAccount(addr, account) -// state.SetStateObject(obj) -// } - -// ret, gas, err := helper.RunVm(state, test.Env, test.Exec) -// // When an error is returned it doesn't always mean the tests fails. -// // Have to come up with some conditional failing mechanism. -// if err != nil { -// t.Errorf("%s", err) -// helper.Log.Infoln(err) -// } - -// rexp := helper.FromHex(test.Out) -// if bytes.Compare(rexp, ret) != 0 { -// t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) -// } - -// gexp := ethutil.Big(test.Gas) -// if gexp.Cmp(gas) != 0 { -// t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) -// } - -// for addr, account := range test.Post { -// obj := state.GetStateObject(helper.FromHex(addr)) -// for addr, value := range account.Storage { -// v := obj.GetState(helper.FromHex(addr)).Bytes() -// vexp := helper.FromHex(value) - -// if bytes.Compare(v, vexp) != 0 { -// t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v)) -// } -// } -// } -// } -// } - -// // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. -// func TestVMArithmetic(t *testing.T) { -// //helper.Logger.SetLogLevel(5) -// const fn = "../files/vmtests/vmArithmeticTest.json" -// RunVmTest(fn, t) -// } - -// /* -// deleted? -// func TestVMSystemOperation(t *testing.T) { -// helper.Logger.SetLogLevel(5) -// const fn = "../files/vmtests/vmSystemOperationsTest.json" -// RunVmTest(fn, t) -// } -// */ - -// func TestBitwiseLogicOperation(t *testing.T) { -// const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" -// RunVmTest(fn, t) -// } - -// func TestBlockInfo(t *testing.T) { -// const fn = "../files/vmtests/vmBlockInfoTest.json" -// RunVmTest(fn, t) -// } - -// func TestEnvironmentalInfo(t *testing.T) { -// const fn = "../files/vmtests/vmEnvironmentalInfoTest.json" -// RunVmTest(fn, t) -// } - -// func TestFlowOperation(t *testing.T) { -// helper.Logger.SetLogLevel(5) -// const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" -// RunVmTest(fn, t) -// } - -// func TestPushDupSwap(t *testing.T) { -// const fn = "../files/vmtests/vmPushDupSwapTest.json" -// RunVmTest(fn, t) -// } - -// func TestVMSha3(t *testing.T) { -// const fn = "../files/vmtests/vmSha3Test.json" -// RunVmTest(fn, t) -// } - -// func TestVm(t *testing.T) { -// const fn = "../files/vmtests/vmtests.json" -// RunVmTest(fn, t) -// } -======= import ( "bytes" "math/big" "strconv" "testing" - "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" @@ -263,7 +128,7 @@ func RunVmTest(p string, t *testing.T) { } if len(test.Logs) > 0 { - genBloom := ethutil.LeftPadBytes(chain.LogsBloom(logs).Bytes(), 64) + genBloom := ethutil.LeftPadBytes(types.LogsBloom(logs).Bytes(), 64) // Logs within the test itself aren't correct, missing empty fields (32 0s) for bloom /*logs*/, _ := range test.Logs { if !bytes.Equal(genBloom, ethutil.Hex2Bytes(bloom)) { @@ -339,4 +204,3 @@ func TestStateSpecialTest(t *testing.T) { const fn = "../files/StateTests/stSpecialTest.json" RunVmTest(fn, t) } ->>>>>>> develop -- cgit v1.2.3 From 83663ed4b01480c628ce2c849e4e881ac04b5120 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 10:53:49 +0100 Subject: Renames for chain, updated VM, moved methods * Renamed a couple more chain => core * Updated VM `pc` to be uint64 rather than big int * XEth interface cleanup --- tests/vm/gh_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 5c4df1975..3da37cd3a 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/ethereum/go-ethereum/chain/types" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" -- cgit v1.2.3 From 186948da22feeca138ffb976fbf96033045ad350 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 10 Dec 2014 11:27:10 +0100 Subject: changed to unsigned integers --- tests/vm/gh_test.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 3da37cd3a..da5a41251 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -20,9 +20,21 @@ type Account struct { } type Log struct { - Address string - Data string - Topics []string + AddressF string `json:"address"` + DataF string `json:"data"` + TopicsF []string `json:"topics"` + BloomF string `json:"bloom"` +} + +func (self Log) Address() []byte { return ethutil.Hex2Bytes(self.AddressF) } +func (self Log) Data() []byte { return ethutil.Hex2Bytes(self.DataF) } +func (self Log) RlpData() interface{} { return nil } +func (self Log) Topics() [][]byte { + t := make([][]byte, len(self.TopicsF)) + for i, topic := range self.TopicsF { + t[i] = ethutil.Hex2Bytes(topic) + } + return t } func StateObjectFromAccount(addr string, account Account) *state.StateObject { @@ -53,7 +65,7 @@ type VmTest struct { Env Env Exec map[string]string Transaction map[string]string - Logs map[string]Log + Logs []Log Gas string Out string Post map[string]Account @@ -128,10 +140,10 @@ func RunVmTest(p string, t *testing.T) { } if len(test.Logs) > 0 { - genBloom := ethutil.LeftPadBytes(types.LogsBloom(logs).Bytes(), 64) // Logs within the test itself aren't correct, missing empty fields (32 0s) - for bloom /*logs*/, _ := range test.Logs { - if !bytes.Equal(genBloom, ethutil.Hex2Bytes(bloom)) { + for i, log := range test.Logs { + genBloom := ethutil.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 64) + if !bytes.Equal(genBloom, ethutil.Hex2Bytes(log.BloomF)) { t.Errorf("bloom mismatch") } } -- cgit v1.2.3 From 198cc69357a0f25ae486a041786e1239c6f5ab0f Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 21:58:26 +0100 Subject: Gas corrections and vm fixes --- tests/vm/gh_test.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index da5a41251..42dcc0ae1 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" ) @@ -76,11 +77,18 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) + helper.Logger.SetLogLevel(5) for name, test := range tests { + if name != "ABAcalls1" { + continue + } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) statedb.SetStateObject(obj) + for a, v := range account.Storage { + obj.SetState(helper.FromHex(a), ethutil.NewValue(helper.FromHex(v))) + } } // XXX Yeah, yeah... @@ -129,6 +137,16 @@ func RunVmTest(p string, t *testing.T) { for addr, account := range test.Post { obj := statedb.GetStateObject(helper.FromHex(addr)) + if obj == nil { + continue + } + + if len(test.Exec) == 0 { + if obj.Balance().Cmp(ethutil.Big(account.Balance)) != 0 { + t.Errorf("%s's : (%x) balance failed. Expected %v, got %v => %v\n", name, obj.Address()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(ethutil.Big(account.Balance), obj.Balance())) + } + } + for addr, value := range account.Storage { v := obj.GetState(helper.FromHex(addr)).Bytes() vexp := helper.FromHex(value) @@ -149,6 +167,7 @@ func RunVmTest(p string, t *testing.T) { } } } + logger.Flush() } // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. @@ -212,7 +231,12 @@ func TestStateRecursiveCreate(t *testing.T) { RunVmTest(fn, t) } -func TestStateSpecialTest(t *testing.T) { +func TestStateSpecial(t *testing.T) { const fn = "../files/StateTests/stSpecialTest.json" RunVmTest(fn, t) } + +func TestStateRefund(t *testing.T) { + const fn = "../files/StateTests/stRefundTest.json" + RunVmTest(fn, t) +} -- cgit v1.2.3 From 332568379454dce6b1fb3c3e023a53d0c52cded0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 22:38:51 +0100 Subject: Fixed refund model --- tests/vm/gh_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 42dcc0ae1..ca63b90d3 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -77,11 +77,11 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) - helper.Logger.SetLogLevel(5) + //helper.Logger.SetLogLevel(5) for name, test := range tests { - if name != "ABAcalls1" { - continue - } + // if name != "refund50_1" { + // continue + // } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) -- cgit v1.2.3 From 4789084998553befa5db1bfe5a14881aa567cb9e Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 23:32:58 +0100 Subject: updated tests --- tests/vm/gh_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index ca63b90d3..10d63897d 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -77,11 +77,11 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) - //helper.Logger.SetLogLevel(5) + helper.Logger.SetLogLevel(5) for name, test := range tests { - // if name != "refund50_1" { - // continue - // } + if name != "CallRecursiveBomb0" { + continue + } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) -- cgit v1.2.3 From a7f4ade7114ee962110cb7c140e7ce7bd3f6664f Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 23:59:53 +0100 Subject: Fixed tests --- tests/vm/gh_test.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 10d63897d..1efda7fe0 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -77,11 +77,7 @@ func RunVmTest(p string, t *testing.T) { tests := make(map[string]VmTest) helper.CreateFileTests(t, p, &tests) - helper.Logger.SetLogLevel(5) for name, test := range tests { - if name != "CallRecursiveBomb0" { - continue - } statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) -- cgit v1.2.3 From 16460b0048b738b0474bc1556d0df469f64bcf26 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 30 Dec 2014 17:16:28 +0100 Subject: Fixed gas check for vm test --- tests/vm/gh_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 1efda7fe0..e06b0ed82 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -107,7 +107,9 @@ func RunVmTest(p string, t *testing.T) { logs state.Logs ) - if len(test.Exec) > 0 { + isVmTest := len(test.Exec) > 0 + + if isVmTest { ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec) } else { ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) @@ -124,10 +126,14 @@ func RunVmTest(p string, t *testing.T) { t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) } - if len(test.Gas) > 0 { - gexp := ethutil.Big(test.Gas) - if gexp.Cmp(gas) != 0 { - t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + if isVmTest { + if len(test.Gas) == 0 && err == nil { + t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull") + } else { + gexp := ethutil.Big(test.Gas) + if gexp.Cmp(gas) != 0 { + t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) + } } } -- cgit v1.2.3 From a4dc12f12c7a06f5e28d5b1e760249875ef7a8c5 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 31 Dec 2014 11:21:39 +0100 Subject: Additional comments and added name to error output --- tests/vm/gh_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index e06b0ed82..f1e4d1acc 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -108,17 +108,16 @@ func RunVmTest(p string, t *testing.T) { ) isVmTest := len(test.Exec) > 0 - if isVmTest { ret, logs, gas, err = helper.RunVm(statedb, env, test.Exec) } else { ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) } - // When an error is returned it doesn't always mean the tests fails. - // Have to come up with some conditional failing mechanism. + // Log the error if there is one. Error does not mean failing test. + // A test fails if err != nil and post params are specified in the test. if err != nil { - helper.Log.Infoln(err) + helper.Log.Infof("%s's: %v\n", name, err) } rexp := helper.FromHex(test.Out) @@ -160,7 +159,6 @@ func RunVmTest(p string, t *testing.T) { } if len(test.Logs) > 0 { - // Logs within the test itself aren't correct, missing empty fields (32 0s) for i, log := range test.Logs { genBloom := ethutil.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 64) if !bytes.Equal(genBloom, ethutil.Hex2Bytes(log.BloomF)) { -- cgit v1.2.3 From 55e55826ee3b763be8805dcdef0468a179619ba1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 2 Jan 2015 17:35:55 +0100 Subject: Changed JUMP(I) behaviour. * All jumps must land on a JUMPDEST instruction byte. * The byte may not be part of a PUSH* --- tests/vm/gh_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index f1e4d1acc..698b0aefc 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -78,6 +78,12 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { + /* + helper.Logger.SetLogLevel(5) + if name != "jump0_jumpdest2" { + continue + } + */ statedb := state.New(helper.NewTrie()) for addr, account := range test.Pre { obj := StateObjectFromAccount(addr, account) @@ -127,7 +133,7 @@ func RunVmTest(p string, t *testing.T) { if isVmTest { if len(test.Gas) == 0 && err == nil { - t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull") + t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull", name) } else { gexp := ethutil.Big(test.Gas) if gexp.Cmp(gas) != 0 { -- cgit v1.2.3 From fed3e6a808921fb8274b50043c5c39a24a1bbccf Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 7 Jan 2015 13:17:48 +0100 Subject: Refactored ethutil.Config.Db out --- tests/vm/gh_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 698b0aefc..2aece215e 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" @@ -38,8 +39,8 @@ func (self Log) Topics() [][]byte { return t } -func StateObjectFromAccount(addr string, account Account) *state.StateObject { - obj := state.NewStateObject(ethutil.Hex2Bytes(addr)) +func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *state.StateObject { + obj := state.NewStateObject(ethutil.Hex2Bytes(addr), db) obj.SetBalance(ethutil.Big(account.Balance)) if ethutil.IsHex(account.Code) { @@ -84,9 +85,10 @@ func RunVmTest(p string, t *testing.T) { continue } */ - statedb := state.New(helper.NewTrie()) + db, _ := ethdb.NewMemDatabase() + statedb := state.New(nil, db) for addr, account := range test.Pre { - obj := StateObjectFromAccount(addr, account) + obj := StateObjectFromAccount(db, addr, account) statedb.SetStateObject(obj) for a, v := range account.Storage { obj.SetState(helper.FromHex(a), ethutil.NewValue(helper.FromHex(v))) -- cgit v1.2.3 From 491c23a728e4f5cdedfa040aded6a6b136f6bee0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 9 Jan 2015 22:42:36 +0100 Subject: Moved the TD method from block processor. --- tests/vm/gh_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 2aece215e..47b588268 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -81,7 +81,7 @@ func RunVmTest(p string, t *testing.T) { for name, test := range tests { /* helper.Logger.SetLogLevel(5) - if name != "jump0_jumpdest2" { + if name != "createNameRegistratorZeroMem" { continue } */ -- cgit v1.2.3 From 750d70c2024784227c8ac920d651c337c2de207e Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 00:25:45 +0100 Subject: updated tests --- tests/vm/gh_test.go | 6 ------ 1 file changed, 6 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 47b588268..699225e90 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,12 +79,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - /* - helper.Logger.SetLogLevel(5) - if name != "createNameRegistratorZeroMem" { - continue - } - */ db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { -- cgit v1.2.3 From 4704a0a288af89795e251db98eb253de117ff031 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 10:30:52 +0100 Subject: remove pre compiled for tests --- tests/vm/gh_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 699225e90..7b41411de 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,6 +79,7 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { + //helper.Log.Infoln("Running", name) db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { @@ -116,12 +117,6 @@ func RunVmTest(p string, t *testing.T) { ret, logs, gas, err = helper.RunState(statedb, env, test.Transaction) } - // Log the error if there is one. Error does not mean failing test. - // A test fails if err != nil and post params are specified in the test. - if err != nil { - helper.Log.Infof("%s's: %v\n", name, err) - } - rexp := helper.FromHex(test.Out) if bytes.Compare(rexp, ret) != 0 { t.Errorf("%s's return failed. Expected %x, got %x\n", name, rexp, ret) @@ -129,10 +124,14 @@ func RunVmTest(p string, t *testing.T) { if isVmTest { if len(test.Gas) == 0 && err == nil { + // Log VM err + helper.Log.Infof("%s's: %v\n", name, err) t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull", name) } else { gexp := ethutil.Big(test.Gas) if gexp.Cmp(gas) != 0 { + // Log VM err + helper.Log.Infof("%s's: %v\n", name, err) t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) } } -- cgit v1.2.3 From 82beaabf6a8b5a146a38e1d6a31a78157c79a0cf Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 14:57:51 +0100 Subject: Fixed consensus issue --- tests/vm/gh_test.go | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 7b41411de..e1fdcd658 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,7 +79,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - //helper.Log.Infoln("Running", name) db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { -- cgit v1.2.3 From d5f38f5690caeb30794e62d4a1b2683a6107cfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 22 Jan 2015 18:00:15 +0100 Subject: JitVM: the EVM JIT bridge --- tests/vm/gh_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/vm') diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index e1fdcd658..41ebba957 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -172,47 +172,47 @@ func RunVmTest(p string, t *testing.T) { // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. func TestVMArithmetic(t *testing.T) { - const fn = "../files/vmtests/vmArithmeticTest.json" + const fn = "../files/VMTests/vmArithmeticTest.json" RunVmTest(fn, t) } func TestBitwiseLogicOperation(t *testing.T) { - const fn = "../files/vmtests/vmBitwiseLogicOperationTest.json" + const fn = "../files/VMTests/vmBitwiseLogicOperationTest.json" RunVmTest(fn, t) } func TestBlockInfo(t *testing.T) { - const fn = "../files/vmtests/vmBlockInfoTest.json" + const fn = "../files/VMTests/vmBlockInfoTest.json" RunVmTest(fn, t) } func TestEnvironmentalInfo(t *testing.T) { - const fn = "../files/vmtests/vmEnvironmentalInfoTest.json" + const fn = "../files/VMTests/vmEnvironmentalInfoTest.json" RunVmTest(fn, t) } func TestFlowOperation(t *testing.T) { - const fn = "../files/vmtests/vmIOandFlowOperationsTest.json" + const fn = "../files/VMTests/vmIOandFlowOperationsTest.json" RunVmTest(fn, t) } func TestPushDupSwap(t *testing.T) { - const fn = "../files/vmtests/vmPushDupSwapTest.json" + const fn = "../files/VMTests/vmPushDupSwapTest.json" RunVmTest(fn, t) } func TestVMSha3(t *testing.T) { - const fn = "../files/vmtests/vmSha3Test.json" + const fn = "../files/VMTests/vmSha3Test.json" RunVmTest(fn, t) } func TestVm(t *testing.T) { - const fn = "../files/vmtests/vmtests.json" + const fn = "../files/VMTests/vmtests.json" RunVmTest(fn, t) } func TestVmLog(t *testing.T) { - const fn = "../files/vmtests/vmLogTest.json" + const fn = "../files/VMTests/vmLogTest.json" RunVmTest(fn, t) } -- cgit v1.2.3