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

[LW-9499] New wallet manager migration #833

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

lucas-barros
Copy link

@lucas-barros lucas-barros commented Jan 11, 2024

Checklist


Proposed solution

Creates migration for newwallet manager

Testing

Unlocked wallet test

  1. Install the extension with main branch
  2. Create/import new wallet
  3. Build this branch, make sure the version in the manifest file is higher then that of the main branch (you might have to manually modify it)
  4. Install the extension with the new build
  5. Open lace and make sure it is working properly (to make sure the migration ran, verify that lock and keyAgentData are not present in localStorage)

Locked wallet test

  1. Repeat the process but lock the wallet after step 2.

Screenshots

Attach screenshots here if implementation involves some UI changes

mchappell and others added 7 commits December 8, 2023 12:47
refactor: use internal wallet address discovery
In order to support multi-wallet/account & shared wallets,
walletManager was completely redesigned in SDK.

There are a couple new components:
- WalletRepository stores key agent data, used accounts,
as well as any additional metadata such as 'name'. Lace
should use it to get an array of all users wallets.
- SignerManager is an abstraction over KeyAgent. Lace
now longer needs to maintain the lifecycle of a KeyAgent.
Instead, it should use this component to sign transactions.
@github-actions github-actions bot added the browser Changes to the browser application. label Jan 11, 2024
Copy link

github-actions bot commented Jan 11, 2024

Allure report

allure-report-publisher generated test report!

smokeTests: ❌ test report for 1c0b289d

passed failed skipped flaky total result
Total 1 30 0 0 31

@lucas-barros lucas-barros changed the title feat: add lock and key angent data migration [LW-9499] New wallet manager migration Jan 16, 2024
@lucas-barros lucas-barros marked this pull request as ready for review January 16, 2024 00:15
@lucas-barros lucas-barros requested a review from a team as a code owner January 16, 2024 00:15
@lucas-barros lucas-barros self-assigned this Jan 16, 2024
Copy link
Member

@mkazlauskas mkazlauskas left a comment

Choose a reason for hiding this comment

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

Looks good! Just a question below

@mkazlauskas mkazlauskas requested a review from a team January 16, 2024 09:16
rootPrivateKeyBytes: HexBlob.fromBytes(Buffer.from(data.encryptedRootPrivateKeyBytes)),
keyMaterial: HexBlob.fromBytes(Buffer.from(JSON.parse(mnemonic).data))
},
metadata: {
Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Member

Choose a reason for hiding this comment

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

yeah looks correct 👍


await walletRepository.addAccount({
accountIndex: keyAgentData.accountIndex,
metadata: { name: 'Account #0', lockValue },
Copy link
Author

Choose a reason for hiding this comment

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

@mkazlauskas now that the wallet will have metadata, does it make sense to add lockValue to the wallet level?

Copy link
Member

Choose a reason for hiding this comment

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

I think so. Depends whether we're locking wallet, account or entire Lace. Product question 🤔

Copy link
Member

Choose a reason for hiding this comment

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

So actually I think it makes more sense to only have it per wallet (not account), because it is encrypted with a passphrase that applies to all accounts

removeItemFromLocalStorage(LOCK_STORAGE);
}

removeItemFromLocalStorage(KEY_AGENT_DATA_STORAGE);
Copy link
Member

Choose a reason for hiding this comment

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

This should also be obsolete

Suggested change
removeItemFromLocalStorage(KEY_AGENT_DATA_STORAGE);
removeItemFromLocalStorage(KEY_AGENT_DATA_STORAGE);
removeItemFromLocalStorage('wallet');

Copy link
Author

Choose a reason for hiding this comment

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

Updated fe614f5

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@coveralls
Copy link

Coverage Status

Changes unknown
when pulling 1c0b289 on feat/lw-9499-migration
into ** on LW-9094-new-wallet-manager**.

@DominikGuzei
Copy link
Member

@lucas-barros the migration seems to be working for me now 👍 for me the wallet is getting locked after the migration (even if i never locked the wallet before), is this intentional? Btw. it's not locked anymore after closing the popup and re-opening it, so it doesn't seem to be enforced either.

image

@lucas-barros
Copy link
Author

@lucas-barros the migration seems to be working for me now 👍 for me the wallet is getting locked after the migration (even if i never locked the wallet before), is this intentional? Btw. it's not locked anymore after closing the popup and re-opening it, so it doesn't seem to be enforced either.

image

@DominikGuzei did you update the manifest file version to a higher then your current version? If not, likely the migration didnt run, the new build was loaded once (which will "lock" the wallet), then the older version would be reload due to the version being higher. What does your local storage look like after the migration?

@mkazlauskas mkazlauskas force-pushed the LW-9094-new-wallet-manager branch from 88123d3 to c68437d Compare January 26, 2024 08:12
@lucas-barros lucas-barros requested review from a team January 26, 2024 08:12
@mkazlauskas mkazlauskas force-pushed the LW-9094-new-wallet-manager branch 10 times, most recently from ccda020 to 1266abb Compare January 29, 2024 07:44
@mkazlauskas mkazlauskas force-pushed the LW-9094-new-wallet-manager branch 3 times, most recently from 55b223d to d8e3ead Compare February 2, 2024 15:02
Base automatically changed from LW-9094-new-wallet-manager to main February 13, 2024 17:07
@rhyslbw rhyslbw marked this pull request as draft September 13, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser Changes to the browser application.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants