You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the example code, the Echidna printer fails. Removing the "-1" fixes it but the type inference also seems off (it says the constant is an uint112 while A is uint256?). Replacing the value of A by a numeric constant also fixes it.
Code example to reproduce the issue:
contractC {
uint256constant A =type(uint112).max;
function f() publicreturns (uint256) {
return A -1;
}
}
Version:
0.10.4
Relevant log output:
% slither foo.sol --print echidna
...
Traceback (most recent call last):
File "/opt/homebrew/bin/slither", line 8, in<module>sys.exit(main())
^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/__main__.py", line 776, in main
main_impl(all_detector_classes=detectors, all_printer_classes=printers)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/__main__.py", line 882, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/__main__.py", line 107, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/__main__.py", line 87, in process_single
return _process(slither, detector_classes, printer_classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/__main__.py", line 143, in _process
printer_results = slither.run_printers()
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/slither.py", line 302, in run_printers
return [p.output(self._crytic_compile.target).data forpin self._printers]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/printers/guidance/echidna.py", line 428, in output
(cst_used, cst_used_in_binary) = _extract_constants(contracts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/printers/guidance/echidna.py", line 259, in _extract_constants
_extract_constants_from_irs(
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/printers/guidance/echidna.py", line 201, in _extract_constants_from_irs
cst = ConstantFolding(ir.expression, type_).result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/constants_folding.py", line 52, in __init__
super().__init__(expression)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/expression.py", line 59, in __init__
self._visit_expression(self.expression)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/expression.py", line 76, in _visit_expression
visitor(expression)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/expression.py", line 87, in _visit_binary_operation
self._visit_expression(expression.expression_left)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/expression.py", line 78, in _visit_expression
self._post_visit(expression)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/expression.py", line 267, in _post_visit
self._post_identifier(expression)
File "/opt/homebrew/Cellar/slither-analyzer/0.10.4/libexec/lib/python3.12/site-packages/slither/visitors/expression/constants_folding.py", line 84, in _post_identifier
assert isinstance(expr, Literal)
^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
The text was updated successfully, but these errors were encountered:
Describe the issue:
With the example code, the Echidna printer fails. Removing the "-1" fixes it but the type inference also seems off (it says the constant is an uint112 while A is uint256?). Replacing the value of A by a numeric constant also fixes it.
Code example to reproduce the issue:
Version:
0.10.4
Relevant log output:
The text was updated successfully, but these errors were encountered: