diff options
author | chriseth <chris@ethereum.org> | 2017-05-24 20:19:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 20:19:53 +0800 |
commit | 85e19cb3859d137df2f4717a9cd261c95fc5f434 (patch) | |
tree | 789864426efea225a20fbe76a2d4468dc2888040 /test/libsolidity/SolidityABIJSON.cpp | |
parent | 6873c936edbd98d446f2f797b177594e6ddfceb2 (diff) | |
parent | 4612c7681cd9304a835a996810cf831499738440 (diff) | |
download | dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.tar dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.tar.gz dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.tar.bz2 dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.tar.lz dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.tar.xz dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.tar.zst dexon-solidity-85e19cb3859d137df2f4717a9cd261c95fc5f434.zip |
Merge pull request #2297 from ethereum/metadata-test
Improve metadata test
Diffstat (limited to 'test/libsolidity/SolidityABIJSON.cpp')
-rw-r--r-- | test/libsolidity/SolidityABIJSON.cpp | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index 1ebccc13..f87390e1 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -752,26 +752,6 @@ BOOST_AUTO_TEST_CASE(function_type) checkInterface(sourceCode, interface); } -BOOST_AUTO_TEST_CASE(metadata_stamp) -{ - // Check that the metadata stamp is at the end of the runtime bytecode. - char const* sourceCode = R"( - pragma solidity >=0.0; - contract test { - function g(function(uint) external returns (uint) x) {} - } - )"; - BOOST_REQUIRE(m_compilerStack.compile(std::string(sourceCode))); - 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() >= 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() } |