Skip to content

Commit 5fe3173

Browse files
authored
Merge pull request #14844 from ethereum/allow-enforcing-gas-costs-with-non-standard-settings
Allow enforcing gas expectations with non-standard settings
2 parents 00a54f8 + c7549de commit 5fe3173

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

Diff for: test/Common.cpp

+9-11
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,16 @@ void CommonOptions::validate() const
143143
"Selected batch has to be less than number of batches."
144144
);
145145

146-
if (enforceGasTest)
146+
if (!enforceGasTest)
147+
cout << endl << "WARNING :: Gas cost expectations are not being enforced" << endl << endl;
148+
else if (evmVersion() != langutil::EVMVersion{} || useABIEncoderV1)
147149
{
148-
assertThrow(
149-
evmVersion() == langutil::EVMVersion{},
150-
ConfigException,
151-
"Gas costs can only be enforced on latest evm version."
152-
);
153-
assertThrow(
154-
useABIEncoderV1 == false,
155-
ConfigException,
156-
"Gas costs can only be enforced on abi encoder v2."
157-
);
150+
cout << endl << "WARNING :: Enforcing gas cost expectations with non-standard settings:" << endl;
151+
if (evmVersion() != langutil::EVMVersion{})
152+
cout << "- EVM version: " << evmVersion().name() << " (default: " << langutil::EVMVersion{}.name() << ")" << endl;
153+
if (useABIEncoderV1)
154+
cout << "- ABI coder: v1 (default: v2)" << endl;
155+
cout << endl << "DO NOT COMMIT THE UPDATED EXPECTATIONS." << endl << endl;
158156
}
159157
}
160158

Diff for: test/soltest.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,6 @@ test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])
238238
if (solidity::test::CommonOptions::get().disableSemanticTests)
239239
cout << endl << "--- SKIPPING ALL SEMANTICS TESTS ---" << endl << endl;
240240

241-
if (!solidity::test::CommonOptions::get().enforceGasTest)
242-
cout << endl << "WARNING :: Gas Cost Expectations are not being enforced" << endl << endl;
243-
244241
Batcher batcher(CommonOptions::get().selectedBatch, CommonOptions::get().batches);
245242
if (CommonOptions::get().batches > 1)
246243
cout << "Batch " << CommonOptions::get().selectedBatch << " out of " << CommonOptions::get().batches << endl;

Diff for: test/tools/isoltest.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,6 @@ int main(int argc, char const *argv[])
448448
if (options.disableSemanticTests)
449449
cout << endl << "--- SKIPPING ALL SEMANTICS TESTS ---" << endl << endl;
450450

451-
if (!options.enforceGasTest)
452-
cout << "WARNING :: Gas Cost Expectations are not being enforced" << endl << endl;
453-
454451
TestStats global_stats{0, 0};
455452
cout << "Running tests..." << endl << endl;
456453

0 commit comments

Comments
 (0)