From 18b4a088927ead71ee9c360176fce6c3c397e9a7 Mon Sep 17 00:00:00 2001 From: stana-ethernal <94966829+stana-ethernal@users.noreply.github.com> Date: Fri, 6 Jan 2023 14:51:44 +0100 Subject: [PATCH 1/2] Migrations for quicksilver issue (#1976) * prepare v8 release (backport #1860) (#1867) * prepare v8 release (#1860) * chore: changelog * chore: update changelog * chore: add changelog for v7.0.3 * chore: add v7.1.0 to changelog Co-authored-by: Yaru Wang (cherry picked from commit f0397fda6d65f405e3080478f88ade8018414105) # Conflicts: # CHANGELOG.md * Update CHANGELOG.md Co-authored-by: billy rennekamp * Added migrations for quicksilver stuck fund fix * Migrations for quicksilver * Check if balance of the refund addess is positive Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: billy rennekamp Co-authored-by: lg --- CHANGELOG.md | 9 ++++++++ app/upgrades/v8/upgrades.go | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05dd8b5b01..1c5d3bcd04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,15 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (gaia) bump [Liquidity](https://github.com/Gravity-Devs/liquidity) module to [v1.5.1](https://github.com/Gravity-Devs/liquidity/releases/tag/v1.5.1). * (gaia) bump [cosmos ledger](https://github.com/cosmos/ledger-go) to [v0.9.3](https://github.com/cosmos/ledger-go/releases/tag/v0.9.3) to fix issue [#1573](https://github.com/cosmos/gaia/issues/1573) - Ledger Nano S Plus not detected by gaiad. +## [v7.1.0] -2022-10-14 +* (gaia) bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.9) to fix the security vulnerability! See [CHANGELOG.md](https://github.com/cosmos/cosmos-sdk/blob/v0.45.9/CHANGELOG.md) for details. + +## [v7.0.3] -2022-08-03 +* (gaia) update go to 1.18. +* (gaia) bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.6). See [CHANGELOG.md](https://github.com/cosmos/cosmos-sdk/blob/v0.45.6/CHANGELOG.md) for details. +* (gaia) bump [Liquidity](https://github.com/Gravity-Devs/liquidity) module to [v1.5.1](https://github.com/Gravity-Devs/liquidity/releases/tag/v1.5.1). +* (gaia) bump [cosmos ledger](https://github.com/cosmos/ledger-go) to [v0.9.3](https://github.com/cosmos/ledger-go/releases/tag/v0.9.3) to fix issue [#1573](https://github.com/cosmos/gaia/issues/1573) - Ledger Nano S Plus not detected by gaiad. +* ## [v7.0.2] -2022-05-09 * (gaia) bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.4). See [CHANGELOG.md](https://github.com/cosmos/cosmos-sdk/blob/v0.45.4/CHANGELOG.md#v0454---2022-04-25) for details. diff --git a/app/upgrades/v8/upgrades.go b/app/upgrades/v8/upgrades.go index 8afab22b66..70da2a1b6d 100644 --- a/app/upgrades/v8/upgrades.go +++ b/app/upgrades/v8/upgrades.go @@ -10,6 +10,8 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" + ibcchanneltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/cosmos/gaia/v8/app/keepers" ) @@ -49,6 +51,45 @@ func FixBankMetadata(ctx sdk.Context, keepers *keepers.AppKeepers) error { return nil } +func QuicksilverFix(ctx sdk.Context, keepers *keepers.AppKeepers) error { + // Refund stuck coins from ica address + sourceAddress, err := sdk.AccAddressFromBech32("cosmos13dqvh4qtg4gzczuktgnw8gc2ewnwmhdwnctekxctyr4azz4dcyysecgq7e") + if err != nil { + return errors.New("invalid source address") + } + destinationAddress, err := sdk.AccAddressFromBech32("cosmos1jc24kwznud9m3mwqmcz3xw33ndjuufnghstaag") + if err != nil { + return errors.New("invalid destination address") + } + + // Get balance from stuck address and subtract 1 uatom sent by bad actor + sourceBalance := keepers.BankKeeper.GetBalance(ctx, sourceAddress, "uatom") + if sourceBalance.IsGTE(sdk.NewCoin("uatom", sdk.NewInt(1))) { + refundBalance := sourceBalance.SubAmount(sdk.NewInt(1)) + err = keepers.BankKeeper.SendCoins(ctx, sourceAddress, destinationAddress, sdk.NewCoins(refundBalance)) + if err != nil { + return errors.New("unable to refund coins") + } + } + + // Close channels + closeChannel(keepers, ctx, "channel-462") + closeChannel(keepers, ctx, "channel-463") + closeChannel(keepers, ctx, "channel-464") + closeChannel(keepers, ctx, "channel-465") + closeChannel(keepers, ctx, "channel-466") + + return nil +} + +func closeChannel(keepers *keepers.AppKeepers, ctx sdk.Context, channelID string) { + channel, found := keepers.IBCKeeper.ChannelKeeper.GetChannel(ctx, icatypes.PortID, channelID) + if found { + channel.State = ibcchanneltypes.CLOSED + keepers.IBCKeeper.ChannelKeeper.SetChannel(ctx, icatypes.PortID, channelID, channel) + } +} + func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, @@ -69,6 +110,11 @@ func CreateUpgradeHandler( return vm, err } + err = QuicksilverFix(ctx, keepers) + if err != nil { + return vm, err + } + // Enable controller chain controllerParams := icacontrollertypes.Params{ ControllerEnabled: true, From d2f3fa95cc0525092e6f47648bf143757b3a9011 Mon Sep 17 00:00:00 2001 From: yaruwangway <69694322+yaruwangway@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:15:44 +0100 Subject: [PATCH 2/2] test: remove unused const (#1988) * test: remove unused const * fix: lint --- tests/e2e/e2e_setup_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 11f2d230d9..77b9570de3 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -58,7 +58,6 @@ const ( gas = 200000 govProposalBlockBuffer = 35 relayerAccountIndex = 0 - icaOwnerAccountIndex = 1 numberOfEvidences = 10 slashingShares int64 = 10000