foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.33k stars 1.76k forks source link

Forge nightly version (foundryup) fails to compile with unresolved imports #9271

Closed aviggiano closed 2 weeks ago

aviggiano commented 2 weeks ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

forge 0.2.0 (57bb12e 2024-11-06T00:26:30.417023000Z)

What command(s) is the bug in?

forge build

Operating System

macOS (Apple Silicon)

Describe the bug

My project is not compiling after running foundryup

This version compiled: https://github.com/SizeCredit/size-solidity/actions/runs/11483354647/job/31958586649 (nightly-c3069a50ba18cccfc4e7d5de9b9b388811d9cc7b also compiles)

The current version (nightly-57bb12e022fb9ea46a4a7ca8647eb016e8d43ca3) is not compiling:

Unable to resolve imports:
      "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol" in ".../size-solidity/src/Size.sol"
      "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol" in ".../size-solidity/src/Size.sol"
      "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol" in ".../size-solidity/src/Size.sol"
      "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol" in ".../size-solidity/test/local/actions/Upgrade.t.sol"
      "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol" in ".../size-solidity/src/Size.sol"
with remappings:
      @openzeppelin/contracts/=.../size-solidity/lib/openzeppelin-contracts/contracts/
      @chainlink/=.../size-solidity/lib/chainlink/
      @src/=.../size-solidity/src/
      @test/=.../size-solidity/test/
      @script/=.../size-solidity/script/
      @solady/=.../size-solidity/lib/solady/src/
      @chimera/=.../size-solidity/lib/chimera/src/
      @crytic/properties/=.../size-solidity/lib/properties/
      @aave/=.../size-solidity/lib/aave-v3-core/contracts/
      halmos-cheatcodes/=.../size-solidity/lib/halmos-cheatcodes/src/
      ERC4626/=.../size-solidity/lib/properties/lib/ERC4626/contracts/
      aave-v3-core/=.../size-solidity/lib/aave-v3-core/
      chainlink/=.../size-solidity/lib/chainlink/contracts/
      chimera/=.../size-solidity/lib/chimera/src/
      ds-test/=.../size-solidity/lib/forge-std/lib/ds-test/src/
      erc4626-tests/=.../size-solidity/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/
      forge-std/=.../size-solidity/lib/forge-std/src/
      openzeppelin-contracts-upgradeable/=.../size-solidity/lib/openzeppelin-contracts-upgradeable/
      openzeppelin-contracts/=.../size-solidity/lib/openzeppelin-contracts/
      properties/=.../size-solidity/lib/properties/contracts/
      solady/=.../size-solidity/lib/solady/
      solmate/=.../size-solidity/lib/properties/lib/solmate/src/
Compiling 240 files with Solc 0.8.23
Solc 0.8.23 finished in 264.43ms
Error: Compiler run failed:
Error (6275): Source "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
ParserError: Source "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
 --> src/Size.sol:4:1:
  |
4 | import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error (6275): Source "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
ParserError: Source "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
 --> src/Size.sol:6:1:
  |
6 | import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error (6275): Source "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
ParserError: Source "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
 --> src/Size.sol:7:1:
  |
7 | import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error (6275): Source "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
ParserError: Source "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
 --> src/Size.sol:8:1:
  |
8 | import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error (6275): Source "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
ParserError: Source "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol" not found: File not found. Searched the following locations: ".../size-solidity".
 --> test/local/actions/Upgrade.t.sol:6:1:
  |
6 | import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
zerosnacks commented 2 weeks ago

cc @grandizzy this appears related to the recent change we made in https://github.com/foundry-rs/foundry/pull/9246

grandizzy commented 2 weeks ago

cc @grandizzy this appears related to the recent change we made in #9246

yeah, that is the case, going to revert that for now and consider this failure when reworking fix from #9246

grandizzy commented 2 weeks ago

the issue is that with the change (checking remappings to add against existing) if there's @openzeppelin/contracts already added then @openzeppelin/contracts-upgradeable remapping will be discarded (as it matches the start...)

zerosnacks commented 2 weeks ago

@aviggiano nightly has been released, please re-run foundryup