Skip to content

Commit

Permalink
Merge pull request #14844 from ethereum/allow-enforcing-gas-costs-wit…
Browse files Browse the repository at this point in the history
…h-non-standard-settings

Allow enforcing gas expectations with non-standard settings
  • Loading branch information
nikola-matic authored Feb 13, 2024
2 parents 00a54f8 + c7549de commit 5fe3173
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
20 changes: 9 additions & 11 deletions test/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,16 @@ void CommonOptions::validate() const
"Selected batch has to be less than number of batches."
);

if (enforceGasTest)
if (!enforceGasTest)
cout << endl << "WARNING :: Gas cost expectations are not being enforced" << endl << endl;
else if (evmVersion() != langutil::EVMVersion{} || useABIEncoderV1)
{
assertThrow(
evmVersion() == langutil::EVMVersion{},
ConfigException,
"Gas costs can only be enforced on latest evm version."
);
assertThrow(
useABIEncoderV1 == false,
ConfigException,
"Gas costs can only be enforced on abi encoder v2."
);
cout << endl << "WARNING :: Enforcing gas cost expectations with non-standard settings:" << endl;
if (evmVersion() != langutil::EVMVersion{})
cout << "- EVM version: " << evmVersion().name() << " (default: " << langutil::EVMVersion{}.name() << ")" << endl;
if (useABIEncoderV1)
cout << "- ABI coder: v1 (default: v2)" << endl;
cout << endl << "DO NOT COMMIT THE UPDATED EXPECTATIONS." << endl << endl;
}
}

Expand Down
3 changes: 0 additions & 3 deletions test/soltest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])
if (solidity::test::CommonOptions::get().disableSemanticTests)
cout << endl << "--- SKIPPING ALL SEMANTICS TESTS ---" << endl << endl;

if (!solidity::test::CommonOptions::get().enforceGasTest)
cout << endl << "WARNING :: Gas Cost Expectations are not being enforced" << endl << endl;

Batcher batcher(CommonOptions::get().selectedBatch, CommonOptions::get().batches);
if (CommonOptions::get().batches > 1)
cout << "Batch " << CommonOptions::get().selectedBatch << " out of " << CommonOptions::get().batches << endl;
Expand Down
3 changes: 0 additions & 3 deletions test/tools/isoltest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,6 @@ int main(int argc, char const *argv[])
if (options.disableSemanticTests)
cout << endl << "--- SKIPPING ALL SEMANTICS TESTS ---" << endl << endl;

if (!options.enforceGasTest)
cout << "WARNING :: Gas Cost Expectations are not being enforced" << endl << endl;

TestStats global_stats{0, 0};
cout << "Running tests..." << endl << endl;

Expand Down

0 comments on commit 5fe3173

Please sign in to comment.