Skip to content

fix: resolve inherited re-exported import aliases#3046

Open
ChargingFoxSec wants to merge 1 commit into
crytic:masterfrom
ChargingFoxSec:fix/import-alias-inheritance-3019
Open

fix: resolve inherited re-exported import aliases#3046
ChargingFoxSec wants to merge 1 commit into
crytic:masterfrom
ChargingFoxSec:fix/import-alias-inheritance-3019

Conversation

@ChargingFoxSec

Copy link
Copy Markdown

Summary

Fixes #3019.

This resolves inherited import aliases that are re-exported from an imported file.

Root cause

resolve_remapping_and_renaming resolves direct import aliases, then falls back to the current file scope. When the inherited name is itself an alias re-exported from another imported file, the fallback does not continue through accessible imported scopes, so Slither fails with:

AssertionError: Contract KeeperCompatibleInterface not found

Changes

  • Add recursive scope lookup through accessible imported scopes.
  • Resolve renamed contracts through each scope's renaming map.
  • Add a solc parsing regression test for inherited re-exported import aliases.

Testing

  • uv run slither /tmp/slither-repro-3019/src/KeepersCounter.sol --compile-force-framework solc --solc-remaps @chainlink/=/tmp/slither-repro-3019/lib/chainlink-evm/ --disable-color
  • uv run pytest tests/e2e/solc_parsing/test_ast_parsing.py -k import_aliases_reexport
  • uv run pytest tests/e2e/solc_parsing/test_ast_parsing.py -k "complex_imports/import_aliases/test.sol"
  • uv run ruff check slither/solc_parsing/slither_compilation_unit_solc.py tests/e2e/solc_parsing/test_ast_parsing.py
  • uv run ruff format --check slither/solc_parsing/slither_compilation_unit_solc.py tests/e2e/solc_parsing/test_ast_parsing.py

@ChargingFoxSec ChargingFoxSec requested a review from smonicas as a code owner June 7, 2026 09:48
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

Successfully merging this pull request may close these issues.

AssertionError in resolve_remapping_and_renaming when analyzing contract with import aliasing

1 participant