refactor(crypto): use slices.Sort for public keys - #4642
Open
vividvisit wants to merge 1 commit into
Open
vividvisit wants to merge 1 commit into
vividvisit wants to merge 1 commit into
Conversation
Author
|
@skosito Could you please take a look when you have a chance? Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace two natural-order
sort.Slicecallbacks inPubKeys.Equalswithslices.Sort.This preserves order-independent public-key equality while removing custom comparator boilerplate.
How Has This Been Tested?
Note
Low Risk
Mechanical sorting refactor in one helper with existing unit tests; no auth or data-path changes.
Overview
Refactors order-independent
PubKeys.Equalsto sort copies of both key lists withslices.Sortinstead ofsort.Sliceand customString()comparators.The import switches from
sorttoslices; equality behavior stays the same (sorted bech32 key strings compared pairwise).Reviewed by Cursor Bugbot for commit 9503dc1. Configure here.
Greptile Summary
This PR simplifies order-independent public-key equality without changing its behavior.
sort.Slicecalls and custom comparators withslices.Sort.sortimport in favor ofslices.Confidence Score: 5/5
The PR appears safe to merge with no actionable correctness, compatibility, security, or repository-rule issues identified.
PubKeyhas an underlying string type and itsStringmethod returns that same value, making the new natural ordering equivalent to the removed comparators; the repository’s supported Go version includesslices.Important Files Changed
PubKeys.Equalswith type-safe standard-library sorting.Reviews (1): Last reviewed commit: "refactor(crypto): use slices.Sort for pu..." | Re-trigger Greptile