From d8973155e308c6ae2aeae843e1a3af91afc0cf7d Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 5 Jun 2015 11:28:19 +0200 Subject: [PATCH 1/9] warnings fixed From 41db3a6162cdb0d9450de6df604d93b65847c212 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Thu, 11 Jun 2015 18:53:29 +0300 Subject: [PATCH 2/9] expectOut fill section to vmTests --- TestHelper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TestHelper.cpp b/TestHelper.cpp index 873ea21e2..733ccb6d0 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -352,6 +352,8 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) BOOST_CHECK_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); else BOOST_WARN_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); + + m_TestObject.erase(m_TestObject.find("expectOut")); } // export logs From 4250e6411627fbb23304d39478f68023144d5a5a Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 12 Jun 2015 12:59:52 +0900 Subject: [PATCH 3/9] Allow unlocking of wallets over RPC. From 39e0029d18471a1c9d327f22dbe56fb13f71b668 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 12 Jun 2015 17:33:21 +0900 Subject: [PATCH 4/9] First JSONRPC admin method. From 91a72076164793ced6887d8c65eb73a265689999 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 12 Jun 2015 11:06:05 +0200 Subject: [PATCH 5/9] Optimize RETURN x 0 to STOP. --- libsolidity/SolidityOptimizer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp index 397ee6316..85a88c030 100644 --- a/libsolidity/SolidityOptimizer.cpp +++ b/libsolidity/SolidityOptimizer.cpp @@ -944,6 +944,14 @@ BOOST_AUTO_TEST_CASE(cse_access_previous_sequence) // 0, SLOAD, 1, ADD, SSTORE, 0 SLOAD } +BOOST_AUTO_TEST_CASE(cse_optimise_return) +{ + checkCSE( + AssemblyItems{u256(0), u256(7), Instruction::RETURN}, + AssemblyItems{Instruction::STOP} + ); +} + BOOST_AUTO_TEST_CASE(control_flow_graph_remove_unused) { // remove parts of the code that are unused From 0233cb44fd45c4cd240b3deab01d1e7298c515c3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 13 Jun 2015 17:46:16 +0800 Subject: [PATCH 6/9] Admin methods. From 839430ab8d4ed571bda35480e3c60664818f217b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Jun 2015 19:14:45 +0800 Subject: [PATCH 7/9] Refactor toJson out into separate file. Implement basic admin_eth_* interfaces. From 650ed1a3fc9902bba9e389d34dc7d8b9312016df Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2015 14:26:08 +0200 Subject: [PATCH 8/9] Distinction between storage pointer and storage ref and type checking for conversion between storage and memory. --- libsolidity/SolidityNameAndTypeResolution.cpp | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp index 3948a4a23..fced12848 100644 --- a/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1889,6 +1889,93 @@ BOOST_AUTO_TEST_CASE(storage_location_local_variables) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); } +BOOST_AUTO_TEST_CASE(assignment_mem_to_local_storage_variable) +{ + char const* sourceCode = R"( + contract C { + uint[] data; + function f(uint[] x) { + var dataRef = data; + dataRef = x; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + +BOOST_AUTO_TEST_CASE(storage_assign_to_different_local_variable) +{ + char const* sourceCode = R"( + contract C { + uint[] data; + uint8[] otherData; + function f() { + uint8[] storage x = otherData; + uint[] storage y = data; + y = x; + // note that data = otherData works + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + +BOOST_AUTO_TEST_CASE(assignment_mem_storage_variable_directly) +{ + char const* sourceCode = R"( + contract C { + uint[] data; + function f(uint[] x) { + data = x; + } + } + )"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); +} + +BOOST_AUTO_TEST_CASE(function_argument_mem_to_storage) +{ + char const* sourceCode = R"( + contract C { + function f(uint[] storage x) private { + } + function g(uint[] x) { + f(x); + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + +BOOST_AUTO_TEST_CASE(function_argument_storage_to_mem) +{ + char const* sourceCode = R"( + contract C { + function f(uint[] storage x) private { + g(x); + } + function g(uint[] x) { + } + } + )"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); +} + +BOOST_AUTO_TEST_CASE(mem_array_assignment_changes_base_type) +{ + // Such an assignment is possible in storage, but not in memory + // (because it would incur an otherwise unnecessary copy). + // This requirement might be lifted, though. + char const* sourceCode = R"( + contract C { + function f(uint8[] memory x) private { + uint[] memory y = x; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + BOOST_AUTO_TEST_SUITE_END() } From 477550c6117f8988a50bc7c6b7f35b5d44eb9e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 16 Jun 2015 10:38:10 +0200 Subject: [PATCH 9/9] Set code hash in FakeExtVM.