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

ParsingError with solidity's custom errors #893

Closed
donguks opened this issue Jul 13, 2021 · 8 comments
Closed

ParsingError with solidity's custom errors #893

donguks opened this issue Jul 13, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@donguks
Copy link

donguks commented Jul 13, 2021

Hi team!
I'm introducing slither for my company's contract security. This project is really cool!

Solidity 0.8.4 adds a new feature, Custom errors.
If slither . command is executed on contracts including the Custom Errors, a parsing error is thrown

Traceback (most recent call last):
  File "**/mypy3/lib/python3.8/site-packages/slither/__main__.py", line 723, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "**/mypy3/lib/python3.8/site-packages/slither/__main__.py", line 82, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "**/mypy3/lib/python3.8/site-packages/slither/__main__.py", line 65, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "**/mypy3/lib/python3.8/site-packages/slither/slither.py", line 81, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "**/mypy3/lib/python3.8/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 169, in parse_top_level_from_loaded_json
    contract_parser = ContractSolc(self, contract, top_level_data)
  File "**/mypy3/lib/python3.8/site-packages/slither/solc_parsing/declarations/contract.py", line 68, in __init__
    self._parse_contract_items()
  File "**/mypy3/lib/python3.8/site-packages/slither/solc_parsing/declarations/contract.py", line 250, in _parse_contract_items
    raise ParsingError("Unknown contract item: " + item[self.get_key()])
slither.solc_parsing.exceptions.ParsingError: Unknown contract item: ErrorDefinition
ERROR:root:Error:
ERROR:root:Unknown contract item: ErrorDefinition
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues

ErrorDefinition is class for the Custom Error of Solidity.

Thanks

@montyly montyly added the enhancement New feature or request label Aug 6, 2021
montyly added a commit that referenced this issue Sep 22, 2021
- Create a new CustomError core object, and associated parsing classes
- Create a specific solidity funciton to handle the revert CustomError
call
- Fix #919, Fix #893
@montyly montyly closed this as completed in df10629 Dec 2, 2021
@montyly
Copy link
Member

montyly commented Dec 2, 2021

Hi @donguks , we added the support for custom error in (#947), it will be available with the upcoming release (#979)

@donguks
Copy link
Author

donguks commented Dec 2, 2021

@montyly
Cool!

@FatemehHeidari
Copy link

I installed slither yesterday and I receive the same error. Is it supposed to be resolved?

@dguido
Copy link
Member

dguido commented Dec 9, 2021

The release is coming this week, but you can build Slither from the master branch and it should work.

@FatemehHeidari
Copy link

Great thanks

@viraj124
Copy link

@dguido on Re Installing I got this since I am using custom errors and my slither version was old
`error: Setup script exited with error: SandboxViolation: mkdir('/private/var/root/Library/Caches/com.apple.python/private', 511)
any other process to get the new version installed ?

@dannyposi
Copy link

@montyly Maybe this is same problem, please help to check

Traceback (most recent call last):
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 84, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 67, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 97, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 179, in parse_top_level_from_loaded_json
    contract_parser = ContractSolc(self, contract, top_level_data)
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/declarations/contract.py", line 73, in __init__
    self._parse_contract_items()
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/declarations/contract.py", line 257, in _parse_contract_items
    raise ParsingError("Unknown contract item: " + item[self.get_key()])
slither.solc_parsing.exceptions.ParsingError: Unknown contract item: UserDefinedValueTypeDefinition

@enderphan94
Copy link
Contributor

I'm still getting this error :

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/__main__.py", line 723, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/__main__.py", line 82, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/__main__.py", line 65, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/slither.py", line 81, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/solc_parsing/slither_compilation_unit_solc.py", line 169, in parse_top_level_from_loaded_json
    contract_parser = ContractSolc(self, contract, top_level_data)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/solc_parsing/declarations/contract.py", line 68, in __init__
    self._parse_contract_items()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slither_analyzer-0.8.0-py3.7.egg/slither/solc_parsing/declarations/contract.py", line 250, in _parse_contract_items
    raise ParsingError("Unknown contract item: " + item[self.get_key()])
slither.solc_parsing.exceptions.ParsingError: Unknown contract item: ErrorDefinition
ERROR:root:Error:
ERROR:root:Unknown contract item: ErrorDefinition
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues

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

No branches or pull requests

7 participants