-
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
Support context aware remappings from nested foundry imports #1855
Comments
TIL |
Is anyone actively working on this issue? |
@fredlacs can you share a repro case which illustrates teh bug? |
Here is a minimal repro of what I'm running into https://github.com/fredlacs/multiple-solc-repro I'm trying to manage 2 dependencies, one using solc 0.6 and another one using 0.8 I've seen other projects just manage multiple OZ versions locally (as in https://github.com/Phission-Finance/Phission-Finance/tree/master/lib). Now that I think of it a bit more maybe the solution here isn't the |
affected by this as well. |
Same when building around existing contracts. Having transitive dependency resolution would be great. |
Can you guys show some minimal repros for us to better understand the problem? |
See #2693 for an example |
Context-specific imports would be very helpful to avoid version incompatibilities in nested dependencies (and thus increase submodule composability) |
Hey @mattsse, any plans to implement this? We've got an issue @morpholabs which we can illustrate with the following, smallest git setup: Let repository @openzeppelin/contracts/=lib/openzeppelin-contracts/contracts Let repository Then One way of solving this could be to have |
I'll take a closer look now. I think adding this should be doable with medium effort, since solc should do the heavy lifting anyways. perhaps we start by making this an opt-in setting in forge. |
It would be awesome thx! |
I ran into this issue while trying to implement opensea's blocklist. Installing operator-filter-registry as a submodule breaks OpenZepplin imports by expecting |
We can't keep OZ in here and in flex-voting because remappings get messed up. This is related to: foundry-rs/foundry#1855
* forge install: flexible-voting * Bump GovernorCountingFractional to audited commit * Remove explicit OZ dependency (we'll get it from flex-voting) We can't keep OZ in here and in flex-voting because remappings get messed up. This is related to: foundry-rs/foundry#1855 * Import OZ from flex-voting dependency * Get tests passing * Add note to readme about dependencies * This shouldn't have changed * Fix readme spacing * Fix slither * Bump slither action to fix "dubious ownership" errors E.g. https://github.com/gitcoinco/Alpha-Governor-Upgrade/actions/runs/4546392465/jobs/8014965843 * Add additional sanity tests around voting configs * Fix failing test and improve formatting * Bump to latest forge-std * Handle some more test edge cases * scopelint * Update README.md Co-authored-by: Matt Solomon <[email protected]> * flex-voting --> Flexible Voting --------- Co-authored-by: Matt Solomon <[email protected]>
Affected by this as well. We are creating a repository similar to our learn-evm-attacks project. The main thing is that we are not writing many contracts but we do write a lot of tests. When we add a new repository-to-test, the ideal workflow would be to simply
Unfortunately due to this problem, this is near impossible: different projects will use different versions and remappings. Context aware remappings are a must here for us. |
Do you happen to have any updates on this, @mattsse? Sorry to tag you, but I've just bumped into a similar scenario to @joaquinlpereyra. It seems to me that the more successful Foundry becomes, the more important this feature becomes because Foundry projects become more intertwined (both depth-wise and breadth-wise). Our project sablier-labs/v2-periphery has many remappings: Because of that and the lack of context-aware remappings in Foundry, V2 Periphery itself cannot be consumed by any third-party Foundry repo (without a patch). I installed
Then, I ran See remappings output
Notice the We can hot-fix this by asking consuming repos to add an explicit re-remapping, like this:
But this is a chore - for us and our users - and it's not scalable either (what happens when we have another dependency?). |
Another hot-fix would be to rename the |
this would definitely be a big QoL upgrade and lacking support is becoming more and more painful. let's tackle this shortly @Evalir |
You could try |
@SweetmanTech see #5447, it may be related to your issue. |
Component
Forge
Describe the feature you would like
Currently forge picks up remappings from imported libraries as well, if a nested library and the project use the same remapping but for different targets (different version of the same dependency for example), the current behaviour is that the project's remapping overrides the nested lib's remapping, which may not be intended.
solc remappings support a
context:
prefix to circumvent this:https://docs.soliditylang.org/en/latest/path-resolution.html#import-remapping
context:prefix=target
where
context
must match the beginning of the source unit name of the file containing the import.so that solc can be invoked like
This would require some upstream changes in ethers-rs:
Remapping
this would also require us to track where the Remapping is coming from so we can derive the
context
(which should be the relative pathlib/<dep>/
I think)Additional context
No response
The text was updated successfully, but these errors were encountered: