diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | libsolidity/AST.h | 1 | ||||
-rw-r--r-- | libsolidity/ExpressionCompiler.cpp | 2 | ||||
-rw-r--r-- | libsolidity/Version.cpp | 6 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 42 |
5 files changed, 49 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 48417d95..db82855f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.1.0") +set(PROJECT_VERSION "0.1.3") project(solidity VERSION ${PROJECT_VERSION}) # Let's find our dependencies diff --git a/libsolidity/AST.h b/libsolidity/AST.h index 4e299743..134ca148 100644 --- a/libsolidity/AST.h +++ b/libsolidity/AST.h @@ -341,6 +341,7 @@ public: std::vector<ASTPointer<VariableDeclaration>> const& _members ): Declaration(_location, _name), m_members(_members) {} + virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index 81ef6690..65706602 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -391,7 +391,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) TypeType const& type = dynamic_cast<TypeType const&>(*_functionCall.expression().annotation().type); auto const& structType = dynamic_cast<StructType const&>(*type.actualType()); - m_context << u256(max(32u, structType.calldataEncodedSize(true))); + m_context << max(u256(32u), structType.memorySize()); utils().allocateMemory(); m_context << eth::Instruction::DUP1; diff --git a/libsolidity/Version.cpp b/libsolidity/Version.cpp index fe140318..c6b5c509 100644 --- a/libsolidity/Version.cpp +++ b/libsolidity/Version.cpp @@ -22,6 +22,7 @@ #include <libsolidity/Version.h> #include <string> +#include <libevmasm/Version.h> #include <solidity/BuildInfo.h> #include <libdevcore/Common.h> @@ -29,11 +30,12 @@ using namespace dev; using namespace dev::solidity; using namespace std; -char const* dev::solidity::VersionNumber = "0.1.2"; +char const* dev::solidity::VersionNumber = ETH_PROJECT_VERSION; extern string const dev::solidity::VersionString = string(dev::solidity::VersionNumber) + "-" + string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) + (ETH_CLEAN_REPO ? "" : "*") + - "/" DEV_QUOTED(ETH_BUILD_TYPE) "-" DEV_QUOTED(ETH_BUILD_PLATFORM); + "/" DEV_QUOTED(ETH_BUILD_TYPE) "-" DEV_QUOTED(ETH_BUILD_PLATFORM) + " linked to libethereum-" + eth::VersionStringLibEvmAsm; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 1bf95636..8026f216 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5283,6 +5283,48 @@ BOOST_AUTO_TEST_CASE(simple_throw) BOOST_CHECK(callContractFunction("f(uint256)", u256(1)) == encodeArgs()); } +BOOST_AUTO_TEST_CASE(strings_in_struct) +{ + char const* sourceCode = R"( + contract buggystruct { + Buggy public bug; + + struct Buggy { + uint first; + uint second; + uint third; + string last; + } + + function buggystruct(){ + bug = Buggy(10, 20, 30, "asdfghjkl"); + } + function getFirst() returns (uint) + { + return bug.first; + } + function getSecond() returns (uint) + { + return bug.second; + } + function getThird() returns (uint) + { + return bug.third; + } + function getLast() returns (string) + { + return bug.last; + } + } + )"; + compileAndRun(sourceCode); + string s = "asdfghjkl"; + BOOST_CHECK(callContractFunction("getFirst()") == encodeArgs(u256(10))); + BOOST_CHECK(callContractFunction("getSecond()") == encodeArgs(u256(20))); + BOOST_CHECK(callContractFunction("getThird()") == encodeArgs(u256(30))); + BOOST_CHECK(callContractFunction("getLast()") == encodeDyn(s)); +} + BOOST_AUTO_TEST_SUITE_END() } |