Conversation
PR SummaryEnhanced WalletConnect implementation by improving session management and error handling. Added session topic validation, improved namespace approval process, and reorganized error messages. The changes focus on preventing stale session issues and providing better error feedback. Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
✅ LGTM!
Review Summary
Commits Considered (18)
- 15ef59e: Debugging
- 615b7db: Debugging
- 6042104: Debugging
- ea9539d: Debugging
- fb65831: Debugging
- 6f1a7b8: Merge remote-tracking branch 'origin/wc-debugging-2' into wc-debugging-2
- cbbcbeb: Disable dev build on branch
- 0b8d5cf: Merge branch 'develop' into wc-debugging-2
- a025e70: Improve session cleanup
- dcad73d: Improve session cleanup
- f1ae541: Improve session cleanup
- a7817ac: Improve session cleanup
- 1fc7469: Improve session cleanup
- 84e630e: Run build
- 57a5d7a: Session cleanup
- 81900f6: Session cleanup
- b908eb4: Improve error handling
- c1df5b3: Improve error handling
Files Processed (6)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnect.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectDelegate.kt (9 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/component/deeplinking/DeepLinkingActivity.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/component/deeplinking/Utils.kt (2 hunks)
- app/src/main/res/values/strings.xml (2 hunks)
Actionable Comments (0)
Skipped Comments (3)
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnect.kt [55-57]
possible issue: "Potential timeout issue in initialization wait logic"
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt [302-304]
enhancement: "Improve error logging for missing authentication parameters"
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectDelegate.kt [424-431]
enhancement: "Improve session topic validation error logging"
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 2e30fb0: Debugging
Files Processed (7)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/Utils.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnect.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectDelegate.kt (9 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/component/deeplinking/DeepLinkingActivity.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/component/deeplinking/Utils.kt (2 hunks)
- app/src/main/res/values/strings.xml (2 hunks)
Actionable Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt [318-354]
possible issue: "Potential infinite retry loop in response sending"
Skipped Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectDelegate.kt [40-41]
best practice: "Consider using atomic boolean for thread safety"
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnect.kt [51-70]
possible issue: "Potential memory leak in initialization wait loop"
| var retryCount = 0 | ||
| val maxRetries = 3 | ||
| var success = false | ||
|
|
||
| while (!success && retryCount < maxRetries) { | ||
| try { | ||
| SignClient.respond(response, onSuccess = { result -> | ||
| logd(TAG, "Response sent successfully: $result") | ||
| success = true | ||
| ioScope { | ||
| try { | ||
| delay(1000) | ||
| logd(TAG, "Authn response sent, proceeding with session settlement") | ||
| // Try to get the redirect URL from the session | ||
| val session = SignClient.getActiveSessionByTopic(topic) | ||
| if (session?.metaData?.redirect.isNullOrEmpty()) { | ||
| logd(TAG, "No redirect URL found in session metadata") | ||
| } else { | ||
| logd(TAG, "Found redirect URL in session metadata: ${session?.metaData?.redirect}") | ||
| } | ||
| } catch (e: Exception) { | ||
| loge(TAG, "Error during authn response cleanup: ${e.message}") | ||
| loge(e) | ||
| // Don't reject here since the response was already sent successfully | ||
| } | ||
| } | ||
| }) { error -> | ||
| loge(TAG, "Failed to send response (attempt ${retryCount + 1}): ${error.throwable.message}") | ||
| loge(error.throwable) | ||
| retryCount++ | ||
| if (retryCount >= maxRetries) { | ||
| reject() | ||
| } | ||
| } | ||
| if (!success) { | ||
| delay(1000L * (retryCount + 1)) | ||
| } |
There was a problem hiding this comment.
The retry mechanism for sending responses could potentially continue indefinitely if success is never set to true and no exception is thrown. Consider adding a timeout or maximum duration for the entire retry process.
There was a problem hiding this comment.
✅ LGTM!
Review Summary
Commits Considered (1)
- 1b6edbf: Pull latest changes
Files Processed (1)
- app/src/main/res/values/strings.xml (2 hunks)
Actionable Comments (0)
Skipped Comments (1)
-
app/src/main/res/values/strings.xml [767-769]
enhancement: "Consider consolidating error messages into a single string resource with formatting"
There was a problem hiding this comment.
✅ LGTM!
Review Summary
Commits Considered (1)
- fa4647b: Pull latest changes
Files Processed (1)
- app/src/main/res/values/strings.xml (2 hunks)
Related Issue
Summary of Changes
reowngenerateApprovedNamespacesmethod which already implements this logicNeed Regression Testing
Risk Assessment
Additional Notes
Screenshots (if applicable)