Skip to content

Commit f617d27

Browse files
authored
Merge pull request ethereum#13019 from ethereum/enforceViaYulNoSmtTests
Remove enforce-via-yul CI run and instead always force via yul in regular test runs.
2 parents 0cb9590 + a2f768d commit f617d27

File tree

1,297 files changed

+38
-1912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,297 files changed

+38
-1912
lines changed

.circleci/config.yml

-11
Original file line numberDiff line numberDiff line change
@@ -1035,16 +1035,6 @@ jobs:
10351035
condition: true
10361036
<<: *steps_soltest
10371037

1038-
t_ubu_soltest_enforce_yul: &t_ubu_soltest_enforce_yul
1039-
<<: *base_ubuntu2004
1040-
parallelism: 20
1041-
environment:
1042-
EVM: << pipeline.parameters.evm-version >>
1043-
SOLTEST_FLAGS: --enforce-via-yul
1044-
OPTIMIZE: 0
1045-
TERM: xterm
1046-
<<: *steps_soltest
1047-
10481038
t_ubu_clang_soltest: &t_ubu_clang_soltest
10491039
<<: *base_ubuntu2004_clang
10501040
parallelism: 20
@@ -1515,7 +1505,6 @@ workflows:
15151505
- t_ubu_cli: *workflow_ubuntu2004
15161506
- t_ubu_locale: *workflow_ubuntu2004
15171507
- t_ubu_soltest_all: *workflow_ubuntu2004
1518-
- t_ubu_soltest_enforce_yul: *workflow_ubuntu2004
15191508
- b_ubu_clang: *workflow_trigger_on_tags
15201509
- t_ubu_clang_soltest: *workflow_ubuntu2004_clang
15211510
- t_ubu_lsp: *workflow_ubuntu2004

test/Common.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ void CommonOptions::addOptions()
107107
("no-semantic-tests", po::bool_switch(&disableSemanticTests)->default_value(disableSemanticTests), "disable semantic tests")
108108
("no-smt", po::bool_switch(&disableSMT)->default_value(disableSMT), "disable SMT checker")
109109
("optimize", po::bool_switch(&optimize)->default_value(optimize), "enables optimization")
110-
("enforce-via-yul", po::value<bool>(&enforceViaYul)->default_value(enforceViaYul)->implicit_value(true), "Enforce compiling all tests via yul to see if additional tests can be activated.")
111110
("enforce-compile-to-ewasm", po::bool_switch(&enforceCompileToEwasm)->default_value(enforceCompileToEwasm), "Enforce compiling all tests to Ewasm to see if additional tests can be activated.")
112111
("enforce-gas-cost", po::value<bool>(&enforceGasTest)->default_value(enforceGasTest)->implicit_value(true), "Enforce checking gas cost in semantic tests.")
113112
("enforce-gas-cost-min-value", po::value(&enforceGasTestMinValue)->default_value(enforceGasTestMinValue), "Threshold value to enforce adding gas checks to a test.")

test/Common.h

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ struct CommonOptions
6060
boost::filesystem::path testPath;
6161
bool ewasm = false;
6262
bool optimize = false;
63-
bool enforceViaYul = false;
6463
bool enforceCompileToEwasm = false;
6564
bool enforceGasTest = false;
6665
u256 enforceGasTestMinValue = 100000;

test/TestCase.h

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class TestCase
4040
std::string filename;
4141
langutil::EVMVersion evmVersion;
4242
std::vector<boost::filesystem::path> vmPaths;
43-
bool enforceCompileViaYul = false;
4443
bool enforceCompileToEwasm = false;
4544
bool enforceGasCost = false;
4645
u256 enforceGasCostMinValue;

test/boostTest.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ int registerTests(
133133
boost::unit_test::test_suite& _suite,
134134
boost::filesystem::path const& _basepath,
135135
boost::filesystem::path const& _path,
136-
bool _enforceViaYul,
137136
bool _enforceCompileToEwasm,
138137
vector<string> const& _labels,
139138
TestCase::TestCaseCreator _testCaseCreator,
@@ -146,7 +145,6 @@ int registerTests(
146145
fullpath.string(),
147146
solidity::test::CommonOptions::get().evmVersion(),
148147
solidity::test::CommonOptions::get().vmPaths,
149-
_enforceViaYul,
150148
_enforceCompileToEwasm,
151149
solidity::test::CommonOptions::get().enforceGasTest,
152150
solidity::test::CommonOptions::get().enforceGasTestMinValue,
@@ -165,7 +163,6 @@ int registerTests(
165163
numTestsAdded += registerTests(
166164
*sub_suite,
167165
_basepath, _path / entry.path().filename(),
168-
_enforceViaYul,
169166
_enforceCompileToEwasm,
170167
_labels,
171168
_testCaseCreator,
@@ -271,7 +268,6 @@ test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])
271268
master,
272269
options.testPath / ts.path,
273270
ts.subpath,
274-
options.enforceViaYul,
275271
options.enforceCompileToEwasm,
276272
ts.labels,
277273
ts.testCaseCreator,

test/libsolidity/SemanticTest.cpp

+16-43
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ SemanticTest::SemanticTest(
4949
string const& _filename,
5050
langutil::EVMVersion _evmVersion,
5151
vector<boost::filesystem::path> const& _vmPaths,
52-
bool _enforceViaYul,
5352
bool _enforceCompileToEwasm,
5453
bool _enforceGasCost,
5554
u256 _enforceGasCostMinValue
@@ -60,27 +59,32 @@ SemanticTest::SemanticTest(
6059
m_lineOffset(m_reader.lineNumber()),
6160
m_builtins(makeBuiltins()),
6261
m_sideEffectHooks(makeSideEffectHooks()),
63-
m_enforceViaYul(_enforceViaYul),
6462
m_enforceCompileToEwasm(_enforceCompileToEwasm),
6563
m_enforceGasCost(_enforceGasCost),
6664
m_enforceGasCostMinValue(move(_enforceGasCostMinValue))
6765
{
68-
static set<string> const compileViaYulAllowedValues{"also", "true", "false", "default"};
66+
static set<string> const compileViaYulAllowedValues{"also", "true", "false"};
6967
static set<string> const yulRunTriggers{"also", "true"};
7068
static set<string> const legacyRunTriggers{"also", "false", "default"};
7169

72-
string compileViaYul = m_reader.stringSetting("compileViaYul", "default");
70+
m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false);
71+
if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get().useABIEncoderV1)
72+
m_shouldRun = false;
73+
74+
string compileViaYul = m_reader.stringSetting("compileViaYul", "also");
75+
if (m_runWithABIEncoderV1Only && compileViaYul != "false")
76+
BOOST_THROW_EXCEPTION(runtime_error(
77+
"ABIEncoderV1Only tests cannot be run via yul, "
78+
"so they need to also specify ``compileViaYul: false``"
79+
));
7380
if (!util::contains(compileViaYulAllowedValues, compileViaYul))
7481
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + compileViaYul + "."));
7582
m_testCaseWantsYulRun = util::contains(yulRunTriggers, compileViaYul);
7683
m_testCaseWantsLegacyRun = util::contains(legacyRunTriggers, compileViaYul);
7784

78-
// Do not enforce via yul and ewasm, if via yul was explicitly denied.
85+
// Do not enforce ewasm, if via yul was explicitly denied.
7986
if (compileViaYul == "false")
80-
{
81-
m_enforceViaYul = false;
8287
m_enforceCompileToEwasm = false;
83-
}
8488

8589
string compileToEwasm = m_reader.stringSetting("compileToEwasm", "false");
8690
if (compileToEwasm == "also")
@@ -97,18 +101,6 @@ SemanticTest::SemanticTest(
97101
if (m_testCaseWantsEwasmRun && !m_supportsEwasm)
98102
m_testCaseWantsEwasmRun = false;
99103

100-
m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false);
101-
if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get().useABIEncoderV1)
102-
m_shouldRun = false;
103-
104-
// Sanity check
105-
if (m_runWithABIEncoderV1Only && (compileViaYul == "true" || compileViaYul == "also"))
106-
BOOST_THROW_EXCEPTION(runtime_error(
107-
"ABIEncoderV1Only can not be used with compileViaYul=" + compileViaYul +
108-
", set it to false or omit the flag. The compileViaYul setting ignores the abicoder pragma"
109-
" and runs everything with ABICoder V2."
110-
));
111-
112104
auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default"));
113105
soltestAssert(revertStrings, "Invalid revertStrings setting.");
114106
m_revertStrings = revertStrings.value();
@@ -307,7 +299,7 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
307299
if (m_testCaseWantsLegacyRun)
308300
result = runTest(_stream, _linePrefix, _formatted, false, false);
309301

310-
if ((m_testCaseWantsYulRun || m_enforceViaYul) && result == TestResult::Success)
302+
if (m_testCaseWantsYulRun && result == TestResult::Success)
311303
result = runTest(_stream, _linePrefix, _formatted, true, false);
312304

313305
if ((m_testCaseWantsEwasmRun || m_enforceCompileToEwasm) && result == TestResult::Success)
@@ -353,7 +345,6 @@ TestCase::TestResult SemanticTest::runTest(
353345
m_compileToEwasm = _isEwasmRun;
354346
}
355347

356-
m_canEnableYulRun = false;
357348
m_canEnableEwasmRun = false;
358349

359350
if (_isYulRun)
@@ -473,18 +464,6 @@ TestCase::TestResult SemanticTest::runTest(
473464
success &= test.call().expectedSideEffects == test.call().actualSideEffects;
474465
}
475466

476-
if (!m_testCaseWantsYulRun && _isYulRun)
477-
{
478-
m_canEnableYulRun = success;
479-
string message = success ?
480-
"Test can pass via Yul, but marked with \"compileViaYul: false.\"" :
481-
"Test compiles via Yul, but it gives different test results.";
482-
AnsiColorized(_stream, _formatted, {BOLD, success ? YELLOW : MAGENTA}) <<
483-
_linePrefix << endl <<
484-
_linePrefix << message << endl;
485-
return TestResult::Failure;
486-
}
487-
488467
// Right now we have sometimes different test results in Yul vs. Ewasm.
489468
// The main reason is that Ewasm just returns a failure in some cases.
490469
// TODO: If Ewasm support got fully implemented, we could implement this in the same way as above.
@@ -662,25 +641,19 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con
662641
void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix)
663642
{
664643
auto& settings = m_reader.settings();
665-
if (settings.empty() && !m_canEnableYulRun)
644+
if (settings.empty() && !m_canEnableEwasmRun)
666645
return;
667646

668647
_stream << _linePrefix << "// ====" << endl;
669648
if (m_canEnableEwasmRun)
670649
{
671-
soltestAssert(m_canEnableYulRun || m_testCaseWantsYulRun, "");
672-
string compileViaYul = m_reader.stringSetting("compileViaYul", "");
673-
if (!compileViaYul.empty())
674-
_stream << _linePrefix << "// compileViaYul: " << compileViaYul << "\n";
650+
soltestAssert(m_testCaseWantsYulRun, "");
675651
_stream << _linePrefix << "// compileToEwasm: also\n";
676652
}
677-
else if (m_canEnableYulRun)
678-
_stream << _linePrefix << "// compileViaYul: also\n";
679653

680654
for (auto const& [settingName, settingValue]: settings)
681655
if (
682-
!(settingName == "compileToEwasm" && m_canEnableEwasmRun) &&
683-
!(settingName == "compileViaYul" && (m_canEnableYulRun || m_canEnableEwasmRun))
656+
!(settingName == "compileToEwasm" && m_canEnableEwasmRun)
684657
)
685658
_stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl;
686659
}

test/libsolidity/SemanticTest.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict
5252
_options.filename,
5353
_options.evmVersion,
5454
_options.vmPaths,
55-
_options.enforceCompileViaYul,
5655
_options.enforceCompileToEwasm,
5756
_options.enforceGasCost,
5857
_options.enforceGasCostMinValue
@@ -63,7 +62,6 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict
6362
std::string const& _filename,
6463
langutil::EVMVersion _evmVersion,
6564
std::vector<boost::filesystem::path> const& _vmPaths,
66-
bool _enforceViaYul = false,
6765
bool _enforceCompileToEwasm = false,
6866
bool _enforceGasCost = false,
6967
u256 _enforceGasCostMinValue = 100000
@@ -97,14 +95,12 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict
9795
std::vector<TestFunctionCall> m_tests;
9896
std::map<std::string, Builtin> const m_builtins;
9997
std::vector<SideEffectHook> const m_sideEffectHooks;
100-
bool m_testCaseWantsYulRun = false;
98+
bool m_testCaseWantsYulRun = true;
10199
bool m_testCaseWantsEwasmRun = false;
102100
bool m_testCaseWantsLegacyRun = true;
103-
bool m_enforceViaYul = false;
104101
bool m_enforceCompileToEwasm = false;
105102
bool m_runWithABIEncoderV1Only = false;
106103
bool m_allowNonExistingFunctions = false;
107-
bool m_canEnableYulRun = false;
108104
bool m_canEnableEwasmRun = false;
109105
bool m_gasCostFailure = false;
110106
bool m_enforceGasCost = false;

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ contract C {
44
}
55
}
66

7-
// ====
8-
// compileViaYul: also
97
// ----
108
// f(bytes): 0x20, 0xc0, 0x20, 0x4, 0x3, 0x4, 0x5, 0x6 -> 0x20, 0x4, 0x3, 0x4, 0x5, 0x6

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_fixed_arrays.sol

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ contract C {
44
return (a[i], b[j][k]);
55
}
66
}
7-
// ====
8-
// compileViaYul: also
97
// ----
108
// f(uint16[3],uint16[2][3],uint256,uint256,uint256): 1, 2, 3, 11, 12, 21, 22, 31, 32, 1, 2, 1 -> 2, 32

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ contract C {
88
}
99
}
1010

11-
// ====
12-
// compileViaYul: also
1311
// ----
1412
// f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ contract C {
1111
}
1212
}
1313

14-
// ====
15-
// compileViaYul: also
1614
// ----
1715
// f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ contract C {
44
}
55
}
66

7-
// ====
8-
// compileViaYul: also
97
// ----
108
// f(bytes): 0x20, 0x20, 0x21 -> 33

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ contract C {
1818
}
1919
}
2020

21-
// ====
22-
// compileViaYul: also
2321
// ----
2422
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ contract C {
1212
}
1313
}
1414

15-
// ====
16-
// compileViaYul: also
1715
// ----
1816
// f(bytes): 0x20, 0xe0, 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc -> 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc

test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ contract C {
2020
}
2121
}
2222

23-
// ====
24-
// compileViaYul: also
2523
// ----
2624
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb
2725
// gas irOptimized: 203310

test/libsolidity/semanticTests/abiEncoderV1/abi_encode.sol

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ contract C {
3030

3131
// ====
3232
// compileToEwasm: also
33-
// compileViaYul: also
3433
// ----
3534
// f0() -> 0x20, 0x0
3635
// f1() -> 0x20, 0x40, 0x1, 0x2

test/libsolidity/semanticTests/abiEncoderV1/abi_encode_call.sol

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@ contract C {
2222
}
2323
}
2424

25-
// ====
26-
// compileViaYul: also
2725
// ----
2826
// f() -> true

test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ contract C {
5757
}
5858
// ====
5959
// EVMVersion: >homestead
60-
// compileViaYul: also
6160
// ----
6261
// test_bytes() ->
6362
// gas irOptimized: 371912

test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ contract C {
77

88
// ====
99
// compileToEwasm: also
10-
// compileViaYul: also
1110
// ----
1211
// f() -> 0x21, 0x40, 0x7, "abcdefg"

test/libsolidity/semanticTests/abiEncoderV1/abi_encode_rational.sol

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ contract C {
77

88
// ====
99
// compileToEwasm: also
10-
// compileViaYul: also
1110
// ----
1211
// f() -> 0x20, 0x40, 0x1, -2

test/libsolidity/semanticTests/abiEncoderV1/bool_out_of_bounds.sol

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ contract C {
44
}
55
// ====
66
// ABIEncoderV1Only: true
7+
// compileViaYul: false
78
// ----
89
// f(bool): true -> true
910
// f(bool): false -> false

test/libsolidity/semanticTests/abiEncoderV1/byte_arrays.sol

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ contract C {
99
return (a, b.length, b[3], c);
1010
}
1111
}
12-
// ====
13-
// compileViaYul: also
1412
// ----
1513
// f(uint256,bytes,uint256): 6, 0x60, 9, 7, "abcdefg" -> 6, 7, "d", 9
1614
// f_external(uint256,bytes,uint256): 6, 0x60, 9, 7, "abcdefg" -> 6, 7, "d", 9

test/libsolidity/semanticTests/abiEncoderV1/calldata_arrays_too_large.sol

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ contract C {
55
}
66
// ====
77
// compileToEwasm: also
8-
// compileViaYul: also
98
// ----
109
// f(uint256,uint256[],uint256): 6, 0x60, 9, 0x8000000000000000000000000000000000000000000000000000000000000002, 1, 2 -> FAILURE

test/libsolidity/semanticTests/abiEncoderV1/cleanup/cleanup.sol

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ contract C {
77
}
88
// ====
99
// ABIEncoderV1Only: true
10+
// compileViaYul: false
1011
// ----
1112
// f(uint16,int16,address,bytes3,bool): 1, 2, 3, "a", true -> 1, 2, 3, "a", true
1213
// f(uint16,int16,address,bytes3,bool): 0xffffff, 0x1ffff, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "abcd", 1 -> 0xffff, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffffffffffffff, "abc", true

test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ contract C {
88

99
// ====
1010
// compileToEwasm: also
11-
// compileViaYul: also
1211
// ----
1312
// f(uint256,uint256): 42, 23 -> 42, 23, 42, 23

test/libsolidity/semanticTests/abiEncoderV1/dynamic_arrays.sol

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ contract C {
44
return (b.length, b[a], c);
55
}
66
}
7-
// ====
8-
// compileViaYul: also
97
// ----
108
// f(uint256,uint16[],uint256): 6, 0x60, 9, 7, 11, 12, 13, 14, 15, 16, 17 -> 7, 17, 9

0 commit comments

Comments
 (0)