From 3af6b0d06c0d30882385dd44e6f163ab170113d5 Mon Sep 17 00:00:00 2001 From: vuong177 Date: Sun, 1 Oct 2023 22:34:59 +0300 Subject: [PATCH 1/5] substituteClientId --- app/upgrades/v5_2_0/fork.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v5_2_0/fork.go b/app/upgrades/v5_2_0/fork.go index 4bed3bb71..28bbe400d 100644 --- a/app/upgrades/v5_2_0/fork.go +++ b/app/upgrades/v5_2_0/fork.go @@ -36,12 +36,12 @@ func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { func UpdateWasmContract(ctx sdk.Context, ibckeeper *ibckeeper.Keeper) { unknownClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, clientId) if !found { - panic("cannot update client with ID") + panic("cannot update client with ID and without found") } clientState, ok := unknownClientState.(*wasm08types.ClientState) if !ok { - panic("cannot update client with ID") + panic("cannot update client with unknownClientState") } code, err := transfertypes.ParseHexHash(newWasmCodeID) @@ -51,7 +51,7 @@ func UpdateWasmContract(ctx sdk.Context, ibckeeper *ibckeeper.Keeper) { clientState.CodeId = code - ibckeeper.ClientKeeper.SetClientState(ctx, clientId, clientState) + ibckeeper.ClientKeeper.SetClientState(ctx, substituteClientId, clientState) } func ClientUpdate(ctx sdk.Context, codec codec.BinaryCodec, ibckeeper *ibckeeper.Keeper, subjectClientId string, substituteClientId string) error { From 0c353a971d61a42001c99eaa505b0fbbb56fc5fa Mon Sep 17 00:00:00 2001 From: vuong177 Date: Sun, 1 Oct 2023 22:37:17 +0300 Subject: [PATCH 2/5] fix client ID --- app/upgrades/v5_2_0/fork.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades/v5_2_0/fork.go b/app/upgrades/v5_2_0/fork.go index 28bbe400d..edffdc03a 100644 --- a/app/upgrades/v5_2_0/fork.go +++ b/app/upgrades/v5_2_0/fork.go @@ -16,7 +16,7 @@ import ( const ( newWasmCodeID = "ad84ee3292e28b4e46da16974c118d40093e1a6e28a083f2f045f68fde7fb575" - clientId = "08-wasm-05" + clientId = "08-wasm-5" substituteClientId = "08-wasm-132" ) From 35c0395d5fdde5d2fd3ff2d6567a382fc301376f Mon Sep 17 00:00:00 2001 From: vuong177 Date: Sun, 1 Oct 2023 22:39:04 +0300 Subject: [PATCH 3/5] bypass height check --- app/upgrades/v5_2_0/fork.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/upgrades/v5_2_0/fork.go b/app/upgrades/v5_2_0/fork.go index edffdc03a..45a8d466c 100644 --- a/app/upgrades/v5_2_0/fork.go +++ b/app/upgrades/v5_2_0/fork.go @@ -67,10 +67,6 @@ func ClientUpdate(ctx sdk.Context, codec codec.BinaryCodec, ibckeeper *ibckeeper return sdkerrors.Wrapf(clienttypes.ErrClientNotFound, "substitute client with ID %s", substituteClientId) } - if subjectClientState.GetLatestHeight().GTE(substituteClientState.GetLatestHeight()) { - return sdkerrors.Wrapf(clienttypes.ErrInvalidHeight, "subject client state latest height is greater or equal to substitute client state latest height (%s >= %s)", subjectClientState.GetLatestHeight(), substituteClientState.GetLatestHeight()) - } - substituteClientStore := ibckeeper.ClientKeeper.ClientStore(ctx, substituteClientId) if status := ibckeeper.ClientKeeper.GetClientStatus(ctx, substituteClientState, substituteClientId); status != exported.Active { From dd1a95feff47f5bdab438628f4ade20162104eee Mon Sep 17 00:00:00 2001 From: vuong177 Date: Sun, 1 Oct 2023 23:15:13 +0300 Subject: [PATCH 4/5] increase upgrade block --- app/upgrades/v5_2_0/constants.go | 2 +- app/upgrades/v5_2_0/fork.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/upgrades/v5_2_0/constants.go b/app/upgrades/v5_2_0/constants.go index 8198d0e74..528b42a44 100644 --- a/app/upgrades/v5_2_0/constants.go +++ b/app/upgrades/v5_2_0/constants.go @@ -8,7 +8,7 @@ const ( // UpgradeHeight defines the block height at which the Composable v6 upgrade is // triggered. - UpgradeHeight = 1769900 + UpgradeHeight = 1771900 ) var Fork = upgrades.Fork{ diff --git a/app/upgrades/v5_2_0/fork.go b/app/upgrades/v5_2_0/fork.go index 45a8d466c..071d91b52 100644 --- a/app/upgrades/v5_2_0/fork.go +++ b/app/upgrades/v5_2_0/fork.go @@ -17,7 +17,7 @@ import ( const ( newWasmCodeID = "ad84ee3292e28b4e46da16974c118d40093e1a6e28a083f2f045f68fde7fb575" clientId = "08-wasm-5" - substituteClientId = "08-wasm-132" + substituteClientId = "08-wasm-133" ) func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { @@ -36,12 +36,12 @@ func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { func UpdateWasmContract(ctx sdk.Context, ibckeeper *ibckeeper.Keeper) { unknownClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, clientId) if !found { - panic("cannot update client with ID and without found") + panic("substitute client client not found ") } clientState, ok := unknownClientState.(*wasm08types.ClientState) if !ok { - panic("cannot update client with unknownClientState") + panic("cannot update client") } code, err := transfertypes.ParseHexHash(newWasmCodeID) From 89b897b6b5e63e54807adf4c9c7227c1fde3ef1f Mon Sep 17 00:00:00 2001 From: vuong177 Date: Sun, 1 Oct 2023 23:18:08 +0300 Subject: [PATCH 5/5] nits --- app/upgrades/v5_2_0/fork.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v5_2_0/fork.go b/app/upgrades/v5_2_0/fork.go index 071d91b52..5a7593ffa 100644 --- a/app/upgrades/v5_2_0/fork.go +++ b/app/upgrades/v5_2_0/fork.go @@ -16,7 +16,7 @@ import ( const ( newWasmCodeID = "ad84ee3292e28b4e46da16974c118d40093e1a6e28a083f2f045f68fde7fb575" - clientId = "08-wasm-5" + subjectClientId = "08-wasm-5" substituteClientId = "08-wasm-133" ) @@ -27,14 +27,14 @@ func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { UpdateWasmContract(ctx, keepers.IBCKeeper) - err := ClientUpdate(ctx, keepers.IBCKeeper.Codec(), keepers.IBCKeeper, clientId, substituteClientId) + err := ClientUpdate(ctx, keepers.IBCKeeper.Codec(), keepers.IBCKeeper, subjectClientId, substituteClientId) if err != nil { panic(err) } } func UpdateWasmContract(ctx sdk.Context, ibckeeper *ibckeeper.Keeper) { - unknownClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, clientId) + unknownClientState, found := ibckeeper.ClientKeeper.GetClientState(ctx, subjectClientId) if !found { panic("substitute client client not found ") }