diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/block_test_util.go | 4 | ||||
-rw-r--r-- | tests/files/BlockchainTests/TestNetwork/bcTheDaoTest.json | 6 | ||||
-rw-r--r-- | tests/files/ansible/test-files/docker-cpp/Dockerfile | 2 | ||||
-rw-r--r-- | tests/files/ansible/test-files/docker-cppjit/Dockerfile | 2 | ||||
-rw-r--r-- | tests/init.go | 6 | ||||
-rw-r--r-- | tests/state_test_util.go | 8 | ||||
-rw-r--r-- | tests/util.go | 4 | ||||
-rw-r--r-- | tests/vm_test_util.go | 9 |
8 files changed, 18 insertions, 23 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go index f04329546..ea63c9996 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -552,9 +552,7 @@ func LoadBlockTests(file string) (map[string]*BlockTest, error) { // Nothing to see here, please move along... func prepInt(base int, s string) string { if base == 16 { - if strings.HasPrefix(s, "0x") { - s = s[2:] - } + s = strings.TrimPrefix(s, "0x") if len(s) == 0 { s = "00" } diff --git a/tests/files/BlockchainTests/TestNetwork/bcTheDaoTest.json b/tests/files/BlockchainTests/TestNetwork/bcTheDaoTest.json index fcbcbbe9f..1dfdfb70a 100644 --- a/tests/files/BlockchainTests/TestNetwork/bcTheDaoTest.json +++ b/tests/files/BlockchainTests/TestNetwork/bcTheDaoTest.json @@ -1,6 +1,6 @@ { "DaoTransactions" : { - "acomment" : "This test checks DAO hardfork transition at block 8. According to specification given list of accounts L from the prestate (except a94f5374fce5edbc8e2a8697c15331677e6ebf0b (caller)) should transfer it's balance at the begining of the block 8 to contract C = bf4ed7b27f1d666546e30d74d50d173d20bca754. Then all blocks from 8 to 17(included) must have extradata set to 0x64616f2d686172642d666f726b otherwise blocks considered incorrect. Additionally all uncles with numbers from 8 to 17(included) in this blocks should corespond to extradata requirenmets.", + "acomment" : "This test checks DAO hardfork transition at block 8. According to specification given list of accounts L from the prestate (except a94f5374fce5edbc8e2a8697c15331677e6ebf0b (caller)) should transfer it's balance at the beginning of the block 8 to contract C = bf4ed7b27f1d666546e30d74d50d173d20bca754. Then all blocks from 8 to 17(included) must have extradata set to 0x64616f2d686172642d666f726b otherwise blocks considered incorrect. Additionally all uncles with numbers from 8 to 17(included) in this blocks should corespond to extradata requirenmets.", "blocks" : [ { "blockHeader" : { @@ -2430,7 +2430,7 @@ } }, "DaoTransactions_EmptyTransactionAndForkBlocksAhead" : { - "acomment" : "This test checks DAO hardfork transition at block 8. According to specification given list of accounts L from the prestate (except a94f5374fce5edbc8e2a8697c15331677e6ebf0b (caller)) should transfer it's balance at the begining of the block 8 to contract C = bf4ed7b27f1d666546e30d74d50d173d20bca754. Then all blocks from 8 to 17(included) must have extradata set to 0x64616f2d686172642d666f726b otherwise blocks considered incorrect. Additionally all uncles with numbers from 8 to 17(included) in this blocks should corespond to extradata requirenmets.", + "acomment" : "This test checks DAO hardfork transition at block 8. According to specification given list of accounts L from the prestate (except a94f5374fce5edbc8e2a8697c15331677e6ebf0b (caller)) should transfer it's balance at the beginning of the block 8 to contract C = bf4ed7b27f1d666546e30d74d50d173d20bca754. Then all blocks from 8 to 17(included) must have extradata set to 0x64616f2d686172642d666f726b otherwise blocks considered incorrect. Additionally all uncles with numbers from 8 to 17(included) in this blocks should corespond to extradata requirenmets.", "blocks" : [ { "blockHeader" : { @@ -4516,7 +4516,7 @@ } }, "DaoTransactions_UncleExtradata" : { - "acomment" : "This test checks DAO hardfork transition at block 8. According to specification given list of accounts L from the prestate (except a94f5374fce5edbc8e2a8697c15331677e6ebf0b (caller)) should transfer it's balance at the begining of the block 8 to contract C = bf4ed7b27f1d666546e30d74d50d173d20bca754. Then all blocks from 8 to 17(included) must have extradata set to 0x64616f2d686172642d666f726b otherwise blocks considered incorrect. Additionally all uncles with numbers from 8 to 17(included) in this blocks should corespond to extradata requirenmets.", + "acomment" : "This test checks DAO hardfork transition at block 8. According to specification given list of accounts L from the prestate (except a94f5374fce5edbc8e2a8697c15331677e6ebf0b (caller)) should transfer it's balance at the beginning of the block 8 to contract C = bf4ed7b27f1d666546e30d74d50d173d20bca754. Then all blocks from 8 to 17(included) must have extradata set to 0x64616f2d686172642d666f726b otherwise blocks considered incorrect. Additionally all uncles with numbers from 8 to 17(included) in this blocks should corespond to extradata requirenmets.", "blocks" : [ { "blockHeader" : { diff --git a/tests/files/ansible/test-files/docker-cpp/Dockerfile b/tests/files/ansible/test-files/docker-cpp/Dockerfile index a3b0e4ca6..11c8bf5e7 100644 --- a/tests/files/ansible/test-files/docker-cpp/Dockerfile +++ b/tests/files/ansible/test-files/docker-cpp/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcu RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons RUN apt-get install -qy libjsoncpp-dev libargtable2-dev -# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) +# NCurses based GUI (not optional though for a successful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) RUN apt-get install -qy libncurses5-dev # Qt-based GUI diff --git a/tests/files/ansible/test-files/docker-cppjit/Dockerfile b/tests/files/ansible/test-files/docker-cppjit/Dockerfile index 2b10727f0..6b3712555 100644 --- a/tests/files/ansible/test-files/docker-cppjit/Dockerfile +++ b/tests/files/ansible/test-files/docker-cppjit/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcu RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons RUN apt-get install -qy libjsoncpp-dev libargtable2-dev -# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) +# NCurses based GUI (not optional though for a successful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) RUN apt-get install -qy libncurses5-dev # Qt-based GUI diff --git a/tests/init.go b/tests/init.go index 361be5f62..7b0924bc3 100644 --- a/tests/init.go +++ b/tests/init.go @@ -87,11 +87,7 @@ func readJsonHttp(uri string, value interface{}) error { } defer resp.Body.Close() - err = readJson(resp.Body, value) - if err != nil { - return err - } - return nil + return readJson(resp.Body, value) } func readJsonFile(fn string, value interface{}) error { diff --git a/tests/state_test_util.go b/tests/state_test_util.go index f47f5f7a1..7841aecfe 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -28,7 +28,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/params" @@ -146,7 +146,7 @@ func runStateTest(chainConfig *params.ChainConfig, test VmTest) error { ret []byte // gas *big.Int // err error - logs vm.Logs + logs []*types.Log ) ret, logs, _, _ = RunState(chainConfig, statedb, env, test.Transaction) @@ -159,7 +159,7 @@ func runStateTest(chainConfig *params.ChainConfig, test VmTest) error { } else { rexp = common.FromHex(test.Out) } - if bytes.Compare(rexp, ret) != 0 { + if !bytes.Equal(rexp, ret) { return fmt.Errorf("return failed. Expected %x, got %x\n", rexp, ret) } @@ -203,7 +203,7 @@ func runStateTest(chainConfig *params.ChainConfig, test VmTest) error { return nil } -func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx map[string]string) ([]byte, vm.Logs, *big.Int, error) { +func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx map[string]string) ([]byte, []*types.Log, *big.Int, error) { environment, msg := NewEVMEnvironment(false, chainConfig, statedb, env, tx) gaspool := new(core.GasPool).AddGas(common.Big(env["currentGasLimit"])) diff --git a/tests/util.go b/tests/util.go index a0a6ab374..134d5b4f8 100644 --- a/tests/util.go +++ b/tests/util.go @@ -47,7 +47,7 @@ func init() { } } -func checkLogs(tlog []Log, logs vm.Logs) error { +func checkLogs(tlog []Log, logs []*types.Log) error { if len(tlog) != len(logs) { return fmt.Errorf("log length mismatch. Expected %d, got %d", len(tlog), len(logs)) @@ -70,7 +70,7 @@ func checkLogs(tlog []Log, logs vm.Logs) error { } } } - genBloom := common.LeftPadBytes(types.LogsBloom(vm.Logs{logs[i]}).Bytes(), 256) + genBloom := common.LeftPadBytes(types.LogsBloom([]*types.Log{logs[i]}).Bytes(), 256) if !bytes.Equal(genBloom, common.Hex2Bytes(log.BloomF)) { return fmt.Errorf("bloom mismatch") diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go index dc9f1d62c..25e55886f 100644 --- a/tests/vm_test_util.go +++ b/tests/vm_test_util.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/logger/glog" @@ -164,20 +165,20 @@ func runVmTest(test VmTest) error { ret []byte gas *big.Int err error - logs vm.Logs + logs []*types.Log ) ret, logs, gas, err = RunVm(statedb, env, test.Exec) // Compare expected and actual return rexp := common.FromHex(test.Out) - if bytes.Compare(rexp, ret) != 0 { + if !bytes.Equal(rexp, ret) { return fmt.Errorf("return failed. Expected %x, got %x\n", rexp, ret) } // Check gas usage if len(test.Gas) == 0 && err == nil { - return fmt.Errorf("gas unspecified, indicating an error. VM returned (incorrectly) successfull") + return fmt.Errorf("gas unspecified, indicating an error. VM returned (incorrectly) successful") } else { gexp := common.Big(test.Gas) if gexp.Cmp(gas) != 0 { @@ -211,7 +212,7 @@ func runVmTest(test VmTest) error { return nil } -func RunVm(statedb *state.StateDB, env, exec map[string]string) ([]byte, vm.Logs, *big.Int, error) { +func RunVm(statedb *state.StateDB, env, exec map[string]string) ([]byte, []*types.Log, *big.Int, error) { chainConfig := ¶ms.ChainConfig{ HomesteadBlock: params.MainNetHomesteadBlock, DAOForkBlock: params.MainNetDAOForkBlock, |