diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 6af3edc30e5..42503349078 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -243,7 +243,6 @@ func (b *broadcastUser) FormattedAddressWithPrefix(prefix string) string { // BroadcastMessages broadcasts the provided messages to the given chain and signs them on behalf of the provided user. // Once the broadcast response is returned, we wait for a few blocks to be created on both chain A and chain B. func (s *E2ETestSuite) BroadcastMessages(ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, msgs ...sdk.Msg) (sdk.TxResponse, error) { - // wrap the user so it is a valid implementation of broadcast user. b := broadcastUser{Wallet: user} diff --git a/modules/core/02-client/keeper/grpc_query.go b/modules/core/02-client/keeper/grpc_query.go index 8449c6fb5d5..dd462cbca29 100644 --- a/modules/core/02-client/keeper/grpc_query.go +++ b/modules/core/02-client/keeper/grpc_query.go @@ -63,25 +63,26 @@ func (q Keeper) ClientStates(c context.Context, req *types.QueryClientStatesRequ clientStates := types.IdentifiedClientStates{} store := prefix.NewStore(ctx.KVStore(q.storeKey), host.KeyClientStorePrefix) - pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { + pageRes, err := query.FilteredPaginate(store, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { + // filter any metadata stored under client state key keySplit := strings.Split(string(key), "/") if keySplit[len(keySplit)-1] != "clientState" { - return nil + return false, nil } clientState, err := q.UnmarshalClientState(value) if err != nil { - return err + return false, err } clientID := keySplit[1] if err := host.ClientIdentifierValidator(clientID); err != nil { - return err + return false, err } identifiedClient := types.NewIdentifiedClientState(clientID, clientState) clientStates = append(clientStates, identifiedClient) - return nil + return true, nil }) if err != nil { return nil, err diff --git a/modules/core/02-client/keeper/grpc_query_test.go b/modules/core/02-client/keeper/grpc_query_test.go index aa4d12265ab..50683e98723 100644 --- a/modules/core/02-client/keeper/grpc_query_test.go +++ b/modules/core/02-client/keeper/grpc_query_test.go @@ -163,11 +163,11 @@ func (suite *KeeperTestSuite) TestQueryClientStates() { ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) res, err := suite.chainA.QueryServer.ClientStates(ctx, req) - if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(expClientStates.Sort(), res.ClientStates) + suite.Require().Equal(len(expClientStates), int(res.Pagination.Total)) } else { suite.Require().Error(err) } @@ -381,7 +381,6 @@ func (suite *KeeperTestSuite) TestQueryConsensusStates() { for i := range expConsensusStates { suite.Require().NotNil(res.ConsensusStates[i]) suite.Require().Equal(expConsensusStates[i], res.ConsensusStates[i]) - // ensure UnpackInterfaces is defined cachedValue := res.ConsensusStates[i].ConsensusState.GetCachedValue() suite.Require().NotNil(cachedValue) diff --git a/modules/core/04-channel/keeper/grpc_query.go b/modules/core/04-channel/keeper/grpc_query.go index da850123764..6385076de75 100644 --- a/modules/core/04-channel/keeper/grpc_query.go +++ b/modules/core/04-channel/keeper/grpc_query.go @@ -96,26 +96,27 @@ func (q Keeper) ConnectionChannels(c context.Context, req *types.QueryConnection channels := []*types.IdentifiedChannel{} store := prefix.NewStore(ctx.KVStore(q.storeKey), []byte(host.KeyChannelEndPrefix)) - pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { + pageRes, err := query.FilteredPaginate(store, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { + // filter any metadata stored under channel key var result types.Channel if err := q.cdc.Unmarshal(value, &result); err != nil { - return err + return false, err } // ignore channel and continue to the next item if the connection is // different than the requested one if result.ConnectionHops[0] != req.Connection { - return nil + return false, nil } portID, channelID, err := host.ParseChannelPath(string(key)) if err != nil { - return err + return false, err } identifiedChannel := types.NewIdentifiedChannel(portID, channelID, result) channels = append(channels, &identifiedChannel) - return nil + return true, nil }) if err != nil { return nil, err