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

Minimal ibcv3 upgrade #824

Merged
merged 10 commits into from
May 4, 2022
Merged

Minimal ibcv3 upgrade #824

merged 10 commits into from
May 4, 2022

Conversation

ethanfrey
Copy link
Member

@ethanfrey ethanfrey commented Apr 28, 2022

First part of #806

Original commits pulled from #793

I just try the upgrade to ibcv3, without renaming, or even the addition of ICA.

I would consider both of those follow up PRs

@ethanfrey ethanfrey marked this pull request as ready for review April 28, 2022 18:42
@ethanfrey ethanfrey requested a review from alpe as a code owner April 28, 2022 18:42
@ethanfrey
Copy link
Member Author

ethanfrey commented Apr 28, 2022

@faddat @vuongnguyen17

I have pulled out the minimal portion of the ibcv3 upgrade here. It does not yet wire up ICA in order to keep this truly minimal. I used as many of your commits as I could and then fixed up a few still-missing things (or cherry-picking conflicts)

I would love your review of this. Also, if you wish to make a PR on top adding ICA, I would be happy to merge (or I will do so next week).

Please do not change imports or rename variables as part of this PR. Those can be separate and make it harder to review and merge.

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #824 (7704459) into main (fe347c6) will increase coverage by 0.02%.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #824      +/-   ##
==========================================
+ Coverage   59.60%   59.63%   +0.02%     
==========================================
  Files          52       52              
  Lines        5944     5948       +4     
==========================================
+ Hits         3543     3547       +4     
  Misses       2139     2139              
  Partials      262      262              
Impacted Files Coverage Δ
app/test_access.go 0.00% <ø> (ø)
x/wasm/keeper/handler_plugin.go 85.14% <ø> (ø)
x/wasm/keeper/handler_plugin_encoders.go 80.88% <ø> (ø)
x/wasm/keeper/ibc.go 77.77% <ø> (ø)
x/wasm/keeper/query_plugins.go 80.60% <ø> (ø)
x/wasm/ibc.go 68.09% <63.63%> (+0.39%) ⬆️
app/ante.go 62.50% <100.00%> (ø)
app/app.go 87.71% <100.00%> (+0.05%) ⬆️

@ethanfrey ethanfrey added this to the v0.27.0 milestone Apr 28, 2022
Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

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

Nice work. 👍
I am not very happy with the channelKeeper.SetChannel but agree that this is a pragmatic solution.

}
}
return nil
return counterpartyVersion, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This as a default makes sense. The contract can return an error when incompatible

@@ -133,6 +136,8 @@ func (i IBCHandler) OnChanOpenAck(
if !ok {
return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
}
channelInfo.Counterparty.ChannelId = counterpartyChannelID
i.channelKeeper.SetChannel(ctx, portID, channelID, channelInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

I stumbled upon this line as the IBC module is responsible for managing the channel data and lifecycle IMHO. When I remove this line, the TestIBCReflectContract contract fails though. After some debugging, I found out that this is due to changes in v3:

Channel state will not be set before application callback

https://github.com/cosmos/ibc-go/pull/647/files#diff-54b5be375a2333c56f2ae1b5b4dc13ac9c734561e30286505f39837ee75762c7R25

This is quite unfortunate as we need the counterparty channel ID in the handler_plugin

Storing it here is quite pragmatic but has some smell as the wasm module does not own the data. Not sure about other side effects.
Please add some code doc why we need this. 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

added some comments

@ethanfrey ethanfrey force-pushed the minimal-ibcv3-upgrade branch from 0b90ef6 to 7704459 Compare May 4, 2022 08:44
@ethanfrey ethanfrey merged commit 7b78b7e into main May 4, 2022
@ethanfrey ethanfrey deleted the minimal-ibcv3-upgrade branch May 4, 2022 09:01
@ethanfrey ethanfrey mentioned this pull request May 4, 2022
youngjoon-lee added a commit to medibloc/panacea-core that referenced this pull request Feb 4, 2023
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