crytic / crytic/slither

[Bug-Candidate]: Failed to convert IR to SSA for Initializable contract.

Open
#2,491 2 comments 1 reaction 0 assignees View on GitHub
bug-candidate
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

When trying to run slither locally against a repo that works with slither actions v4 on github, I get a strange failure.

### Code example to reproduce the issue:

Contract not public yet, but using solady Initializable, UUPSUpgradeable

### Version:

0.10.3

### Relevant log output:

```shell
/.solc-select/artifacts/solc-0.8.26/solc-0.8.26 forge-std/=lib/forge-std/src/ solady/=lib/solady/src/ src/Chaos.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes --optimize --optimize-runs 200 --via-ir --evm-version paris --allow-paths .,/Users/me/Code/MyProjects/warlock/warlock-chaos/src' running
ERROR:SlitherSolcParsing:
Failed to convert IR to SSA for Initializable contract. Please open an issue https://github.com/crytic/slither/issues.

Traceback (most recent call last):
File "/opt/homebrew/bin/slither", line 8, in
sys.exit(main())
File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 782, in main
main_impl(all_detector_classes=detectors, all_printer_classes=printers)
File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 888, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 113, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 80, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 202, in __init__
self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 221, in _init_parsing_and_analyses
raise e
File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 217, in _init_parsing_and_analyses
parser.analyze_contracts()
File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 593, in analyze_contracts
self._convert_to_slithir()
File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 834, in _convert_to_slithir
raise e
File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 829, in _convert_to_slithir
contract.convert_expression_to_slithir_ssa()
File "/opt/homebrew/lib/python3.10/site-packages/slither/core/declarations/contract.py", line 1577, in convert_expression_to_slithir_ssa
func.generate_slithir_ssa(all_ssa_state_variables_instances)
File "/opt/homebrew/lib/python3.10/site-packages/slither/core/declarations/function_contract.py", line 140, in generate_slithir_ssa
add_ssa_ir(self, all_ssa_state_variables_instances)
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 206, in add_ssa_ir
fix_phi_rvalues_and_storage_ref(
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 526, in fix_phi_rvalues_and_storage_ref
fix_phi_rvalues_and_storage_ref(
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 526, in fix_phi_rvalues_and_storage_ref
fix_phi_rvalues_and_storage_ref(
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 526, in fix_phi_rvalues_and_storage_ref
fix_phi_rvalues_and_storage_ref(
[Previous line repeated 4 more times]
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 496, in fix_phi_rvalues_and_storage_ref
variables = [
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 497, in
last_name(dst, ir.lvalue, init_local_variables_instances) for dst in ir.nodes
File "/opt/homebrew/lib/python3.10/site-packages/slither/slithir/utils/ssa.py", line 363, in last_name
assert candidates
AssertionError
```

Contributor guide

Open the contributing guide

Research direction

Reproduce with Slither 0.10.3 against a project using solady Initializable/UUPSUpgradeable and solc 0.8.26 with --via-ir. Trace slither/slithir/utils/ssa.py, especially fix_phi_rvalues_and_storage_ref and last_name, from the reported AssertionError; done means conversion no longer fails and the regression is covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, solidity
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.