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

passes wallet passphrase from CLI to migrator #5631

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

hughy
Copy link
Contributor

@hughy hughy commented Nov 11, 2024

Summary

adds an error type, EncryptedWalletMigrationError, and catches errors of that type in the three commands that run migrations: 'migrations:start', 'migrations:revert', and 'start'

prompts user to enter wallet passphrase and passes passphrase through to migrator

to support passing the passphrase down to the migrator in the 'start' command we pass the passphrase through 'NodeUtils.waitForOpen' and the the node's 'openDB' method

supports implementing database migrations that handle encrypted wallet logic. for example, throwing the EncryptedWalletMigrationError on an encrypted account and using the wallet passphrase passed to 'migrate' to decrypt and re-encrypt the wallet

Closes IFL-3125

Testing Plan

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

@hughy hughy requested a review from a team as a code owner November 11, 2024 22:10
@hughy hughy changed the base branch from master to staging November 11, 2024 22:11
@hughy hughy force-pushed the feat/hughy/migrate-passphrase-prompt branch from 741db60 to 5b3ae02 Compare November 12, 2024 01:22
adds an error type, EncryptedWalletMigrationError, and catches errors of that
type in the three commands that run migrations: 'migrations:start',
'migrations:revert', and 'start'

prompts user to enter wallet passphrase and passes passphrase through to
migrator

to support passing the passphrase down to the migrator in the 'start' command we
pass the passphrase through 'NodeUtils.waitForOpen' and the the node's 'openDB' method

supports implementing database migrations that handle encrypted wallet logic.
for example, throwing the EncryptedWalletMigrationError on an encrypted account
and using the wallet passphrase passed to 'migrate' to decrypt and re-encrypt
the wallet
displays error message to user instead

removes logic plumbing passphrase through openDB to migrator
@hughy hughy force-pushed the feat/hughy/migrate-passphrase-prompt branch from 5b3ae02 to fa3756f Compare November 14, 2024 18:04
this.logger.error(
'Run `ironfish migrations:start` to enter wallet passphrase and migrate wallet databases',
)
this.exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

Ok nice, this looks different from the original PR so the migrations will need to run separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I updated this flow to require migrations to run separately based on Jason's comment on the original PR: #5624 (comment)

@hughy hughy merged commit f16a7c3 into staging Nov 19, 2024
12 checks passed
@hughy hughy deleted the feat/hughy/migrate-passphrase-prompt branch November 19, 2024 18:48
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