-
Notifications
You must be signed in to change notification settings - Fork 370
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
[Wallet] Fix slow activity feed tx confirmations #2290
Conversation
@@ -86,7 +86,7 @@ function* registerStandbyTransaction(id: string, value: string, address: string) | |||
id, | |||
type: TransactionTypes.ESCROW_SENT, | |||
status: TransactionStatus.Pending, | |||
value, | |||
value: +value, |
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.
Note that storing StandbyTransaction as number
instead of string
does not impact precision, as the confirmed transaction value is stored as a number
anyway. Did not want to modify graphQL to change both to strings so as not to overlap with @jeanregisser 's local currency work
@@ -61,6 +46,24 @@ type TransferTransactionTypes = | |||
| TransactionTypes.INVITE_RECEIVED | |||
| TransactionTypes.NETWORK_FEE | |||
|
|||
export const isTransferType = (txType: TransactionTypes) => { |
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.
Couldn't find a cleaner way to check multiple types but lmk if you think of one
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.
sometimes i will make an array here and then just check if the string is contained in the array
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.
Kk I find the function cleaner than the array so will keep as is
Codecov Report
@@ Coverage Diff @@
## master #2290 +/- ##
==========================================
- Coverage 74.55% 74.52% -0.03%
==========================================
Files 278 278
Lines 7777 7777
Branches 991 709 -282
==========================================
- Hits 5798 5796 -2
- Misses 1868 1869 +1
- Partials 111 112 +1
Continue to review full report at Codecov.
|
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.
woot woot woot
|
||
export const invitedAddress = '0x1b173' | ||
|
||
const exchangeDollar: HomeExchangeFragment = { | ||
__typename: EventTypeNames.Exchange, | ||
type: 'EXCHANGE' as TransactionTypes, | ||
type: 'EXCHANGE' as TransactionTypes.EXCHANGE, |
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.
Why not just use the enum's actual value? (not sure who did this originally)
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 think this is a more realistic mock of what would be returned?
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 think Connors point is that TransactionTypes.Exchange
=== 'EXCHANGE' so why hardcode the value here?
And I think the reason it was originally hard coded in the first place is that the auto-gen typing tool did it this way
@@ -1,41 +1,51 @@ | |||
import { Query } from 'react-apollo' | |||
import { TransactionTypes } from 'src/transactions/reducer' | |||
import { CURRENCY_ENUM } from 'src/geth/consts' |
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 just tried it and it doesn't work right now, but i think this file originally came from running yarn run build:gen-graphql-types
with the blockchain api running locally
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.
Kk are you saying we should avoid modifying this generated file?
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.
This file was originally made that way but most of that auto gen code has been changed over time. I've made modifications here too.
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 believe we diverged away from the auto gen types because of the differing shapes of our standby tx and graphql txs
@@ -28,8 +27,7 @@ describe('ExchangeFeedItem', () => { | |||
<Provider store={createMockStore({})}> | |||
<ExchangeFeedItem | |||
status={TransactionStatus.Complete} | |||
__typename={EventTypeNames.Exchange} | |||
type={'EXCHANGE' as TransactionTypes} | |||
type={'EXCHANGE' as TransactionTypes.EXCHANGE} |
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.
same enum 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.
Same as above
@@ -61,6 +46,24 @@ type TransferTransactionTypes = | |||
| TransactionTypes.INVITE_RECEIVED | |||
| TransactionTypes.NETWORK_FEE | |||
|
|||
export const isTransferType = (txType: TransactionTypes) => { |
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.
sometimes i will make an array here and then just check if the string is contained in the array
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.
Thanks for tackling this! Can you clarify how this solves the problem exactly?
@@ -1,41 +1,51 @@ | |||
import { Query } from 'react-apollo' | |||
import { TransactionTypes } from 'src/transactions/reducer' | |||
import { CURRENCY_ENUM } from 'src/geth/consts' |
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.
This file was originally made that way but most of that auto gen code has been changed over time. I've made modifications here too.
@@ -1,41 +1,51 @@ | |||
import { Query } from 'react-apollo' | |||
import { TransactionTypes } from 'src/transactions/reducer' | |||
import { CURRENCY_ENUM } from 'src/geth/consts' |
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 believe we diverged away from the auto gen types because of the differing shapes of our standby tx and graphql txs
|
||
export const invitedAddress = '0x1b173' | ||
|
||
const exchangeDollar: HomeExchangeFragment = { | ||
__typename: EventTypeNames.Exchange, | ||
type: 'EXCHANGE' as TransactionTypes, | ||
type: 'EXCHANGE' as TransactionTypes.EXCHANGE, |
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 think Connors point is that TransactionTypes.Exchange
=== 'EXCHANGE' so why hardcode the value here?
And I think the reason it was originally hard coded in the first place is that the auto-gen typing tool did it this way
timestamp: Date.now(), | ||
address: '0x423043cca38e75d7913504fedfd1dd4539cc55b3', | ||
comment: 'FAKE FAKE FAKE', | ||
hash: '01010', | ||
} | ||
const verificationReward: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, |
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.
Why don't we need these graphQL provided __typename properties anymore? Is it cause @jeanregisser split the home feed and exchange feed queries in bc-api?
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.
Yeah we don't need them since we know the EventType from the transaction type
packages/utils/src/phoneNumbers.ts
Outdated
@@ -153,7 +153,9 @@ export function parsePhoneNumber( | |||
} | |||
: null | |||
} catch (error) { | |||
console.debug(`phoneNumbers/parsePhoneNumber/Failed to parse phone number, error: ${error}`) | |||
console.debug( | |||
`phoneNumbers/parsePhoneNumber/Failed to parse phone number ${phoneNumberRaw}, error: ${error}` |
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.
We intentionally excluded the phone number for privacy reasons, as the logs get uploaded to firebase
This solves the problem as the issue was that the "Confirming..." notification was not being removed once the confirmation came in. It was actually not a network issue of the transaction taking a long time to be confirmed- it was a UI issue of the PendingTransaction not going away (though it occurred more often when internet was slow, perhaps bc it took longer to query the notification feed?). After cleaning up |
* master: (139 commits) Accelerate time based parameters (#2377) Fix circle not being started (#2380) Blockscout logs patch for json format (#2268) [Wallet] Fix slow activity feed tx confirmations (#2290) Aaronmgdr/about followup (#2376) Change "not syncing" to "not synced" (#2372) [Docs] Update Contributing guide with links to good first issues (#2375) Optimize Bundles (#2352) Update blockscout for alfajores and pilot envs (#1954) Make the same hotfix proposal executable with unique salts (#2357) Fix Contribution Guildelines in the docs (#2370) Add Snapshot for each page on website (#2313) Turn on Emit (#2369) Update to latest blockchain with select issuers fix (#2362) Add docs on how to generate sms retriever hash (#2356) Aaronmgdr/about below (#1194) Switch to using native pbkdf to fix hanging on older devices (#2354) Adding a command to the docker script allowing to stop validating (#2295) Update prettier to 1.19.1 to support TypeScript 3.7 (optional chaining, nullish coalescing, etc) (#2358) Fixes needed to make slashing work (#2346) ...
This reverts commit 8ebc663. Conflicts too much with the transaction feed refactor.
Description
Currently, the activity feed can be slow to update transactions in the activity from "confirming..." to "confirmed", especially when on a 3g connection. Balances update but the "confirming..." is still there, along with a duplicate "confirmed" transaction.
Now, the activity feed removes the "confirming..." transactions promptly and never renders "confirming..." and "confirmed" at the same time.
Tested
Updated jest tests
Tested on pixel 2, throttling to 3g speeds using Charles, also using normal wifi. Confirmed that transaction confirmations for send, exchange and invite come in at the same time that the balance is updated
Other changes
Created Transaction type to align Standby and confirmed (from graphQL) transactions
Updated some logging
Related issues
Backwards compatibility
Yes