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

Implement IBC contract support #394

Merged
merged 4 commits into from
Jan 29, 2021
Merged

Implement IBC contract support #394

merged 4 commits into from
Jan 29, 2021

Conversation

alpe
Copy link
Contributor

@alpe alpe commented Jan 28, 2021

Integrates IBC support for Wasm contracts. 🎉

Entry points

Wasm contracts can implement the following entry points to become an IBC port assigned automatically: wasm.<contract-address>

Channel lifecycle

A contract can receive/send packets via channels.
See IBC flow

Handshake start: OnChanOpenInit, OnChanOpenTry,
Handshake confirmation: OnChanOpenAck, OnChanOpenConfirm
Close: OnChanCloseInit, OnChanCloseConfirm

Packet lifecycle

Packets transport data on the application level. See [IBC flow](https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#packet-flow--handling]

New IBC messages
  • TransferMsg - start an ICS-20 transfer using the cosmos-sdk IBC/transfer module
  • SendPacket - send an IBC data package on an existing channel
  • CloseChannelMsg - initiate close procedure for an existing IBC channel

Credits

This PR contains also a lot of work and feedback from @ethanfrey and @webmaster128 👏

@alpe alpe marked this pull request as draft January 28, 2021 14:53
@codecov
Copy link

codecov bot commented Jan 28, 2021

Codecov Report

Merging #394 (edad9ef) into master (e6735eb) will decrease coverage by 0.87%.
The diff coverage is 48.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #394      +/-   ##
==========================================
- Coverage   56.13%   55.26%   -0.88%     
==========================================
  Files          34       39       +5     
  Lines        3461     4015     +554     
==========================================
+ Hits         1943     2219     +276     
- Misses       1373     1617     +244     
- Partials      145      179      +34     
Impacted Files Coverage Δ
app/test_access.go 0.00% <0.00%> (ø)
app/test_helpers.go 0.50% <0.00%> (-12.00%) ⬇️
x/wasm/internal/keeper/options.go 0.00% <0.00%> (ø)
x/wasm/internal/types/codec.go 41.17% <0.00%> (-2.58%) ⬇️
x/wasm/internal/types/tx.go 49.09% <0.00%> (-4.91%) ⬇️
x/wasm/internal/types/types.go 23.93% <ø> (ø)
x/wasm/ibc.go 59.37% <59.37%> (ø)
x/wasm/internal/keeper/handler_plugin.go 78.26% <74.64%> (+2.03%) ⬆️
x/wasm/internal/keeper/ibc.go 75.00% <75.00%> (ø)
x/wasm/internal/keeper/keeper.go 88.64% <77.55%> (-1.92%) ⬇️
... and 9 more

@alpe alpe marked this pull request as ready for review January 28, 2021 15:43
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Great (team)work here!

One minor nit, then let's merge this. And extend the functionality with more PRs to come.

Also: should we make a note on the README that master is not to be used except local tests? We are based on git commits of wasmvm and cosmwasm, and interfaces are in flux.

x/wasm/relay_pingpong_test.go Outdated Show resolved Hide resolved
@alpe
Copy link
Contributor Author

alpe commented Jan 28, 2021

Also: should we make a note on the README that master is not to be used except local tests? We are based on git commits of wasmvm and cosmwasm, and interfaces are in flux.

This has not changed afaik. Anything before v1.0.0 should not be considered stable.
https://github.com/CosmWasm/wasmd#stability

@alpe alpe merged commit 0f46dee into master Jan 29, 2021
@alpe alpe deleted the stargate_ibc_integration branch January 29, 2021 10:11
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.

2 participants