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

adds template for migrations on encrypted wallets #5655

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

hughy
Copy link
Contributor

@hughy hughy commented Nov 14, 2024

Summary

adds a template migration , 033-encrypted-wallet-template, to demonstrate how to
write wallet migrations on wallet databases that may be encrypted

now that account data may be encrypted we need to be careful to decrypt the
account before running the migration and to re-encrypt the migrated data before
writing it back to the database

Closes IFL-3124

Testing Plan

  1. make a copy of an existing datadir, or create a new datadir on the staging branch
  2. encrypt the wallet from step 1.
  3. checkout this branch
  4. run migrations:start
  5. enter passphrase when prompted
  6. verify that accounts are still accessible and usable after migration and that wallet is still locked (e.g., run wallet:accounts, wallet:balances, etc.)

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes

adds a template migration , 033-encrypted-wallet-template, to demonstrate how to
write wallet migrations on wallet databases that may be encrypted

now that account data may be encrypted we need to be careful to decrypt the
account before running the migration and to re-encrypt the migrated data before
writing it back to the database

adds EncryptedWalletMigrationError thrown when a migration tries to access an
encrypted account without the wallet passphrase to allow client code (e.g.,
'migrations:start' command) to handle decryption flow

optionally passes wallet passphrase through migrator to an individual migration
to decrypt/encrypt account data in migrations

updates 'start' command to catch EncryptedWalletMigrationError and prompt for
wallet passphrase. passes wallet passphrase through node openDB flow to suppoprt
running migrator with wallet passphrase

NOTE: this example assumes that the schema for the masterKey store does not
change and assumes that the schema for encrypted account data does not change.
if the masterKey schema changes then that change must be addressed in a separate
migration. if the encrypted account schema changes, then that change should be
addressed separately from any change to the decrypted account schema in a
separate migration.
@hughy hughy force-pushed the feat/hughy/migrate-encrypted-wallet branch from 19637d8 to 818d105 Compare November 22, 2024 20:27
@hughy hughy marked this pull request as ready for review November 22, 2024 20:27
@hughy hughy requested a review from a team as a code owner November 22, 2024 20:27
renames 033-encrypted-wallet-template to 000-encrypted-wallet-template so that
the migration is not runnable

resets walletDb version to 32
@hughy hughy merged commit f168064 into staging Nov 26, 2024
12 checks passed
@hughy hughy deleted the feat/hughy/migrate-encrypted-wallet branch November 26, 2024 19:00
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.

2 participants