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!: revert recent consumer packet data changes #1150

Merged
merged 9 commits into from
Jul 18, 2023

Conversation

shaspitz
Copy link
Contributor

@shaspitz shaspitz commented Jul 14, 2023

Description

#1037 included the addition of an idx field to the ccv.ConsumerPacketData type, see this comment. After developing more, it turns out the addition of the idx field breaks the wire, since the ConsumerPacketData type is used for JSON serialization here. This PR reverts the addition of the idx field to ConsumerPacketData.

To allow pending packet deletion (by idx) in the consumer's SendPackets method, we introduce a new wrapper type ConsumerPacketDataWithIdx which is only used for the new keeper method, GetAllPendingPacketsWithIdx. This allows us to leave ccv.ConsumerPacketData unchanged.

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 state-machine breaking change (i.e., requires coordinated upgrade)
  • Confirmed this PR does not introduce changes requiring state migrations, OR migration code has been added to consumer and/or provider modules
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Followed the guidelines for building SDK 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 this PR does not introduce changes requiring state migrations, OR confirmed migration code has been added to consumer and/or provider modules
  • 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

@shaspitz shaspitz requested a review from a team as a code owner July 14, 2023 21:58
@shaspitz shaspitz changed the title fix: revert recent consumer packet data changes fix!: revert recent consumer packet data changes Jul 14, 2023
@MSalopek
Copy link
Contributor

Is this in release/v3.0.0 or release/v3.1.0 and what are the implications of this? If there's consumers already using this, we cannot just change it.

@shaspitz
Copy link
Contributor Author

@MSalopek this is a correction to #1037 which has not been released yet, and only exists in main

MSalopek
MSalopek previously approved these changes Jul 17, 2023
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.

Confirming that this does not affect any existing releases as changes were only available in main.

The Protobuf/break-check is expected.

@MSalopek MSalopek self-requested a review July 17, 2023 16:34
@shaspitz shaspitz marked this pull request as draft July 17, 2023 16:34
@MSalopek MSalopek dismissed their stale review July 17, 2023 16:34

Code broke in the meantime

@shaspitz shaspitz marked this pull request as ready for review July 17, 2023 20:28
@shaspitz
Copy link
Contributor Author

@MSalopek this is ready to review again, I had to add a wrapper type to maintain the functionality from #1146

Copy link
Contributor

@jtremback jtremback left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -606,9 +606,29 @@ func (k Keeper) getAndIncrementPendingPacketsIdx(ctx sdk.Context) (toReturn uint
return toReturn
}

// GetPendingPackets returns ALL the pending CCV packets from the store
// GetPendingPackets returns ALL the pending CCV packets from the store without indexes.
func (k Keeper) GetPendingPackets(ctx sdk.Context) []ccv.ConsumerPacketData {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could get rid of this method, it'd just make the PR a lot larger

Copy link
Contributor

@jtremback jtremback left a comment

Choose a reason for hiding this comment

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

LGTM

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.

LGTM!

@shaspitz shaspitz merged commit 2f62e7d into main Jul 18, 2023
@shaspitz shaspitz deleted the shawn/revert-consumer-packet-data-changes branch July 18, 2023 17:10
insumity pushed a commit that referenced this pull request Jul 24, 2023
* revert changes

* lint

* Update CHANGELOG.md

* wrapper type
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.

3 participants