From ae2213effc1e8b073cb4dc730735ba01d5651b8b Mon Sep 17 00:00:00 2001 From: subtly Date: Wed, 17 Jun 2015 21:28:27 -0400 Subject: [PATCH 01/35] Add test for frame writer. Cleanup abstraction in preparation for reader. Initial reader code. From 6343bea67dd7d2dc5936c682e46ce86c950b2952 Mon Sep 17 00:00:00 2001 From: subtly Date: Fri, 19 Jun 2015 23:42:16 -0400 Subject: [PATCH 02/35] rlpx frame reader fixes. rename writer::drain to mux. From e87c4b919f127787d3134a9dc28ac4decd3d977a Mon Sep 17 00:00:00 2001 From: subtly Date: Sat, 20 Jun 2015 03:24:11 -0400 Subject: [PATCH 03/35] rename drain to mux From 533984d522ccaaba8b50e8f212d52830d0552e4d Mon Sep 17 00:00:00 2001 From: subtly Date: Sat, 20 Jun 2015 07:35:04 -0400 Subject: [PATCH 04/35] Windows compile complaint. From 310a151d110f10088cc86cf3f7adc7c5f692e067 Mon Sep 17 00:00:00 2001 From: subtly Date: Sat, 20 Jun 2015 08:34:53 -0400 Subject: [PATCH 05/35] Initial reader test. Something broken with encframes vector of bytes. From 43c6eca73e3a1aa546ea7ffedc049e84170ffefe Mon Sep 17 00:00:00 2001 From: subtly Date: Sat, 27 Jun 2015 07:00:43 -0400 Subject: [PATCH 06/35] Update/fix test for builds. From 235f17c67427ed23c98f74c5863f7e1722815cce Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 5 Jul 2015 00:44:44 -0700 Subject: [PATCH 07/35] mux/demux working test From a53e4fecde345022d76b4ab95c84afd9a8e9dc41 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 5 Jul 2015 18:56:06 -0700 Subject: [PATCH 08/35] Cleanup. Interface for enqueuing packets. Fix: Include packet type in total size. From adbd774abea85481b34fc7139a8b6ae2c46291a0 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 5 Jul 2015 18:56:59 -0700 Subject: [PATCH 09/35] windows compile fix From 6cb15576fc4ecf4af1c88fe8ea4ed0d94e307d37 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 6 Jul 2015 16:52:43 -0700 Subject: [PATCH 10/35] Fixup and document frame writer. Add test for coalesced packets. From de07e957fba1c335d688854f7ef8ff8e823316fc Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 6 Jul 2015 19:26:10 -0700 Subject: [PATCH 11/35] Cleanup. More fixes. More tests. From 8b98571a845f02b4c9533d152e283b53759d6c46 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 7 Jul 2015 17:00:56 +0200 Subject: [PATCH 12/35] levelDB for whisper From 2173ad25a92156be73c8ef91e0fff285eb4d5c4d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 8 Jul 2015 01:13:56 +0200 Subject: [PATCH 13/35] Flexible string literals, convertible to bytesX, bytes and string. --- libsolidity/SolidityEndToEndTest.cpp | 45 +++++++++++++------ libsolidity/SolidityNameAndTypeResolution.cpp | 15 ++++++- libsolidity/solidityExecutionFramework.h | 6 +++ 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 3ddb05528..ad2175461 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -564,20 +564,6 @@ BOOST_AUTO_TEST_CASE(strings) BOOST_CHECK(callContractFunction("pipeThrough(bytes2,bool)", string("\0\x02", 2), true) == encodeArgs(string("\0\x2", 2), true)); } -BOOST_AUTO_TEST_CASE(empty_string_on_stack) -{ - char const* sourceCode = R"( - contract test { - function run() external returns(bytes2 ret) { - var y = ""; - ret = y; - } - } - )"; - compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("run()") == encodeArgs(byte(0x00))); -} - BOOST_AUTO_TEST_CASE(inc_dec_operators) { char const* sourceCode = R"( @@ -5001,6 +4987,37 @@ BOOST_AUTO_TEST_CASE(struct_named_constructor) BOOST_CHECK(callContractFunction("s()") == encodeArgs(u256(1), true)); } +BOOST_AUTO_TEST_CASE(literal_strings) +{ + char const* sourceCode = R"( + contract Test { + string public long; + string public medium; + string public short; + string public empty; + function f() returns (string) { + long = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678900123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; + medium = "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; + short = "123"; + empty = ""; + return "Hello, World!"; + } + } + )"; + compileAndRun(sourceCode, 0, "Test"); + string longStr = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678900123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; + string medium = "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; + string shortStr = "123"; + string hello = "Hello, World!"; + + BOOST_CHECK(callContractFunction("f()") == encodeDyn(hello)); + BOOST_CHECK(callContractFunction("long()") == encodeDyn(longStr)); + BOOST_CHECK(callContractFunction("medium()") == encodeDyn(medium)); + BOOST_CHECK(callContractFunction("short()") == encodeDyn(shortStr)); + BOOST_CHECK(callContractFunction("empty()") == encodeDyn(string())); +} + + BOOST_AUTO_TEST_SUITE_END() } diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp index 50fcdbbe5..1e40ee4f6 100644 --- a/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/libsolidity/SolidityNameAndTypeResolution.cpp @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(large_string_literal) char const* text = "contract test {\n" " function f() { var x = \"123456789012345678901234567890123\"; }" "}\n"; - BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } BOOST_AUTO_TEST_CASE(balance) @@ -2097,6 +2097,19 @@ BOOST_AUTO_TEST_CASE(struct_named_constructor) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); } +BOOST_AUTO_TEST_CASE(literal_strings) +{ + char const* text = R"( + contract Foo { + function f() { + string memory long = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; + string memory short = "123"; + } + } + )"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/libsolidity/solidityExecutionFramework.h b/libsolidity/solidityExecutionFramework.h index 200940a43..03a201c72 100644 --- a/libsolidity/solidityExecutionFramework.h +++ b/libsolidity/solidityExecutionFramework.h @@ -145,6 +145,12 @@ public: { return bytes(); } + //@todo might be extended in the future + template + static bytes encodeDyn(Arg const& _arg) + { + return encodeArgs(u256(0x20), u256(_arg.size()), _arg); + } private: template From ab9c6c0108275349eaff4095b1b3803d61727af7 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Thu, 9 Jul 2015 19:45:13 +0200 Subject: [PATCH 14/35] naming conventions changed From 8d6aa3bd509c54fad2e0f96588d468c9d4c93a7b Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 9 Jul 2015 20:45:13 +0200 Subject: [PATCH 15/35] update to latest version of wallet code From 1980063b8ef690c889036cd4b6a9dd803ce41363 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 10 Jul 2015 01:30:03 +0200 Subject: [PATCH 16/35] add multiOwnedRemoveOwner test From 270717c2693398a2ec77de9b27dca12a1bf97a8a Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 10 Jul 2015 01:39:27 +0200 Subject: [PATCH 17/35] set daily limit From 1c0207f7454142df9f665c606de901f2d7a4f073 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 10 Jul 2015 01:59:21 +0200 Subject: [PATCH 18/35] add new daily limit test From eac8c5675a418f3202f95818f9e092eb897d6857 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 10 Jul 2015 04:37:36 +0200 Subject: [PATCH 19/35] update bcWalletTest From df114bd18b1d98b5239c2d74a0ae37381d77cbef Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 10 Jul 2015 14:06:24 +0200 Subject: [PATCH 20/35] update wallet test From 4547637c3f1086bb58aba50a8ba5661e2e8dd616 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 10 Jul 2015 18:58:20 +0200 Subject: [PATCH 21/35] new tests added From 0ca5e4aca1c9452366af5c637f80a50ea13281b9 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Fri, 3 Jul 2015 18:02:18 +0400 Subject: [PATCH 22/35] RLPTests: refactoring --- TestHelper.h | 1 + 1 file changed, 1 insertion(+) diff --git a/TestHelper.h b/TestHelper.h index 1c1dfb5f0..4ac59e917 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -188,6 +188,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin); void doStateTests(json_spirit::mValue& v, bool _fillin); void doVMTests(json_spirit::mValue& v, bool _fillin); void doBlockchainTests(json_spirit::mValue& _v, bool _fillin); +void doRlpTests(json_spirit::mValue& v, bool _fillin); template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) From 2617a0926c106a9f34afa645fecb99be16bc43bb Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Fri, 3 Jul 2015 18:28:07 +0400 Subject: [PATCH 23/35] RLPTests: fill rlp tests From 41144f0825af258daf122c6436f102de4777d3f1 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 6 Jul 2015 16:33:33 +0300 Subject: [PATCH 24/35] RLPTests Refactoring From edd62f4c722a9a6a59617f52924724fad47121ab Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Tue, 7 Jul 2015 16:27:26 +0400 Subject: [PATCH 25/35] newtests: style From 5f8256be3b5a649fdb80fa6752f7df60feb0c269 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 10 Jul 2015 14:27:59 +0300 Subject: [PATCH 26/35] RLP test refactoring: style From 51b1cd5346800415e0215b9029f2ce78acad1efd Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 13 Jul 2015 10:55:00 -0700 Subject: [PATCH 27/35] Remove packet copy constructor. Simplify bool use. From 358ea0bfb3ccfd3ea0878cefd1aa4af2ef395339 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 14 Jul 2015 13:12:37 +0200 Subject: [PATCH 28/35] rpc api test filler with fork simulation From 1dd7a1a554f33eb6bd0d83097bb1a00fef43b2dd Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 14 Jul 2015 14:10:20 +0200 Subject: [PATCH 29/35] mark blocks in RPC_API_TestFiller as reverted From e906bb906f912524e70a49aec580ae5e0d99be32 Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 14 Jul 2015 14:30:30 +0200 Subject: [PATCH 30/35] find instead of find_firt_of --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 9a1b16935..2ed1ed4d0 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -479,7 +479,7 @@ bytes importCode(json_spirit::mObject& _o) { bytes code; if (_o["code"].type() == json_spirit::str_type) - if (_o["code"].get_str().find_first_of("0x") != 0) + if (_o["code"].get_str().find("0x") != 0) code = compileLLL(_o["code"].get_str(), false); else code = fromHex(_o["code"].get_str().substr(2)); From 29d79ef2656fe84eea00478b7f31c7ca231d0ac1 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 14 Jul 2015 15:22:15 +0200 Subject: [PATCH 31/35] test fixed From 48e09c449cf614ce87f03074aaa748f5addebf25 Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 14 Jul 2015 15:23:02 +0200 Subject: [PATCH 32/35] KeyManager::kill test From dd3afa2877b06a2f196c2f4c85453b0e2d8ec745 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2015 16:37:11 +0200 Subject: [PATCH 33/35] Fix comparison between bytes types. Fixes #2087 --- libsolidity/SolidityEndToEndTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index ad2175461..9f806347e 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -585,6 +585,22 @@ BOOST_AUTO_TEST_CASE(inc_dec_operators) BOOST_CHECK(callContractFunction("f()") == encodeArgs(0x53866)); } +BOOST_AUTO_TEST_CASE(bytes_comparison) +{ + char const* sourceCode = R"( + contract test { + function f() returns (bool) { + bytes2 a = "a"; + bytes2 x = "aa"; + bytes2 b = "b"; + return a < x && x < b; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(true)); +} + BOOST_AUTO_TEST_CASE(state_smoke_test) { char const* sourceCode = "contract test {\n" From cd264b72ab9aae337ed9e0887cd0449dfa82f2b3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2015 17:43:13 +0200 Subject: [PATCH 34/35] Check whether a literal is a valid literal before using it. Fixes #2078 --- libsolidity/SolidityNameAndTypeResolution.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp index 1e40ee4f6..0f5e4800f 100644 --- a/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2110,6 +2110,30 @@ BOOST_AUTO_TEST_CASE(literal_strings) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } +BOOST_AUTO_TEST_CASE(invalid_integer_literal_fraction) +{ + char const* text = R"( + contract Foo { + function f() { + var x = 1.20; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + +BOOST_AUTO_TEST_CASE(invalid_integer_literal_exp) +{ + char const* text = R"( + contract Foo { + function f() { + var x = 1e2; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + BOOST_AUTO_TEST_SUITE_END() } From f66eabed76282a3078d8c1ded1a3e2573ae760b6 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 17:50:56 +0200 Subject: [PATCH 35/35] Disable p2p tests. --- TestHelper.cpp | 2 ++ TestHelper.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 2ed1ed4d0..f49ed1e09 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -767,6 +767,8 @@ Options::Options() wallet = true; else if (arg == "--nonetwork") nonetwork = true; + else if (arg == "--network") + nonetwork = false; else if (arg == "--nodag") nodag = true; else if (arg == "--all") diff --git a/TestHelper.h b/TestHelper.h index 4ac59e917..420278838 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -224,7 +224,7 @@ public: bool inputLimits = false; bool bigData = false; bool wallet = false; - bool nonetwork = false; + bool nonetwork = true; bool nodag = true; /// @}