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 avatar chosen during account creation #5267

Closed

Conversation

ikem-legend
Copy link
Member

What was the problem?

This PR resolves #5236

How was it solved?

  • Updating avatar logic to include custom derivation settings

How was it tested?

  • Unit tests
  • Manually

const wrapperRef = useRef();
const timeout = useRef();
const { t } = useTranslation();
const { enableAccessToLegacyAccounts } = useSettings('enableAccessToLegacyAccounts');
Copy link
Contributor

Choose a reason for hiding this comment

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

Since all new accounts are created with default custom derivation path, you do not need this logic, enableAccessToLegacyAccounts is false by default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Noticed a strange scenario which might affect the intended behaviour regarding this.

  1. Go to http://0.0.0.0:8080/#/account/add/secret-recovery
  2. Check Enable access to legacy Lisk accounts
  3. Go to http://0.0.0.0:8080/#/register?strength=128
  4. Continue the flow and the user will encrypt the new account with this API cryptography.legacy.getKeys(passphrase).

Copy link
Member Author

Choose a reason for hiding this comment

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

@ManuGowda The extractKeyPair function requires enableAccessToLegacyAccounts and even if it's false by default, changing it affects the account generation. The bug occurred because it wasn't taken into account previously

Copy link
Member Author

Choose a reason for hiding this comment

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

@oskarleonard I followed the steps and it's fine because prior to the SDK update, accounts were generated based on that function

Copy link
Contributor

Choose a reason for hiding this comment

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

What i mean was that the account would in that case not be created with the default custom derivation Manu talked about, but instead with our legacy one. Which is why it wont work to remove it in this step.

If feels strange that we removed the enableAccessToLegacyAccounts from settings if it can be used in this way. Feels like ✅ "Enable access to legacy Lisk accounts" should not be preserved when creating a new account. Ie that the enableAccessToLegacyAccounts state should only be used when adding an account from Secret recovery phrase 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

@oskarleonard new account created should always be using custom derivation path, ikem now has fixed it

Copy link
Contributor

Choose a reason for hiding this comment

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

@ManuGowda It will still be possible to create a new account using this legacy API cryptography.legacy.getKeys(passphrase). Is that intended?

accounts.map(async (account) => {
const options = {
passphrase: account.passphrase,
enableAccessToLegacyAccounts,
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this, it will be false by default.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ManuGowda Done

@ManuGowda ManuGowda removed the request for review from eniolam1000752 August 28, 2023 08:22
Comment on lines +40 to +42
).then((list) => {
setAccountList(list);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
).then((list) => {
setAccountList(list);
});
).then(setAccountList);

@ikem-legend ikem-legend deleted the 5236-avatar-chosen-during-account-creation branch August 29, 2023 07:32
@ManuGowda ManuGowda restored the 5236-avatar-chosen-during-account-creation branch November 17, 2023 17:36
@ManuGowda ManuGowda deleted the 5236-avatar-chosen-during-account-creation branch November 28, 2023 14:25
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

4 participants