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

refactor: deploy all libraries when running tests #8034

Merged
merged 7 commits into from
Jun 3, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Jun 2, 2024

Motivation

Closes #1161
Closes #6120
Closes #8014

Keeping foundry-rs/book#1361 open as this still won't work in scripts.

Solution

Instead of linking each contract separately and keeping separate libs_to_deploy for each test contract we now link entire project output and keep single libs_to_deploy and known_contracts. That way, we reduce memory usage and by deploying all needed libraries unblock usage of getCode/getDeployedCode with artifacts requiring linking.

To avoid nonce of the sender being affected by the number of external libraries used in project, I've inroduced separate LIBRARY_DEPLOYER which deploys all libraries, that way, test contract will always have the same address regardless of the number of libraries it requires to run.

crates/forge/bin/cmd/test/mod.rs Outdated Show resolved Hide resolved
crates/forge/src/runner.rs Outdated Show resolved Hide resolved
crates/forge/src/runner.rs Outdated Show resolved Hide resolved
@DaniPopes
Copy link
Member

This should close #8014

crates/forge/bin/cmd/test/mod.rs Outdated Show resolved Hide resolved
crates/forge/bin/cmd/test/mod.rs Show resolved Hide resolved
Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

nice

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants