Skip to content

Commit

Permalink
add v1.4.7-rc2 upgradehandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Bowman committed Feb 1, 2024
1 parent 1ff4f40 commit ff33cae
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
V010405rc7UpgradeName = "v1.4.5-rc7"
V010407rc0UpgradeName = "v1.4.7-rc0"
V010407rc1UpgradeName = "v1.4.7-rc1"
V010407rc2UpgradeName = "v1.4.7-rc2"

// mainnet upgrades
V010217UpgradeName = "v1.2.17"
Expand Down
54 changes: 54 additions & 0 deletions app/upgrades/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/query"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

Expand All @@ -24,6 +26,7 @@ func Upgrades() []Upgrade {
{UpgradeName: V010405rc7UpgradeName, CreateUpgradeHandler: NoOpHandler},
{UpgradeName: V010407rc0UpgradeName, CreateUpgradeHandler: NoOpHandler},
{UpgradeName: V010407rc1UpgradeName, CreateUpgradeHandler: V010407rc1UpgradeHandler},
{UpgradeName: V010407rc2UpgradeName, CreateUpgradeHandler: V010407rc2UpgradeHandler},

// v1.2: this needs to be present to support upgrade on mainnet
{UpgradeName: V010217UpgradeName, CreateUpgradeHandler: NoOpHandler},
Expand Down Expand Up @@ -214,3 +217,54 @@ func V010407rc1UpgradeHandler(
return mm.RunMigrations(ctx, configurator, fromVM)
}
}

func V010407rc2UpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
appKeepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
if isTestnet(ctx) || isDevnet(ctx) {
appKeepers.InterchainstakingKeeper.IterateZones(ctx, func(index int64, zone *icstypes.Zone) (stop bool) {

Check failure on line 229 in app/upgrades/upgrades.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
vals := appKeepers.InterchainstakingKeeper.GetValidators(ctx, zone.ChainId)
delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: zone.DelegationAddress.Address, Pagination: &query.PageRequest{Limit: uint64(len(vals))}}
bz := appKeepers.InterchainstakingKeeper.GetCodec().MustMarshal(&delegationQuery)

appKeepers.InterchainQueryKeeper.MakeRequest(
ctx,
zone.ConnectionId,
zone.ChainId,
"cosmos.staking.v1beta1.Query/DelegatorDelegations",
bz,
sdk.NewInt(-1),
icstypes.ModuleName,
"delegations",
0,
)

balancesQuery := banktypes.QueryAllBalancesRequest{Address: zone.DelegationAddress.Address}
bz = appKeepers.InterchainstakingKeeper.GetCodec().MustMarshal(&balancesQuery)
appKeepers.InterchainQueryKeeper.MakeRequest(
ctx,
zone.ConnectionId,
zone.ChainId,
"cosmos.bank.v1beta1.Query/AllBalances",
bz,
sdk.NewInt(-1),
icstypes.ModuleName,
"delegationaccountbalances",
0,
)
// increment waitgroup; decremented in delegationaccountbalance callback
zone.WithdrawalWaitgroup++

appKeepers.InterchainstakingKeeper.SetZone(ctx, zone)

return false
})
}

return mm.RunMigrations(ctx, configurator, fromVM)
}
}

0 comments on commit ff33cae

Please sign in to comment.