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 sorting of Option values and error on duplicates from BTreeSet/BTreeMap. #5731

Merged
merged 6 commits into from
Dec 19, 2023

Conversation

Neopallium
Copy link
Contributor

@Neopallium Neopallium commented Sep 27, 2023

Sorting was using toU8a(true) for Option values. The bare encoding wasn't working for Enum values in an Option.

Also added detection of duplicate values (BTreeSet) and keys (BTreeMap).

@Neopallium Neopallium changed the title Fix sorting of Option values and filter duplicates from BTreeSet/BTreeMap. Fix sorting of Option values and error on duplicates from BTreeSet/BTreeMap. Sep 28, 2023
Copy link
Member

@jacogr jacogr left a comment

Choose a reason for hiding this comment

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

I believe this looks great.

Would like to see some tests added for dupe checking as well as options - this just ensures that into the future the behavior stays as intended.

@Neopallium Neopallium requested a review from jacogr December 18, 2023 13:26
@Neopallium
Copy link
Contributor Author

Added tests for duplicates and Option cases for both BTreeMap & BTreeSet. Even checked that the tests would fail with the old logic.

Copy link
Member

@jacogr jacogr left a comment

Choose a reason for hiding this comment

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

Brilliant, thank you.

@jacogr jacogr merged commit b4150d5 into polkadot-js:master Dec 19, 2023
4 checks passed
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Dec 21, 2023
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.

3 participants