-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(forge): optimize compilation through preprocessing and caching #10010
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
Conversation
added working on adding depending on the edited file the results are mixed in impact but always more favorable with test caching enabled |
For
The diff (with / without test caching) being limited to:
Alternatively:
Can also just be a side effect of how the codebase is set up with very deep hierarchies |
Yeah, most probably many mocks aka contracts under test that extend contracts under src, like for example contract BatchTestProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput where
You can check all the files marked as mock in cache file |
they also have |
Let me know if there's sth I can help with on the aave side. I suspect the problem is though that we essentially deploy the whole protocol + periphery on every test, which is not trivial to change. |
Tested on Solady and Euler's EVC - no issues, added the benchmarks |
103404d
to
def0113
Compare
Implements a preprocessor allowing us to skip recompiling tests on non-interface source file changes. See the companion Foundry PR foundry-rs/foundry#10010 for benchmarks and more details. Supersedes #198: - uses solar AST instead solang-parser to compute interface representation - uses solar HIR instead of solc AST to find bytecode dependencies - handles more edge cases, like deploying with salt/value Closes #197. ### TODO - [x] use solar HIR (deps to review and include paradigmxyz/solar#210) - [x] unit tests - [x] opt-in caching changes - [x] autodetect mocks - [x] figure out how to parse when building from different dir - [x] additional testing (tested with uniswap v4-core and simpler projects) ### Depends on - [x] merge solar PR (paradigmxyz/solar#210) - [x] solar release --------- Co-authored-by: Arsenii Kulikov <[email protected]> Co-authored-by: zerosnacks <[email protected]> Co-authored-by: DaniPopes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, send it 2
Motivation
dynamic_test_linking
to avoid unnecessary test compilation. Disabled by default, can be used asforge build --dynamic-test-linking
TODO
Lock.lock();
at PoolManager.sol#L107amountOut < minAmountOut
at PSM3.sol#L125if (assets < 0)
at MorphoBundler.sol#L106require(assets != 0, ErrorsLib.ZERO_ASSETS)
at Morpho.sol#L424if (cliffTime < 0)
at SablierLockup.sol#L480_setOwner(newOwner)
at Ownable.sol#L182SET_MAX_ELEMENTS
to11
at Set.sol#L7Solution
PR Checklist