Merge pull request #8695 from mijovic/isolTestEnforceCompileViaYul

[isoltest] Enforcing compileViaYul to be set if test can pass via yul
This commit is contained in:
chriseth 2020-05-05 00:55:59 +02:00 committed by GitHub
commit fc41f78146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
127 changed files with 412 additions and 145 deletions

View File

@ -617,6 +617,23 @@ jobs:
t_ubu_soltest: &t_ubu_soltest t_ubu_soltest: &t_ubu_soltest
<<: *test_ubuntu1904 <<: *test_ubuntu1904
t_ubu_soltest_enforce_yul: &t_ubu_soltest_enforce_yul
docker:
- image: ethereum/solidity-buildpack-deps:ubuntu1904-<< pipeline.parameters.ubuntu-1904-docker-image-rev >>
environment:
EVM: constantinople
SOLTEST_FLAGS: --enforce-via-yul
OPTIMIZE: 0
TERM: xterm
steps:
- checkout
- attach_workspace:
at: build
- run: *run_soltest
- store_test_results: *store_test_results
- store_artifacts: *artifacts_test_results
t_ubu_clang_soltest: &t_ubu_clang_soltest t_ubu_clang_soltest: &t_ubu_clang_soltest
<<: *test_ubuntu1904_clang <<: *test_ubuntu1904_clang
environment: environment:
@ -818,6 +835,7 @@ workflows:
- b_ubu18: *workflow_trigger_on_tags - b_ubu18: *workflow_trigger_on_tags
- t_ubu_cli: *workflow_ubuntu1904 - t_ubu_cli: *workflow_ubuntu1904
- t_ubu_soltest: *workflow_ubuntu1904 - t_ubu_soltest: *workflow_ubuntu1904
- t_ubu_soltest_enforce_yul: *workflow_ubuntu1904
- b_ubu_clang: *workflow_trigger_on_tags - b_ubu_clang: *workflow_trigger_on_tags
- t_ubu_clang_soltest: *workflow_ubuntu1904_clang - t_ubu_clang_soltest: *workflow_ubuntu1904_clang

View File

@ -95,6 +95,7 @@ CommonOptions::CommonOptions(std::string _caption):
("no-smt", po::bool_switch(&disableSMT), "disable SMT checker") ("no-smt", po::bool_switch(&disableSMT), "disable SMT checker")
("optimize", po::bool_switch(&optimize), "enables optimization") ("optimize", po::bool_switch(&optimize), "enables optimization")
("optimize-yul", po::bool_switch(&optimizeYul), "enables Yul optimization") ("optimize-yul", po::bool_switch(&optimizeYul), "enables Yul optimization")
("enforce-via-yul", po::bool_switch(&enforceViaYul), "Enforce compiling all tests via yul to see if additional tests can be activated.")
("abiencoderv2", po::bool_switch(&useABIEncoderV2), "enables abi encoder v2") ("abiencoderv2", po::bool_switch(&useABIEncoderV2), "enables abi encoder v2")
("show-messages", po::bool_switch(&showMessages), "enables message output") ("show-messages", po::bool_switch(&showMessages), "enables message output")
("show-metadata", po::bool_switch(&showMetadata), "enables metadata output"); ("show-metadata", po::bool_switch(&showMetadata), "enables metadata output");

View File

@ -47,6 +47,7 @@ struct CommonOptions: boost::noncopyable
boost::filesystem::path testPath; boost::filesystem::path testPath;
bool optimize = false; bool optimize = false;
bool optimizeYul = false; bool optimizeYul = false;
bool enforceViaYul = false;
bool disableSMT = false; bool disableSMT = false;
bool useABIEncoderV2 = false; bool useABIEncoderV2 = false;
bool showMessages = false; bool showMessages = false;

View File

@ -40,6 +40,11 @@ void TestCase::printSettings(ostream& _stream, const string& _linePrefix, const
_stream << _linePrefix << "// " << setting.first << ": " << setting.second << endl; _stream << _linePrefix << "// " << setting.first << ": " << setting.second << endl;
} }
void TestCase::printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix)
{
printSettings(_stream, _linePrefix);
}
bool TestCase::isTestFilename(boost::filesystem::path const& _filename) bool TestCase::isTestFilename(boost::filesystem::path const& _filename)
{ {
string extension = _filename.extension().string(); string extension = _filename.extension().string();

View File

@ -38,6 +38,7 @@ public:
{ {
std::string filename; std::string filename;
langutil::EVMVersion evmVersion; langutil::EVMVersion evmVersion;
bool enforceCompileViaYul;
}; };
enum class TestResult { Success, Failure, FatalError }; enum class TestResult { Success, Failure, FatalError };
@ -59,6 +60,8 @@ public:
virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const = 0; virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const = 0;
/// Outputs settings. /// Outputs settings.
virtual void printSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false); virtual void printSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false);
/// Outputs updated settings
virtual void printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix = "");
/// Outputs test expectations to @arg _stream that match the actual results of the test. /// Outputs test expectations to @arg _stream that match the actual results of the test.
/// Each line of output is prefixed with @arg _linePrefix. /// Each line of output is prefixed with @arg _linePrefix.
virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const = 0; virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const = 0;

View File

@ -64,12 +64,13 @@ int registerTests(
boost::unit_test::test_suite& _suite, boost::unit_test::test_suite& _suite,
boost::filesystem::path const& _basepath, boost::filesystem::path const& _basepath,
boost::filesystem::path const& _path, boost::filesystem::path const& _path,
bool _enforceViaYul,
TestCase::TestCaseCreator _testCaseCreator TestCase::TestCaseCreator _testCaseCreator
) )
{ {
int numTestsAdded = 0; int numTestsAdded = 0;
fs::path fullpath = _basepath / _path; fs::path fullpath = _basepath / _path;
TestCase::Config config{fullpath.string(), solidity::test::CommonOptions::get().evmVersion()}; TestCase::Config config{fullpath.string(), solidity::test::CommonOptions::get().evmVersion(), _enforceViaYul};
if (fs::is_directory(fullpath)) if (fs::is_directory(fullpath))
{ {
test_suite* sub_suite = BOOST_TEST_SUITE(_path.filename().string()); test_suite* sub_suite = BOOST_TEST_SUITE(_path.filename().string());
@ -78,7 +79,12 @@ int registerTests(
fs::directory_iterator() fs::directory_iterator()
)) ))
if (fs::is_directory(entry.path()) || TestCase::isTestFilename(entry.path().filename())) if (fs::is_directory(entry.path()) || TestCase::isTestFilename(entry.path().filename()))
numTestsAdded += registerTests(*sub_suite, _basepath, _path / entry.path().filename(), _testCaseCreator); numTestsAdded += registerTests(
*sub_suite,
_basepath, _path / entry.path().filename(),
_enforceViaYul,
_testCaseCreator
);
_suite.add(sub_suite); _suite.add(sub_suite);
} }
else else
@ -164,6 +170,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
master, master,
options.testPath / ts.path, options.testPath / ts.path,
ts.subpath, ts.subpath,
options.enforceViaYul,
ts.testCaseCreator ts.testCaseCreator
) > 0, std::string("no ") + ts.title + " tests found"); ) > 0, std::string("no ") + ts.title + " tests found");
} }

View File

@ -36,9 +36,10 @@ using namespace boost::unit_test;
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVersion): SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVersion, bool enforceViaYul):
SolidityExecutionFramework(_evmVersion), SolidityExecutionFramework(_evmVersion),
EVMVersionRestrictedTestCase(_filename) EVMVersionRestrictedTestCase(_filename),
m_enforceViaYul(enforceViaYul)
{ {
m_source = m_reader.source(); m_source = m_reader.source();
m_lineOffset = m_reader.lineNumber(); m_lineOffset = m_reader.lineNumber();
@ -78,12 +79,17 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted) TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
{ {
for(bool compileViaYul: set<bool>{!m_runWithoutYul, m_runWithYul})
for (bool compileViaYul: set<bool>{!m_runWithoutYul, m_runWithYul || m_enforceViaYul})
{
try
{ {
reset(); reset();
bool success = true; bool success = true;
m_compileViaYul = compileViaYul; m_compileViaYul = compileViaYul;
m_compileViaYulCanBeSet = false;
if (compileViaYul) if (compileViaYul)
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul:" << endl; AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul:" << endl;
@ -155,7 +161,15 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
} }
} }
if (!success) if (success && !m_runWithYul && compileViaYul)
{
m_compileViaYulCanBeSet = true;
AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) << _linePrefix << endl << _linePrefix
<< "Test can pass via Yul and marked with compileViaYul: false." << endl;
return TestResult::Failure;
}
if (!success && (m_runWithYul || !compileViaYul))
{ {
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl; AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl;
for (auto const& test: m_tests) for (auto const& test: m_tests)
@ -177,7 +191,8 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
if (compileViaYul && m_runWithoutYul) if (compileViaYul && m_runWithoutYul)
{ {
_stream << _linePrefix << endl << _linePrefix; _stream << _linePrefix << endl << _linePrefix;
AnsiColorized(_stream, _formatted, {RED_BACKGROUND}) << "Note that the test passed without Yul."; AnsiColorized(_stream, _formatted, {RED_BACKGROUND})
<< "Note that the test passed without Yul.";
_stream << endl; _stream << endl;
} }
else if (!compileViaYul && m_runWithYul) else if (!compileViaYul && m_runWithYul)
@ -186,6 +201,25 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
return TestResult::Failure; return TestResult::Failure;
} }
} }
catch (boost::exception const&)
{
if (compileViaYul && !m_runWithYul)
continue;
throw;
}
catch (std::exception const&)
{
if (compileViaYul && !m_runWithYul)
continue;
throw;
}
catch (...)
{
if (compileViaYul && !m_runWithYul)
continue;
throw;
}
}
return TestResult::Success; return TestResult::Success;
} }
@ -204,6 +238,20 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con
_stream << test.format("", true, false) << endl; _stream << test.format("", true, false) << endl;
} }
void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix)
{
auto& settings = m_reader.settings();
if (settings.empty() && !m_compileViaYulCanBeSet)
return;
_stream << _linePrefix << "// ====" << endl;
if (m_compileViaYulCanBeSet)
_stream << _linePrefix << "// compileViaYul: also\n";
for (auto const& setting: settings)
if (!m_compileViaYulCanBeSet || setting.first != "compileViaYul")
_stream << _linePrefix << "// " << setting.first << ": " << setting.second << endl;
}
void SemanticTest::parseExpectations(istream& _stream) void SemanticTest::parseExpectations(istream& _stream)
{ {
TestFileParser parser{_stream}; TestFileParser parser{_stream};

View File

@ -40,13 +40,14 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict
{ {
public: public:
static std::unique_ptr<TestCase> create(Config const& _options) static std::unique_ptr<TestCase> create(Config const& _options)
{ return std::make_unique<SemanticTest>(_options.filename, _options.evmVersion); } { return std::make_unique<SemanticTest>(_options.filename, _options.evmVersion, _options.enforceCompileViaYul); }
explicit SemanticTest(std::string const& _filename, langutil::EVMVersion _evmVersion); explicit SemanticTest(std::string const& _filename, langutil::EVMVersion _evmVersion, bool _enforceViaYul = false);
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override; TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override;
void printSource(std::ostream &_stream, std::string const& _linePrefix = "", bool _formatted = false) const override; void printSource(std::ostream &_stream, std::string const& _linePrefix = "", bool _formatted = false) const override;
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix = "") const override; void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix = "") const override;
void printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix = "") override;
/// Instantiates a test file parser that parses the additional comment section at the end of /// Instantiates a test file parser that parses the additional comment section at the end of
/// the input stream \param _stream. Each function call is represented using a `FunctionCallTest` /// the input stream \param _stream. Each function call is represented using a `FunctionCallTest`
@ -64,8 +65,10 @@ private:
std::vector<TestFunctionCall> m_tests; std::vector<TestFunctionCall> m_tests;
bool m_runWithYul = false; bool m_runWithYul = false;
bool m_runWithoutYul = true; bool m_runWithoutYul = true;
bool m_enforceViaYul = false;
bool m_runWithABIEncoderV1Only = false; bool m_runWithABIEncoderV1Only = false;
bool m_allowNonExistingFunctions = false; bool m_allowNonExistingFunctions = false;
bool m_compileViaYulCanBeSet = false;
}; };
} }

View File

@ -5,6 +5,8 @@ contract C {
return 23; return 23;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256[][2][]): 0x20, 0x01, 0x20, 0x40, 0x60, 0x00, 0x00 -> 23 # this is the common encoding for x.length == 1 && x[0][0].length == 0 && x[0][1].length == 0 # // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x40, 0x60, 0x00, 0x00 -> 23 # this is the common encoding for x.length == 1 && x[0][0].length == 0 && x[0][1].length == 0 #
// f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00, 0x00 -> 23 # exotic, but still valid encoding # // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00, 0x00 -> 23 # exotic, but still valid encoding #

View File

@ -10,6 +10,8 @@ contract C {
return this.g(x); return this.g(x);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256): 0 -> 0 // f(uint256): 0 -> 0
// g(address): 0 -> 0 # test validation as well as sanity check # // g(address): 0 -> 0 # test validation as well as sanity check #

View File

@ -10,6 +10,8 @@ contract C {
return this.gggg(x); return this.gggg(x);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256): 0 -> false // f(uint256): 0 -> false
// gggg(bool): 0 -> false # test validation as well as sanity check # // gggg(bool): 0 -> false # test validation as well as sanity check #

View File

@ -42,6 +42,8 @@ contract C {
return this.g16(x); return this.g16(x);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f1(bytes32): left(0) -> left(0) // f1(bytes32): left(0) -> left(0)
// gg1(bytes1): left(0) -> left(0) # test validation as well as sanity check # // gg1(bytes1): left(0) -> left(0) # test validation as well as sanity check #

View File

@ -42,6 +42,8 @@ contract C {
return this.g128(x); return this.g128(x);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f8(int256): 0 -> 0 // f8(int256): 0 -> 0
// ggg8(int8): 0 -> 0 # test validation as well as sanity check # // ggg8(int8): 0 -> 0 # test validation as well as sanity check #

View File

@ -42,6 +42,8 @@ contract C {
return this.g128(x); return this.g128(x);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f8(uint256): 0 -> 0 // f8(uint256): 0 -> 0
// ggg8(uint8): 0 -> 0 # test validation as well as sanity check # // ggg8(uint8): 0 -> 0 # test validation as well as sanity check #

View File

@ -7,7 +7,8 @@ contract C {
return a % b; return a % b;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// div(uint256,uint256): 7, 2 -> 3 // div(uint256,uint256): 7, 2 -> 3
// div(uint256,uint256): 7, 0 -> FAILURE # throws # // div(uint256,uint256): 7, 0 -> FAILURE # throws #

View File

@ -11,6 +11,7 @@ contract c {
l = data.length; l = data.length;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> 1, 0 // test() -> 1, 0

View File

@ -6,6 +6,7 @@ contract c {
return true; return true;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> FAILURE // test() -> FAILURE

View File

@ -8,6 +8,7 @@ contract c {
x = 3; x = 3;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> 3 // test() -> 3

View File

@ -14,6 +14,7 @@ contract c {
z = data[2]; z = data[2];
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> 5, 4, 3, 3 // test() -> 5, 4, 3, 3

View File

@ -9,6 +9,5 @@ contract c {
return true; return true;
} }
} }
// ---- // ----
// test() -> FAILURE // test() -> FAILURE

View File

@ -8,6 +8,7 @@ contract c {
x = 3; x = 3;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> 3 // test() -> 3

View File

@ -11,6 +11,7 @@ contract C {
b = s[1]; b = s[1];
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256[2]): 42, 23 -> 42, 23 // f(uint256[2]): 42, 23 -> 42, 23

View File

@ -11,7 +11,8 @@ contract C {
return 42; return 42;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256[][]): 0x20, 0x0 -> 42 # valid access stub # // f(uint256[][]): 0x20, 0x0 -> 42 # valid access stub #
// f(uint256[][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding # // f(uint256[][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding #

View File

@ -16,7 +16,8 @@ contract C {
return 42; return 42;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256[][1][]): 0x20, 0x0 -> 42 # valid access stub # // f(uint256[][1][]): 0x20, 0x0 -> 42 # valid access stub #
// f(uint256[][1][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding # // f(uint256[][1][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding #

View File

@ -4,6 +4,7 @@ contract C {
return 7; return 7;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 7 // f() -> 7

View File

@ -29,6 +29,7 @@ contract C {
return 0; return 0;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 7 // f() -> 7

View File

@ -12,7 +12,8 @@ contract A {
return true; return true;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> false // test() -> false
// testIt() -> FAILURE // testIt() -> FAILURE

View File

@ -7,7 +7,8 @@ contract Creator {
ch = s[2]; ch = s[2];
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// constructor(): 1, 2, 3, 4 -> // constructor(): 1, 2, 3, 4 ->
// r() -> 4 // r() -> 4

View File

@ -5,6 +5,7 @@ contract C {
return (x.length, bytes16(uint128(2)).length, a.length + 7); return (x.length, bytes16(uint128(2)).length, a.length + 7);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bytes32): "789" -> 32, 16, 8 // f(bytes32): "789" -> 32, 16, 8

View File

@ -10,5 +10,7 @@ contract Test {
return data; return data;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07 // f() -> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07

View File

@ -11,7 +11,8 @@ contract C {
return rows[n][k - 1]; return rows[n][k - 1];
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256,uint256): 3, 1 -> 1 // f(uint256,uint256): 3, 1 -> 1
// f(uint256,uint256): 9, 5 -> 70 // f(uint256,uint256): 9, 5 -> 70

View File

@ -19,6 +19,8 @@ contract C {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// l() -> 0 // l() -> 0
// lv(uint256): 42 -> // lv(uint256): 42 ->

View File

@ -11,6 +11,8 @@ contract C {
_out = _in; _out = _in;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bool): 0x0 -> 0x0 // f(bool): 0x0 -> 0x0
// f(bool): 0x1 -> 0x1 // f(bool): 0x1 -> 0x1

View File

@ -13,6 +13,8 @@ contract C {
return 0; return 0;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE # We input longer data on purpose.# // f(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE # We input longer data on purpose.#
// g(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE // g(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE

View File

@ -10,5 +10,7 @@ contract C {
return 0; return 0;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bytes2,uint16): "abc", 0x40102 -> FAILURE # We input longer data on purpose. # // f(bytes2,uint16): "abc", 0x40102 -> FAILURE # We input longer data on purpose. #

View File

@ -8,6 +8,7 @@ contract C {
return (x, y); return (x, y);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> 0xff, 0xff // test() -> 0xff, 0xff

View File

@ -20,5 +20,7 @@ contract Derived is Base {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// getA() -> 49 // getA() -> 49

View File

@ -15,7 +15,8 @@ contract Main {
return flag; return flag;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// constructor(): "abc", true // constructor(): "abc", true
// getFlag() -> true // getFlag() -> true

View File

@ -20,5 +20,7 @@ contract Derived is Base {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// getA() -> 2 // getA() -> 2

View File

@ -14,7 +14,8 @@ contract Derived is Base {
return m_derived; return m_derived;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// getBMember() -> 5 // getBMember() -> 5
// getDMember() -> 6 // getDMember() -> 6

View File

@ -5,6 +5,8 @@ contract test {
return cond ? x : y; return cond ? x : y;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bool): true -> 0xcd // f(bool): true -> 0xcd
// f(bool): false -> 0xabab // f(bool): false -> 0xabab

View File

@ -3,5 +3,7 @@ contract test {
return false ? 5 : 10; return false ? 5 : 10;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 10 // f() -> 10

View File

@ -7,6 +7,8 @@ contract test {
return z(); return z();
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bool): true -> 1 // f(bool): true -> 1
// f(bool): false -> 2 // f(bool): false -> 2

View File

@ -6,6 +6,8 @@ contract test {
x > 50 ? 50 : 10; x > 50 ? 50 : 10;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256): 1001 -> 1000 // f(uint256): 1001 -> 1000
// f(uint256): 500 -> 100 // f(uint256): 500 -> 100

View File

@ -3,5 +3,7 @@ contract test {
return true ? 5 : 10; return true ? 5 : 10;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 5 // f() -> 5

View File

@ -3,6 +3,8 @@ contract test {
return cond ? (1, 2) : (3, 4); return cond ? (1, 2) : (3, 4);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bool): true -> 1, 2 // f(bool): true -> 1, 2
// f(bool): false -> 3, 4 // f(bool): false -> 3, 4

View File

@ -3,6 +3,8 @@ contract test {
cond ? a = v : b = v; cond ? a = v : b = v;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(bool,uint256): true, 20 -> 20, 0 // f(bool,uint256): true, 20 -> 20, 0
// f(bool,uint256): false, 20 -> 0, 20 // f(bool,uint256): false, 20 -> 0, 20

View File

@ -5,6 +5,8 @@ contract C {
receive () payable external { ++y; } receive () payable external { ++y; }
function f() external returns (uint, uint) { return (x, y); } function f() external returns (uint, uint) { return (x, y); }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 0, 0 // f() -> 0, 0
// () -> // () ->

View File

@ -4,6 +4,8 @@ contract A {
function getData() public returns (uint r) { return data; } function getData() public returns (uint r) { return data; }
} }
contract B is A {} contract B is A {}
// ====
// compileViaYul: also
// ---- // ----
// getData() -> 0 // getData() -> 0
// (): 42 -> // (): 42 ->

View File

@ -4,6 +4,8 @@ contract A {
function fow() public { x = 3; } function fow() public { x = 3; }
fallback () external { x = 2; } fallback () external { x = 2; }
} }
// ====
// compileViaYul: also
// ---- // ----
// (): hex"d88e0b" // (): hex"d88e0b"
// x() -> 2 // x() -> 2

View File

@ -22,6 +22,8 @@ contract test {
return sum; return sum;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256[]): 32, 3, 1000, 1, 2 -> 3 // f(uint256[]): 32, 3, 1000, 1, 2 -> 3
// f(uint256[]): 32, 3, 100, 500, 300 -> 600 // f(uint256[]): 32, 3, 100, 500, 300 -> 600

View File

@ -10,5 +10,7 @@ contract C is V
{ {
function a() internal view override returns (uint256) { return 42;} function a() internal view override returns (uint256) { return 42;}
} }
// ====
// compileViaYul: also
// ---- // ----
// b() -> 42 // b() -> 42

View File

@ -11,7 +11,8 @@ contract C {
return 7; return 7;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// intern() -> FAILURE # This should throw exceptions # // intern() -> FAILURE # This should throw exceptions #
// extern() -> FAILURE // extern() -> FAILURE

View File

@ -15,6 +15,7 @@ contract C {
return 2; return 2;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// t() -> FAILURE // t() -> FAILURE

View File

@ -16,6 +16,8 @@ contract test {
return (a[0][key], a[1][key], b[0][key], b[1][key]); return (a[0][key], a[1][key], b[0][key], b[1][key]);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// set(uint8,uint8,uint8,uint8,uint8): 1, 21, 22, 42, 43 -> 0, 0, 0, 0 // set(uint8,uint8,uint8,uint8,uint8): 1, 21, 22, 42, 43 -> 0, 0, 0, 0
// get(uint8): 1 -> 21, 22, 42, 43 // get(uint8): 1 -> 21, 22, 42, 43

View File

@ -14,6 +14,8 @@ contract test {
return (a[key], b[key]); return (a[key], b[key]);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// set(uint8,uint8,uint8): 1, 21, 42 -> 0, 0 // set(uint8,uint8,uint8): 1, 21, 42 -> 0, 0
// get(uint8): 1 -> 21, 42 // get(uint8): 1 -> 21, 42

View File

@ -6,6 +6,7 @@ contract test {
} }
// ==== // ====
// allowNonExistingFunctions: true // allowNonExistingFunctions: true
// compileViaYul: also
// ---- // ----
// a() -> 0 // a() -> 0
// b() -> 1 // b() -> 1

View File

@ -2,5 +2,7 @@ contract test {
function a(uint a, uint b, uint c) public returns (uint r) { r = a * 100 + b * 10 + c * 1; } function a(uint a, uint b, uint c) public returns (uint r) { r = a * 100 + b * 10 + c * 1; }
function b() public returns (uint r) { r = a({a: 1, b: 2, c: 3}); } function b() public returns (uint r) { r = a({a: 1, b: 2, c: 3}); }
} }
// ====
// compileViaYul: also
// ---- // ----
// b() -> 123 // b() -> 123

View File

@ -14,6 +14,8 @@ contract Main {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// constructor(), 20 wei -> // constructor(), 20 wei ->
// s() -> true // s() -> true

View File

@ -3,6 +3,8 @@ contract test {
function g() public { revert(); } function g() public { revert(); }
function h() public { assert(false); } function h() public { assert(false); }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> // f() ->
// g() -> FAILURE // g() -> FAILURE

View File

@ -3,6 +3,8 @@ contract C {
return msg.value; return msg.value;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(), 1 ether -> 1000000000000000000 // f(), 1 ether -> 1000000000000000000
// f(), 1 wei -> 1 // f(), 1 wei -> 1

View File

@ -7,10 +7,9 @@ contract C {
return x(a); return x(a);
} }
function g(uint256 x) public returns (uint256) { function g(uint256 x) public pure returns (uint256) {
return x + 1; return x + 1;
} }
} }
// ---- // ----
// f(uint256): 7 -> 8 // f(uint256): 7 -> 8

View File

@ -13,7 +13,8 @@ contract C {
return double(_arg); return double(_arg);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// runtime(uint256): 3 -> 6 // runtime(uint256): 3 -> 6
// initial() -> 4 // initial() -> 4

View File

@ -25,6 +25,8 @@ contract C {
return (a, (new A()).f(), (new B()).f()); return (a, (new A()).f(), (new B()).f());
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 3, 7, 5 // f() -> 3, 7, 5
// x() -> 7 // x() -> 7

View File

@ -16,7 +16,8 @@ contract C {
return true; return true;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> true // f() -> true
// z() -> 7 // z() -> 7

View File

@ -17,7 +17,8 @@ contract C {
return true; return true;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> true // f() -> true
// z() -> 7 // z() -> 7

View File

@ -10,5 +10,7 @@ contract C {
} }
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 2 // f() -> 2

View File

@ -29,6 +29,8 @@ contract Homer is ERC165, Simpson {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a0) -> false
// supportsInterface(bytes4): left(0x01ffc9a7) -> true // supportsInterface(bytes4): left(0x01ffc9a7) -> true

View File

@ -40,6 +40,8 @@ contract Lisa is ERC165MappingImplementation, Simpson {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a0) -> false
// supportsInterface(bytes4): left(0x01ffc9a7) -> true // supportsInterface(bytes4): left(0x01ffc9a7) -> true

View File

@ -17,6 +17,7 @@ contract B is A {
return A(this).f(m); return A(this).f(m);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// g() -> 23 // g() -> 23

View File

@ -14,5 +14,7 @@ contract Derived is Base {
contract Final is Derived(4) {} contract Final is Derived(4) {}
// ====
// compileViaYul: also
// ---- // ----
// m_i() -> 4 // m_i() -> 4

View File

@ -19,5 +19,7 @@ contract Derived is Base, Base1 {
contract Final is Derived(4) {} contract Final is Derived(4) {}
// ====
// compileViaYul: also
// ---- // ----
// m_i() -> 4 // m_i() -> 4

View File

@ -19,5 +19,7 @@ contract Derived is Base, Base1 {
contract Final is Derived(4) {} contract Final is Derived(4) {}
// ====
// compileViaYul: also
// ---- // ----
// m_i() -> 4 // m_i() -> 4

View File

@ -10,5 +10,7 @@ contract Tsra {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 1 // f() -> 1

View File

@ -13,5 +13,7 @@ contract Tsra {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 1 // f() -> 1

View File

@ -3,5 +3,7 @@ contract C {
return hex"12_34_5678_9A"; return hex"12_34_5678_9A";
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 32, 5, left(0x123456789A) // f() -> 32, 5, left(0x123456789A)

View File

@ -13,7 +13,8 @@ contract C {
x = t; x = t;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// x() -> 0 // x() -> 0
// f() -> // f() ->

View File

@ -13,7 +13,8 @@ contract C {
x = t; x = t;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// x() -> 0 // x() -> 0
// f() -> // f() ->

View File

@ -2,6 +2,8 @@ contract A {
uint public x; uint public x;
receive () external payable { ++x; } receive () external payable { ++x; }
} }
// ====
// compileViaYul: also
// ---- // ----
// x() -> 0 // x() -> 0
// () // ()

View File

@ -1,6 +1,8 @@
contract C { contract C {
receive () payable external { } receive () payable external { }
} }
// ====
// compileViaYul: also
// ---- // ----
// (), 1 ether // (), 1 ether
// (), 1 ether: 1 -> FAILURE // (), 1 ether: 1 -> FAILURE

View File

@ -4,6 +4,8 @@ contract A {
function getData() public returns (uint r) { return data; } function getData() public returns (uint r) { return data; }
} }
contract B is A {} contract B is A {}
// ====
// compileViaYul: also
// ---- // ----
// getData() -> 0 // getData() -> 0
// () -> // () ->

View File

@ -6,6 +6,7 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256,uint256,uint256[]): 2, 1, 0x80, 3, 1, 2, 3 -> FAILURE, hex"08c379a0", 0x20, 22, "Slice starts after end" // f(uint256,uint256,uint256[]): 2, 1, 0x80, 3, 1, 2, 3 -> FAILURE, hex"08c379a0", 0x20, 22, "Slice starts after end"
// f(uint256,uint256,uint256[]): 1, 5, 0x80, 3, 1, 2, 3 -> FAILURE, hex"08c379a0", 0x20, 28, "Slice is greater than length" // f(uint256,uint256,uint256[]): 1, 5, 0x80, 3, 1, 2, 3 -> FAILURE, hex"08c379a0", 0x20, 28, "Slice is greater than length"

View File

@ -7,5 +7,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256[][]): 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray stride" // f(uint256[][]): 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray stride"

View File

@ -8,5 +8,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00 -> FAILURE, hex"08c379a0", 0x20, 28, "Invalid calldata tail offset" // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00 -> FAILURE, hex"08c379a0", 0x20, 28, "Invalid calldata tail offset"

View File

@ -10,5 +10,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// g(uint256[][2][]): 0x20, 0x01, 0x20, 0x00 -> FAILURE, hex"08c379a0", 0x20, 30, "Invalid calldata access offset" // g(uint256[][2][]): 0x20, 0x01, 0x20, 0x00 -> FAILURE, hex"08c379a0", 0x20, 30, "Invalid calldata access offset"

View File

@ -7,5 +7,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256[][]): 0x20, 1, 0x20, 0x0100000000000000000000 -> FAILURE, hex"08c379a0", 0x20, 28, "Invalid calldata tail length" // f(uint256[][]): 0x20, 1, 0x20, 0x0100000000000000000000 -> FAILURE, hex"08c379a0", 0x20, 28, "Invalid calldata tail length"

View File

@ -7,5 +7,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256,uint256[],uint256): 6, 0x60, 9, 0x1000000000000000000000000000000000000000000000000000000000000002, 1, 2 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray length" // f(uint256,uint256[],uint256): 6, 0x60, 9, 0x1000000000000000000000000000000000000000000000000000000000000002, 1, 2 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray length"

View File

@ -5,5 +5,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256[][]): 0x20, 1, 0x20, 2, 0x42 -> FAILURE, hex"08c379a0", 0x20, 23, "Calldata tail too short" // f(uint256[][]): 0x20, 1, 0x20, 2, 0x42 -> FAILURE, hex"08c379a0", 0x20, 23, "Calldata tail too short"

View File

@ -5,5 +5,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// f(uint256[]): 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray stride" // f(uint256[]): 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray stride"

View File

@ -5,5 +5,6 @@ contract C {
// ==== // ====
// EVMVersion: >=byzantium // EVMVersion: >=byzantium
// revertStrings: debug // revertStrings: debug
// compileViaYul: also
// ---- // ----
// e(bytes): 0x20, 7 -> FAILURE, hex"08c379a0", 0x20, 39, "ABI decoding: invalid byte array", " length" // e(bytes): 0x20, 7 -> FAILURE, hex"08c379a0", 0x20, 39, "ABI decoding: invalid byte array", " length"

View File

@ -15,6 +15,7 @@ contract C {
return this.tested(garbled); return this.tested(garbled);
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> FAILURE # should throw # // test() -> FAILURE # should throw #

View File

@ -14,6 +14,8 @@ contract C {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> FAILURE // f() -> FAILURE
// a() -> 42 // a() -> 42

View File

@ -6,6 +6,8 @@ contract Test {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f(uint256): 11 -> 21 // f(uint256): 11 -> 21
// f(uint256): 1 -> FAILURE // f(uint256): 1 -> FAILURE

View File

@ -18,6 +18,7 @@ contract A {
} }
} }
// ==== // ====
// compileViaYul: also
// EVMVersion: >=constantinople // EVMVersion: >=constantinople
// ---- // ----
// f(), 10 ether -> 3007, 3008, 3009 // f(), 10 ether -> 3007, 3008, 3009

View File

@ -1,6 +1,7 @@
contract C { contract C {
uint256 public a = 0x42 << 8; uint256 public a = 0x42 << 8;
} }
// ====
// compileViaYul: also
// ---- // ----
// a() -> 0x4200 // a() -> 0x4200

View File

@ -1,6 +1,7 @@
contract C { contract C {
uint256 public a = 0x4200 >> 8; uint256 public a = 0x4200 >> 8;
} }
// ====
// compileViaYul: also
// ---- // ----
// a() -> 0x42 // a() -> 0x42

View File

@ -1,6 +1,7 @@
contract C { contract C {
int256 public a = -0x42 << 8; int256 public a = -0x42 << 8;
} }
// ====
// compileViaYul: also
// ---- // ----
// a() -> -16896 // a() -> -16896

View File

@ -1,6 +1,7 @@
contract C { contract C {
int256 public a = -0x4200 >> 8; int256 public a = -0x4200 >> 8;
} }
// ====
// compileViaYul: also
// ---- // ----
// a() -> -66 // a() -> -66

View File

@ -12,6 +12,8 @@ contract C {
return "any"; return "any";
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// e(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB) // e(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB)
// e(bytes): 32, 32, 0x20 -> 32, 32, 0x20 // e(bytes): 32, 32, 0x20 -> 32, 32, 0x20

View File

@ -10,6 +10,8 @@ contract C {
state = _state; state = _state;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// constructor(), 2 wei: 3 -> // constructor(), 2 wei: 3 ->
// state() -> 3 // state() -> 3

Some files were not shown because too many files have changed in this diff Show More