Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Revert mnemonic serialization format #81

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Jan 17, 2023

Per @Gudahtt 's here we want to revert the serialization format from Uint8Arrays because they don't serialize nicely to JSON and we want to avoid any possible issues that arise there, back to an untyped array.

This format was previously changed here and released with v5.0.0

@adonesky1 adonesky1 requested a review from a team as a code owner January 17, 2023 20:07
@adonesky1 adonesky1 marked this pull request as draft January 17, 2023 20:08
@adonesky1 adonesky1 force-pushed the revert-mnemonic-serialization-format branch from 015a163 to 4e52067 Compare January 17, 2023 21:31
@@ -228,7 +234,7 @@ describe('hd-keyring', () => {
expect(accountsSecondCheck[1]).toStrictEqual(secondAcct);
expect(accountsSecondCheck).toHaveLength(2);
const serialized = await keyring.serialize();
expect(keyring._uint8ArrayToString(serialized.mnemonic)).toStrictEqual(
expect(Buffer.from(serialized.mnemonic).toString()).toStrictEqual(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is simply reverting this change

@adonesky1 adonesky1 marked this pull request as ready for review January 17, 2023 21:40
keyring.mnemonic.toString(),
);
beforeEach(() => {
keyring = new HdKeyring({
Copy link
Member

@Gudahtt Gudahtt Jan 17, 2023

Choose a reason for hiding this comment

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

Nit: Rather than introduce a new beforeEach, it'd probably be better to move this step into each test instead. Setup within each test allows customization, avoiding this scenario we're in here where setup steps get repeated (e.g. here the constructor is getting called twice; three times for some tests).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! PR to address this here

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@adonesky1 adonesky1 merged commit 3e277aa into main Jan 18, 2023
@adonesky1 adonesky1 deleted the revert-mnemonic-serialization-format branch January 18, 2023 03:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants