-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add docs on Error handling for ibc_packet_receive #1646
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 nice article. Minor comments about how much detail we want.
Fine if you ignore the second comment as TMI, but wanted to bring it up.
this is excellent documentation. thank you! |
some additional questions i have thinking about this a little:
these may be more general SDK questions, so let me know if they're out of scope. |
|
||
If you are using the acknowledgement types shipped with cosmwasm-std | ||
([#1512](https://github.com/CosmWasm/cosmwasm/issues/1512)), your protocol's | ||
acknowledgement is compatible with that. |
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.
I don't fully understand how the StdAck
is handled downstream. It is important to consider the state commit/rollback for "errors" scenario 2 and 3
Scenario 3:
If the "error" is returned to wasmd as IBCReceiveResult.Err, then the state is rolled back and the error text redacted (currently) and serialized into the json format above.
Scenario 2:
If the "error" is returned to wasmd as IBCReceiveResult.Ok.Acknowledgement then the data is returned as it is with the state committed. I assume StdAck
is doing this but I may got it wrong
Good questions:
The ACK data is not overwritten but if any panic happens downstream in ibc-go or SDK (due to out of gas for example) the TX would roll back and no state would be persisted.
An IBC packet is a raw bytes slice. You can put any data in there that makes sense for you. Can json, proto or any custom format. The total length of this packet data must be >0 or it will be rejected in ibc-go packet validation. |
It would be good to document behaviour for contract/ sub-message events for the success/error Ack scenario as well. |
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 is very important info. Would be great to merge this.
I have added a suggestion for the changes we made in 2.0.
Co-authored-by: Christoph Otter <chris@confio.gmbh>
b0cfb73
to
0508f1c
Compare
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.
LGTM
Thank you, Chris! |
Rendered version here: https://github.com/CosmWasm/cosmwasm/blob/ibc_packet_receive-erros/docs/ERROR_HANDLING.md