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

Fix: remove outdated failed withdrawals #304

Merged
merged 1 commit into from
May 5, 2023

Conversation

ShookLyngs
Copy link
Collaborator

@ShookLyngs ShookLyngs commented Apr 29, 2023

Issue

Previously in #300, we wanted to find outdated failed withdrawals in the localTxHistory variable and remove them.
However, in our tests, @Dawn-githup and I discovered that the failed status is not updated in the localTxHistory variable.

SImply put, here's the localTxHistory in withdrawal v1 list:

  • When new withdrawals was created, add new item to the localTxHistory and save to localStorage
  • When rendering local pending withdrawals, load localTxHistory from localStorage
  • When a item in localTxHistory is completed (comparing with a list from gwscan api), remove it from the localTxHistory

You can see there's no status check or update during the variable's lifecycle. Further more, items of the localTxHistory in the specific withdrawal v1 list don't have the status property we need. Therefore, when we tried to check items' status field of the localTxHistory variable, it won't work because the property was contained.

Fix

The fix here is to use the pendingList variable instead of localTxHistory, which is a resolved pending list based on local pending withdrawals, but the status field is handled so it's not undefined.

Another issue left tho, is that items of pendingList don't have a date field, so after we find a failed withdrawal from pendingList, in order to find out if the failed withdrawal is outdated, we need to search for its local pending history from the localTxHistory, which seems to be a performance bomb.

@vercel
Copy link

vercel bot commented Apr 29, 2023

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

Name Status Preview Updated (UTC)
godwoken-bridge-mainnet ✅ Ready (Inspect) Visit Preview Apr 29, 2023 3:30pm
godwoken-bridge-testnet ✅ Ready (Inspect) Visit Preview Apr 29, 2023 3:30pm

@Flouse Flouse linked an issue Apr 30, 2023 that may be closed by this pull request
@Flouse Flouse merged commit f16424a into develop May 5, 2023
@Flouse Flouse deleted the fix-outdated-failed-withdrawals branch May 5, 2023 06:01
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.

The failed withdrawal transaction will remain in the history record
3 participants