-
Notifications
You must be signed in to change notification settings - Fork 519
Description
With the current ibc implementation, we take great care a contract never errors on ibc_recv_packet. It must also take care to roll back any state internally on error (using submessage to self if needed). Any error it returns would revert the entire transaction, rather than signal a failure in the acknowledgement.
In ibcv2, we have 4 cases to cover:
- success
- application failure and NO rollback
- application error and rollback app state
- tx error and rollback ibc state as well
(1 and 2 we handled by the current version, only difference is the interpretation of bytes in the ack data)
In https://github.com/CosmWasm/wasmvm/blob/main/lib.go#L540-L547 we unmarshall the response from the contract and consider a Result::Err from the contract the same as a VM error and convert both to a Go error. (VM error is "out of gas", "panic", "no ibc entry point" or other hard abort)
One step suggested by @alpe would be returning the complete IBCReceiveResult rather than unmarshalling it in wasmvm. That will provide more info to the caller. However, how do we handle these two cases:
- contract returned error
- vm returned error
Until wasmd 0.21 (on cosmos-sdk 0.42) both are handled the same and abort the transaction, which means the ibc packet is never recorded as received, so no ack can be returned to the sender. Can we do something better now?