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: wallet connect stale storage issue #151

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

bayological
Copy link
Member

@bayological bayological commented Nov 4, 2024

Description

We had an issue where users could not use a safe to execute transactions. This surfaced with a recent bug reported by RefiMedellin(https://discord.com/channels/966739027782955068/1302704425948807179).

Multiple compounding issues are causing the bug. During investigation and troubleshooting, it was discovered that one of the problems was an invalid WalletConnect state in the local storage (more info here).

This change will clear all items in local storage, from wallet connect, when the user connects. This does not fully resolve the bug, as it seems the reported issue is directly related to cCOP/cUSD, but will prevent this specific issue from occurring again.

Other changes

  • None

Tested

  • Executed small swap on mainnet using the 1/1 safe connected to the mento labs dev account
    wc-safe-bug.webm

Related issues

Checklist before requesting a review

  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • The PR title follows the conventions
  • I have run the regression tests

This commit refactors the code to include a function that cleans up stale wallet sessions. The function removes wallet sessions older than 1 hour from localStorage. This is necessary to resolve issues with corrupted walletconnect data causing problems with wallet connections.

Changes:
- Added `cleanupStaleWalletSessions` function to `src/config/wallets.ts`
- Updated `ConnectButton.tsx` and `NetworkModal.tsx` to call `cleanupStaleWalletSessions` when necessary
Copy link

vercel bot commented Nov 4, 2024

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

Name Status Preview Comments Updated (UTC)
mento-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 9:12pm

@Andrew718PLTS Andrew718PLTS self-requested a review November 6, 2024 14:29
@Andrew718PLTS
Copy link

It works and looks good to me

Copy link
Contributor

@philbow61 philbow61 left a comment

Choose a reason for hiding this comment

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

LGTM
swap worked 👍

Copy link
Contributor

@denviljclarke denviljclarke left a comment

Choose a reason for hiding this comment

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

LGTM 🫡

@bayological bayological merged commit d79850d into dev Nov 6, 2024
7 checks passed
@bayological bayological deleted the fix-150/walletconnect-storage-issue branch November 6, 2024 19:20
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.

4 participants