Skip to content

Conversation

@nisedo
Copy link
Contributor

@nisedo nisedo commented Dec 2, 2025

Summary

The add_refers_to method in LocalIRVariable was failing with an AssertionError during SSA generation when the rvalue was a TopLevelVariable (file-level constant/immutable).

This fix expands the assertion to accept TopLevelVariable in addition to the existing SlithIRVariable and TemporaryVariable types.

Details

  • Root cause: When analyzing contracts that reference file-level constants/immutables in storage pointer contexts, the SSA generation passes a TopLevelVariable to add_refers_to, which only accepted SlithIRVariable and TemporaryVariable.

  • Similar precedent: PR Fixed issue which disallowed using operator[] with TopLevelVariables #1968 fixed a similar issue where TopLevelVariable wasn't supported in other slithir operations (index.py, reference.py).

@nisedo nisedo requested a review from smonicas as a code owner December 2, 2025 09:05
The add_refers_to method in LocalIRVariable was failing with an
AssertionError during SSA generation when the rvalue was a
TopLevelVariable (file-level constant/immutable).

This fix expands the assertion to accept TopLevelVariable in
addition to the existing SlithIRVariable and TemporaryVariable types.
@nisedo nisedo force-pushed the fix/ssa-add-refers-to-assertion branch from b962ec1 to f5056e4 Compare December 2, 2025 09:21
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.

2 participants