-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
foundry-rs/compilers
#36Labels
T-bugType: bugType: bug
Milestone
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.2.0 (bf56869 2023-07-05T00:05:02.811991000Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Apple Silicon)
Describe the bug
If you use files that are outside the project through a remapping (like@remapped/=../remapped/
), and a file there does a relative import, then verification fails.
Reproduction
-
forge init bad_verif
, -
Add this to the initial
bad_verif/foundry.ml
:
remappings = ["@remapped/=../remapped/"]
allow_paths = ["../remapped/"]
- Create
remapped/
so that you have
.
├── remapped
├── bad_verif
- In
remapped/
, createParent.sol
:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "./Child.sol";
and Child.sol
:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
- In
Counter.sol
, add:
import "@remapped/Parent.sol";
- Deploy with
--broadcast --verify
Expected
Verification works.
Actual
If you deploy and verify, you will get the following error (I tried on polygon):
Fail - Unable to verify. Solidity Compilation Error: Source "../remapped/Child.sol" not found: File not found. Searched the following locations: "".
This is because the input json contains the following:
{
"sources":{
"src/Counter.sol": <content of Counter.sol>
"../remapped/Parent.sol":{
"content":"// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\nimport \"./Child.sol\";\n"
},
"/Users/ah/temp/remapped/Child.sol": <content of Child.sol>
},
"settings":{
"remappings":[
"@remapped/=../remapped/"
],
}
}
Suggestion
The key for Child.sol
should probably use the relative path ../remapped/Child.sol
instead of the absolute path /Users/ah/temp/remapped/Child.sol
.
RickVM, xBA5ED and PaulRBerg
Metadata
Metadata
Assignees
Labels
T-bugType: bugType: bug