Skip to content
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

[POC repo included] default foundry.toml "src" remappings dont work correctly #9454

Open
2 tasks done
DrakeEvans opened this issue Dec 2, 2024 · 3 comments · May be fixed by #9466
Open
2 tasks done

[POC repo included] default foundry.toml "src" remappings dont work correctly #9454

DrakeEvans opened this issue Dec 2, 2024 · 3 comments · May be fixed by #9466
Assignees
Labels
A-remappings Area: remappings T-bug Type: bug

Comments

@DrakeEvans
Copy link
Contributor

DrakeEvans commented Dec 2, 2024

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

No response

What command(s) is the bug in?

forge build

Operating System

macOS (Apple Silicon)

Describe the bug

I use src/contracts to store all my smart contracts, this means my foundry.toml contains the line
src = "src/contracts"
I like to use contracts/ as an import alias, such that I don't need to use relative imports everywhere, this means I have a remapping.txt with the line:
contracts/=src/contracts/

This causes foundry build to crash. When I switch the line:
src = "src/contracts" => src = "src" in foundry.toml the compilation works

reproduction repo: https://github.com/DrakeEvans/foundry-remapping-bug

Recreate: run forge build -w
Fix: comment out line 3 and uncomment line 2

Fwiw, this is definitely a regression as I have been using this configuration 6 months ago fine

@DrakeEvans DrakeEvans added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Dec 2, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Dec 2, 2024
@grandizzy
Copy link
Collaborator

hey @DrakeEvans thanks for your report! Indeed, this was changed in PR #9258 in order to solve #3440 (that is to avoid any src remapping in deps to be applied for the root project). As you mentioned, changing src = "src/contracts" to src = "src" would be the proper fix (as contracts/=src/contracts/ remapping will be properly resolved), lmk if this doesn't make sense.

@DaniPopes DaniPopes removed the T-needs-triage Type: this issue needs to be labelled label Dec 2, 2024
@DrakeEvans
Copy link
Contributor Author

The issue with that fix is that it is now compiling a bunch of extra contracts potentially. I want to limit compiling to just whats in src/contracts. Im not clear on the value of what you are describing

@grandizzy grandizzy self-assigned this Dec 3, 2024
@grandizzy grandizzy added the A-remappings Area: remappings label Dec 3, 2024
@DrakeEvans
Copy link
Contributor Author

@grandizzy I can confirm that #9466 fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-remappings Area: remappings T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants