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

Adding version to UnmarshalPacketData interface #6988

Conversation

chatton
Copy link
Contributor

@chatton chatton commented Jul 30, 2024

Description

closes: #6976

This PR updates the UnmarshalPacketData to return the underlying application version.

Note: in a few tests, we needed to make them stateful since we are fetching the version via the ics20Wrapper


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@@ -353,11 +353,17 @@ func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string)
// UnmarshalPacketData attempts to unmarshal the provided packet data bytes
// into an InterchainAccountPacketData. This function implements the optional
// PacketDataUnmarshaler interface required for ADR 008 support.
func (IBCMiddleware) UnmarshalPacketData(_ sdk.Context, _, _ string, bz []byte) (interface{}, error) {
func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is some linter complaining about name, name type pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no it's required to fetch the app version below

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, meant if a linter was complaining for having these as portID, channelID string as opposed to portID string, channelID string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nothing was shouting at me about it I don't think 🤔

@chatton
Copy link
Contributor Author

chatton commented Jul 30, 2024

I seem to have broken some transfer E2Es (also failing locally) looking into it now

@chatton
Copy link
Contributor Author

chatton commented Jul 30, 2024

test fixed by #6993

@@ -889,7 +889,7 @@ func (suite *TransferTestSuite) TestPacketDataUnmarshalerInterface() {
unmarshalerStack, ok := transferStack.(porttypes.PacketDataUnmarshaler)
suite.Require().True(ok)

packetData, err := unmarshalerStack.UnmarshalPacketData(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, data)
packetData, _, err := unmarshalerStack.UnmarshalPacketData(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, data)
Copy link
Contributor

Choose a reason for hiding this comment

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

we should assert the version?

Can do using the if statement below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes good call, will add 👍

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Nice one! Thank you @chatton 🙏 The changes LGTM. Only thing I noticed was that in transfer we could do an assertion on the returned version

Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

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

thanks for picking this up!

@DimitrisJim
Copy link
Contributor

lets not forget to slap backport label

@chatton chatton enabled auto-merge July 30, 2024 14:26
@chatton chatton added this pull request to the merge queue Jul 30, 2024
Copy link

sonarcloud bot commented Jul 30, 2024

Merged via the queue into main with commit 75ec6e9 Jul 30, 2024
67 of 69 checks passed
@chatton chatton deleted the cian/issue#6976-modify-unmarshalpacketdata-interface-to-return-version branch July 30, 2024 14:35
mergify bot pushed a commit that referenced this pull request Jul 30, 2024
* chore: adding version to UnmarshalPacketData interface

* chore: addressing PR feedback

(cherry picked from commit 75ec6e9)
@colin-axner
Copy link
Contributor

We forgot to update docs on this as well

colin-axner pushed a commit that referenced this pull request Jul 30, 2024
* chore: adding version to UnmarshalPacketData interface

* chore: addressing PR feedback

(cherry picked from commit 75ec6e9)

Co-authored-by: Cian Hatton <cian@interchain.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify UnmarshalPacketData interface to return version
3 participants