-
Notifications
You must be signed in to change notification settings - Fork 1
fix: gate sheets and rotate receive address on restore #465
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
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4327451 to
121d8c8
Compare
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.
Pull Request Overview
This PR implements two key improvements to the wallet restore functionality: preventing UI disruptions during restore operations and ensuring fresh receive addresses after restoration.
- Gates timed promotional sheets from appearing while wallet restore is in progress
- Converts the
isRestoringflag to a reactiveStateFlowfor better state management - Ensures onchain receive addresses are rotated after wallet restoration by clearing them from backup data
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt | Added BackupRepo dependency and early return check to prevent timed sheets from displaying during wallet restore |
| app/src/main/java/to/bitkit/repositories/BackupRepo.kt | Converted isRestoring boolean to StateFlow for reactive state management, updated all references, and cleared onchain address from backup data to force address rotation on restore |
Code ReviewSummaryThis PR makes two targeted fixes to prevent issues during wallet restoration:
Positive Aspects ✅Good architectural improvement:
Consistent implementation:
Thread safety:
Issues & Concerns 🔍1. Potential Race Condition (Medium Priority)Location: The onchain address is cleared by setting it to an empty string: val caches = parsed.cache.copy(onchainAddress = "")However, there's a potential timing issue:
Recommendation: Consider whether the address rotation should happen before or after the 2. Missing Comment/Documentation (Low Priority)Location: The comment says "Force onchain address rotation" but it's not immediately clear WHY this is needed. Recommendation: Add a brief explanation: // Force onchain address rotation by clearing cached address
// This ensures E2E tests receive a fresh address on restore
val caches = parsed.cache.copy(onchainAddress = "")3. Test Coverage ObservationI don't see any new tests added for:
Recommendation: Consider adding unit tests to verify: // Example test cases:
// 1. Verify timed sheets are blocked when isRestoring = true
// 2. Verify backup listeners don't trigger when isRestoring = true
// 3. Verify onchain address is empty after restorePerformance Considerations ⚡Positive:
Note: The Security Concerns 🔒No security issues identified. The changes don't introduce any new attack vectors. The address rotation is intentional and documented in the PR description as needed for testing. Code Quality & Best Practices 📋Strengths:
Minor suggestion: RecommendationsPriority: Medium
Priority: Low
VerdictLGTM with minor suggestions ✅ The core implementation is solid and follows best practices. The conversion to Review generated with Claude Code |
Roadmap feature: Backup & Restore
Description
This PR:
Preview
n/aQA Notes
Validation: Failing E2E tests should pass.