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 fails on structs definition outside the contract #520

Closed
sobolev-igor opened this issue Jun 24, 2020 · 2 comments
Closed

Slither fails on structs definition outside the contract #520

sobolev-igor opened this issue Jun 24, 2020 · 2 comments

Comments

@sobolev-igor
Copy link
Contributor

sobolev-igor commented Jun 24, 2020

Hello!

Since Solidity version 0.6.0, structs and enums may be declared outside the contract. I have such structs declaration in my project and Slither fails with the following error

ERROR:root:Traceback (most recent call last):
  File "/home/igor/.local/lib/python3.8/site-packages/slither/__main__.py", line 604, in main_impl
    (slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
  File "/home/igor/.local/lib/python3.8/site-packages/slither/__main__.py", line 67, in process_all
    (slither, current_results_detectors, current_results_printers, current_analyzed_count) = process_single(
  File "/home/igor/.local/lib/python3.8/site-packages/slither/__main__.py", line 53, in process_single
    slither = Slither(target,
  File "/home/igor/.local/lib/python3.8/site-packages/slither/slither.py", line 66, in __init__
    self._parse_contracts_from_loaded_json(ast, path)
  File "/home/igor/.local/lib/python3.8/site-packages/slither/solc_parsing/slitherSolc.py", line 105, in _parse_contracts_from_loaded_json
    assert contract_data[self.get_key()] in ['ContractDefinition', 'PragmaDirective', 'ImportDirective']
AssertionError

I suppose there should be smth like 'StructDefinition' and 'EnumDefinition' in the list at the end of the traceback.

@montyly
Copy link
Member

montyly commented Jun 24, 2020

Hi @sobolev-igor. Thank you for reporting this.

We recently added the support in #499, but I just realize that there is a bug in Truffle that will prevent Slither from working.

I have reported the issue here: trufflesuite/truffle#3124

@sobolev-igor
Copy link
Contributor Author

Hi, @montyly !

Thanks for the investigation and opened issue. I'm looking forward to the fix 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants