feat(config): option to disallow linked references#13585
Open
mgiagante wants to merge 5 commits intofoundry-rs:masterfrom
Open
feat(config): option to disallow linked references#13585mgiagante wants to merge 5 commits intofoundry-rs:masterfrom
mgiagante wants to merge 5 commits intofoundry-rs:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR solves #9641 by implementing conditional bail logic in https://github.com/foundry-rs/foundry/blob/master/crates/forge/src/cmd/build.rs exposed as a new
--disallow-linked-librariesoption for the build process.Note on AI usage:
Motivation
Refer to #9641
Briefly: The
--disallow-linked-librariesoption enables users to ensure compiled Solidity code will not result in bytecode with unintended linked references to libraries.Solution
The added logic iterates over artifacts in the compiler output and collects any containing linked references to libraries as a result of the presence of public methods.
If one or more artifacts have linked references, the build process bails with an error listing the infringing contracts.