Merge pull request #817 from crytic/dev-fix-0.8-type-parsing

Import type parsing for Solidity 0.8
pull/827/head
Feist Josselin 4 years ago committed by GitHub
commit cf07c59516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      setup.py
  2. 16
      slither/solc_parsing/solidity_types/type_parsing.py

@ -5,13 +5,13 @@ setup(
description="Slither is a Solidity static analysis framework written in Python 3.", description="Slither is a Solidity static analysis framework written in Python 3.",
url="https://github.com/crytic/slither", url="https://github.com/crytic/slither",
author="Trail of Bits", author="Trail of Bits",
version="0.7.0", version="0.7.1",
packages=find_packages(), packages=find_packages(),
python_requires=">=3.6", python_requires=">=3.6",
install_requires=[ install_requires=[
"prettytable>=0.7.2", "prettytable>=0.7.2",
"pysha3>=1.0.2", "pysha3>=1.0.2",
"crytic-compile>=0.1.12", "crytic-compile>=0.1.13",
# "crytic-compile", # "crytic-compile",
], ],
# dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], # dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"],

@ -14,6 +14,7 @@ from slither.core.solidity_types.mapping_type import MappingType
from slither.core.solidity_types.type import Type from slither.core.solidity_types.type import Type
from slither.core.solidity_types.user_defined_type import UserDefinedType from slither.core.solidity_types.user_defined_type import UserDefinedType
from slither.core.variables.function_type_variable import FunctionTypeVariable from slither.core.variables.function_type_variable import FunctionTypeVariable
from slither.exceptions import SlitherError
from slither.solc_parsing.exceptions import ParsingError from slither.solc_parsing.exceptions import ParsingError
if TYPE_CHECKING: if TYPE_CHECKING:
@ -291,6 +292,21 @@ def parse_type(t: Union[Dict, UnknownType], caller_context):
all_enums, all_enums,
) )
# Introduced with Solidity 0.8
if t[key] == "IdentifierPath":
if is_compact_ast:
return _find_from_type_name(
t["name"],
functions,
contracts,
structures_direct_access,
all_structures,
enums_direct_access,
all_enums,
)
raise SlitherError("Solidity 0.8 not supported with the legacy AST")
if t[key] == "ArrayTypeName": if t[key] == "ArrayTypeName":
length = None length = None
if is_compact_ast: if is_compact_ast:

Loading…
Cancel
Save