Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove query client #3227

Merged
merged 7 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions modules/apps/29-fee/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() {
tc.malleate() // malleate mutates test data

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.IncentivizedPackets(ctx, req)

res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPackets(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -125,7 +126,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() {
tc.malleate() // malleate mutates test data

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.IncentivizedPacket(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPacket(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -219,7 +220,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() {
tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.IncentivizedPacketsForChannel(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPacketsForChannel(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -275,7 +276,7 @@ func (suite *KeeperTestSuite) TestQueryTotalRecvFees() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.TotalRecvFees(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalRecvFees(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -334,7 +335,7 @@ func (suite *KeeperTestSuite) TestQueryTotalAckFees() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.TotalAckFees(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalAckFees(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -393,7 +394,7 @@ func (suite *KeeperTestSuite) TestQueryTotalTimeoutFees() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.TotalTimeoutFees(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalTimeoutFees(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -460,7 +461,7 @@ func (suite *KeeperTestSuite) TestQueryPayee() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.Payee(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.Payee(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -523,7 +524,7 @@ func (suite *KeeperTestSuite) TestQueryCounterpartyPayee() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.CounterpartyPayee(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.CounterpartyPayee(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -630,7 +631,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.FeeEnabledChannels(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannels(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -679,7 +680,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() {
tc.malleate()

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.FeeEnabledChannel(ctx, req)
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannel(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down
7 changes: 0 additions & 7 deletions modules/apps/29-fee/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"testing"

"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/suite"

Expand Down Expand Up @@ -33,8 +32,6 @@ type KeeperTestSuite struct {

path *ibctesting.Path
pathAToC *ibctesting.Path

queryClient types.QueryClient
}

func (suite *KeeperTestSuite) SetupTest() {
Expand All @@ -57,10 +54,6 @@ func (suite *KeeperTestSuite) SetupTest() {
path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort
path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort
suite.pathAToC = path

queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry())
types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().IBCFeeKeeper)
suite.queryClient = types.NewQueryClient(queryHelper)
}

func TestKeeperTestSuite(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions modules/apps/transfer/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTrace() {
tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.DenomTrace(ctx, req)
res, err := suite.chainA.GetSimApp().TransferKeeper.DenomTrace(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand All @@ -92,7 +92,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTrace() {
func (suite *KeeperTestSuite) TestQueryDenomTraces() {
var (
req *types.QueryDenomTracesRequest
expTraces = types.Traces(nil)
expTraces = types.Traces{}
)

testCases := []struct {
Expand Down Expand Up @@ -136,7 +136,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTraces() {
tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.DenomTraces(ctx, req)
res, err := suite.chainA.GetSimApp().TransferKeeper.DenomTraces(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand All @@ -152,7 +152,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTraces() {
func (suite *KeeperTestSuite) TestQueryParams() {
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
expParams := types.DefaultParams()
res, _ := suite.queryClient.Params(ctx, &types.QueryParamsRequest{})
res, _ := suite.chainA.GetSimApp().TransferKeeper.Params(ctx, &types.QueryParamsRequest{})
suite.Require().Equal(&expParams, res.Params)
}

Expand Down Expand Up @@ -209,7 +209,7 @@ func (suite *KeeperTestSuite) TestQueryDenomHash() {
tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.DenomHash(ctx, req)
res, err := suite.chainA.GetSimApp().TransferKeeper.DenomHash(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -249,7 +249,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() {
tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.EscrowAddress(ctx, req)
res, err := suite.chainA.GetSimApp().TransferKeeper.EscrowAddress(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down
3 changes: 0 additions & 3 deletions modules/apps/transfer/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ type KeeperTestSuite struct {
chainA *ibctesting.TestChain
chainB *ibctesting.TestChain
chainC *ibctesting.TestChain

queryClient types.QueryClient
}

func (suite *KeeperTestSuite) SetupTest() {
Expand All @@ -31,7 +29,6 @@ func (suite *KeeperTestSuite) SetupTest() {

queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry())
types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().TransferKeeper)
suite.queryClient = types.NewQueryClient(queryHelper)
}

func NewTransferPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {
Expand Down
7 changes: 1 addition & 6 deletions modules/core/02-client/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import (

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
"github.com/cosmos/cosmos-sdk/types/query"
"google.golang.org/grpc/metadata"

"github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v6/modules/core/exported"
Expand Down Expand Up @@ -626,10 +624,7 @@ func (suite *KeeperTestSuite) TestQueryUpgradedConsensusStates() {

tc.malleate()

ctx := sdk.WrapSDKContext(suite.ctx)
ctx = metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height))

res, err := suite.queryClient.UpgradedConsensusState(ctx, req)
res, err := suite.keeper.UpgradedConsensusState(suite.ctx, req)
if tc.expPass {
suite.Require().NoError(err)
suite.Require().True(expConsensusState.Equal(res.UpgradedConsensusState))
Expand Down
10 changes: 0 additions & 10 deletions modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"testing"
"time"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -67,9 +66,6 @@ type KeeperTestSuite struct {
solomachine *ibctesting.Solomachine

signers map[string]tmtypes.PrivValidator

// TODO: deprecate
queryClient types.QueryClient
}

func (suite *KeeperTestSuite) SetupTest() {
Expand All @@ -88,7 +84,6 @@ func (suite *KeeperTestSuite) SetupTest() {
suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: height, ChainID: testClientID, Time: now2})
suite.keeper = &app.IBCKeeper.ClientKeeper
suite.privVal = ibctestingmock.NewPV()

pubKey, err := suite.privVal.GetPubKey()
suite.Require().NoError(err)

Expand Down Expand Up @@ -123,11 +118,6 @@ func (suite *KeeperTestSuite) SetupTest() {
}

suite.solomachine = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinesingle", "testing", 1)

// TODO: deprecate
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry())
types.RegisterQueryServer(queryHelper, app.IBCKeeper.ClientKeeper)
suite.queryClient = types.NewQueryClient(queryHelper)
}

func TestKeeperTestSuite(t *testing.T) {
Expand Down