diff --git a/x/interchainstaking/keeper/callbacks_test.go b/x/interchainstaking/keeper/callbacks_test.go index 2222a55e2..2aa5d043c 100644 --- a/x/interchainstaking/keeper/callbacks_test.go +++ b/x/interchainstaking/keeper/callbacks_test.go @@ -935,6 +935,36 @@ func (s *KeeperTestSuite) TestAccountBalanceCallbackMismatch() { }) } +func (s *KeeperTestSuite) TestAccountBalance046Callback() { + s.Run("account balance", func() { + s.SetupTest() + s.setupTestZones() + + app := s.GetQuicksilverApp(s.chainA) + app.InterchainstakingKeeper.CallbackHandler().RegisterCallbacks() + ctx := s.chainA.GetContext() + + zone, _ := app.InterchainstakingKeeper.GetZone(ctx, s.chainB.ChainID) + zone.DepositAddress.IncrementBalanceWaitgroup() + zone.WithdrawalAddress.IncrementBalanceWaitgroup() + app.InterchainstakingKeeper.SetZone(ctx, &zone) + + response := sdk.NewInt(10) + + respbz, err := response.Marshal() + s.Require().NoError(err) + + for _, addr := range []string{zone.DepositAddress.Address, zone.WithdrawalAddress.Address} { + accAddr, err := sdk.AccAddressFromBech32(addr) + s.Require().NoError(err) + data := append(banktypes.CreateAccountBalancesPrefix(accAddr), []byte("qck")...) + + err = keeper.AccountBalanceCallback(app.InterchainstakingKeeper, ctx, respbz, icqtypes.Query{ChainId: s.chainB.ChainID, Request: data}) + s.Require().NoError(err) + } + }) +} + func (s *KeeperTestSuite) TestAccountBalanceCallbackNil() { s.Run("account balance", func() { s.SetupTest() @@ -949,8 +979,8 @@ func (s *KeeperTestSuite) TestAccountBalanceCallbackNil() { zone.WithdrawalAddress.BalanceWaitgroup++ app.InterchainstakingKeeper.SetZone(ctx, &zone) - response := sdk.Coin{} - respbz, err := app.AppCodec().Marshal(&response) + var response *sdk.Coin = nil + respbz, err := app.AppCodec().Marshal(response) s.Require().NoError(err) for _, addr := range []string{zone.DepositAddress.Address, zone.WithdrawalAddress.Address} {