Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Ternary operation not handled new bytes #1813

Closed
0xdavinchee opened this issue Mar 30, 2023 · 3 comments
Closed

[Bug]: Ternary operation not handled new bytes #1813

0xdavinchee opened this issue Mar 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@0xdavinchee
Copy link

0xdavinchee commented Mar 30, 2023

Describe the issue:

I am getting a strange issue when attempting to run slither . --compile-force-framework truffle in packages/ethereum-contracts of this repo on the integrate-slither branch.

Code example to reproduce the issue:

Clone the repo at: https://github.com/superfluid-finance/protocol-monorepo/.
Checkout to integrate-slither branch.
Run slither . --compile-force-framework truffle in packages/ethereum-contracts.

Version:

0.9.3

Relevant log output:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 837, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 101, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 79, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 135, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 145, in _init_parsing_and_analyses
    raise e
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 141, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 518, in parse_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 628, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 727, in _analyze_variables_modifiers_functions
    contract.analyze_content_functions()
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/declarations/contract.py", line 418, in analyze_content_functions
    function_parser.analyze_content()
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/declarations/function.py", line 314, in analyze_content
    self._rewrite_ternary_as_if_else()
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/declarations/function.py", line 1349, in _rewrite_ternary_as_if_else
    st = SplitTernaryExpression(node.expression)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 65, in __init__
    self.copy_expression(expression, self.true_expression, self.false_expression)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 116, in copy_expression
    self.convert_call_expression(expression, next_expr, true_expression, false_expression)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 214, in convert_call_expression
    self.copy_expression(
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 116, in copy_expression
    self.convert_call_expression(expression, next_expr, true_expression, false_expression)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 214, in convert_call_expression
    self.copy_expression(
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 112, in copy_expression
    self.convert_expressions(expression, true_expression, false_expression)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 149, in convert_expressions
    self.copy_expression(
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 116, in copy_expression
    self.convert_call_expression(expression, next_expr, true_expression, false_expression)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 178, in convert_call_expression
    self.copy_expression(next_expr, true_expression.called, false_expression.called)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/utils/expression_manipulations.py", line 130, in copy_expression
    raise SlitherException(
slither.exceptions.SlitherException: Ternary operation not handled new bytes(<class 'slither.core.expressions.new_elementary_type.NewElementaryType'>)
ERROR:root:Error:
ERROR:root:Ternary operation not handled new bytes(<class 'slither.core.expressions.new_elementary_type.NewElementaryType'>)
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues
@0xdavinchee 0xdavinchee added the bug-candidate Bugs reports that are not yet confirmed label Mar 30, 2023
@hellwolf
Copy link

I can reproduce with 0.9.2 too.

@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Mar 31, 2023
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Ternary operation not handled new bytes [Bug]: Ternary operation not handled new bytes Mar 31, 2023
@hellwolf
Copy link

hellwolf commented May 5, 2023

I guess the fix will be available from 0.9.4?

@0xalpharush
Copy link
Contributor

@hellwolf Yes, it will be included in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants