From 17cac588d053429ff74c53fd82648da7c8c55db9 Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Tue, 14 Aug 2018 11:41:40 +0200 Subject: [PATCH] Replace safety stop by invalid --- libevmasm/Assembly.cpp | 4 ++-- test/libevmasm/Assembler.cpp | 2 +- test/libsolidity/LibSolc.cpp | 8 ++++---- test/libsolidity/StandardCompiler.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 28ae95777..e49e675da 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -617,8 +617,8 @@ LinkerObject const& Assembly::assemble() const } if (!m_subs.empty() || !m_data.empty() || !m_auxiliaryData.empty()) - // Append a STOP just to be sure. - ret.bytecode.push_back(0); + // Append an INVALID here to help tests find miscompilation. + ret.bytecode.push_back(byte(Instruction::INVALID)); for (size_t i = 0; i < m_subs.size(); ++i) { diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index 8992430ea..bc652f56b 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(all_assembly_items) _assembly.assemble().toHex(), "5b6001600220606773__someLibrary___________________________" "6000567f556e75736564206665617475726520666f722070757368696e" - "6720737472696e605f6001605e7300000000000000000000000000000000000000000000" + "6720737472696e605f6001605e73000000000000000000000000000000000000000000fe" "fe010203044266eeaa" ); BOOST_CHECK_EQUAL( diff --git a/test/libsolidity/LibSolc.cpp b/test/libsolidity/LibSolc.cpp index 9d5ffa272..61e5ebba1 100644 --- a/test/libsolidity/LibSolc.cpp +++ b/test/libsolidity/LibSolc.cpp @@ -111,12 +111,12 @@ BOOST_AUTO_TEST_CASE(basic_compilation) BOOST_CHECK(contract["bytecode"].isString()); BOOST_CHECK_EQUAL( dev::test::bytecodeSansMetadata(contract["bytecode"].asString()), - "6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00" + "6080604052348015600f57600080fd5b50603580601d6000396000f3fe6080604052600080fdfe" ); BOOST_CHECK(contract["runtimeBytecode"].isString()); BOOST_CHECK_EQUAL( dev::test::bytecodeSansMetadata(contract["runtimeBytecode"].asString()), - "6080604052600080fd00" + "6080604052600080fdfe" ); BOOST_CHECK(contract["functionHashes"].isObject()); BOOST_CHECK(contract["gasEstimates"].isObject()); @@ -153,12 +153,12 @@ BOOST_AUTO_TEST_CASE(single_compilation) BOOST_CHECK(contract["bytecode"].isString()); BOOST_CHECK_EQUAL( dev::test::bytecodeSansMetadata(contract["bytecode"].asString()), - "6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00" + "6080604052348015600f57600080fd5b50603580601d6000396000f3fe6080604052600080fdfe" ); BOOST_CHECK(contract["runtimeBytecode"].isString()); BOOST_CHECK_EQUAL( dev::test::bytecodeSansMetadata(contract["runtimeBytecode"].asString()), - "6080604052600080fd00" + "6080604052600080fdfe" ); BOOST_CHECK(contract["functionHashes"].isObject()); BOOST_CHECK(contract["gasEstimates"].isObject()); diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 4b0a2d132..3aa1dc24f 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(basic_compilation) BOOST_CHECK(contract["evm"]["bytecode"]["object"].isString()); BOOST_CHECK_EQUAL( dev::test::bytecodeSansMetadata(contract["evm"]["bytecode"]["object"].asString()), - "6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00" + "6080604052348015600f57600080fd5b50603580601d6000396000f3fe6080604052600080fdfe" ); BOOST_CHECK(contract["evm"]["assembly"].isString()); BOOST_CHECK(contract["evm"]["assembly"].asString().find(