cosmos / ibc

Interchain Standards (ICS) for the Cosmos network & interchain ecosystem.
Other
919 stars 382 forks source link

ICS4: Must revert state if sequence mismatch upgrade error returns #1053

Closed AdityaSripal closed 8 months ago

AdityaSripal commented 8 months ago

Currently when the TRY returns an upgrade mismatch error, the previous writes done before are still retained.

This is especially problematic in the non-crossing-hello case, because then the higher-sequence side will be left initialized with an upgrade that is explicitly rejected from the counterparty with the lower sequence.

The solution is to revert state and only write the upgrade error receipt when returning

See the commits that caught and fixed this behaviour in the following commits:

https://github.com/cosmos/quint-channel-upgradability/pull/8/commits/395a501f35ba667f39288534f47d867ca216855b

https://github.com/cosmos/quint-channel-upgradability/pull/8/commits/6583c5c83d12cd0c8b0a8d6c2d784e54008708dc