Repository navigation
fix: other review fixes - #1509
Conversation
📝 WalkthroughWalkthroughThe pull request adds tolerant Dash Platform identity retrieval, clears obsolete encryption fallbacks during PIN changes, preserves merged gift-card metadata, and applies targeted UI, service, and test corrections. ChangesPlatform identity cache tolerance
Encryption fallback reset
Gift-card metadata preservation
UI and test correctness updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ContactRequest
participant PlatformService
participant IdentityCache
participant DAPI
ContactRequest->>PlatformService: getContactIdentity(userId)
PlatformService->>IdentityCache: identities.get(userId)
IdentityCache-->>PlatformService: cached identity or CBOR failure
PlatformService->>DAPI: getIdentity(userId, true)
DAPI-->>PlatformService: identity
PlatformService-->>ContactRequest: contact identity
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
da9386e to
1e85d1a
Compare
…out a logo DashSpend gift card transactions whose merchant has no logo were falling back to the static gift card icon in the tx_display_cache. Generate a full-name merchant icon (matching the merchant list) instead, both on the home tx list (TxDisplayCacheService) and in the transaction details view (TransactionResultViewBinder). Adds MerchantNameIcon to the shared MerchantInitialIcon component and caches generated bitmaps by merchant name. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- UserLocationState: rethrow CancellationException so coroutine cancellation isn't swallowed by the generic catch - MerchantsAtmsResultAdapter: capture logoLocation in a local val to avoid dereferencing a nullable merchant - TxDisplayCacheService: try iconBitmapForEntry first on cold start so logo-less gift cards still get a generated icon when customIconId is null - WalletTransactionMetadataProvider: persist merged gift-card values (not raw input) and carry redeemUrlChallenge to avoid null overwrites - MainActivityExt: fix time-skew dialog to report minutes (abs/60) - SecurityGuard/DualFallbackEncryptionProvider/EncryptWalletLiveData: remove stale fallbacks on PIN change before recreating them - bump versionName to 11.8.2, dashj 22.0.4, dpp 4.0.0 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Check hasDecryptionKey() alongside the transfer and encryption key checks so identities missing only the DECRYPTION key are flagged for upgrade and have it added on next sync. The dpp library now includes a DECRYPTION key in its default key list and reuses the ENCRYPTION key material when adding it. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rade" This reverts commit 77e3df97f55f550e5213d230ce5b2e8f6f1ee388.
…tacts Port the dpp-4.0.1 CBOR crash fixes from the kotlin migration branch (51f3ec9, dff670f) instead of bumping the dpp dependency. Accepting/receiving a contact request from an identity carrying a contract-bound key (iOS/Rust-SDK identities) crashed inside the legacy dashj-platform in-memory identity cache: storeIdentity CBOR-encodes the fetched identity and throws "No converter for SingleContractDocumentType" after a successful fetch, aborting the whole accept/receive flow. - Add IdentityCacheTolerance.kt: pure, unit-tested helper that runs the cached get and, only on that specific CBOR cache failure, recovers via a cache-bypassing refetch. Any other error propagates unchanged. - Add PlatformService.getContactIdentity(), wired into the send, accept, and receive/reconcile call sites (PlatformBroadcastService, PlatformSyncService). - Never string-interpolate a legacy dashj Identity in logs: toString() routes through hashCode() -> CBOR toBuffer() and throws the same "No converter for ..." on contract-bound identities. Log the id only. Scoped to the CBOR fix only; the migration branch's accept-vs-send error wording UX (which depends on refactoring not present on this branch) is intentionally excluded. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The test had drifted from MainViewModel's constructor and init block: - Pass the missing crowdNodeApi constructor arg (mock with signUpStatus and balance stubbed, needed by the CrowdNode withdrawal-reminder flow) - Stub BlockchainIdentityConfig.observe() (BaseProfileViewModel init) - Stub WorkManager.getWorkInfosByTagFlow (allOperationsStatus moved from LiveData to Flow) - Relax TxDisplayCacheService mock (init now calls setFilter) - Stub Configuration.isRestoringBackup and the crowdnode reminder saved-state key Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- GetUsernameVotingResultOperationTest assumed a 2-minute buffer after the voting period, but production (DELAY_AFTER_VOTING_PERIOD) has always been 1 minute — all 9 assertions were off by exactly 60s. Align the expected values and comments with the shipped formula. - TransactionExportTest never called initMetadataMap() before exportString(), crashing on the lateinit metadataMap. Production callers (ToolsViewModel) initialize it first; do the same. Full :wallet:test_testNet3DebugUnitTest suite now passes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1e85d1a to
c7a0023
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt (1)
105-114: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftDo not report success when fallback recreation fails.
removeFallbacks()deletes the old recovery entries beforeensurePinFallback()andensureMnemonicFallbacks()run, but both Boolean results are ignored. If either operation fails, the PIN has changed, all or part of the fallback recovery is missing, and this method still returnsResource.success(wallet). Handle both results and make the replacement path transactional or explicitly surface failure before reporting success.🤖 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 `@wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt` around lines 105 - 114, Handle the Boolean results from securityGuard.ensurePinFallback and securityGuard.ensureMnemonicFallbacks in the isPinCorrect branch, and do not return Resource.success(wallet) if either fallback recreation fails. Surface the failure explicitly or make the remove-and-recreate sequence transactional so the PIN update cannot report success with incomplete recovery data.
🧹 Nitpick comments (2)
wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt (2)
355-365: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract duplicated merge logic.
This
existing.copy(...)merge logic is duplicated exactly ininsertOrUpdateGiftCard(lines 705-715). Consider extracting it into an extension function (e.g.,private fun GiftCard.mergeWith(existing: GiftCard): GiftCard) to keep the merge rules consistent and DRY.🤖 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 `@wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt` around lines 355 - 365, Extract the duplicated existing.copy merge logic from this provider and insertOrUpdateGiftCard into a single private GiftCard.mergeWith(existing: GiftCard) extension function. Preserve all current field precedence and fallback rules, then replace both inline merges with calls to the shared function.
377-385: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse named arguments for clarity and safety.
insertGiftCardDatatakes severalString?parameters consecutively. Using named arguments prevents accidental parameter swaps if the DAO signature ever changes (e.g., ensuringmerged.notemaps safely toorderandmerged.redeemUrlChallengetogiftCardChallenge).♻️ Proposed refactor
- merged.txId, - merged.number, - merged.pin, - merged.merchantName, - merged.price, - merged.merchantUrl, - merged.note, - merged.redeemUrlChallenge, - merged.index + txId = merged.txId, + giftCardNumber = merged.number, + giftCardPin = merged.pin, + merchantName = merged.merchantName, + originalPrice = merged.price, + merchantUrl = merged.merchantUrl, + order = merged.note, + giftCardChallenge = merged.redeemUrlChallenge, + index = merged.index🤖 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 `@wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt` around lines 377 - 385, Update the call to insertGiftCardData to use named arguments for each consecutive nullable String parameter, especially mapping merged.note to order and merged.redeemUrlChallenge to giftCardChallenge; preserve the existing values and argument order for all remaining parameters.
🤖 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.
Outside diff comments:
In `@wallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.kt`:
- Around line 105-114: Handle the Boolean results from
securityGuard.ensurePinFallback and securityGuard.ensureMnemonicFallbacks in the
isPinCorrect branch, and do not return Resource.success(wallet) if either
fallback recreation fails. Surface the failure explicitly or make the
remove-and-recreate sequence transactional so the PIN update cannot report
success with incomplete recovery data.
---
Nitpick comments:
In
`@wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt`:
- Around line 355-365: Extract the duplicated existing.copy merge logic from
this provider and insertOrUpdateGiftCard into a single private
GiftCard.mergeWith(existing: GiftCard) extension function. Preserve all current
field precedence and fallback rules, then replace both inline merges with calls
to the shared function.
- Around line 377-385: Update the call to insertGiftCardData to use named
arguments for each consecutive nullable String parameter, especially mapping
merged.note to order and merged.redeemUrlChallenge to giftCardChallenge;
preserve the existing values and argument order for all remaining parameters.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4e17090b-6eda-48b2-a7c2-621a20217c1a
📒 Files selected for processing (17)
features/exploredash/src/main/java/org/dash/wallet/features/exploredash/services/UserLocationState.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/adapters/MerchantsAtmsResultAdapter.ktwallet/src/de/schildbach/wallet/livedata/EncryptWalletLiveData.ktwallet/src/de/schildbach/wallet/security/DualFallbackEncryptionProvider.ktwallet/src/de/schildbach/wallet/security/SecurityGuard.javawallet/src/de/schildbach/wallet/service/TxDisplayCacheService.ktwallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.ktwallet/src/de/schildbach/wallet/service/platform/IdentityCacheTolerance.ktwallet/src/de/schildbach/wallet/service/platform/PlatformBroadcastService.ktwallet/src/de/schildbach/wallet/service/platform/PlatformService.ktwallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.ktwallet/src/de/schildbach/wallet/ui/main/MainActivityExt.ktwallet/test/de/schildbach/wallet/service/WalletTransactionMetadataProviderGiftCardTest.ktwallet/test/de/schildbach/wallet/service/platform/IdentityCacheToleranceTest.ktwallet/test/de/schildbach/wallet/ui/dashpay/work/GetUsernameVotingResultOperationTest.ktwallet/test/de/schildbach/wallet/ui/more/tools/TransactionExportTest.ktwallet/test/de/schildbach/wallet/util/viewModels/MainViewModelTest.kt
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist:
Summary by CodeRabbit