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(WC)_: Create indexes for WC queries #5989

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alexjba
Copy link
Contributor

@alexjba alexjba commented Oct 24, 2024

Create the indexes needed for WalletConnect queries based on .expert recommendations.

Fixing: status-im/status-desktop#14975

@alexjba alexjba requested review from a team, dlipicar and Cuteivist and removed request for a team October 24, 2024 14:13
@status-im-auto
Copy link
Member

status-im-auto commented Oct 24, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d128fad #1 2024-10-24 14:18:21 ~4 min linux 📦zip
✔️ d128fad #1 2024-10-24 14:18:26 ~4 min ios 📦zip
✔️ d128fad #1 2024-10-24 14:19:35 ~6 min android 📦aar
✔️ d128fad #1 2024-10-24 14:20:06 ~6 min tests-rpc 📄log
✖️ d128fad #1 2024-10-24 14:47:51 ~34 min tests 📄log
✔️ d128fad #2 2024-10-25 06:57:17 ~30 min tests 📄log

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.48%. Comparing base (c72f491) to head (d128fad).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5989      +/-   ##
===========================================
- Coverage    47.49%   47.48%   -0.02%     
===========================================
  Files          849      849              
  Lines       138606   138606              
===========================================
- Hits         65836    65813      -23     
- Misses       64984    64996      +12     
- Partials      7786     7797      +11     
Flag Coverage Δ
functional 10.20% <ø> (+0.01%) ⬆️
unit 46.97% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 24 files with indirect coverage changes

Copy link
Contributor

@saledjenic saledjenic left a comment

Choose a reason for hiding this comment

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

@alexjba do we really need this indexing?
Wondering now, how many rows do we expect from an average user?
Do we do any table cleaning once the session expires?

@alexjba
Copy link
Contributor Author

alexjba commented Nov 1, 2024

@alexjba do we really need this indexing? Wondering now, how many rows do we expect from an average user? Do we do any table cleaning once the session expires?

We don't do any cleaning! And then it could become an issue if the query is not optimized. Moreover, it adds some weight to this decision when we consider that everything is processed synchronously.

Now the reasoning why we never delete sessions is another topic that should be discussed soon. What I've found so far is that this was an informed decision.

The sessions requests from dApps are persisted for offline dApps display and to have history later on when implemented in UX.
https://www.notion.so/Wallet-Connect-Desktop-handover-73a52b2de7cf45b3af2905dfe164cd76?pvs=4#600332b3cce94e92815e4e4173f7aea6

@saledjenic
Copy link
Contributor

saledjenic commented Nov 1, 2024

But the session has its own expiration date, I don't think that we need to keep an expired session in db, but agree we should discuss that.

@alexjba
Copy link
Contributor Author

alexjba commented Nov 20, 2024

@clauxx The mobile WC integration is using the sessions and dapps stored in the DB?

I see little value for these tables here, but maybe I'm missing something.

IMO these tables are useful only to show some dapps if the user starts the app and the network is down. But this doesn't mean the dapp list is valid. Once WC is connected then the dapp list can change. So we could just inform the user that the network is down and wait for the connection before showing the connected dApps.

As @saledjenic pointed out, there's this issue where we never delete sessions. So everything just piles up in the DB. From this perspective I think the DB needs to be optimized if these tables are useful to us. Either to delete sessions periodically, or to optimize the DB queries (or maybe both)

@alexjba alexjba requested a review from clauxx November 20, 2024 09:32
@clauxx
Copy link
Member

clauxx commented Nov 20, 2024

@clauxx The mobile WC integration is using the sessions and dapps stored in the DB?

I see little value for these tables here, but maybe I'm missing something.

IMO these tables are useful only to show some dapps if the user starts the app and the network is down. But this doesn't mean the dapp list is valid. Once WC is connected then the dapp list can change. So we could just inform the user that the network is down and wait for the connection before showing the connected dApps.

As @saledjenic pointed out, there's this issue where we never delete sessions. So everything just piles up in the DB. From this perspective I think the DB needs to be optimized if these tables are useful to us. Either to delete sessions periodically, or to optimize the DB queries (or maybe both)

Aside from the offline case, we don't clear expired sessions because we were planning to show the user their expired sessions next to the active ones (also we had some requirements to show all the sessions the user had with a specific dapp).

No issues with indexing from my side.

@saledjenic
Copy link
Contributor

also we had some requirements to show all the sessions the user had with a specific dapp

@clauxx where do those requirements come from? Does any other wallet offer you a list of expired or non-active sessions?
The active session only matters nothing else.

Imagine how many entries can be here for a really active user in a year, and why, I don't see a need for that.

@clauxx
Copy link
Member

clauxx commented Nov 20, 2024

also we had some requirements to show all the sessions the user had with a specific dapp

@clauxx where do those requirements come from? Does any other wallet offer you a list of expired or non-active sessions? The active session only matters nothing else.

Imagine how many entries can be here for a really active user in a year, and why, I don't see a need for that.

Went through the designs and can't find them anymore, maybe misremembering. I guess it makes sense to clean up expired sessions, cause the validity seems to be ~ a week and with heavy usage might indeed grow too much.

The active session only matters nothing else

Given the number of dapps available, it might be useful to show the user expired dapps they used before, so they can potentially re-connect to them, but it seems we don't have this requirement/user-story written anywhere, so could be irrelevant for now.

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.

5 participants