Open arxenix opened 5 years ago
This is a bit different now. The above example will compile and run with slither (though its correctness may not be adequate, not sure). Here is an example of what will analyze without error, and what will throw an exception for more context:
contract NonProblematic {
function f() public returns(uint) {
uint x;
(x, ) = (7, 7);
return x;
}
}
contract Problematic {
function f() public returns(uint) {
uint x;
(((x, ), )) = ((7, 7) ,7);
return x;
}
}
Exception:
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\github\slither\slither\__main__.py", line 67, in process_all
(slither, current_results_detectors, current_results_printers, current_analyzed_count) = process_single(
File "c:\users\x\documents\github\slither\slither\__main__.py", line 53, in process_single
slither = Slither(target,
File "c:\users\x\documents\github\slither\slither\slither.py", line 86, in __init__
self._parser.analyze_contracts()
File "c:\users\x\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 345, in analyze_contracts
self._convert_to_slithir()
File "c:\users\x\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 489, in _convert_to_slithir
func.generate_slithir_and_analyze()
File "c:\users\x\documents\github\slither\slither\core\declarations\function.py", line 1652, in generate_slithir_and_analyze
node.slithir_generation()
File "c:\users\x\documents\github\slither\slither\core\cfg\node.py", line 702, in slithir_generation
self._irs = convert_expression(expression, self)
File "c:\users\x\documents\github\slither\slither\slithir\convert.py", line 64, in convert_expression
visitor = ExpressionToSlithIR(expression, node)
File "c:\users\x\documents\github\slither\slither\visitors\slithir\expression_to_slithir.py", line 103, in __init__
self._visit_expression(self.expression)
File "c:\users\x\documents\github\slither\slither\visitors\expression\expression.py", line 95, in _visit_expression
self._post_visit(expression)
File "c:\users\x\documents\github\slither\slither\visitors\expression\expression.py", line 265, in _post_visit
self._post_assignement_operation(expression)
File "c:\users\x\documents\github\slither\slither\visitors\slithir\expression_to_slithir.py", line 122, in _post_assignement_operation
operation = convert_assignment(left[idx], right[idx], expression.type, expression.expression_return_type)
File "c:\users\x\documents\github\slither\slither\visitors\slithir\expression_to_slithir.py", line 72, in convert_assignment
return Assignment(left, right, return_type)
File "c:\users\x\documents\github\slither\slither\slithir\operations\assignment.py", line 13, in __init__
assert is_valid_lvalue(left_variable)
AssertionError
Slither fails to parse certain tuple assignment expressions such as:
(uint y, ) = (1,2);
I believe the only broken case is where you have a partial assignment tuple on the LHS and a tuple literal on the RHS