Skip to content

Commit f761ded

Browse files
Do not remove custom errors in IR pipeline when strip revert strings is requested
1 parent 9386d87 commit f761ded

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Compiler Features:
1313

1414
Bugfixes:
1515
* Yul EVM Code Transform: Improve stack shuffler performance by fixing a BFS deduplication issue.
16+
* Yul IR Code Generation: Preserve custom error argument of `require` when option `revert-strings=strip` is selected.
1617

1718

1819
### 0.8.34 (2026-02-18)

libsolidity/codegen/ir/IRGeneratorForStatements.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
11581158
solAssert(arguments.size() > 0, "Expected at least one parameter for require/assert");
11591159
solAssert(arguments.size() <= 2, "Expected no more than two parameters for require/assert");
11601160

1161-
Type const* messageArgumentType =
1162-
arguments.size() > 1 && m_context.revertStrings() != RevertStrings::Strip ?
1163-
arguments[1]->annotation().type :
1164-
nullptr;
1161+
Type const* messageArgumentType = arguments.size() > 1 ? arguments[1]->annotation().type : nullptr;
11651162

11661163
auto const* magicType = dynamic_cast<MagicType const*>(messageArgumentType);
11671164
if (magicType && magicType->kind() == MagicType::Kind::Error)
@@ -1175,6 +1172,9 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
11751172
}
11761173
else
11771174
{
1175+
// This option only remove strings, not custom errors
1176+
if (m_context.revertStrings() == RevertStrings::Strip)
1177+
messageArgumentType = nullptr;
11781178
ASTPointer<Expression const> stringArgumentExpression = messageArgumentType ? arguments[1] : nullptr;
11791179
std::string requireOrAssertFunction = m_utils.requireOrAssertFunction(
11801180
functionType->kind() == FunctionType::Kind::Assert,

0 commit comments

Comments
 (0)