8000 chore(dashpay): Merge feature-dashdirect into dashpay-dashdirect by Syn-McJ · Pull Request #1130 · dashpay/dash-wallet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore(dashpay): Merge feature-dashdirect into dashpay-dashdirect #1130

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

Merged
merged 6 commits into from
Jun 13, 2023

Conversation

Syn-McJ
Copy link
Member
@Syn-McJ Syn-McJ commented Jun 8, 2023

We need to merge master into dashpay.
To avoid doing more work than necessary, we'll first merge dashdirect branch into dashpay-dashdirect, and then the latter into dashpay.

Issue being fixed or feature implemented

  • Fix issues with getCreditFundingTransaction and authentication group.

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

@Syn-McJ Syn-McJ self-assigned this Jun 8, 2023
Comment on lines 386 to 391
// TODO: do we need these?
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY);
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING);
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_TOPUP);
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.INVITATION_FUNDING);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we do.

Comment on lines 132 to 142
// TODO: do we need only Platform types in here?
private val keyChainTypes = EnumSet.of(
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_TOPUP,
AuthenticationKeyChain.KeyChainType.INVITATION_FUNDING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_PLATFORM_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_VOTING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OWNER
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need platform types here. The masternode types will be added when users go to the Masternode Keys page if those key types were not yet added to the wallet.

Comment on lines 565 to 572
} else {
// TODO: do we need this branch? addWalletAuthenticationKeysAsync is only called with non-null keyParameter
authenticationGroupExtension.addKeyChains(
wallet.params,
seed,
keyChainTypes
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we don't need this else. We have other places in DashPay that handle the case of a null keyParameter, but the wallet is always encrypted so this keyParameter will always be non-null.

Comment on lines 76 to 84
AuthenticationGroupExtension authExtension =
(AuthenticationGroupExtension) dashPayWallet.addOrGetExistingExtension(
// TODO: do we need to call addKeyChains here?
new AuthenticationGroupExtension(dashPayWallet.getParams())
);
CreditFundingTransaction cftx = authExtension.getCreditFundingTransaction(tx);
// TODO: getKeyChainGroup and getKeyChainType are protected. Any other way to get the type?
AuthenticationKeyChainGroup group = ((AuthenticationKeyChainGroup)authExtension.getKeyChainGroup());
switch (group.getKeyChainType(cftx.getCreditBurnPublicKeyId().getBytes())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if CreditFundingTransaction.isCreditFundingTransaction(tx) is true, that means that the keychains were already added during as part of username creation. We don't need to call addKeyChains here.

The only place to call addKeyChains is during username creation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HashEngineering what about the second issue - we were checking the transaction type by calling wallet. getAuthenticationKeyType, but now it's missing, and keyChainGroup.getKeyChainType method is protected.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a PR for this:
dashpay/dashj#217

It is part of the CoinJoin branch, which we will be using in the next PR after this one.

You should be able to change the dashj version to 19.1-CJ-SNAPSHOT and hopefully nothing is missing or broken. Otherwise, we can make the change change to the master branch of dashj

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HashEngineering another change might be needed. See the PR

Comment on lines 320 to 325
AuthenticationGroupExtension authExtension =
(AuthenticationGroupExtension) wallet.addOrGetExistingExtension(
// TODO: do we need to call addKeyChains here?
new AuthenticationGroupExtension(wallet.getParams())
);
CreditFundingTransaction cftx = authExtension.getCreditFundingTransaction(tx);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't to call addKeyChains here.

Comment on lines 97 to 114
// TODO: is there a simpler way to do this?
val authenticationGroupExtension = AuthenticationGroupExtension(wallet)
authenticationGroupExtension.addEncryptedKeyChains(
wallet.params,
decryptedSeed,
newKey,
EnumSet.of(
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_TOPUP,
AuthenticationKeyChain.KeyChainType.INVITATION_FUNDING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_PLATFORM_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_VOTING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OWNER
)
)
wallet.addOrGetExistingExtension(authenticationGroupExtension)
Copy link
Collaborator
@HashEngineering HashEngineering Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be removed because WalletApplication.setWallet does this.

EncryptLiveData is only used after a user installs and does 10000 the onboarding (create wallet or restore wallet).

Comment on lines 68 to 74
// TODO: is this the right way to get the auth extension?
// Should we have static ID for the extension?
// Do we need to call addKeyChains here?
val authExtension = wallet.addOrGetExistingExtension(
AuthenticationGroupExtension(wallet.params)
) as AuthenticationGroupExtension
authExtension.getCreditFundingTransaction(this)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, this is the way. having a static id will be the best way for this case. I will add it in my Platform 0.24 story. When CoinJoin (feature-coinjoin) is merged into DashPay (dashpay), then we replace this and other places.

dashpay/dashj#216

Comment on lines 144 to 161
// TODO: not used. Do we need this?
// val invitationLinkData = liveData(Dispatchers.IO) {
// val tx = walletApplication.wallet!!.getTransaction(invitation.txid)
// val cftx = walletApplication.wallet!!.getCreditFundingTransaction(tx)
//
// val wallet = WalletApplication.getInstance().wallet!!
// val password = SecurityGuard().retrievePassword()
// var encryptionKey: KeyParameter? = null
// try {
// encryptionKey = wallet.keyCrypter!!.deriveKey(password)
// } catch (ex: KeyCrypterException) {
// analytics.logError(ex, "create invitation link: failed to derive encryption key")
// emit("")
// }
//
// val invite = platformRepo.blockchainIdentity.getInvitationString(cftx, encryptionKey)
// emit(invite)
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was superceded by other methods that obtain the invite string. This can be removed.

Comment on lines 386 to 390
// TODO: do we need these?
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY);
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING);
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_TOPUP);
authenticationGroupExtension.freshKey(AuthenticationKeyChain.KeyChainType.INVITATION_FUNDING);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this part.

Comment on lines 68 to 74
// TODO: is this the right way to get the auth extension?
// Should we have static ID for the extension?
// Do we need to call addKeyChains here?
val authExtension = wallet.addOrGetExistingExtension(
AuthenticationGroupExtension(wallet.params)
) as AuthenticationGroupExtension
authExtension.getCreditFundingTransaction(this)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Comment on lines 97 to 114
// TODO: is there a simpler way to do this?
val authenticationGroupExtension = AuthenticationGroupExtension(wallet)
authenticationGroupExtension.addEncryptedKeyChains(
wallet.params,
decryptedSeed,
newKey,
EnumSet.of(
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_TOPUP,
AuthenticationKeyChain.KeyChainType.INVITATION_FUNDING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_PLATFORM_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_VOTING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OWNER
)
)
wallet.addOrGetExistingExtension(authenticationGroupExtension)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Comment on lines 320 to 325
AuthenticationGroupExtension authExtension =
(AuthenticationGroupExtension) wallet.addOrGetExistingExtension(
// TODO: do we need to call addKeyChains here?
new AuthenticationGroupExtension(wallet.getParams())
);
CreditFundingTransaction cftx = authExtension.getCreditFundingTransaction(tx);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Comment on lines +649 to +652
val authExtension = walletApplication.wallet!!.addOrGetExistingExtension(
AuthenticationGroupExtension(walletApplication.wallet!!.params)
) as AuthenticationGroupExtension
val cftxs = authExtension.creditFundingTransactions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to call addKeyChains here?

Comment on lines 132 to 143
// TODO: do we need only Platform types in here?
private val keyChainTypes = EnumSet.of(
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING,
AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_TOPUP,
AuthenticationKeyChain.KeyChainType.INVITATION_FUNDING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_PLATFORM_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OPERATOR,
AuthenticationKeyChain.KeyChainType.MASTERNODE_VOTING,
AuthenticationKeyChain.KeyChainType.MASTERNODE_OWNER
)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Comment on lines 566 to 572
// TODO: do we need this branch? addWalletAuthenticationKeysAsync is only called with non-null keyParameter
authenticationGroupExtension.addKeyChains(
wallet.params,
seed,
keyChainTypes
)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

//
// val invite = platformRepo.blockchainIdentity.getInvitationString(cftx, encryptionKey)
// emit(invite)
// }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCreditFundingTransaction required refactoring, but given that we don't use invitationLinkData it might be simpler to just remove it.

Comment on lines 76 to 84
AuthenticationGroupExtension authExtension =
(AuthenticationGroupExtension) dashPayWallet.addOrGetExistingExtension(
// TODO: do we need to call addKeyChains here?
new AuthenticationGroupExtension(dashPayWallet.getParams())
);
CreditFundingTransaction cftx = authExtension.getCreditFundingTransaction(tx);
// TODO: getKeyChainGroup and getKeyChainType are protected. Any other way to get the type?
AuthenticationKeyChainGroup group = ((AuthenticationKeyChainGroup)authExtension.getKeyChainGroup());
switch (group.getKeyChainType(cftx.getCreditBurnPublicKeyId().getBytes())) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Comment on lines 76 to 84
AuthenticationGroupExtension authExtension =
(AuthenticationGroupExtension) dashPayWallet.addOrGetExistingExtension(
// TODO: do we need to call addKeyChains here?
new AuthenticationGroupExtension(dashPayWallet.getParams())
);
CreditFundingTransaction cftx = authExtension.getCreditFundingTransaction(tx);
// TODO: getKeyChainGroup and getKeyChainType are protected. Any other way to get the type?
AuthenticationKeyChainGroup group = ((AuthenticationKeyChainGroup)authExtension.getKeyChainGroup());
switch (group.getKeyChainType(cftx.getCreditBurnPublicKeyId().getBytes())) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HashEngineering what about the second issue - we were checking the transaction type by calling wallet. getAuthenticationKeyType, but now it's missing, and keyChainGroup.getKeyChainType method is protected.

@Syn-McJ Syn-McJ marked this pull request as ready for review June 12, 2023 08:29
@Syn-McJ Syn-McJ requested a review from HashEngineering June 13, 2023 12:16
Copy link
Collaborator
@HashEngineering HashEngineering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@HashEngineering HashEngineering merged commit 302ce7c into dashpay-dashdirect Jun 13, 2023
@Syn-McJ Syn-McJ deleted the dashpay-dashdirect-merge branch June 17, 2023 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0