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

[Bug]: Slither cannot process file aliases #2309

Closed
Tiko7454 opened this issue Feb 15, 2024 · 1 comment
Closed

[Bug]: Slither cannot process file aliases #2309

Tiko7454 opened this issue Feb 15, 2024 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@Tiko7454
Copy link
Contributor

Describe the issue:

When I aliased a file, I cannot access its contracts using alias.contract notation

Code example to reproduce the issue:

# a.sol
pragma solidity 0.7.6;
import "b.sol" as B;
contract A is B.C{}
# b.sol
pragma solidity 0.7.6;
contract C{}

Version:

0.10.0

Relevant log output:

'solc --version' running
'solc a.sol --combined-json abi,ast,bin,bin-runtime,srcmap,srcmap-runtime,userdoc,devdoc,hashes,compact-format --allow-paths .,/home/tigran/temp/reduced' running
Compilation warnings/errors on a.sol:
Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> a.sol

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> b.sol

Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.7.6;"
--> b.sol

Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.7.6;"
--> a.sol


Traceback (most recent call last):
  File "/home/tigran/Projects/integrator/query-engine/venv/bin/slither", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 727, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 833, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/slither.py", line 144, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/slither.py", line 154, in _init_parsing_and_analyses
    raise e
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/slither.py", line 150, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/home/tigran/Projects/integrator/query-engine/venv/lib/python3.11/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 449, in parse_contracts
    assert target, f"Contract {contract_name} not found"
AssertionError: Contract B.C not found
@Tiko7454 Tiko7454 added the bug-candidate Bugs reports that are not yet confirmed label Feb 15, 2024
@0xalpharush
Copy link
Member

This is not currently supported and being tracked in #1452

@0xalpharush 0xalpharush added bug Something isn't working duplicate This issue or pull request already exists and removed bug-candidate Bugs reports that are not yet confirmed labels Feb 15, 2024
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Slither cannot process file aliases [Bug]: Slither cannot process file aliases Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants