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

Check oder of iteration #599

Closed
wants to merge 6 commits into from
Closed

Check oder of iteration #599

wants to merge 6 commits into from

Conversation

mpoke
Copy link
Contributor

@mpoke mpoke commented Dec 14, 2022

Description

Based on #583:

  • All SDK iterators behave as expected, i.e., the iteration order is correct.
  • All keys under the same prefix are unique.

Linked issues

Closes: #537

Type of change

If you've checked more than one of the first three boxes, consider splitting this PR into multiple PRs!

  • Fix: Changes and/or adds code behavior, specifically to fix a bug
  • Refactor: Changes existing code style, naming, structure, etc.
  • Docs: Adds documentation

Regression tests

If Refactor, describe the new or existing tests that verify no behavior was changed or added where refactors were introduced.

  • TODO: add tests

New behavior tests

Several tests were updated.

@mpoke mpoke mentioned this pull request Dec 14, 2022
12 tasks
@mpoke mpoke requested a review from MSalopek December 14, 2022 12:41
Copy link
Contributor

@shaspitz shaspitz left a comment

Choose a reason for hiding this comment

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

This PR looks solid, but I still would like to stress the importance of #454 when introducing so many refactors and behavior changes for iterators in such a short period of time

x/ccv/provider/keeper/genesis.go Show resolved Hide resolved
ctx := sdk.UnwrapSDKContext(goCtx)
props := k.GetAllConsumerAdditionProps(ctx)
props := types.ConsumerAdditionProposals{}
k.IteratePendingConsumerAdditionProps(ctx, func(prop types.ConsumerAdditionProposal) (stop bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reasoning behind using the iterate method instead of GetAllConsumerAdditionProps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GetAllConsumerAdditionProps was only used here. Just wanted to cleanup the code. We could revert back if you think it's useful to have it. @MSalopek was also saying he prefers to have it.

x/ccv/provider/keeper/proposal.go Outdated Show resolved Hide resolved
x/ccv/provider/types/keys.go Outdated Show resolved Hide resolved
Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

I have some nitpicks, but those are not that important.

Would you mind clarifying how #596 will be integrated with regards to this PR? There is a fair amount of overlap between this PR and #596, some sort of agreement and scheduling as to when and where both of these commits get merged seems to be required.

@mpoke
Copy link
Contributor Author

mpoke commented Dec 15, 2022

I have some nitpicks, but those are not that important.

Would you mind clarifying how #596 will be integrated with regards to this PR? There is a fair amount of overlap between this PR and #596, some sort of agreement and scheduling as to when and where both of these commits get merged seems to be required.

@jtremback can say more on that as he's currently working on #596

@mpoke mpoke marked this pull request as draft December 19, 2022 22:21
@mpoke
Copy link
Contributor Author

mpoke commented Dec 21, 2022

Close in favor of #620

@mpoke mpoke closed this Dec 21, 2022
@mpoke mpoke deleted the marius/537-iterators-v2 branch September 12, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

At least one instance of incorrect iteration in the codebase- there may be more
3 participants