Skip to content

Commit 1bdb0e9

Browse files
authored
remove query client (#3227)
* remove query client * merge main * go mod tidy
1 parent b2ad0e1 commit 1bdb0e9

File tree

6 files changed

+19
-44
lines changed

6 files changed

+19
-44
lines changed

modules/apps/29-fee/keeper/grpc_query_test.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() {
6666
tc.malleate() // malleate mutates test data
6767

6868
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
69-
res, err := suite.queryClient.IncentivizedPackets(ctx, req)
69+
70+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPackets(ctx, req)
7071

7172
if tc.expPass {
7273
suite.Require().NoError(err)
@@ -125,7 +126,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() {
125126
tc.malleate() // malleate mutates test data
126127

127128
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
128-
res, err := suite.queryClient.IncentivizedPacket(ctx, req)
129+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPacket(ctx, req)
129130

130131
if tc.expPass {
131132
suite.Require().NoError(err)
@@ -219,7 +220,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() {
219220
tc.malleate()
220221
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
221222

222-
res, err := suite.queryClient.IncentivizedPacketsForChannel(ctx, req)
223+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPacketsForChannel(ctx, req)
223224

224225
if tc.expPass {
225226
suite.Require().NoError(err)
@@ -275,7 +276,7 @@ func (suite *KeeperTestSuite) TestQueryTotalRecvFees() {
275276
tc.malleate()
276277

277278
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
278-
res, err := suite.queryClient.TotalRecvFees(ctx, req)
279+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalRecvFees(ctx, req)
279280

280281
if tc.expPass {
281282
suite.Require().NoError(err)
@@ -334,7 +335,7 @@ func (suite *KeeperTestSuite) TestQueryTotalAckFees() {
334335
tc.malleate()
335336

336337
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
337-
res, err := suite.queryClient.TotalAckFees(ctx, req)
338+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalAckFees(ctx, req)
338339

339340
if tc.expPass {
340341
suite.Require().NoError(err)
@@ -393,7 +394,7 @@ func (suite *KeeperTestSuite) TestQueryTotalTimeoutFees() {
393394
tc.malleate()
394395

395396
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
396-
res, err := suite.queryClient.TotalTimeoutFees(ctx, req)
397+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalTimeoutFees(ctx, req)
397398

398399
if tc.expPass {
399400
suite.Require().NoError(err)
@@ -460,7 +461,7 @@ func (suite *KeeperTestSuite) TestQueryPayee() {
460461
tc.malleate()
461462

462463
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
463-
res, err := suite.queryClient.Payee(ctx, req)
464+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.Payee(ctx, req)
464465

465466
if tc.expPass {
466467
suite.Require().NoError(err)
@@ -523,7 +524,7 @@ func (suite *KeeperTestSuite) TestQueryCounterpartyPayee() {
523524
tc.malleate()
524525

525526
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
526-
res, err := suite.queryClient.CounterpartyPayee(ctx, req)
527+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.CounterpartyPayee(ctx, req)
527528

528529
if tc.expPass {
529530
suite.Require().NoError(err)
@@ -630,7 +631,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() {
630631
tc.malleate()
631632

632633
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
633-
res, err := suite.queryClient.FeeEnabledChannels(ctx, req)
634+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannels(ctx, req)
634635

635636
if tc.expPass {
636637
suite.Require().NoError(err)
@@ -679,7 +680,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() {
679680
tc.malleate()
680681

681682
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
682-
res, err := suite.queryClient.FeeEnabledChannel(ctx, req)
683+
res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannel(ctx, req)
683684

684685
if tc.expPass {
685686
suite.Require().NoError(err)

modules/apps/29-fee/keeper/keeper_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"testing"
66

7-
"github.com/cosmos/cosmos-sdk/baseapp"
87
sdk "github.com/cosmos/cosmos-sdk/types"
98
"github.com/stretchr/testify/suite"
109

@@ -33,8 +32,6 @@ type KeeperTestSuite struct {
3332

3433
path *ibctesting.Path
3534
pathAToC *ibctesting.Path
36-
37-
queryClient types.QueryClient
3835
}
3936

4037
func (suite *KeeperTestSuite) SetupTest() {
@@ -57,10 +54,6 @@ func (suite *KeeperTestSuite) SetupTest() {
5754
path.EndpointA.ChannelConfig.PortID = ibctesting.MockFeePort
5855
path.EndpointB.ChannelConfig.PortID = ibctesting.MockFeePort
5956
suite.pathAToC = path
60-
61-
queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry())
62-
types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().IBCFeeKeeper)
63-
suite.queryClient = types.NewQueryClient(queryHelper)
6457
}
6558

6659
func TestKeeperTestSuite(t *testing.T) {

modules/apps/transfer/keeper/grpc_query_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTrace() {
7676
tc.malleate()
7777
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
7878

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

8181
if tc.expPass {
8282
suite.Require().NoError(err)
@@ -92,7 +92,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTrace() {
9292
func (suite *KeeperTestSuite) TestQueryDenomTraces() {
9393
var (
9494
req *types.QueryDenomTracesRequest
95-
expTraces = types.Traces(nil)
95+
expTraces = types.Traces{}
9696
)
9797

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

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

141141
if tc.expPass {
142142
suite.Require().NoError(err)
@@ -152,7 +152,7 @@ func (suite *KeeperTestSuite) TestQueryDenomTraces() {
152152
func (suite *KeeperTestSuite) TestQueryParams() {
153153
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
154154
expParams := types.DefaultParams()
155-
res, _ := suite.queryClient.Params(ctx, &types.QueryParamsRequest{})
155+
res, _ := suite.chainA.GetSimApp().TransferKeeper.Params(ctx, &types.QueryParamsRequest{})
156156
suite.Require().Equal(&expParams, res.Params)
157157
}
158158

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

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

214214
if tc.expPass {
215215
suite.Require().NoError(err)
@@ -249,7 +249,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() {
249249
tc.malleate()
250250
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
251251

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

254254
if tc.expPass {
255255
suite.Require().NoError(err)

modules/apps/transfer/keeper/keeper_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ type KeeperTestSuite struct {
1919
chainA *ibctesting.TestChain
2020
chainB *ibctesting.TestChain
2121
chainC *ibctesting.TestChain
22-
23-
queryClient types.QueryClient
2422
}
2523

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

3230
queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry())
3331
types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().TransferKeeper)
34-
suite.queryClient = types.NewQueryClient(queryHelper)
3532
}
3633

3734
func NewTransferPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {

modules/core/02-client/keeper/grpc_query_test.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import (
55

66
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
77
sdk "github.com/cosmos/cosmos-sdk/types"
8-
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
98
"github.com/cosmos/cosmos-sdk/types/query"
10-
"google.golang.org/grpc/metadata"
119

1210
"github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
1311
"github.com/cosmos/ibc-go/v7/modules/core/exported"
@@ -631,10 +629,7 @@ func (suite *KeeperTestSuite) TestQueryUpgradedConsensusStates() {
631629

632630
tc.malleate()
633631

634-
ctx := sdk.WrapSDKContext(suite.ctx)
635-
ctx = metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", height))
636-
637-
res, err := suite.queryClient.UpgradedConsensusState(ctx, req)
632+
res, err := suite.keeper.UpgradedConsensusState(suite.ctx, req)
638633
if tc.expPass {
639634
suite.Require().NoError(err)
640635
suite.Require().True(expConsensusState.Equal(res.UpgradedConsensusState))

modules/core/02-client/keeper/keeper_test.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ import (
88
tmbytes "github.com/cometbft/cometbft/libs/bytes"
99
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
1010
tmtypes "github.com/cometbft/cometbft/types"
11-
"github.com/cosmos/cosmos-sdk/baseapp"
1211
"github.com/cosmos/cosmos-sdk/codec"
1312
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
1413
sdk "github.com/cosmos/cosmos-sdk/types"
1514
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
16-
"github.com/stretchr/testify/suite"
17-
1815
"github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
1916
"github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
2017
commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"
@@ -25,6 +22,7 @@ import (
2522
ibctesting "github.com/cosmos/ibc-go/v7/testing"
2623
ibctestingmock "github.com/cosmos/ibc-go/v7/testing/mock"
2724
"github.com/cosmos/ibc-go/v7/testing/simapp"
25+
"github.com/stretchr/testify/suite"
2826
)
2927

3028
const (
@@ -68,9 +66,6 @@ type KeeperTestSuite struct {
6866
solomachine *ibctesting.Solomachine
6967

7068
signers map[string]tmtypes.PrivValidator
71-
72-
// TODO: deprecate
73-
queryClient types.QueryClient
7469
}
7570

7671
func (suite *KeeperTestSuite) SetupTest() {
@@ -89,7 +84,6 @@ func (suite *KeeperTestSuite) SetupTest() {
8984
suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: height, ChainID: testClientID, Time: now2})
9085
suite.keeper = &app.IBCKeeper.ClientKeeper
9186
suite.privVal = ibctestingmock.NewPV()
92-
9387
pubKey, err := suite.privVal.GetPubKey()
9488
suite.Require().NoError(err)
9589

@@ -124,11 +118,6 @@ func (suite *KeeperTestSuite) SetupTest() {
124118
}
125119

126120
suite.solomachine = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinesingle", "testing", 1)
127-
128-
// TODO: deprecate
129-
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry())
130-
types.RegisterQueryServer(queryHelper, app.IBCKeeper.ClientKeeper)
131-
suite.queryClient = types.NewQueryClient(queryHelper)
132121
}
133122

134123
func TestKeeperTestSuite(t *testing.T) {

0 commit comments

Comments
 (0)