Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
Signed-off-by: Yaru Wang <[email protected]>
  • Loading branch information
Yaru Wang committed Jan 6, 2023
2 parents 583edb7 + d2f3fa9 commit 2f76c6f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
46 changes: 46 additions & 0 deletions app/upgrades/v8/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/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"
)
Expand Down Expand Up @@ -48,6 +50,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,
Expand All @@ -68,6 +109,11 @@ func CreateUpgradeHandler(
return vm, err
}

err = QuicksilverFix(ctx, keepers)
if err != nil {
return vm, err
}

// Change hostParams allow_messages = [*] instead of whitelisting individual messages
hostParams := icahosttypes.Params{
HostEnabled: true,
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const (
gas = 200000
govProposalBlockBuffer = 35
relayerAccountIndex = 0
icaOwnerAccountIndex = 1
numberOfEvidences = 10
slashingShares int64 = 10000

Expand Down

0 comments on commit 2f76c6f

Please sign in to comment.