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

feat: adding chanUpgradeAck handler to 04-channel #3828

Merged
merged 19 commits into from
Jun 14, 2023

Conversation

damiannolan
Copy link
Member

Description

Adding 04-channel handler for ChanUpgradeAck, msg server implementation PR will follow this.

closes: #3741


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 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/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

modules/core/04-channel/keeper/upgrade.go Show resolved Hide resolved
testing/endpoint.go Show resolved Hide resolved
false,
},
{
"channel end version mismatch on crossing hellos",
Copy link
Member Author

Choose a reason for hiding this comment

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

spoke with @AdityaSripal about this yesterday, testing this case as a full integration with the testing lib is tricky as its a timing sensitive state we end up, which would require a historical proof being submitted for the second chain to transition to TRY.

I chose to override the channel state directly here in order to cover this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can open an issue to make the test case more robust? It might be nice to have a test which simulates this scenario as it would potentially occur

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

Excellent! Only requested change is moving the version check below startFlushUpgradeHandshake. Left many suggestions

modules/core/04-channel/keeper/upgrade.go Show resolved Hide resolved
modules/core/04-channel/keeper/upgrade.go Outdated Show resolved Hide resolved
modules/core/04-channel/keeper/upgrade.go Outdated Show resolved Hide resolved
.golangci.yml Show resolved Hide resolved
modules/core/04-channel/keeper/upgrade.go Show resolved Hide resolved
modules/core/04-channel/keeper/upgrade_test.go Outdated Show resolved Hide resolved
modules/core/04-channel/keeper/upgrade_test.go Outdated Show resolved Hide resolved
false,
},
{
"channel end version mismatch on crossing hellos",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can open an issue to make the test case more robust? It might be nice to have a test which simulates this scenario as it would potentially occur

@damiannolan damiannolan changed the title chore: adding chanUpgradeAck handler to 04-channel feat: adding chanUpgradeAck handler to 04-channel Jun 13, 2023
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.

yay! Great work :)

modules/core/04-channel/keeper/upgrade.go Outdated Show resolved Hide resolved
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thanks, @damiannolan!

return errorsmod.Wrapf(types.ErrInvalidFlushStatus, "expected one of [%s, %s], got %s", types.FLUSHING, types.FLUSHCOMPLETE, counterpartyFlushStatus)
}

connection, err := k.GetConnection(ctx, channel.ConnectionHops[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do this instead?

Suggested change
connection, err := k.GetConnection(ctx, channel.ConnectionHops[0])
connection, err := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])

I believe this is the way we retrieve the connection from the channel keeper in the rest of the 04-channel codebase. If I'm not mistaken, the GetConnection function in channel keeper is only used in ICA, since it is not possible to access the connection keeper from there.

Copy link
Member Author

Choose a reason for hiding this comment

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

seems like all of the channel upgradability code is currently using k.GetConnection(), maybe we could address all together and choose one for consistency in a follow up PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

opened #3840 as I'd like to get this merged

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

LGTM! I left a few small suggestions, not of which are blockers and I'd be happy with followups if you'd like to get this merged 💪

modules/core/04-channel/keeper/upgrade.go Show resolved Hide resolved
modules/core/04-channel/keeper/upgrade.go Show resolved Hide resolved
testing/endpoint.go Show resolved Hide resolved
@damiannolan damiannolan merged commit 5e4af4c into 04-channel-upgrades Jun 14, 2023
@damiannolan damiannolan deleted the damian/1620-chan-upgrade-ack branch June 14, 2023 09:56
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.

6 participants