Skip to content

fix(script): skip unused library deployments#15862

Open
stevencartavia wants to merge 2 commits into
masterfrom
steven/skip-unused-libraries
Open

fix(script): skip unused library deployments#15862
stevencartavia wants to merge 2 commits into
masterfrom
steven/skip-unused-libraries

Conversation

@stevencartavia

Copy link
Copy Markdown
Member

Avoid deploying unused libraries when forge script broadcasts direct contract creations. Required libraries are determined from the created artifacts, while omitted libraries remain available during local execution. Unsupported transaction shapes retain the existing deploy-all behavior.

Closes #6215

figtracer
figtracer previously approved these changes Jul 23, 2026
Comment thread crates/script/src/library_deployments.rs

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the candidate reruns the script with cloned wallets, but the rerun-unsafe selector list doesn't include wallet-backed vm.sign/vm.signCompact. this can prompt hardware, browser, or remote signers twice. can we add sign(bytes32), sign(address,bytes32), signCompact(bytes32), and signCompact(address,bytes32) to SIGNATURES and cover that they skip the optimization?

@stevencartavia
stevencartavia force-pushed the steven/skip-unused-libraries branch from 228a5c5 to ffae0da Compare July 23, 2026 16:16
mablr

This comment was marked as outdated.

| foundry_config::fs_permissions::FsAccessPermission::ReadWrite
)
})
|| self.used_rerun_unsafe_cheatcode()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gate only sees unsafe cheatcodes reached by the baseline run. Nondeterministic control flow can reach vm.rpc, prompting/signing, or another side effect only in the speculative rerun, before equivalence rejects that candidate. I reproduced this with a candidate-only vm.rpc("anvil_setBalance", ...): the RPC mutation escaped even though the deploy-all baseline was retained. Please hard-disable side-effecting cheatcodes during the candidate execution (an error can safely fall back to the baseline).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure #15207 is not reintroduced.

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.

bug(linking): unused libraries may be deployed

4 participants