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

Exception: Ternary operation not handled #98

Closed
ggrieco-tob opened this issue Dec 11, 2018 · 0 comments
Closed

Exception: Ternary operation not handled #98

ggrieco-tob opened this issue Dec 11, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@ggrieco-tob
Copy link
Member

Slither crashes when analyzing this contract:

$ slither contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol 
INFO:Slither:Compilation warnings/errors on contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:27:2: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
	function DeDeMasterContract(address _dedeNetworkAddress){
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:61:3: Warning: Use of the "var" keyword is deprecated.
		var _dede = DeDeContract(dede);
		^-------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:72:3: Warning: Use of the "var" keyword is deprecated.
		var _dede = DeDeContract(dede);
		^-------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:109:2: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
	function DeDeContract(address _dip, address _scs, address _issuer, uint256 _targetAmount, uint256 _bulletAmount, address _targetAddress, address _bulletAddress, uint256 _validationTime) payable {
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:58:3: Warning: Invoking events without "emit" prefix is deprecated.
		Issue(msg.sender, dedeNetworkAddress, _issuer, dede);
		^--------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:69:3: Warning: Invoking events without "emit" prefix is deprecated.
		Activate(_dede.dip(), _dede.scs(), _dede.issuer(), dede);
		^------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:80:3: Warning: Invoking events without "emit" prefix is deprecated.
		Nullify(_dede.dip(), _dede.scs(), _dede.issuer(), dede);
		^-----------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:137:4: Warning: "suicide" has been deprecated in favour of "selfdestruct"
			suicide(dip); // force send bullet ether to dip
			^----------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:141:4: Warning: "suicide" has been deprecated in favour of "selfdestruct"
			suicide(scs); // force send target or leftover ether to scs
			^----------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:152:3: Warning: "suicide" has been deprecated in favour of "selfdestruct"
		suicide(dip);
		^----------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:4:2: Warning: No visibility specified. Defaulting to "public". 
	function totalSupply() constant returns (uint supply);
	^----------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:5:2: Warning: No visibility specified. Defaulting to "public". 
	function balanceOf(address _owner) constant returns (uint balance);
	^-----------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:6:2: Warning: No visibility specified. Defaulting to "public". 
	function transfer(address _to, uint _value) returns (bool success);
	^-----------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:7:2: Warning: No visibility specified. Defaulting to "public". 
	function transferFrom(address _from, address _to, uint _value) returns (bool success);
	^------------------------------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:8:2: Warning: No visibility specified. Defaulting to "public". 
	function approve(address _spender, uint _value) returns (bool success);
	^---------------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:9:2: Warning: No visibility specified. Defaulting to "public". 
	function allowance(address _owner, address _spender) constant returns (uint remaining);
	^-------------------------------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:27:2: Warning: No visibility specified. Defaulting to "public". 
	function DeDeMasterContract(address _dedeNetworkAddress){
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:32:2: Warning: No visibility specified. Defaulting to "public". 
	function changeDedeAddress(address newDedeAddress){
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:37:2: Warning: No visibility specified. Defaulting to "public". 
	function issue(uint256 _targetAmount, uint256 _bulletAmount, address _targetAddress, address _bulletAddress, uint256 _validationTime, address _issuer) payable {
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:60:2: Warning: No visibility specified. Defaulting to "public". 
	function activate(address dede) payable {
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:71:2: Warning: No visibility specified. Defaulting to "public". 
	function nullify(address dede){
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:109:2: Warning: No visibility specified. Defaulting to "public". 
	function DeDeContract(address _dip, address _scs, address _issuer, uint256 _targetAmount, uint256 _bulletAmount, address _targetAddress, address _bulletAddress, uint256 _validationTime) payable {
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:126:2: Warning: No visibility specified. Defaulting to "public". 
	function activate(address sender) payable {
 ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:144:2: Warning: No visibility specified. Defaulting to "public". 
	function nullify(address sender) {
 ^ (Relevant source part starts here and spans across multiple lines).

ERROR:root:Error in contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol
ERROR:root:Traceback (most recent call last):
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/__main__.py", line 226, in main_impl
    (results, number_contracts) = process(filename, args, detector_classes, printer_classes)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/__main__.py", line 35, in process
    slither = Slither(filename, args.solc, args.disable_solc_warnings, args.solc_args, ast)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/slither.py", line 41, in __init__
    self._analyze_contracts()
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/slitherSolc.py", line 187, in _analyze_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/slitherSolc.py", line 269, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/slitherSolc.py", line 309, in _analyze_variables_modifiers_functions
    contract.analyze_content_functions()
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/declarations/contract.py", line 347, in analyze_content_functions
    function.analyze_content()
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/declarations/function.py", line 825, in analyze_content
    st = SplitTernaryExpression(node.expression)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 48, in __init__
    self.copy_expression(expression, self.true_expression, self.false_expression)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 90, in copy_expression
    false_expression.expressions[-1])
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 100, in copy_expression
    false_expression.called)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 100, in copy_expression
    false_expression.called)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 79, in copy_expression
    false_expression.expression)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 90, in copy_expression
    false_expression.expressions[-1])
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 120, in copy_expression
    raise Exception('Ternary operation not handled {}({})'.format(expression, type(expression)))
Exception: Ternary operation not handled new DeDeContract(<class 'slither.core.expressions.new_contract.NewContract'>)
@ggrieco-tob ggrieco-tob added the bug Something isn't working label Dec 11, 2018
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

1 participant