Fix --enforce-gas-cost-min-value being applied only when the cost expectations are not provided in the test file

This commit is contained in:
Kamil Śliwak 2021-11-15 14:36:13 +01:00
parent cf52827107
commit 077b3a003d

View File

@ -565,14 +565,14 @@ bool SemanticTest::checkGasCostExpectation(TestFunctionCall& io_test, bool _comp
// We don't check gas if enforce gas cost is not active // We don't check gas if enforce gas cost is not active
// or test is run with abi encoder v1 only // or test is run with abi encoder v1 only
// or gas used less than threshold for enforcing feature // or gas used less than threshold for enforcing feature
// or the test has used up all available gas (test will fail anyway)
// or setting is "ir" and it's not included in expectations // or setting is "ir" and it's not included in expectations
// or if the called function is an isoltest builtin e.g. `smokeTest` or `storageEmpty` // or if the called function is an isoltest builtin e.g. `smokeTest` or `storageEmpty`
if ( if (
!m_enforceGasCost || !m_enforceGasCost ||
( m_gasUsed < m_enforceGasCostMinValue ||
(setting == "ir" || m_gasUsed < m_enforceGasCostMinValue || m_gasUsed >= m_gas) && m_gasUsed >= m_gas ||
io_test.call().expectations.gasUsed.count(setting) == 0 (setting == "ir" && io_test.call().expectations.gasUsed.count(setting) == 0) ||
) ||
io_test.call().kind == FunctionCall::Kind::Builtin io_test.call().kind == FunctionCall::Kind::Builtin
) )
return true; return true;