Foundry migration improve speed#2868
Merged
clement-ux merged 35 commits intoclement/foundry-migrationfrom Apr 7, 2026
Merged
Conversation
…lt tests Replace concrete contract imports (OUSDVault, OUSD, VaultStorage, Proxies) with interface-only imports (IVault, IOToken, IProxy) and vm.deployCode. This keeps test compilation units small for better Forge caching. - Add IOToken and IProxy interfaces - Add isGovernor() to IVault interface - Update Shared.t.sol to deploy via vm.deployCode and cast to interfaces - Replace all VaultStorage.Event with IVault.Event references - Use struct field access instead of tuple destructuring - Document interface-only testing pattern in tests/README.md
…lt tests Same migration as OUSDVault: replace concrete contract imports (OETHVault, OETH, VaultStorage, Proxies) with interface-only imports (IVault, IOToken, IProxy) and vm.deployCode for better Forge caching. - Update Shared.t.sol to deploy via vm.deployCode and cast to interfaces - Replace all VaultStorage.Event with IVault.Event references - Use struct field access instead of tuple destructuring
…ken tests Replace concrete contract imports (OUSD, OUSDVault, Proxies) with interface-only imports (IOToken, IVault, IProxy) and vm.deployCode for better Forge caching. - Update Shared.t.sol to deploy via vm.deployCode and cast to interfaces - Replace all OUSD.Event with IOToken.Event references - Update Initialize.t.sol to use vm.deployCode for fresh deployments - Update Transfer.t.sol MockNonRebasingTwo helper to use IOToken
…THBase/OSonic token tests Replace concrete token imports with IOToken interface and vm.deployCode for better Forge caching.
… token tests Add IWOToken interface for WOETH/WOETHBase/WOETHPlume/WOSonic/WrappedOusd. Replace concrete contract imports with interface-only imports (IWOToken, IOToken, IVault, IProxy) and vm.deployCode across all wrapped token tests.
- Fix vm.deployCode path typo in README - Add proxy, token, and wrapped token deployment examples - Add available interfaces reference table - Update unit-test skill: interface types, vm.deployCode, checklist
…ategy tests Add 15 per-strategy interfaces in contracts/interfaces/strategies/ and migrate all 15 strategy test suites to interface-only imports with vm.deployCode for better Forge caching. - ICurveAMOStrategy, IBaseCurveAMOStrategy, IOETHSupernovaAMOStrategy - IAerodromeAMOStrategy, ISonicSwapXAMOStrategy, ISonicStakingStrategy - IBridgedWOETHStrategy, IGeneralized4626Strategy, IMorphoV2Strategy - INativeStakingSSVStrategy, ICompoundingStakingSSVStrategy - IConsolidationController, ICrossChainMaster/RemoteStrategy - IVaultValueChecker
Add a new Claude/Codex skill for reorganizing Foundry test files structurally without semantic changes. Apply it to OUSDVault unit tests: - Sort imports into named groups (Test base, External libraries, Project imports) - Reorder state variables (CONSTANTS before CONTRACTS & MOCKS) - Consolidate revert tests next to their parent function sections
Add `make lint-imports` step to the Formatting & Lint job in the Foundry workflow so PRs introducing unused Solidity imports fail CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Clean up unused imports across scripts, unit tests, fork tests, smoke tests, and mocks flagged by `forge lint --only-lint unused-import`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve Foundry compilation speed when a core contract (e.g.
OUSD.sol,VaultAdmin.sol) is modified. After one such change, recompilation of the full test suite was slow because test files imported concrete contract types, causing deep dependency chains that invalidated large portions of the Forge cache.Benchmark
Changing one line in
VaultAdmin.soland runningforge build:Key changes
IVault,IOToken,IProxy, etc. instead ofVaultCore.sol,OUSD.sol, etc. This decouples the test compilation graph from implementation changes, so modifying a core contract only recompiles contracts that directly depend on it, not the entire test suite.Base.t.solminimal — only actors, constants,IERC20external tokens, fork IDs, andsetUp()live inBase.t.sol. All typed contract/proxy/mock state variables are declared in each product'sShared.t.sol. This prevents a single change inBase.t.solfrom invalidating the entire Forge cache.make lint-importsCI check (forge lint --only-lint unused-import) to the Formatting & Lint job so unused imports don't creep back in.organize-testskill for consistent test file structure.Test plan
make test-unitpassesmake lint-importsreports zero unused importsforge fmt --check scripts/ tests/passescontracts/vault/VaultCore.sol, runforge build tests/unit/, confirm only relevant files recompile🤖 Generated with Claude Code