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

ICS4: question on send packet with channel not opened #536

Closed
4 tasks
ancazamfir opened this issue Feb 9, 2021 · 10 comments · Fixed by #865
Closed
4 tasks

ICS4: question on send packet with channel not opened #536

ancazamfir opened this issue Feb 9, 2021 · 10 comments · Fixed by #865
Labels
from-review Feedback / alterations from specification review. implementation Tracking an external implementation of the spec. tao Transport, authentication, & ordering layer.

Comments

@ancazamfir
Copy link
Contributor

Summary

The send packet handler checks if a channel is not closed (*), however I believe it will only be successful if the channel is in open state. Trying to send a fungible token transfer packet over a channel in init state returns this error:

log=Log(\"failed to execute message; message index: 0: packet failed basic validation: invalid destination channel ID: identifier cannot be blank: invalid identifier\")"

With the latest specs/ code the destination channel identifier is only known once in open state.

(*) same in the ics02 pseudocode function sendPacket(packet: Packet) {.. but there is also this comment before "Checks that the channel & connection are open to send packets".


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@colin-axner
Copy link
Contributor

Thanks for bringing this up @ancazamfir. I think this area of design was overlooked in the last minute identifier changes. I believe it is safe for us to disable the identifier check since the destination port should only be used in receive at which point the channel must be open. We might need to add more packet data checks in receive since I think we rely on the checks in send.

At the very least this is not problematic right now, it just prevents optimistic sends (which seems a little unnecessary to be for ICS 20)

cc @cwgoes

@ancazamfir
Copy link
Contributor Author

At the very least this is not problematic right now, it just prevents optimistic sends (which seems a little unnecessary to be for ICS 20)

Yes, was trying to test optimistic channel opening, optimistic send, channel closing. Optimistic sends handling in the relayer needs a bit of a special treatment and would be happy to leave it for later if we confirm this will not be supported in Stargate.

@cwgoes
Copy link
Contributor

cwgoes commented Feb 10, 2021

Thanks @ancazamfir - good catch - this should be changed, but it won't happen for Stargate, we aren't going to delay for it.

@cwgoes cwgoes self-assigned this Feb 10, 2021
@cwgoes
Copy link
Contributor

cwgoes commented Feb 10, 2021

(this is technically breaking, so it can't be in 1.0.1)

@cwgoes
Copy link
Contributor

cwgoes commented Feb 10, 2021

I'm going to move this to the spec repo, it needs to be dealt with there first.

@cwgoes cwgoes transferred this issue from cosmos/cosmos-sdk Feb 10, 2021
@ethanfrey
Copy link
Contributor

We have used a partial version of this in wasmd. Basically, in the OnChannelAck or OnChannelConfirm handlers, you can now send a packet (this got fixed in Cosmos SDK v0.41.0). You cannot send a packet in OnChannelInit or OnChannelTry.

@cwgoes cwgoes transferred this issue from cosmos/ibc Feb 23, 2021
@cwgoes cwgoes transferred this issue from another repository Mar 23, 2021
@cwgoes
Copy link
Contributor

cwgoes commented Nov 3, 2021

cc @AdityaSripal has this been fixed since?

@cwgoes cwgoes removed their assignment Nov 3, 2021
@colin-axner
Copy link
Contributor

I happened to revisit this issue. I think:

  • checking that channel is not closed is correct behaviour in core IBC 04-channel sendPacket (otherwise optimistic sends are not possible)
  • the spec comment is incorrect -> "Checks that the channel & connection are open to send packets" as pointed out in the original comment for this issue
  • ibc-go does not allow optimistic ics20 sends during when the channel is in INIT because it gets the dest channel from the channel set state. Is this something we should change? We can bring the details of this change to our repo, but it'd be nice if the spec indicated what the expected behaviour was (optimistic or non optimistic send support)

@cwgoes
Copy link
Contributor

cwgoes commented Jan 31, 2022

The spec comment is clearly wrong and should change. If optimistic sends are desired, the ibc-go implementation will need to change as well. cc @dtribble is Agoric testing this?

@mpoke mpoke changed the title question on send packet with channel not opened ICS4: question on send packet with channel not opened Mar 17, 2022
@mpoke mpoke added tao Transport, authentication, & ordering layer. from-review Feedback / alterations from specification review. implementation Tracking an external implementation of the spec. labels Mar 17, 2022
@crodriguezvega
Copy link
Contributor

I opened #865 to update the comment. If it gets merged I propose we close this issue and open a different one to discuss how to properly support optimistic sends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-review Feedback / alterations from specification review. implementation Tracking an external implementation of the spec. tao Transport, authentication, & ordering layer.
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

6 participants