#3019·slither

在分析具有导入别名的合约时,在 resolve_remapping_and_renaming 中发生 AssertionError

作者: Aniket-Engg创建于 2026年5月11日更新于 2026年6月7日

Description Slither fails with an AssertionError when analyzing Solidity code that imports files using import aliasing (specifically the Chainlink KeeperCompatibleInterface.sol pattern). ## Environment - Slither version: 0.11.5 - Python version: 3.11 - Operating system: macOS (Darwin 22.3.0) - Solidity compiler: 0.8.34 - Framework: Foundry ## Steps to Reproduce 1. Create a Foundry project with the following structure: foundry.toml: [profile.default] src = "src" out = "out" libs = ["lib"] remappings.txt: @chainlink/=lib/chainlink-evm/ src/KeepersCounter.sol: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@chainlink/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol"; contract KeepersCounter is KeeperCompatibleInterface { uint256 public counter; uint256 public immutable interval; uint256 public lastTimeStamp; constructor(uint256 updateInterval) { interval = updateInterval; lastTimeStamp = block.timestamp; counter = 0; } function checkUpkeep(bytes calldata) external view override returns (bool upkeepNeeded, bytes memory) { upkeepNeeded = (block.timestamp - lastTimeStamp) > interval; } function performUpkeep(bytes calldata) external override { if ((block.timestamp - lastTimeStamp) > interval) { lastTimeStamp = block.timestamp; counter = counter + 1; } } } lib/chainlink-evm/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./AutomationCompatibleInterface.sol"; lib/chainlink-evm/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AutomationCompatibleInterface { function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData); function performUpkeep(bytes calldata performData) external; } 2. Run: forge build (this succeeds) 3. Run: slither . Expected Behavior Slither should successfully analyze the contract. Actual Behavior Slither fails with: Traceback (most recent call last): File "/opt/homebrew/bin/slither", line 8, in sys.exit(main()) ^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/slither/main.py", line 760, in main main_impl(all_detector_classes=detectors, all_printer_classes=printers) File "/opt/homebrew/lib/python3.11/site-packages/slither/main.py", line 865, in main_impl (process_all(filename, args, detector_classes, printer_classes)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File