fix: replace hardcoded date in VaultPerformanceChart with dynamic time and add testable date utils - #313
Merged
Junirezz merged 2 commits intoApr 24, 2026
Conversation
…e and add testable date utils - Removed hardcoded reference date and replaced with dynamic `new Date()` - Extracted `getNow` and `getCutoffDate` into shared dateUtils module - Centralized time range logic (7D, 1M, 3M, ALL) to avoid duplication - Used timestamp arithmetic instead of Date mutation to avoid DST issues - Updated VaultPerformanceChart to use new helpers - Fixed implicit `any` in tickFormatter - Added unit tests with mocked system time using vi.useFakeTimers()
|
@Shadow-MMN Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #286
new Date()getNowandgetCutoffDateinto shared dateUtils moduleanyin tickFormatterPull Request Template
📋 Description
Fixes an issue where VaultPerformanceChart used a hardcoded reference date (
2026-03-25), causing 7D, 1M, and 3M filters to become stale over time and return misleading or empty data.🔗 Type of Change
🔒 SECURITY REVIEW (⭐ MANDATORY FOR SMART CONTRACT CHANGES)
For all smart contract code changes, complete the following checklist.
See
docs/SECURITY_CHECKLIST.mdfor detailed guidance.Required: Security Checklist Sign-Off
I have reviewed this PR against the Internal Security Checklist (
docs/SECURITY_CHECKLIST.md)onlyOwner,onlyRole(), etc.)require(success, ...))If any checkbox cannot be verified, explain below:
Slither Static Analysis Results
Ran Slither locally:
slither . --config-file slither.config.jsonGitHub Actions Slither workflow passed:
If this PR has security findings, document them below:
Handling Security Findings
Option A: Fixed in This PR ✅
Option B: False Positive 🟡
contracts/.false-positives.mdwith:Option C: Accepted Risk⚠️
📝 Testing
Functional Testing
Security Testing
For state-changing functions:
For external integrations:
Test Coverage
[Link or reference]🚀 Deployment Notes
Mainnet Readiness
Breaking Changes
If this PR introduces breaking changes:
[timeframe]📊 Automated Scan Results
Slither Analysis
Related Documentation
✅ Reviewer Checklist
For code reviewers (use this to guide your security-focused review):
📞 Questions or Issues?
docs/SECURITY_CHECKLIST.mddocs/FALSE_POSITIVE_HANDLING.md@security-teamin comments📋 Pre-Submit Checklist
Before marking PR as ready for review:
npm testnpm run lintslither . --config-file slither.config.json✅ Ready for Review? Ensure all items above are checked before requesting review.