Skip to content

feat(config): option to disallow linked references#13585

Open
mgiagante wants to merge 5 commits intofoundry-rs:masterfrom
mgiagante:feat/disallow-linked-references
Open

feat(config): option to disallow linked references#13585
mgiagante wants to merge 5 commits intofoundry-rs:masterfrom
mgiagante:feat/disallow-linked-references

Conversation

@mgiagante
Copy link
Copy Markdown
Contributor

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-libraries option for the build process.

Note on AI usage:

  • I use OpenCode to understand the codebase incrementally over time but all my solutions are fully authored manually by myself.

Motivation

Refer to #9641
Briefly: The --disallow-linked-libraries option 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.

@mgiagante mgiagante changed the title Feat/disallow linked references feat(config): option to disallow linked references Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant