Skip to content
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

Komenci <> Valora Integration: invites and escrow #5742

Merged
merged 148 commits into from
Nov 10, 2020

Conversation

tarikbellamine
Copy link
Contributor

@tarikbellamine tarikbellamine commented Nov 6, 2020

Description

This PR builds on the previous two PRs of the series (DEK/wallet registration and feeless verification to provide an escrow experience that does not use "invite codes".

This PR includes unmerged changes included in previous PRs. The most relevant files for this PR:

  • escrow/saga
  • invite/saga

The pertinent UI changes:

  1. Elimination of the "Enter Invite Code" screen as there is no longer an invite code to redeem
  2. Copy changes to prepopulated invite messages we form for users on WhatsApp or SMS

The transaction changes:

  1. Unique escrow paymentIds and the private key required to redeeem are now both formed using a hash of the recipient's pepper
  2. Added support for redemption of multiple escrow transctions

Other changes

N/A

Tested

Not yet

Related issues

Backwards compatibility

No

Gonzalo Nardini and others added 30 commits September 25, 2020 03:19
Copy link
Contributor

@gnardini gnardini left a comment

Choose a reason for hiding this comment

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

Looking good! A few small things regarding sharing :)

packages/mobile/locales/en-US/sendFlow7.json Outdated Show resolved Hide resolved
packages/mobile/src/invite/saga.ts Outdated Show resolved Hide resolved
packages/mobile/src/config.ts Outdated Show resolved Hide resolved
packages/mobile/src/invite/saga.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

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

Looking great! 👍 🚀
Mostly small things commented.

packages/mobile/src/config.ts Outdated Show resolved Hide resolved
packages/mobile/src/escrow/utils.ts Outdated Show resolved Hide resolved
// Needed to ensure that codes inputted in quick succession are not
// assigned the same nonce by Komenci
while (yield select(feelessProcessingInputCodeSelector)) {
yield delay(100)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the delay actually important or are we just interested in reacting to redux state changes?
in that case we could replace the delay by yield take() which would wait for any dispatched action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may not be as simple as yield take given we want them to be taken one-by-one and there may be 2 codes "waiting". I've left a TODO to look into this later.

packages/mobile/locales/en-US/sendFlow7.json Outdated Show resolved Hide resolved
}, [])

useEffect(() => {
if (status.isVerified) {
dispatch(setNumberVerified(true))
}
}, [verificationState.status.isVerified, feelessVerificationState.status.isVerified])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, [verificationState.status.isVerified, feelessVerificationState.status.isVerified])
}, [status.isVerified])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we want to leave this as is. There is an edge case where a user is allowed to tryFeeless but they've already verified in the non-feeless flow.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand we might not want to change this at the last minute but the dependencies listed should only be values that are used in the useEffect block.

@@ -124,7 +130,7 @@ export function* feelessFetchVerificationState() {
])

const komenciKit = new KomenciKit(contractKit, walletAddress, {
url: KOMENCI_URL,
url: feelessVerificationState.komenci.callbackUrl || KOMENCI_URL,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need the fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this has to do with data center routing.

@@ -92,7 +98,7 @@ import { TransactionReceipt } from 'web3-eth'

const TAG = 'identity/feelessVerification'

const KOMENCI_URL = 'https://komenci.celo-networks-dev.org'
export const KOMENCI_URL = 'https://staging-komenci.azurefd.net'
Copy link
Contributor

Choose a reason for hiding this comment

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

This is only temporary right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The placement was temporary, the url is not. That will be our staging URL moving forward.

Comment on lines +184 to +205
useEffect(() => {
if (reviewButtonPressed) {
if (recipientVerificationStatus === RecipientVerificationStatus.UNKNOWN) {
// Wait until the recipient status is fetched.
return
} else if (
recipientVerificationStatus === RecipientVerificationStatus.UNVERIFIED &&
dollarAmount.isGreaterThan(MAX_ESCROW_VALUE)
) {
const maxAmount = convertDollarsToLocalAmount(MAX_ESCROW_VALUE, localCurrencyExchangeRate)
dispatch(
showError(ErrorMessages.MAX_ESCROW_TRANSFER_EXCEEDED, ALERT_BANNER_DURATION, {
maxAmount: maxAmount?.toFixed(2),
symbol: localCurrencySymbol,
})
)
} else {
isOutgoingPaymentRequest ? onRequest() : onSend()
}
setReviewButtonPressed(false)
}
}, [reviewButtonPressed, recipientVerificationStatus])
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a slight bug here since localCurrencyExchangeRate and localCurrencySymbol are not the in dependencies list of useEffect. Though in practice those values won't change at this point.
Adding them to the dependencies list is not enough though, we'd also need to make sure the action is not dispatched twice. Which would happen if other values change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but I feel pretty comfortable leaving it as is. Nothing bad happens if the user is over the limit here; it's an artificial constraint we are placing as an added security measure. There is also no way to change localCurrency on the screen.

Is there a use case you had in mind where this could be problematic?

Copy link
Contributor

@jeanregisser jeanregisser Nov 10, 2020

Choose a reason for hiding this comment

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

Again it's harmless, localCurrency doesn't change but localCurrencyExchangeRate can change.
The point is that it's not entirely right and introduces a subtle bug. Which might or might not bite us in the future ;)

@tarikbellamine tarikbellamine changed the base branch from tarikbellamine/komenci-valora-verification to master November 10, 2020 02:03
@tarikbellamine tarikbellamine added the automerge Have PR merge automatically when checks pass label Nov 10, 2020
@tarikbellamine tarikbellamine merged commit bcaa3ff into master Nov 10, 2020
@mergify mergify bot deleted the tarikbellamine/komenci-valora-escrow branch November 10, 2020 08:20
@Lss-Ankit
Copy link

Hi @tarikbellamine Verified task on latest test flight build v1.5.5 (34) and Android play store internal build v1.5.5 (1004294323) and observe the followings

  • User A is able to invite the userB with escrow payment
  • User B redirected to app store OR play-store when tapping on received URL
    However, user is not redirected to latest v1.5.5 builds even app in installed
  • user get blocked to install the latest build v1.5.5 by tapping on received invite URL link

Can you please provide more information about this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass fee-less onboarding All issues in the Fee-less Onboarding bubble wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants