-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(remappings
): unable to import Solidity file using auto-remappings, missing src/
suffix
#9247
Comments
import
Solidity file using auto-remappingsremappings
): unable to import Solidity file using auto-remappings, missing src/
suffix
@acuarica I don't think there's anything wrong here, we're inheriting remappings of module, so the right way to do is to import as import {Surl} from "surl/src/Surl.sol"; or add a remapping
Can you clarify why would you expect |
@grandizzy thanks for your reply. Sure. The Surl documentation mentions how to import their contract and it's without the Moreover, if we replace $ forge init foundry-example-solmate && cd foundry-example-solmate
$ forge install transmissions11/solmate
$ forge remappings
ds-test/=lib/solmate/lib/ds-test/src/
forge-std/=lib/forge-std/src/
solmate/=lib/solmate/src Finally, whether I set my project using Hope it's a bit more clear now. Thanks for the support. |
yeah, but solmate doesn't have test nor scripts in root so you could only import from src. Surl has both so if remappings to src then there'll be no way to import and use something from test or script (Granted I am still digging the remappings mechanism.) |
checked the code and that's the intended behavior, if you want to make it solmate like and have remappings to |
Thanks for taking a look at this and for clarifying what the intended behavior should be. However, the only thing that hints something is not working properly is the following
|
ah, yes, worth checking some more, reopening. Thank you! |
similar behavior to investigate https://github.com/StackOverflowExcept1on/frost-secp256k1-evm |
@acuarica ack this is an issue, similar with #4717 (comment) going to close this one as a dupe and track fix there. thank you! |
That's great, thanks for confirming this. |
np, pending fix in #9263 |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (17e0981 2024-11-01T00:27:49.655450000Z)
What command(s) is the bug in?
forge remappings, forge build
Operating System
macOS (Apple Silicon)
Describe the bug
When installing some dependencies, the auto-remappings (and
build
command) do not resolve theimport
path properly.Steps to reproduce
Create an empty Foundry project and install the Surl library
forge init foundry-example cd foundry-example forge install memester-xyz/surl
then
The last remapping
surl/=lib/surl/
seems to be missing thesrc/
suffix (according to how the library is configured).If I add the following
import
into, for example,test/Counter.t.sol
I get an error when running
build
(which is consistent with theremappings
mentioned above)Using the
foundry.toml
provided by the template projectWorkaround
By changing the
import
as shown below solves this problemAdditional context
However, if I use a
..
in thelib
path resolving to the same folder as above, bothforge remappings
(andforge build
) commands work as expectedRelated issues
As mentioned in some of the issues below, this does not happen for every dependency (for example installing
solmate
works fine).remappings
): unable to import Solidity file using auto-remappings, missing src/ suffix #4717config
): file paths not resolved if submodule specifies root path remappings #3440The text was updated successfully, but these errors were encountered: