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: store/rootmulti: fix non-deterministic map iteration #12487

Merged
merged 10 commits into from
Jul 12, 2022
Merged

fix: store/rootmulti: fix non-deterministic map iteration #12487

merged 10 commits into from
Jul 12, 2022

Conversation

kirbyquerby
Copy link
Contributor

@kirbyquerby kirbyquerby commented Jul 7, 2022

Description

This change fixes non-deterministic map iteration over rs.stores from (*Store).buildCommitInfo by instead sorting the keys then iterating over the sorted slice.

Fixes #12429


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@kirbyquerby kirbyquerby marked this pull request as ready for review July 7, 2022 22:25
@kirbyquerby kirbyquerby requested a review from a team as a code owner July 7, 2022 22:25
@alexanderbez
Copy link
Contributor

Hi! Let's rebase and then we can merge 👍

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

lgtm

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Jul 11, 2022
@amaury1093
Copy link
Contributor

@kirbyquerby could you rebase or merge master? Or altnernatively give us write access to your branch. This way our bot can automerge your PR.

@kirbyquerby
Copy link
Contributor Author

Rebased again, thanks for the reviews :)

kirbyquerby and others added 3 commits July 11, 2022 14:26
This change fixes non-deterministic map iteration over rs.stores from (*Store).buildCommitInfo by instead sorting the keys then iterating over the sorted slice.

Fixes #12429
@kirbyquerby
Copy link
Contributor Author

What a contentious file T_T. I unfortunately don't see the button to allow maintainers to edit my branch. The documentation seems to indicate that this is only available for PRs from user-owned forks (I made this PR from a fork owned by an organization). I'll try to keep updating this PR and make future PRs from a personal fork.

@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #12487 (63563c8) into main (7c1d743) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12487      +/-   ##
==========================================
+ Coverage   65.29%   65.32%   +0.02%     
==========================================
  Files         693      693              
  Lines       71815    71823       +8     
==========================================
+ Hits        46894    46920      +26     
+ Misses      22282    22263      -19     
- Partials     2639     2640       +1     
Impacted Files Coverage Δ
store/rootmulti/store.go 73.04% <100.00%> (+0.32%) ⬆️
x/distribution/simulation/operations.go 90.42% <0.00%> (+9.57%) ⬆️

@mergify mergify bot merged commit 901a204 into cosmos:main Jul 12, 2022
@kirbyquerby kirbyquerby deleted the map branch July 12, 2022 07:02
dwedul-figure pushed a commit to provenance-io/cosmos-sdk that referenced this pull request Jul 12, 2022
This change fixes non-deterministic map iteration over rs.stores from (*Store).buildCommitInfo by instead sorting the keys then iterating over the sorted slice.

Fixes cosmos#12429

---

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
SpicyLemon pushed a commit to provenance-io/cosmos-sdk that referenced this pull request Jul 27, 2022
This change fixes non-deterministic map iteration over rs.stores from (*Store).buildCommitInfo by instead sorting the keys then iterating over the sorted slice.

Fixes cosmos#12429

---

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
SpicyLemon added a commit to provenance-io/cosmos-sdk that referenced this pull request Jul 27, 2022
…) (#204)

This change fixes non-deterministic map iteration over rs.stores from (*Store).buildCommitInfo by instead sorting the keys then iterating over the sorted slice.

Fixes cosmos#12429

---

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)

Co-authored-by: Nathan Dias <kirbyquerby@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Store
Projects
None yet
Development

Successfully merging this pull request may close these issues.

store/rootmulti: non-determinism in (*Store).buildCommitInfo due to map iteration
3 participants