test(fork): add FORK_VAULT_COUNT enumeration to lock vault table length#209
test(fork): add FORK_VAULT_COUNT enumeration to lock vault table length#209thedavidmeister wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a ChangesFork vault enumeration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/lib/LibFork.sol`:
- Line 25: The FORK_VAULT_COUNT constant at line 25 is a manual source of truth
that can drift from the actual number of WT_* vault constants defined above it.
Instead of maintaining separate WT_* constants and a manual count, consolidate
all vault definitions into a single canonical registry (such as an array or
mapping) that contains all the WT_* vault identifiers, and then derive
FORK_VAULT_COUNT mechanically from the length or size of this registry. This
ensures the count is always in sync with the actual number of vaults defined and
cannot accidentally drift out of sync.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 670937f4-6488-4ba1-8e0a-c778436ab244
📒 Files selected for processing (2)
test/lib/LibFork.soltest/src/concrete/ERC4626Words.fork.t.sol
| address constant WT_ARKK = 0x9FfF48B4535AF3765Ac9E1b164720EDc01DF8EE7; | ||
| address constant WT_SGOV = 0x78c31580c97101694C70022c83D570150c11e935; | ||
|
|
||
| uint256 constant FORK_VAULT_COUNT = 15; |
There was a problem hiding this comment.
FORK_VAULT_COUNT is still a manual source of truth and can silently drift.
At Line 25, the count is not mechanically tied to the number of WT_* constants above. A new WT_* constant can still be added without compile/test failure if this count and the enumeration table are not updated in the same change, so the “cannot ship untested” guarantee is incomplete. Please consolidate to a single canonical vault registry (from which count is derived) instead of maintaining independent constants and a manual count.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/lib/LibFork.sol` at line 25, The FORK_VAULT_COUNT constant at line 25 is
a manual source of truth that can drift from the actual number of WT_* vault
constants defined above it. Instead of maintaining separate WT_* constants and a
manual count, consolidate all vault definitions into a single canonical registry
(such as an array or mapping) that contains all the WT_* vault identifiers, and
then derive FORK_VAULT_COUNT mechanically from the length or size of this
registry. This ensures the count is always in sync with the actual number of
vaults defined and cannot accidentally drift out of sync.
…fork-vault-enumeration # Conflicts: # test/lib/LibFork.sol # test/src/concrete/ERC4626Words.fork.t.sol
Summary
FORK_VAULT_COUNT = 15constant totest/lib/LibFork.sol— the canonical count of WT_* vault address constants.testForkVaultEnumeration()which builds a fixed-sizeaddress[FORK_VAULT_COUNT]table of all 15 vaults and runscheckVaultover each.FORK_VAULT_COUNTentries, adding a new WT_* address without bumping the constant (and adding it to the table) causes a compile error — a new address cannot ship without a corresponding test entry.Closes #139.
Why this is needed
After PR #184 merged, expected values are now derived from the vault oracle rather than hand-typed. But the vault address list itself remains unchecked: adding a WT_* constant without a test lets the address ship untested, silently.
FORK_VAULT_COUNTenforces structural completeness at compile time.Test plan
forge buildsucceeds (fixed-size array initializer count matchesFORK_VAULT_COUNT)FORK_RPC_URL_BASEset):testForkVaultEnumerationpasses for all 15 vaultsFORK_VAULT_COUNTto 16:forge buildfails (compile error on array initializer length)🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Summary by CodeRabbit