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

imp: rm app upgrade interface from IBCModule and use type assertions for app callback routing #5375

Merged
merged 8 commits into from
Dec 12, 2023

Conversation

damiannolan
Copy link
Member

Description

  • Removes UpgradableModule from IBCModule interface
  • Uses type assertions to cast cbs to UpgradeableModule for app callback routing in core

closes: #1614


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.

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.

LGTM, but would be very lovely with test cases :)

modules/core/05-port/types/module.go Outdated Show resolved Hide resolved
@damiannolan
Copy link
Member Author

LGTM, but would be very lovely with test cases :)

Indeed, I thought about tests but I think the mock app is implementing all the upgrade callbacks. I'd rather not introduce a dependency on some app that doesn't implement the interface yet.
We'd probably need to add another mock app struct somewhere, what do you think?

@damiannolan
Copy link
Member Author

Think we need to cast in the app callbacks as well

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.

left some comments/nits for your reading delight, lgtm!

modules/core/keeper/msg_server.go Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #5375 (720ed24) into 04-channel-upgrades (e1d4b20) will decrease coverage by 0.24%.
The diff coverage is 35.13%.

❗ Current head 720ed24 differs from pull request most recent head 076aeda. Consider uploading reports for the commit 076aeda to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           04-channel-upgrades    #5375      +/-   ##
=======================================================
- Coverage                80.68%   80.45%   -0.24%     
=======================================================
  Files                      197      197              
  Lines                    14871    14927      +56     
=======================================================
+ Hits                     11999    12009      +10     
- Misses                    2420     2455      +35     
- Partials                   452      463      +11     
Files Coverage Δ
...7-interchain-accounts/controller/ibc_middleware.go 57.93% <0.00%> (-1.90%) ⬇️
modules/apps/29-fee/ibc_middleware.go 88.27% <44.44%> (-4.70%) ⬇️
modules/core/keeper/msg_server.go 62.22% <33.33%> (-1.89%) ⬇️

@damiannolan damiannolan enabled auto-merge (squash) December 12, 2023 09:40
@damiannolan damiannolan merged commit 8865e29 into 04-channel-upgrades Dec 12, 2023
54 of 55 checks passed
@damiannolan damiannolan deleted the damian/1614-app-upgrade-interface branch December 12, 2023 09:43
@colin-axner
Copy link
Contributor

Indeed, I thought about tests but I think the mock app is implementing all the upgrade callbacks. I'd rather not introduce a dependency on some app that doesn't implement the interface yet.
We'd probably need to add another mock app struct somewhere, what do you think?

I would test by creating a router which points to a mock ibc app which doesn't implement the upgrade module interface. It might be possible to rework the mock package so that it has three types:

  • IBCModule
  • UpgradeModule
  • MockModule (contains both IBCModule and UpgradeModule)

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.

4 participants