Skip to content

[mlir][Sol] Make sol.revert's signature attribute optional - #133

Merged
PavelKopyl merged 1 commit into
mainfrom
kpv-fix-rever-sign
Jul 28, 2026
Merged

[mlir][Sol] Make sol.revert's signature attribute optional#133
PavelKopyl merged 1 commit into
mainfrom
kpv-fix-rever-sign

Conversation

@PavelKopyl

@PavelKopyl PavelKopyl commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

NomicFoundation/solx-solidity#169

Distinguish revert() and revert(""). Lower revert("") to an ABI-encoded Error(""), while lowering revert() to a bare revert(0, 0).

@abinavpp
abinavpp force-pushed the app-dispatcher-revert-strings branch 7 times, most recently from 5b8b157 to 8f57970 Compare July 28, 2026 12:55
Base automatically changed from app-dispatcher-revert-strings to main July 28, 2026 12:55
Distinguish revert() and revert(""). Lower revert("") to an
ABI-encoded Error(""), while lowering revert() to a bare revert(0, 0).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Sol dialect sol.revert operation to make its signature attribute optional, allowing the IR to represent plain revert() distinctly from revert(""), and adapts the Sol→Yul lowering accordingly.

Changes:

  • Make sol.revert’s signature an OptionalAttr<StrAttr> and adjust the textual assembly format to allow omission.
  • Update RevertOpLowering to treat “absent signature” as revert() and “present (even empty) signature” as revert("reason").

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
mlir/lib/Conversion/SolToYul/SolToYul.cpp Updates sol.revert lowering to handle optional signatures and preserve the empty-reason vs no-reason distinction.
mlir/include/mlir/Dialect/Sol/SolOps.td Makes signature optional for sol.revert and updates the op’s assembly format/documentation accordingly.
Comments suppressed due to low confidence (1)

mlir/include/mlir/Dialect/Sol/SolOps.td:545

  • There are currently no MLIR/lit tests covering sol.revert parsing/printing or the semantic distinction between revert(), revert(""), and revert("reason"). Since this PR changes the textual assembly format and the meaning of an absent vs empty signature, adding a round-trip test would help prevent regressions.
  let arguments = (ins Variadic<AnyType>:$args,
                       OptionalAttr<StrAttr>:$signature, UnitAttr:$call);

  let assemblyFormat = "($signature^)? ($args^ `:` type($args))? attr-dict";
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mlir/lib/Conversion/SolToYul/SolToYul.cpp
Comment thread mlir/include/mlir/Dialect/Sol/SolOps.td

@abinavpp abinavpp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you!

@PavelKopyl
PavelKopyl merged commit 7d0702e into main Jul 28, 2026
5 checks passed
@PavelKopyl
PavelKopyl deleted the kpv-fix-rever-sign branch July 28, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants