Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/web-ui/react-refresh…
Browse files Browse the repository at this point in the history
…-0.14.0
  • Loading branch information
faddat authored Jan 11, 2024
2 parents aaf178d + a153a25 commit f5d2377
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 18 deletions.
1 change: 1 addition & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions app/upgrades/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
}

Expand All @@ -41,7 +41,7 @@ func NoOpHandler(
}
}

func V010405UpgradeHandler(
func V010406UpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
appKeepers *keepers.AppKeepers,
Expand Down Expand Up @@ -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
Expand Down
95 changes: 91 additions & 4 deletions app/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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)

Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion x/interchainstaking/keeper/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions x/interchainstaking/keeper/callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f5d2377

Please sign in to comment.