Omit require revert strings in IR code generator.

This commit is contained in:
chriseth 2021-01-18 18:47:55 +01:00
parent 87a68feea1
commit a3ee334b42
2 changed files with 28 additions and 22 deletions

View File

@ -1057,7 +1057,10 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
solAssert(arguments.size() > 0, "Expected at least one parameter for require/assert");
solAssert(arguments.size() <= 2, "Expected no more than two parameters for require/assert");
Type const* messageArgumentType = arguments.size() > 1 ? arguments[1]->annotation().type : nullptr;
Type const* messageArgumentType =
arguments.size() > 1 && m_context.revertStrings() != RevertStrings::Strip ?
arguments[1]->annotation().type :
nullptr;
string requireOrAssertFunction = m_utils.requireOrAssertFunction(
functionType->kind() == FunctionType::Kind::Assert,
messageArgumentType

View File

@ -5696,6 +5696,8 @@ BOOST_AUTO_TEST_CASE(strip_reason_strings)
}
}
)";
ALSO_VIA_YUL(
DISABLE_EWASM_TESTRUN()
m_revertStrings = RevertStrings::Default;
compileAndRun(sourceCode, 0, "C");
@ -5719,6 +5721,7 @@ BOOST_AUTO_TEST_CASE(strip_reason_strings)
ABI_CHECK(callContractFunction("f1(bool)", false), encodeArgs());
ABI_CHECK(callContractFunction("g1(bool)", true), encodeArgs(10));
ABI_CHECK(callContractFunction("g1(bool)", false), encodeArgs());
)
}
BOOST_AUTO_TEST_SUITE_END()