aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/interface/Version.cpp8
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/libsolidity/interface/Version.cpp b/libsolidity/interface/Version.cpp
index 31ba4afc..0dca1ced 100644
--- a/libsolidity/interface/Version.cpp
+++ b/libsolidity/interface/Version.cpp
@@ -58,12 +58,14 @@ bytes dev::solidity::binaryVersion()
solAssert(i < VersionString.size() && VersionString[i] == '.', "");
++i;
ret.push_back(byte(parseDecimal()));
- solAssert(i < VersionString.size() && VersionString[i] == '-', "");
+ solAssert(i < VersionString.size() && (VersionString[i] == '-' || VersionString[i] == '+'), "");
++i;
+ size_t commitpos = VersionString.find("commit.");
+ solAssert(commitpos != string::npos, "");
+ i = commitpos + 7;
solAssert(i + 7 < VersionString.size(), "");
bytes commitHash = fromHex(VersionString.substr(i, 8));
- if (commitHash.empty())
- commitHash = bytes(4, 0);
+ solAssert(!commitHash.empty(), "");
ret += commitHash;
solAssert(ret.size() == 1 + 3 + 4, "");
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 3c85d8a8..7ee5700c 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5961,7 +5961,7 @@ BOOST_AUTO_TEST_CASE(version_stamp_for_libraries)
bytes runtimeCode = compileAndRun(sourceCode, 0, "lib");
BOOST_CHECK(runtimeCode.size() >= 8);
BOOST_CHECK_EQUAL(runtimeCode[0], int(Instruction::PUSH6)); // might change once we switch to 1.x.x
- BOOST_CHECK_EQUAL(runtimeCode[1], 3); // might change once we switch away from x.3.x
+ BOOST_CHECK_EQUAL(runtimeCode[1], 4); // might change once we switch away from x.4.x
BOOST_CHECK_EQUAL(runtimeCode[7], int(Instruction::POP));
}