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: vault server lock propagation #1280

Merged
merged 12 commits into from
May 28, 2024

Conversation

arthurgeron
Copy link
Contributor

@arthurgeron arthurgeron commented May 6, 2024

Context

useUnlock listens for lock and unlock events from VaultClient, but the communication with VaultServer was one-way, meaning those events from the Server never reached the client. That means that a lock changes from server-side would never be reflected in our UI.
In that scenario the wallet locks but the user wouldn't be redirected to the auth screen, being able to keep interacting with UI elements behind the auth guard, leading to several bugs.

Solution

Fixed by using propagating VaultServer lock change events to VaultClient through existing communication protocol, VaultClient further propagates those events, which are now correctly handled by useUnlock, leading to proper behavior (e.g. redirection to the auth screen).

Evidence

Before

before.mov

After

after.mov

Copy link
Contributor

github-actions bot commented May 7, 2024

Coverage report for ./packages/app

St.
Category Percentage Covered / Total
🟡 Statements 62.49% 3233/5174
🔴 Branches 41.91% 627/1496
🔴 Functions 47.01% 685/1457
🟡 Lines 63.04% 3115/4941

Test suite run success

240 tests passing in 70 suites.

Report generated by 🧪jest coverage report action from 4bac9e7

Copy link
Collaborator

@HoTandy HoTandy left a comment

Choose a reason for hiding this comment

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

Hi Arthur, in your "After" example in the PR, the little popup Invalid Credentials pops up for a few seconds, with me this isn't happening, therefore there's no feedback to the user. Could you please take a look. Thanks!

Screen.Recording.2024-05-23.at.10.49.57.mov

@arthurgeron arthurgeron merged commit 6e94172 into master May 28, 2024
12 checks passed
@arthurgeron arthurgeron deleted the ag/fix/vault-server-lock-propagation branch May 28, 2024 19:36
LuizAsFight pushed a commit that referenced this pull request May 28, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to master, this PR
will be updated.


# Releases
## fuels-wallet@0.20.0

### Minor Changes

- [#1317](#1317)
[`f1dab207`](f1dab20)
Thanks [@arthurgeron](https://github.com/arthurgeron)! - Fixes bug where
wrong Asset Id is shown for other tokens (e.g. ETH)
    Updated Fuels package to tag pr-2395
Updated NPM Packs dependencies packages (e.g. @fuels/react,
@fuels/ts-config) to new minor 0.20.0

### Patch Changes

- [#1313](#1313)
[`b5766321`](b576632)
Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Fix error not
showing on Dapp Approve transaction

- [#1313](#1313)
[`b5766321`](b576632)
Thanks [@LuizAsFight](https://github.com/LuizAsFight)! - Re-add block
explorer link to transaction header

- [#1279](#1279)
[`9ffddf70`](9ffddf7)
Thanks [@arthurgeron](https://github.com/arthurgeron)! - vault crash on
export seed auth fail

- [#1280](#1280)
[`6e94172c`](6e94172)
Thanks [@arthurgeron](https://github.com/arthurgeron)! - vault client
not propagating lock unlock events from server

- [#1290](#1290)
[`57f87f84`](57f87f8)
Thanks [@arthurgeron](https://github.com/arthurgeron)! - - Re-enabled
E2E contract tests
- Fixed biome trying to validate files generated by playwright test runs
- Fixed Playwright tests starting up before CRX files are available, now
runs `build` beforehand.
- Fixed CRX dev server reloading during playwright tests, causing
instabilities
- Fixed NODE_ENV being set to default (production) on local E2E tests,
leading to the wrong version (i.e. production) being installed
- Fixed bug where only the first test file in a suite run would use the
local CRX build, it'd then download and use a production build of the
Wallet for the rest

- Updated dependencies
\[[`f1dab207`](f1dab20)]:
    -   @fuel-wallet/connections@0.20.0

## @fuel-wallet/connections@0.20.0

### Minor Changes

- [#1317](#1317)
[`f1dab207`](f1dab20)
Thanks [@arthurgeron](https://github.com/arthurgeron)! - Fixes bug where
wrong Asset Id is shown for other tokens (e.g. ETH)
    Updated Fuels package to tag pr-2395
Updated NPM Packs dependencies packages (e.g. @fuels/react,
@fuels/ts-config) to new minor 0.20.0

## @fuel-wallet/types@0.20.0

### Minor Changes

- [#1317](#1317)
[`f1dab207`](f1dab20)
Thanks [@arthurgeron](https://github.com/arthurgeron)! - Fixes bug where
wrong Asset Id is shown for other tokens (e.g. ETH)
    Updated Fuels package to tag pr-2395
Updated NPM Packs dependencies packages (e.g. @fuels/react,
@fuels/ts-config) to new minor 0.20.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

None yet

3 participants