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

fix(pg): Avoid recompiling every single time we invoke the users script #1564

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

RPate97
Copy link
Collaborator

@RPate97 RPate97 commented Mar 16, 2024

Purpose

Fixes an issue reported by Sablier where the Validating Networks... step is taking an extremely long time to run.

Context

Foundry recently implemented a change where the cache is disregarded if the build info file is requested. This causes a UX issue where if you have build_info = true in your foundry.toml file then the entire project is recompiled every single time you run a script/test/etc. This is obviously a terrible experience.
foundry-rs/foundry#7379

This causes our plugin to run extremely slow because the users entire project is recompiled every time we call into their script.

This PR makes the following changes to temporarily address the issue:

  1. Remove build_info = true from our recommended foundry.toml settings
  2. When we call compile at the beginning of a script we compile with the --build-info flag since the rest of our logic still needs it. Also because we have to recompile the entire project anyway, I've added in the --force flag because that makes our later logic to fetch the build info file faster.
  3. Whenever we call into the users script in the rest of the plugin, I've added an environment variable FOUNDRY_BUILD_INFO: 'false'. This prevents the users entire project from being rebuilt whenever we call into the script if the user has build_info=true in their foundry.toml file.

Note

Obviously, this is not the ideal solution. This PR aims to ensure the plugin continues to be usable in projects where compilation takes a long time, such as Sablier. We should further discuss the ideal solution which may involve implementing logic to use the cache when compiling with build_info=true in Foundry if that is reasonable to do.

@RPate97 RPate97 force-pushed the pate/slow-network-validaton branch from bcc209a to cde3c9a Compare March 16, 2024 19:32
Copy link
Collaborator

@sam-goldman sam-goldman left a comment

Choose a reason for hiding this comment

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

lgtm

@RPate97 RPate97 merged commit 94f5a22 into develop Mar 16, 2024
8 checks passed
@RPate97 RPate97 deleted the pate/slow-network-validaton branch March 16, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants