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

[gh-2022] update address data in mnemonic data. #2091

Merged
merged 5 commits into from
Jul 9, 2024

Conversation

feliciss
Copy link
Collaborator

@feliciss feliciss commented Jul 7, 2024

Summary

Update address data in mnemonic.

See discussion in #2022 for details.

Copy link

vercel bot commented Jul 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 9, 2024 10:02am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Jul 9, 2024 10:02am

password: Option<String>,
) -> Result<GeneratedKeyPair, anyhow::Error> {
// load mnemonic phrase from keystore
let mnemonic = self.get_mnemonic(password.clone())?;
let account_index = mnemonic.mnemonic_data.addresses.len() as u32;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the mnemonic_data.addresses.len() incorrect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why is the mnemonic_data.addresses.len() incorrect?

See #2022 for details.

Cause there's only one address in mnemonic_data.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why only one address in mnemonic_data? It also should be fixed

Copy link
Collaborator Author

@feliciss feliciss Jul 7, 2024

Choose a reason for hiding this comment

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

Why only one address in mnemonic_data? It also should be fixed

#950 (comment)

We should discuss it with @baichuan3

Copy link
Collaborator

Choose a reason for hiding this comment

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

Use keystore.addresses() as the account index is ok. If do this, we can remove MnemonicData.addresses field to simplify the MnemonicData definition.
Or when creating an account, need to update the new address to MnemonicData.addresses, and can keep MnemonicData.addresses.
Both implementations can work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use keystore.addresses() as the account index is ok. If do this, we can remove MnemonicData.addresses field to simplify the MnemonicData definition. Or when creating an account, need to update the new address to MnemonicData.addresses, and can keep MnemonicData.addresses. Both implementations can work.

It sounds like that we can remove MnemonicData.addresses as mentioned in #950 (comment).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@feliciss
Copy link
Collaborator Author

feliciss commented Jul 8, 2024

I updated the process to add the Rooch addresses to mnemonic data while using the current length of keystores as account index to create keys as the addresses from keys are needed to be generated from account index before adding them to mnemonic data.

@feliciss feliciss changed the title [gh-2022] get account index from keys in keystore. [gh-2022] update address data in mnemonic data. Jul 9, 2024
@jolestar jolestar merged commit e4ed3b4 into rooch-network:main Jul 9, 2024
7 checks passed
@feliciss feliciss deleted the #2022 branch July 9, 2024 13:27
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.

[cli] rooch account create can not create more account
3 participants