From ac846ccf5787b2058d0d72115e165f362c06ad65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Thu, 20 May 2021 13:27:35 +0200 Subject: [PATCH 1/2] remove duplicate checks --- modules/core/02-client/types/proposal.go | 4 ---- modules/light-clients/07-tendermint/types/upgrade.go | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/modules/core/02-client/types/proposal.go b/modules/core/02-client/types/proposal.go index 3d10a925f5b..612342287a4 100644 --- a/modules/core/02-client/types/proposal.go +++ b/modules/core/02-client/types/proposal.go @@ -111,10 +111,6 @@ func (up *UpgradeProposal) ValidateBasic() error { return err } - if up.Plan.Height <= 0 { - return sdkerrors.Wrap(ErrInvalidUpgradeProposal, "IBC chain upgrades must set a positive height") - } - if up.UpgradedClientState == nil { return sdkerrors.Wrap(ErrInvalidUpgradeProposal, "upgraded client state cannot be nil") } diff --git a/modules/light-clients/07-tendermint/types/upgrade.go b/modules/light-clients/07-tendermint/types/upgrade.go index ab5ebcf4148..e2a3d87be70 100644 --- a/modules/light-clients/07-tendermint/types/upgrade.go +++ b/modules/light-clients/07-tendermint/types/upgrade.go @@ -6,10 +6,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types" "github.com/cosmos/ibc-go/modules/core/exported" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) // VerifyUpgradeAndUpdateState checks if the upgraded client has been committed by the current client @@ -71,10 +71,6 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( return nil, nil, sdkerrors.Wrap(err, "could not retrieve consensus state for lastHeight") } - if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { - return nil, nil, sdkerrors.Wrap(clienttypes.ErrInvalidClient, "cannot upgrade an expired client") - } - // Verify client proof bz, err := cdc.MarshalInterface(upgradedClient) if err != nil { From d8c5de7712501d8d3e9155910f06ed353c578b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Thu, 20 May 2021 13:28:55 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8119e1019a7..d790d6c00d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (07-tendermint) [\#182](https://github.com/cosmos/ibc-go/pull/182) Remove duplicate checks in upgrade logic. * (modules/core/04-channel) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Standardized channel `Acknowledgement` moved to its own file. Codec registration redundancy removed. * (modules/core/04-channel) [\#144](https://github.com/cosmos/ibc-go/pull/144) Introduced a `packet_data_hex` attribute to emit the hex-encoded packet data in events. This allows for raw binary (proto-encoded message) to be sent over events and decoded correctly on relayer. Original `packet_data` is DEPRECATED. All relayers and IBC event consumers are encouraged to switch to `packet_data_hex` as soon as possible. * (modules/light-clients/07-tendermint) [\#125](https://github.com/cosmos/ibc-go/pull/125) Implement efficient iteration of consensus states and pruning of earliest expired consensus state on UpdateClient.