diff --git a/chain/cosmos/ics.go b/chain/cosmos/ics.go index 9a77bbd1d..ea503101c 100644 --- a/chain/cosmos/ics.go +++ b/chain/cosmos/ics.go @@ -32,6 +32,8 @@ import ( const ( icsVer330 = "v3.3.0" icsVer400 = "v4.0.0" + icsVer450 = "v4.5.0" + icsVer640 = "v6.4.0" ) // FinishICSProviderSetup sets up the base of an ICS connection with respect to the relayer, provider actions, and flushing of packets. @@ -447,9 +449,31 @@ func (c *CosmosChain) transformCCVState(ctx context.Context, ccvState []byte, co if semver.Compare(providerVersion, icsVer400) > 0 { imageVersion = providerVersion } - toVersion = semver.Major(consumerVersion) - if toVersion == "v3" { - toVersion = semver.MajorMinor(consumerVersion) + if (semver.Major(providerVersion) == "v4" && semver.Compare(providerVersion, icsVer450) > 0) || + (semver.Major(providerVersion) == "v6" && semver.Compare(providerVersion, icsVer640) > 0) { + switch semver.Major(consumerVersion) { + case "v4": + if semver.Compare("v4.5.0", consumerVersion) >= 0 { + toVersion = "v4.5" + } else { + toVersion = "