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

ERROR: unresolved reference to identifier _BITMASK_ADDRESS on ERC721A contracts #1610

Closed
odee30 opened this issue Jan 17, 2023 · 6 comments
Closed
Labels
bug Something isn't working High Priority

Comments

@odee30
Copy link

odee30 commented Jan 17, 2023

Describe the issue:

When using slither to check contracts that inherit from ERC721A we are getting the following error:

slither.exceptions.SlitherException: unresolved reference to identifier _BITMASK_ADDRESS
Error:
unresolved reference to identifier _BITMASK_ADDRESS

Code example to reproduce the issue:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "ERC721A/ERC721A.sol";

contract SlitherERC721AExample is ERC721A {
    constructor() ERC721A("SlitherERC721AExample", "o") {
    }
}

Version:

slither --version
0.9.2
solc --version
solc, the solidity compiler commandline interface
Version: 0.8.16+commit.07a7930e.Linux.g++

forge-std v1.2.0

Relevant log output:

`slither ./src/SlitherERC721AExample.sol 
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/slither/__main__.py", line 834, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/usr/lib/python3.10/site-packages/slither/__main__.py", line 98, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/usr/lib/python3.10/site-packages/slither/__main__.py", line 76, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/usr/lib/python3.10/site-packages/slither/slither.py", line 133, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/usr/lib/python3.10/site-packages/slither/slither.py", line 143, in _init_parsing_and_analyses
    raise e
  File "/usr/lib/python3.10/site-packages/slither/slither.py", line 139, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 519, in parse_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 629, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 728, in _analyze_variables_modifiers_functions
    contract.analyze_content_functions()
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/declarations/contract.py", line 416, in analyze_content_functions
    function_parser.analyze_content()
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 312, in analyze_content
    node_parser.analyze_expressions()
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 332, in analyze_expressions
    node.analyze_expressions()
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 65, in analyze_expressions
    expression = parse_yul(self._scope, self, self._unparsed_expression)
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 698, in parse_yul_assignment
    return _parse_yul_assignment_common(root, node, ast, "variableNames")
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 676, in _parse_yul_assignment_common
    rhs = parse_yul(root, node, ast["value"])
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 702, in parse_yul_function_call
    args = [parse_yul(root, node, arg) for arg in ast["arguments"]]
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 702, in <listcomp>
    args = [parse_yul(root, node, arg) for arg in ast["arguments"]]
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
  File "/usr/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 819, in parse_yul_identifier
    raise SlitherException(f"unresolved reference to identifier {name}")
slither.exceptions.SlitherException: unresolved reference to identifier _BITMASK_ADDRESS
Error:
unresolved reference to identifier _BITMASK_ADDRESS`
@odee30 odee30 added the bug-candidate Bugs reports that are not yet confirmed label Jan 17, 2023
@0xalpharush 0xalpharush added bug Something isn't working High Priority and removed bug-candidate Bugs reports that are not yet confirmed labels Jan 17, 2023
@odee30
Copy link
Author

odee30 commented Jan 17, 2023

For additional info, going back to v0.9.1 resolves the issue

@jaycenhorton
Copy link

Same issue. Repro here.

slither --version
0.9.2
solc-select versions
0.8.17 (current, set by /home/ubuntu/.solc-select/global-version)
solc --version
solc, the solidity compiler commandline interface
Version: 0.8.17+commit.8df45f5f.Linux.g++
Traceback (most recent call last):
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/__main__.py", line 834, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/__main__.py", line 98, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/__main__.py", line 76, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/slither.py", line 133, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/slither.py", line 143, in _init_parsing_and_analyses
    raise e
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/slither.py", line 139, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 519, in parse_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 629, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 728, in _analyze_variables_modifiers_functions
    contract.analyze_content_functions()
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/declarations/contract.py", line 416, in analyze_content_functions
    function_parser.analyze_content()
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/declarations/function.py", line 312, in analyze_content
    node_parser.analyze_expressions()
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 332, in analyze_expressions
    node.analyze_expressions()
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 65, in analyze_expressions
    expression = parse_yul(self._scope, self, self._unparsed_expression)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 698, in parse_yul_assignment
    return _parse_yul_assignment_common(root, node, ast, "variableNames")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 676, in _parse_yul_assignment_common
    rhs = parse_yul(root, node, ast["value"])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 702, in parse_yul_function_call
    args = [parse_yul(root, node, arg) for arg in ast["arguments"]]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 702, in <listcomp>
    args = [parse_yul(root, node, arg) for arg in ast["arguments"]]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.12.0a4/lib/python3.12/site-packages/slither/solc_parsing/yul/parse_yul.py", line 819, in parse_yul_identifier
    raise SlitherException(f"unresolved reference to identifier {name}")
slither.exceptions.SlitherException: unresolved reference to identifier _BITMASK_ADDRESS
Error:
unresolved reference to identifier _BITMASK_ADDRESS
Please report an issue to https://github.com/crytic/slither/issues


@montyly
Copy link
Member

montyly commented Jan 17, 2023

Hi. Thank you for reporting this. We will investigate this issue asap

@bwgh0
Copy link

bwgh0 commented Jan 25, 2023

Bump. I am also getting same bug with an ERC721A contract

@AlSirang
Copy link

AlSirang commented Feb 2, 2023

  • Contract type ERC721A

Slither version

$ slither --version
$ 0.9.2

Error message

Error:
unresolved reference to identifier _BITMASK_ADDRESS

@igingu
Copy link

igingu commented Feb 22, 2023

Hi! I am having the same issue as well, leaving more information in case it's needed

Solc version

solc --version
solc, the solidity compiler commandline interface
Version: 0.8.17+commit.8df45f5f.Linux.g++

Slither version

$ slither --version
$ 0.9.2

Steps to reproduce

git clone https://github.com/igingu/code-423n4-2022-12-caviar --recurse-submodules
yarn
foundryup
forge install
slither .

What I did to fix it

pip3 install slither-analyzer==0.9.1
slither --version
0.9.1
slither . ### no longer throws an error

Error message and stack trace

'forge build --build-info --force' running
Compiling 51 files with 0.8.17
Solc 0.8.17 finished in 7.37s
Compiler run successful

Traceback (most recent call last):
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/__main__.py", line 834, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/__main__.py", line 98, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/__main__.py", line 76, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/slither.py", line 133, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/slither.py", line 143, in _init_parsing_and_analyses
    raise e
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/slither.py", line 139, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 519, in parse_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 629, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 728, in _analyze_variables_modifiers_functions
    contract.analyze_content_functions()
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/declarations/contract.py", line 416, in analyze_content_functions
    function_parser.analyze_content()
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 312, in analyze_content
    node_parser.analyze_expressions()
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 332, in analyze_expressions
    node.analyze_expressions()
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 65, in analyze_expressions
    expression = parse_yul(self._scope, self, self._unparsed_expression)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 698, in parse_yul_assignment
    return _parse_yul_assignment_common(root, node, ast, "variableNames")
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 676, in _parse_yul_assignment_common
    rhs = parse_yul(root, node, ast["value"])
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 702, in parse_yul_function_call
    args = [parse_yul(root, node, arg) for arg in ast["arguments"]]
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 702, in <listcomp>
    args = [parse_yul(root, node, arg) for arg in ast["arguments"]]
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 857, in parse_yul
    op: Expression = parsers.get(ast["nodeType"], parse_yul_unsupported)(root, node, ast)
  File "/home/igingu/.local/lib/python3.10/site-packages/slither/solc_parsing/yul/parse_yul.py", line 819, in parse_yul_identifier
    raise SlitherException(f"unresolved reference to identifier {name}")
slither.exceptions.SlitherException: unresolved reference to identifier _BITMASK_ADDRESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working High Priority
Projects
None yet
Development

No branches or pull requests

7 participants