-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
chore: all: use golang.org/x/exp/maps.(Keys, Values) where necessary #13349
Merged
Conversation
This file contains 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
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #13349 +/- ##
==========================================
+ Coverage 54.84% 55.80% +0.95%
==========================================
Files 652 697 +45
Lines 55859 60070 +4211
==========================================
+ Hits 30638 33521 +2883
- Misses 22738 23710 +972
- Partials 2483 2839 +356
|
odeke-em
changed the title
chore: store/internal/proofs: simplify SortedKeys with golang.org/x/exp/maps.Keys
chore: all: use golang.org/x/exp/maps.Keys where necessary
Sep 20, 2022
odeke-em
force-pushed
the
store-internal-proofs-use-maps.Keys
branch
from
September 20, 2022 22:50
1b8ca64
to
50c8600
Compare
odeke-em
changed the title
chore: all: use golang.org/x/exp/maps.Keys where necessary
chore: all: use golang.org/x/exp/maps.(Keys, Values) where necessary
Sep 20, 2022
odeke-em
force-pushed
the
store-internal-proofs-use-maps.Keys
branch
from
September 20, 2022 23:03
50c8600
to
2cee5b8
Compare
julienrbrt
approved these changes
Sep 20, 2022
lgtm! |
Uses golang.org/x/exp/maps.(Keys, Values) to sort out flagged potential non-determinism issues due to map iteration which is randomized in maps. These were flagged by cosmos/gosec in * https://github.com/cosmos/cosmos-sdk/security/code-scanning/724 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/725 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/726 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/727 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/728 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/729 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/782 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/813 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/814 * https://github.com/cosmos/cosmos-sdk/security/code-scanning/816 which complained about potential non-determinism in map iteration in which we only want appends in map iteration loops, this change instead uses golang.org/x/exp/maps.Keys to retrieve the keys then sort.Strings which simplifies the helper code. This change fixes issues in: * orm/model/ormdb: non-determinism in ExportJSON * store/internal/proofs * types/module * x/auth/keeper * x/bank * x/genutil/client/cli Fixes #13348
odeke-em
force-pushed
the
store-internal-proofs-use-maps.Keys
branch
from
September 21, 2022 01:52
57d9f1f
to
b0885e2
Compare
Thank you for the review @julienrbrt! |
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.
Uses golang.org/x/exp/maps.(Keys, Values) to sort out flagged
potential non-determinism issues due to map iteration which is
randomized in maps.
These were flagged by cosmos/gosec in
which complained about potential non-determinism in
map iteration in which we only want appends in map iteration loops,
this change instead uses golang.org/x/exp/maps.Keys to retrieve
the keys then sort.Strings which simplifies the helper code.
This change fixes issues in:
Fixes #13348