diff options
-rw-r--r-- | test/libsolidity/SolidityABIJSON.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index f5f8b342..890db241 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -747,8 +747,11 @@ BOOST_AUTO_TEST_CASE(metadata_stamp) bytes const& bytecode = m_compilerStack.runtimeObject("test").bytecode; bytes hash = dev::swarmHash(m_compilerStack.onChainMetadata("test")).asBytes(); BOOST_REQUIRE(hash.size() == 32); - BOOST_REQUIRE(bytecode.size() >= hash.size()); - BOOST_CHECK(std::equal(hash.begin(), hash.end(), bytecode.end() - 32)); + BOOST_REQUIRE(bytecode.size() >= 2); + size_t metadataCBORSize = (size_t(bytecode.end()[-2]) << 8) + size_t(bytecode.end()[-1]); + BOOST_REQUIRE(metadataCBORSize < bytecode.size() - 2); + bytes expectation = bytes{0xa1, 0x65, 'b', 'z', 'z', 'r', '0', 0x58, 0x20} + hash; + BOOST_CHECK(std::equal(expectation.begin(), expectation.end(), bytecode.end() - metadataCBORSize - 2)); } BOOST_AUTO_TEST_SUITE_END() |