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

slither.solc_parsing.expressions.expression_parsing.VariableNotFound: Variable not found: _options #100

Closed
ggrieco-tob opened this issue Dec 11, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@ggrieco-tob
Copy link
Member

Slither crashes when analyzing this contract:

$ slither contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol 
INFO:Slither:Compilation warnings/errors on contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:40:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
    function Survey(address tokenAddress, uint duration, string _question, bytes32[] _responseOptions) {
    ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:62:9: Warning: Use of the "var" keyword is deprecated.
        var tokenId = devcon2Token.ownedToken(msg.sender);
        ^---------^
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:66:29: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
        if (tokenId == 0x0) throw;
                            ^---^
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:89:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
    function MainnetSurvey(uint duration, string _question, bytes32[] _responseOptions) Survey(0xabf65a51c7adc3bdef0adf8992884be38072c184, duration, _question, _responseOptions) {
    ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:95:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
    function ETCSurvey() MainnetSurvey(
    ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:1:1: Warning: Source file does not specify required compiler version!Consider adding "pragma solidity ^0.4.25;"
contract Devcon2Interface {
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:77:9: Warning: Invoking events without "emit" prefix is deprecated.
        Response(tokenId, responseId);
        ^---------------------------^
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:89:96: Warning: This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'. Correct checksummed address: '0xaBF65A51c7aDC3BDef0Adf8992884be38072c184'. For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals
 ... 0xabf65a51c7adc3bdef0adf8992884be38072c184 ... 
     ^----------------------------------------^
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:2:5: Warning: No visibility specified. Defaulting to "public". 
    function isTokenOwner(address _owner) constant returns (bool);
    ^------------------------------------------------------------^
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:3:5: Warning: No visibility specified. Defaulting to "public". 
    function ownedToken(address _owner) constant returns (bytes32 tokenId);
    ^---------------------------------------------------------------------^
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:40:5: Warning: No visibility specified. Defaulting to "public". 
    function Survey(address tokenAddress, uint duration, string _question, bytes32[] _responseOptions) {
    ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:52:5: Warning: No visibility specified. Defaulting to "public". 
    function respond(uint responseId) returns (bool) {
    ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:89:5: Warning: No visibility specified. Defaulting to "public". 
    function MainnetSurvey(uint duration, string _question, bytes32[] _responseOptions) Survey(0xabf65a51c7adc3bdef0adf8992884be38072c184, duration, _question, _responseOptions) {
    ^ (Relevant source part starts here and spans across multiple lines).
contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.sol:95:5: Warning: No visibility specified. Defaulting to "public". 
    function ETCSurvey() MainnetSurvey(
    ^ (Relevant source part starts here and spans across multiple lines).

ERROR:root:Error in contracts/0xdb6d68e1d8c3f69d32e2d83065492e502b4c67ba_ETCSurvey.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 811, in analyze_content
    self._parse_modifier(child)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/declarations/function.py", line 757, in _parse_modifier
    m = parse_expression(modifier, self)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/expressions/expression_parsing.py", line 548, in parse_expression
    arguments = [parse_expression(a, caller_context) for a in children[1::]]
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/expressions/expression_parsing.py", line 548, in <listcomp>
    arguments = [parse_expression(a, caller_context) for a in children[1::]]
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/expressions/expression_parsing.py", line 418, in parse_expression
    var = find_variable(value, caller_context, referenced_declaration)
  File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/expressions/expression_parsing.py", line 131, in find_variable
    raise VariableNotFound('Variable not found: {}'.format(var_name))
slither.solc_parsing.expressions.expression_parsing.VariableNotFound: Variable not found: _options
@ggrieco-tob ggrieco-tob added the bug Something isn't working label Dec 11, 2018
@montyly
Copy link
Member

montyly commented Dec 12, 2018

Fixed in master

@montyly montyly closed this as completed Dec 12, 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

2 participants