-
Notifications
You must be signed in to change notification settings - Fork 9
Sdk-integration #959
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
Sdk-integration #959
Conversation
PR SummaryIntegrated Flow Wallet Kit SDK and migrated crypto provider implementations. Resolved dependency conflicts in Gradle and updated transaction handling to use new Flow SDK models. Improved account management with better error handling and logging. Changes
autogenerated by presubmit.ai |
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 needs attention.
Review Summary
Files Processed (15)
- app/build.gradle (3 hunks)
- app/src/main/AndroidManifest.xml (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitAdapter.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitKeyAdapter.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/account/AccountManager.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/BackupCryptoProvider.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (9 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/key/CryptoProviderManager.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/key/HDWalletCryptoProvider.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/network/UserRegisterUtils.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/restore/keystore/PrivateKeyStoreCryptoProvider.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/restore/multirestore/viewmodel/MultiRestoreViewModel.kt (12 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/wallet/confirm/presenter/WalletConfirmPresenter.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/wallet/proxy/WalletProxyConfirmationDialog.kt (2 hunks)
- build.gradle (2 hunks)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitAdapter.kt [23-23]
best practice: "Potential issue with temporary directory usage on Android"
-
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitKeyAdapter.kt [72-74]
security: "Missing signature validation implementation"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/page/wallet/proxy/WalletProxyConfirmationDialog.kt [78-105]
best practice: "Potential memory leak in coroutine usage"
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitKeyAdapter.kt
Outdated
Show resolved
Hide resolved
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 needs attention.
Review Summary
Commits Considered (1)
- a812318: Key + account integration
Files Processed (21)
- app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitAdapter.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitKeyAdapter.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/account/AccountManager.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/BackupCryptoProvider.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/GoogleDriveBackupUtils.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/dropbox/DropboxBackupUtils.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (9 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/key/CryptoProviderManager.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/key/HDWalletCryptoProvider.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/network/UserRegisterUtils.kt (7 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupDropboxViewModel.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupGoogleDriveViewModel.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupRecoveryPhraseViewModel.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/viewmodel/BackupSeedPhraseViewModel.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/restore/keystore/PrivateKeyStoreCryptoProvider.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/restore/multirestore/viewmodel/MultiRestoreViewModel.kt (11 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/security/recovery/SecurityPrivateKeyActivity.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/security/recovery/SecurityPublicKeyActivity.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/wallet/confirm/presenter/WalletConfirmPresenter.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/wallet/proxy/WalletProxyConfirmationDialog.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/walletrestore/Utils.kt (1 hunk)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitKeyAdapter.kt [73-76]
security: "Signature validation is not implemented"
-
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitAdapter.kt [90-93]
possible issue: "Missing data migration implementation"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/page/wallet/proxy/WalletProxyConfirmationDialog.kt [78-79]
best practice: "Potential memory leak in coroutine scope"
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitKeyAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/flowfoundation/wallet/flowkit/FlowKitAdapter.kt
Outdated
Show resolved
Hide resolved
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 needs attention.
Review Summary
Commits Considered (1)
- 4659101: Key + account integration
Files Processed (14)
- app/src/main/java/com/flowfoundation/wallet/manager/account/AccountWalletManager.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/BackupCryptoProvider.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/drive/GoogleDriveAuthActivity.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/dropbox/DropboxAuthActivity.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/evm/Utils.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/key/CryptoProviderManager.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectResponse.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletDappDelegate.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/fragment/BackupCompletedFragment.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupDropboxViewModel.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupGoogleDriveViewModel.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupRecoveryPhraseViewModel.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/profile/subpage/claimdomain/ClaimDomainViewModel.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/restore/multirestore/viewmodel/MultiRestoreViewModel.kt (11 hunks)
Actionable Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/account/AccountWalletManager.kt [52-57]
security: "Potential security risk with hardcoded empty passphrase"
Skipped Comments (3)
-
app/src/main/java/com/flowfoundation/wallet/page/restore/multirestore/viewmodel/MultiRestoreViewModel.kt [241-248]
possible issue: "Potential memory leak with multiple key instances"
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletDappDelegate.kt [193-194]
maintainability: "Incomplete TODO comment"
-
app/src/main/java/com/flowfoundation/wallet/page/profile/subpage/claimdomain/ClaimDomainViewModel.kt [94-94]
maintainability: "Incomplete TODO comment"
app/src/main/java/com/flowfoundation/wallet/manager/account/AccountWalletManager.kt
Show resolved
Hide resolved
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 needs attention.
Review Summary
Commits Considered (1)
- 0b9aec0: Key + account integration
Files Processed (11)
- app/src/main/AndroidManifest.xml (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/account/AccountManager.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt (8 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletDappDelegate.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/network/UserRegisterUtils.kt (7 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupRecoveryPhraseViewModel.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/backup/viewmodel/BackupSeedPhraseViewModel.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/profile/subpage/claimdomain/ClaimDomainActivity.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/profile/subpage/claimdomain/ClaimDomainViewModel.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/profile/subpage/claimdomain/Utils.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/profile/subpage/wallet/WalletSettingActivity.kt (2 hunks)
Actionable Comments (3)
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt [241-241]
best practice: "Function should be marked as suspend since it performs asynchronous operations"
-
app/src/main/java/com/flowfoundation/wallet/manager/account/AccountManager.kt [200-202]
possible bug: "Potential null pointer exception in public key handling"
-
app/src/main/java/com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupRecoveryPhraseViewModel.kt [176-176]
possible issue: "Missing input validation for mnemonic phrase"
Skipped Comments (0)
.../main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt
Show resolved
Hide resolved
app/src/main/java/com/flowfoundation/wallet/manager/account/AccountManager.kt
Outdated
Show resolved
Hide resolved
...com/flowfoundation/wallet/page/backup/multibackup/viewmodel/BackupRecoveryPhraseViewModel.kt
Outdated
Show resolved
Hide resolved
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 needs attention.
Review Summary
Commits Considered (1)
- 98c0dfa: Key + account integration
Files Processed (12)
- app/src/androidTest/java/com/flowfoundation/wallet/TestApi.kt (1 hunk)
- app/src/androidTest/java/com/flowfoundation/wallet/TestKeyStore.kt (1 hunk)
- app/src/androidTest/java/com/flowfoundation/wallet/TestWallet.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/account/AccountKeyManager.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/account/AccountMigrate.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/evm/COALinkCheckManager.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/evm/EVMWalletManager.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/evm/Utils.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateManager.kt (7 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateWatcher.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/Utils.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt (9 hunks)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt [461-477]
possible issue: "Missing error handling in coroutine block"
-
app/src/main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt [470-470]
possible bug: "Potential null pointer exception in message handling"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/evm/Utils.kt [191-191]
enhancement: "Add timeout handling for cryptographic operation"
.../main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt
Show resolved
Hide resolved
.../main/java/com/flowfoundation/wallet/manager/walletconnect/WalletConnectRequestDispatcher.kt
Outdated
Show resolved
Hide resolved
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 needs attention.
Review Summary
Commits Considered (1)
- 07357b3: Transactions integration
Files Processed (1)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (15 hunks)
Actionable Comments (3)
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [55-56]
possible bug: "Potential null pointer exception in transaction ID logging"
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [166-169]
possible issue: "Missing error handling in transaction submission"
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [367-371]
possible bug: "Potential null reference in authorizers list"
Skipped Comments (0)
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt
Outdated
Show resolved
Hide resolved
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 needs attention.
Review Summary
Commits Considered (1)
- e724ea2: Transactions integration
Files Processed (1)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (14 hunks)
Actionable Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [346-350]
possible bug: "Potential null reference in authorizers list"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [55-56]
possible issue: "Missing error handling for transaction ID"
| authorizers = if (transaction.authorizers.isNullOrEmpty()) { | ||
| listOf(transaction.proposalKey.address.orEmpty()) | ||
| } else { | ||
| authorizers(transaction.authorizers.map { FlowAddress(it) }.toMutableList()) | ||
| } | ||
|
|
||
| payerAddress = FlowAddress(transaction.payer.orEmpty()) | ||
| } | ||
| transaction.authorizers | ||
| }, |
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.
The code doesn't validate the transaction.proposalKey.address before using it as a fallback for authorizers. Consider adding null checks:
authorizers = if (transaction.authorizers.isNullOrEmpty()) {
transaction.proposalKey.address?.takeIf { it.isNotEmpty() }?.let { listOf(it) } ?: emptyList()
} else {
transaction.authorizers
}
<!-- presubmit.ai: comment -->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.
✅ LGTM!
Review Summary
Commits Considered (1)
- ed41495: Transactions integration
Files Processed (6)
- app/src/main/java/com/flowfoundation/wallet/manager/flow/FlowCadenceApi.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/CadenceExecutor.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/FlowAddressRegistry.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (13 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateManager.kt (8 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateWatcher.kt (2 hunks)
Actionable Comments (0)
Skipped Comments (3)
-
app/src/main/java/com/flowfoundation/wallet/manager/flow/FlowCadenceApi.kt [57-57]
best practice: "Generic error wrapping may hide important details"
-
app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateManager.kt [104-105]
readability: "Variable declaration could be moved closer to usage"
-
app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateWatcher.kt [24-25]
maintainability: "Unused variable declaration"
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 needs attention.
Review Summary
Commits Considered (1)
- 9cd6d1a: Transactions integration
Files Processed (8)
- app/src/main/java/com/flowfoundation/wallet/manager/LaunchManager.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/GoogleDriveBackupUtils.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/dropbox/DropboxBackupUtils.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flow/FlowCadenceApi.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/Utils.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (13 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateWatcher.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/Utils.kt (1 hunk)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/backup/GoogleDriveBackupUtils.kt [82-83]
possible bug: "Potential null pointer exception when accessing block account"
-
app/src/main/java/com/flowfoundation/wallet/manager/transaction/Utils.kt [12-14]
possible bug: "Potential null pointer exception in transaction status check"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateWatcher.kt [28-31]
best practice: "Missing error handling for transaction result"
| val blockAccount = FlowAddress(wallet?.walletAddress().orEmpty()).lastBlockAccount() | ||
| val keyExist = blockAccount?.keys?.firstOrNull { provider.getPublicKey() == it.publicKey.base16Value } != null | ||
| val keyExist = blockAccount?.keys?.firstOrNull { provider.getPublicKey() == it.publicKey } != null |
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.
The code accesses blockAccount.keys directly without checking if blockAccount is null first. This could lead to a null pointer exception. Consider adding a null check:
val keyExist = blockAccount?.keys?.firstOrNull { provider.getPublicKey() == it.publicKey } != null| fun TransactionResult.isExecuteFinished(): Boolean { | ||
| return !status.ordinal.isProcessing() && errorMessage.isBlank() | ||
| } |
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.
The isExecuteFinished() function accesses status.ordinal and errorMessage without checking if they are null. Consider adding null safety checks:
fun TransactionResult.isExecuteFinished(): Boolean {
return !status?.ordinal?.isProcessing() ?: false && (errorMessage?.isBlank() ?: true)
}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 needs attention.
Review Summary
Commits Considered (1)
- fe8a557: Transactions integration
Files Processed (3)
- app/src/main/java/com/flowfoundation/wallet/manager/flow/CadenceScriptBuilder.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateManager.kt (8 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateWatcher.kt (2 hunks)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/flow/CadenceScriptBuilder.kt [33-37]
possible issue: "Incomplete error handling in chain ID mapping"
-
app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateManager.kt [117-119]
possible bug: "Potential null safety issue in transaction status check"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/transaction/TransactionStateManager.kt [112-116]
best practice: "Missing error handling for transaction result check"
| private fun getFlowChainId(chainId: ChainId): ChainId { | ||
| return when (chainId) { | ||
| ChainId.Testnet -> FlowChainId.TESTNET | ||
| else -> FlowChainId.MAINNET | ||
| ChainId.Testnet -> ChainId.Testnet | ||
| else -> ChainId.Mainnet | ||
| } |
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.
The getFlowChainId function only handles Testnet explicitly and uses Mainnet as a catch-all default. This could silently handle invalid chain IDs incorrectly. Consider adding an else branch that throws an exception for unhandled chain IDs to fail fast on invalid inputs.
| if (ret.status!!.ordinal != state.state) { | ||
| state.state = ret.status!!.ordinal | ||
| state.errorMsg = ret.errorMessage |
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.
The code assumes ret.status is non-null by using the !! operator. This could lead to a runtime crash if the status is null. Consider adding a null check or using a safe call operator ?. with appropriate fallback handling.
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 needs attention.
Review Summary
Commits Considered (1)
- 608846e: Transactions integration
Files Processed (4)
- app/build.gradle (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/GoogleDriveBackupUtils.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/dropbox/DropboxBackupUtils.kt (5 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (13 hunks)
Actionable Comments (2)
-
app/build.gradle [26-27]
security: "Potential security risk in credentials handling"
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [273-275]
possible bug: "Potential data loss in argument handling"
Skipped Comments (1)
-
app/build.gradle [254-256]
possible issue: "Potential version conflict in dependencies"
app/build.gradle
Outdated
| username = properties.getProperty("gpr.user") as String?: System.getenv("GITHUB_USER") | ||
| password = properties.getProperty("gpr.key") as String?: System.getenv("GITHUB_TOKEN") |
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.
The GitHub credentials are being read from properties or environment variables. Consider using a more secure secret management solution for production builds, and ensure these credentials have minimal required permissions. Also add validation to handle cases where both property and environment variable are missing.
| type = it.getTypeName(), | ||
| value = it.value ?: "" // to-do : is empty string ok here? | ||
| ) |
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.
The code uses an empty string as a fallback when argument value is null. This could mask actual issues and lead to invalid transactions. Consider throwing an exception or handling null values more explicitly:
value = it.value ?: throw IllegalArgumentException("Transaction argument value cannot be null")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 needs attention.
Review Summary
Commits Considered (1)
- 1ed692d: Transactions integration
Files Processed (3)
- app/src/main/java/com/flowfoundation/wallet/manager/evm/Utils.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/FlowApi.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (7 hunks)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [209-209]
possible issue: "Missing error handling for failed transaction signing"
-
app/src/main/java/com/flowfoundation/wallet/manager/evm/Utils.kt [190-190]
possible issue: "Function returns empty string on error"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [313-313]
best practice: "Hardcoded gas limit value"
| val signer = createSigner( | ||
| address = payer, | ||
| keyIndex = currentKey.index.toInt(), | ||
| signer = cryptoProvider.getSigner() |
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.
The signEthereumMessage function should include error handling and validation for the case when signing fails. Consider wrapping the signing operation in a try-catch block and returning an appropriate error message or throwing a specific exception.
| } | ||
|
|
||
| fun signTypedData(data: ByteArray): String { | ||
| suspend fun signTypedData(data: ByteArray): String { |
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.
The signTypedData function returns an empty string when the crypto provider or wallet address is not available. Consider throwing an exception or returning a Result type to better handle error cases.
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 needs attention.
Review Summary
Commits Considered (1)
- d5e31dc: Transactions integration
Files Processed (4)
- app/src/main/java/com/flowfoundation/wallet/manager/flow/FlowCadenceApi.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/PayerSignable.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt (6 hunks)
- app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Utils.kt (2 hunks)
Actionable Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [242-242]
possible bug: "Potential null pointer exception in sign method"
Skipped Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/flow/FlowCadenceApi.kt [57-57]
best practice: "Generic error message may hide important details"
-
app/src/main/java/com/flowfoundation/wallet/manager/flowjvm/transaction/Transaction.kt [367-367]
maintainability: "Magic number in gas limit default value"
| override var address: String = address | ||
| override var keyIndex: Int = keyIndex | ||
|
|
||
| override suspend fun sign(transaction: Transaction?, bytes: ByteArray): ByteArray { |
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.
The sign method accepts a nullable Transaction parameter but doesn't handle the null case. Consider adding null checks or documenting why null is acceptable here.
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 needs attention.
Review Summary
Commits Considered (1)
- c7eea31: Transactions integration + key integration
Files Processed (1)
- app/src/main/java/com/flowfoundation/wallet/manager/backup/BackupCryptoProvider.kt (1 hunk)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/manager/backup/BackupCryptoProvider.kt [20-22]
possible bug: "Potential null pointer exception in public key conversion"
-
app/src/main/java/com/flowfoundation/wallet/manager/backup/BackupCryptoProvider.kt [29-31]
possible issue: "Potential failure in signature generation"
Skipped Comments (0)
| @OptIn(ExperimentalStdlibApi::class) | ||
| override fun getPublicKey(): String { | ||
| val privateKey = wallet.getCurveKey(Curve.NIST256P1, DERIVATION_PATH) | ||
| val publicKey = privateKey.publicKeyNist256p1.uncompressed().data().bytesToHex() | ||
| return publicKey.removePrefix("04") | ||
| return seedPhraseKey.publicKey(SigningAlgorithm.ECDSA_P256)?.toHexString()?.removePrefix("04") ?: "" |
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.
The publicKey() call can return null, and while there's a null-safe operator, the empty string fallback could lead to issues downstream. Consider throwing an exception or handling the null case more explicitly to fail fast if the public key cannot be generated.
| @OptIn(ExperimentalStdlibApi::class) | ||
| override suspend fun signData(data: ByteArray): String { | ||
| return seedPhraseKey.sign(data, SigningAlgorithm.ECDSA_P256, HashingAlgorithm.SHA2_256).toHexString() |
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.
The sign() method might throw exceptions in case of signing failures. Consider wrapping this in a try-catch block to handle potential cryptographic operation failures gracefully.
| setOf(ChainId.Mainnet, ChainId.Testnet), | ||
| getStorage() | ||
| ) | ||
| return BackupCryptoProvider(seedPhraseKey, wallet as KeyWallet) |
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.
I remember that HDWallet here is used to handle the original 12-word mnemonic key, which has a weight of 1000. The BackupCryptoProvider, on the other hand, is specifically designed to handle multi-backup keys, all of which have a weight of 500. This needs to be confirmed.
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.
Yes the same logic is currently applied:
- HDWalletCryptoProvider (Original 12-word mnemonic, Weight: 1000)
- BackupCryptoProvider (Multi-backup keys, Weight: 500)
@jaymengxy
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.
I see that BackupCryptoProvider is used here, Shouldn't we use the HDWalletCryptoProvider here?
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.
Updated this one - re-testing
| // Fallback to sensible defaults based on signing algorithm | ||
| when (signingAlgorithm) { | ||
| SigningAlgorithm.ECDSA_secp256k1 -> HashingAlgorithm.SHA2_256 | ||
| SigningAlgorithm.ECDSA_P256 -> HashingAlgorithm.SHA3_256 |
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.
The hash algorithm used for our multi-backup was previously SHA2-256. Please check if it can be synchronized with iOS.
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.
@jaymengxy ok - should we always fallback to SHA2-256 if the hashing algorithm isn't found on the provider?
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.
Another option would be to throw an error instead of falling back to a default algorithm
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.
My question is why the SigningAlgorithm.ECDSA_P256 was changed to use the HashingAlgorithm.SHA3_256 instead of SHA2_256.
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.
ah, I see what you mean. I think it is using SHA2_256, this is just a fallback in case the hashing algorithm isn't found on the provider. I can update it to SHA2_256 in the fallback.
Related Issue
Closes #???
Summary of Changes
Need Regression Testing
Risk Assessment
Additional Notes
Screenshots (if applicable)