-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add ibc support #167
Add ibc support #167
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool to see IBC support here! 🎸
Some minor notes on naming and types.
Thanks for the review @alpe I will make some of the requested changes in the data types in cosmwasm and get a new cosmwasm build out before updating the Go side. My key question before I can properly update the Rust types is this:
|
Timestamp is the absolute timeout.
From the packet validation logic I must assume both can be set but one is required |
Changes to the ibc types made here: CosmWasm/cosmwasm@62b9fc7 Also, the ibc_enabled flag is now available. TODO:
|
131d08f
to
faf0303
Compare
I will do some cleanup as mentioned before. @alpe this should be usable for wasmd integration. You will need to copy the updated contracts over. Note that |
08b1d6b
to
4bcc5a1
Compare
Src IBCEndpoint `json:"src"` | ||
Dest IBCEndpoint `json:"dest"` | ||
Sequence uint64 `json:"sequence"` | ||
TimeoutHeight *IBCTimeoutHeight `json:"timeout_height,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming became a bit odd. This field and the height have the same name. This results into: msg.SendPacket.TimeoutHeight.TimeoutHeight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy for better names. I copied them both from "somewhere else".
If you want to propose names for all these fields, I can PR that into cosmwasm
type TransferMsg struct { | ||
ChannelID string `json:"channel_id"` | ||
ToAddress string `json:"to_address"` | ||
Amount Coins `json:"amount"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be type Coin
. Transfer does not support multiple. See https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/tx.proto#L28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I did this in Rust. Typo here. I will fix.
Transfer {
/// exisiting channel to send the tokens over
channel_id: String,
/// address on the remote chain to receive these tokens
to_address: HumanAddr,
/// packet data only supports one coin
/// https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20
amount: Coin,
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Nanoseconds since UNIX epoch | ||
// See https://golang.org/pkg/time/#Time.UnixNano | ||
TimeoutTimestamp *uint64 `json:"timeout_timestamp,omitempty"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICS-20 port-id is not fix to transport
. It can be configured in the genesis and may vary between chain. Although I don't expect this to happen. To fully support ICS-20 transfers we should have the PortID
as a field in the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fully support ICS-20 transfers we should have the PortID as a field in the message.
Actually the opposite.
The contract cannot be expected to know the proper port (and would hardcode to transfer). The x/wasm
module could read the genesis info "somehow" and then auto-fill with the canonical ICS-20 port for the chain.
At least that is my reasoning. If we could expose this info to a contract, we could just auto-fill.
Or is this info not available to x/wasm
?
Closes #166
In follow up PR #172: