diff --git a/app/upgrades/types.go b/app/upgrades/types.go index 1015afa7f..e20f376df 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -23,6 +23,7 @@ const ( // mainnet upgrades V010217UpgradeName = "v1.2.17" V010405UpgradeName = "v1.4.5" + V010406UpgradeName = "v1.4.6" ) // Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal diff --git a/app/upgrades/upgrades.go b/app/upgrades/upgrades.go index e8a3776ae..7f1c1bec6 100644 --- a/app/upgrades/upgrades.go +++ b/app/upgrades/upgrades.go @@ -25,8 +25,8 @@ func Upgrades() []Upgrade { // v1.2: this needs to be present to support upgrade on mainnet {UpgradeName: V010217UpgradeName, CreateUpgradeHandler: NoOpHandler}, - {UpgradeName: V010405UpgradeName, CreateUpgradeHandler: NoOpHandler}, + {UpgradeName: V010406UpgradeName, CreateUpgradeHandler: V010406UpgradeHandler}, } } @@ -41,7 +41,7 @@ func NoOpHandler( } } -func V010405UpgradeHandler( +func V010406UpgradeHandler( mm *module.Manager, configurator module.Configurator, appKeepers *keepers.AppKeepers, @@ -82,6 +82,12 @@ func V010405UpgradeHandler( query := stakingtypes.QueryValidatorsRequest{} _ = appKeepers.InterchainstakingKeeper.EmitValSetQuery(ctx, zone.ConnectionId, zone.ChainId, query, math.NewInt(-1)) } + + appKeepers.InterchainstakingKeeper.SetAddressZoneMapping(ctx, zone.DepositAddress.Address, zone.ChainId) + appKeepers.InterchainstakingKeeper.SetAddressZoneMapping(ctx, zone.DelegationAddress.Address, zone.ChainId) + appKeepers.InterchainstakingKeeper.SetAddressZoneMapping(ctx, zone.PerformanceAddress.Address, zone.ChainId) + appKeepers.InterchainstakingKeeper.SetAddressZoneMapping(ctx, zone.WithdrawalAddress.Address, zone.ChainId) + zone.Validators = nil appKeepers.InterchainstakingKeeper.SetZone(ctx, zone) return false diff --git a/app/upgrades_test.go b/app/upgrades_test.go index fa5ee2a97..0e1204fff 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -72,7 +72,11 @@ func (s *AppTestSuite) SetupTest() { s.coordinator.UpdateTime() } -func (s *AppTestSuite) InitV145TestZones() { +func (s *AppTestSuite) InitV146TestZones() { + cosmosWithdrawal := addressutils.GenerateAddressForTestWithPrefix("cosmos") + cosmosPerformance := addressutils.GenerateAddressForTestWithPrefix("cosmos") + cosmosDeposit := addressutils.GenerateAddressForTestWithPrefix("cosmos") + cosmosDelegate := addressutils.GenerateAddressForTestWithPrefix("cosmos") // cosmos zone zone := icstypes.Zone{ ConnectionId: "connection-77001", @@ -82,9 +86,33 @@ func (s *AppTestSuite) InitV145TestZones() { BaseDenom: "uatom", MultiSend: false, LiquidityModule: false, + WithdrawalAddress: &icstypes.ICAAccount{ + Address: cosmosWithdrawal, + PortName: "icacontroller-cosmoshub-4.withdrawal", + WithdrawalAddress: cosmosWithdrawal, + }, + DelegationAddress: &icstypes.ICAAccount{ + Address: cosmosDelegate, + PortName: "icacontroller-cosmoshub-4.delegate", + WithdrawalAddress: cosmosWithdrawal, + }, + DepositAddress: &icstypes.ICAAccount{ + Address: cosmosDeposit, + PortName: "icacontroller-cosmoshub-4.deposit", + WithdrawalAddress: cosmosWithdrawal, + }, + PerformanceAddress: &icstypes.ICAAccount{ + Address: cosmosPerformance, + PortName: "icacontroller-cosmoshub-4.performance", + WithdrawalAddress: cosmosWithdrawal, + }, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) + osmoWithdrawal := addressutils.GenerateAddressForTestWithPrefix("osmo") + osmoPerformance := addressutils.GenerateAddressForTestWithPrefix("osmo") + osmoDeposit := addressutils.GenerateAddressForTestWithPrefix("osmo") + osmoDelegate := addressutils.GenerateAddressForTestWithPrefix("osmo") // osmosis zone zone = icstypes.Zone{ ConnectionId: "connection-77002", @@ -94,9 +122,35 @@ func (s *AppTestSuite) InitV145TestZones() { BaseDenom: "uosmo", MultiSend: false, LiquidityModule: false, + WithdrawalAddress: &icstypes.ICAAccount{ + Address: osmoWithdrawal, + PortName: "icacontroller-osmosis-1.withdrawal", + WithdrawalAddress: osmoWithdrawal, + }, + DelegationAddress: &icstypes.ICAAccount{ + Address: osmoDelegate, + PortName: "icacontroller-osmosis-1.delegate", + WithdrawalAddress: osmoWithdrawal, + }, + DepositAddress: &icstypes.ICAAccount{ + Address: osmoDeposit, + PortName: "icacontroller-osmosis-1.deposit", + WithdrawalAddress: osmoWithdrawal, + }, + PerformanceAddress: &icstypes.ICAAccount{ + Address: osmoPerformance, + PortName: "icacontroller-osmosis-1.performance", + WithdrawalAddress: osmoWithdrawal, + }, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) // uni-5 zone + + junoWithdrawal := addressutils.GenerateAddressForTestWithPrefix("juno") + junoPerformance := addressutils.GenerateAddressForTestWithPrefix("juno") + junoDeposit := addressutils.GenerateAddressForTestWithPrefix("juno") + junoDelegate := addressutils.GenerateAddressForTestWithPrefix("juno") + zone = icstypes.Zone{ ConnectionId: "connection-77003", ChainId: "juno-1", @@ -105,6 +159,26 @@ func (s *AppTestSuite) InitV145TestZones() { BaseDenom: "ujuno", MultiSend: false, LiquidityModule: false, + WithdrawalAddress: &icstypes.ICAAccount{ + Address: junoWithdrawal, + PortName: "icacontroller-juno-1.withdrawal", + WithdrawalAddress: junoWithdrawal, + }, + DelegationAddress: &icstypes.ICAAccount{ + Address: junoDelegate, + PortName: "icacontroller-juno-1.delegate", + WithdrawalAddress: junoWithdrawal, + }, + DepositAddress: &icstypes.ICAAccount{ + Address: junoDeposit, + PortName: "icacontroller-juno-1.deposit", + WithdrawalAddress: junoWithdrawal, + }, + PerformanceAddress: &icstypes.ICAAccount{ + Address: junoPerformance, + PortName: "icacontroller-juno-1.performance", + WithdrawalAddress: junoWithdrawal, + }, } s.GetQuicksilverApp(s.chainA).InterchainstakingKeeper.SetZone(s.chainA.GetContext(), &zone) @@ -140,11 +214,12 @@ func addVestingAccount(ctx sdk.Context, ak *authkeeper.AccountKeeper, address st ak.SetAccount(ctx, vest) } -func (s *AppTestSuite) TestV010405UpgradeHandler() { - s.InitV145TestZones() +func (s *AppTestSuite) TestV010406UpgradeHandler() { + s.InitV146TestZones() app := s.GetQuicksilverApp(s.chainA) - handler := upgrades.V010405UpgradeHandler(app.mm, app.configurator, &app.AppKeepers) + handler := upgrades.V010406UpgradeHandler(app.mm, + app.configurator, &app.AppKeepers) ctx := s.chainA.GetContext() _, err := handler(ctx, types.Plan{}, app.mm.GetVersionMap()) @@ -181,4 +256,16 @@ func (s *AppTestSuite) TestV010405UpgradeHandler() { s.True(ok) s.Equal(int64(1712880000), pva.EndTime) s.Equal(10, len(pva.VestingPeriods)) + + ctestZone, found := app.InterchainstakingKeeper.GetZoneForAccount(ctx, cosmosZone.DepositAddress.Address) + s.True(found) + s.Equal(ctestZone.ChainId, cosmosZone.ChainId) + + otestZone, found := app.InterchainstakingKeeper.GetZoneForAccount(ctx, osmoZone.PerformanceAddress.Address) + s.True(found) + s.Equal(otestZone.ChainId, osmoZone.ChainId) + + noTestZone, found := app.InterchainstakingKeeper.GetZoneForAccount(ctx, addressutils.GenerateAddressForTestWithPrefix("cosmos")) + s.False(found) + s.Nil(noTestZone) } diff --git a/x/interchainstaking/keeper/callbacks.go b/x/interchainstaking/keeper/callbacks.go index 061c27a2d..ffc65be4d 100644 --- a/x/interchainstaking/keeper/callbacks.go +++ b/x/interchainstaking/keeper/callbacks.go @@ -275,7 +275,7 @@ func SigningInfoCallback(k *Keeper, ctx sdk.Context, args []byte, query icqtypes valSigningInfo := slashingtypes.ValidatorSigningInfo{} if len(args) == 0 { k.Logger(ctx).Error("unable to find signing info for validator", "query", query.Request) - return errors.New("attempted to unmarshal zero length byte slice (10)") + return nil } err := k.cdc.Unmarshal(args, &valSigningInfo) if err != nil { diff --git a/x/interchainstaking/keeper/callbacks_test.go b/x/interchainstaking/keeper/callbacks_test.go index 6f9a2bfa6..337c8b66b 100644 --- a/x/interchainstaking/keeper/callbacks_test.go +++ b/x/interchainstaking/keeper/callbacks_test.go @@ -1988,17 +1988,6 @@ func (suite *KeeperTestSuite) TestSigningInfoCallback() { }, expectErr: true, }, - // args has no len - { - name: "args has no len", - malleate: func(quicksilver *app.Quicksilver, ctx sdk.Context) []byte { - return []byte{} - }, - query: icqtypes.Query{ - ChainId: suite.chainB.ChainID, - }, - expectErr: true, - }, // wrong type args { name: "wrong type args",