GoodDollar / GoodDAPP

GoodDollar.org Wallet is the simplest access point to Claim your daily G$. It Is based on web3 and React native web.
good-dapp.vercel.app
MIT License
101 stars 52 forks source link

4221 fix explorer calls #4223

Closed L03TJ3 closed 4 months ago

L03TJ3 commented 5 months ago

Description

Several errors and failed api calls were reported. also it seemed the API was called extensively which should be roughly every 30 seconds, not accounting for when someone scrolls over the feed. that triggers the sync again.

One bug was found (cause of it not found yet) where a BRIDGE_IN transaction is wrongly created on the feed with regular txtype receive. this results in it thinking its a regular contract transaction and tries to fetch the contract name for it as a result

Additional fixes

About # (link your issue here)

4221

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
goodwallet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2024 11:55am
2 Ignored Deployments | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **gooddollar-delta** | ⬜️ Ignored ([Inspect](https://vercel.com/gooddollarteam/gooddollar-delta/G1MQcMr25ETSZCDRpYUxsarJNhJR)) | [Visit Preview](https://gooddollar-delta-git-4221-fix-explorer-calls-gooddollarteam.vercel.app) | | Feb 20, 2024 11:55am | | **goodid** | ⬜️ Ignored ([Inspect](https://vercel.com/gooddollarteam/goodid/3V1UYCM8wdjYc3rx3pGnb6rUzkfQ)) | [Visit Preview](https://goodid-git-4221-fix-explorer-calls-gooddollarteam.vercel.app) | | Feb 20, 2024 11:55am |
L03TJ3 commented 5 months ago

@johnsmith-gooddollar @sirpy I added some fixes. The one I don't know how to handle is how to throttle these two calls properly: https://github.com/GoodDollar/GoodDAPP/blob/530198a94020ab302b1e678f11326c0f53bdc922/src/lib/wallet/GoodWalletClass.js#L480

In theory it should run every 30 seconds. but I believe the sync retriggers when scrolling and it loads the not yet loaded feed-items

sirpy commented 5 months ago

@L03TJ3 scrolling feed shouldnt have any effect, since syncTx from blockchain/explorer are called periodically unrelated to the feed, except maybe because of the getcontract/counterparty/smallavatar bug

L03TJ3 commented 5 months ago

@sirpy right, after the last couple of fixes it does not look like it triggers additional calls to sync when scrolling the feed

L03TJ3 commented 4 months ago

@johnsmith-gooddollar @sirpy Latest changes are:

  1. throw error when results is not the expected array, removed the data from the error log, that is only being logged as warning
  2. removed usage of Promise.all with the given code from @johnsmith-gooddollar
  3. removed inner try-catch from syncTxFromExplorer, this so the outer try-catch is used and it will when exception is thrown for explorer retry fetching with syncTxFromBlockchain