From 919e9068661efd3fe7548585a1ce7c18335738da Mon Sep 17 00:00:00 2001 From: SaReN Date: Tue, 28 Jul 2020 18:23:35 +0530 Subject: [PATCH] Minor Code Cleanup - gRPC queries (#6862) * add missing RegisterQueryService * Update generated proto files * Update grpc tests for auth,bank * Make format * fix godoc * Address suggestions * Update godoc --- baseapp/baseapp.go | 2 +- client/keys/utils.go | 2 +- crypto/hd/algo.go | 2 +- crypto/keyring/keyring.go | 2 +- crypto/keyring/keyring_test.go | 2 +- crypto/types/multisig/codec.go | 2 +- telemetry/metrics.go | 2 +- telemetry/metrics_test.go | 2 +- telemetry/wrapper.go | 2 +- testutil/testdata/test_helper.go | 2 +- x/auth/keeper/grpc_query.go | 12 ++++++------ x/auth/keeper/keeper.go | 6 +++--- x/auth/vesting/types/period.go | 2 +- x/auth/vesting/types/vesting_account.go | 3 ++- x/bank/handler.go | 2 +- x/bank/keeper/grpc_query.go | 18 ++++++++--------- x/bank/keeper/grpc_query_test.go | 26 ++++--------------------- x/bank/keeper/keeper_test.go | 11 +++++++++-- x/capability/types/types.go | 2 +- x/distribution/handler.go | 2 +- x/distribution/types/params.go | 2 +- x/evidence/module.go | 4 +++- x/evidence/types/evidence.go | 8 ++++---- x/gov/handler.go | 2 +- x/gov/types/deposit.go | 2 +- x/gov/types/params.go | 2 +- x/gov/types/tally.go | 2 +- x/gov/types/vote.go | 2 +- x/mint/types/params.go | 2 +- x/params/types/proposal/proposal.go | 2 +- x/staking/handler.go | 2 +- x/staking/module.go | 5 ++++- 32 files changed, 67 insertions(+), 72 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 0cedd43f6c..9d5b98585a 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -186,7 +186,7 @@ func (app *BaseApp) MountKVStores(keys map[string]*sdk.KVStoreKey) { } } -// MountTransientStores mounts all IAVL or DB stores to the provided keys in +// MountTransientStores mounts all transient stores to the provided keys in // the BaseApp multistore. func (app *BaseApp) MountTransientStores(keys map[string]*sdk.TransientStoreKey) { for _, key := range keys { diff --git a/client/keys/utils.go b/client/keys/utils.go index 891ddeaeb9..7490914d11 100644 --- a/client/keys/utils.go +++ b/client/keys/utils.go @@ -5,7 +5,7 @@ import ( "io" "path/filepath" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" cryptokeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" ) diff --git a/crypto/hd/algo.go b/crypto/hd/algo.go index 264f0ae8df..d112226645 100644 --- a/crypto/hd/algo.go +++ b/crypto/hd/algo.go @@ -1,7 +1,7 @@ package hd import ( - "github.com/cosmos/go-bip39" + bip39 "github.com/cosmos/go-bip39" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/secp256k1" ) diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 05598d0613..43631d36f8 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/99designs/keyring" - "github.com/cosmos/go-bip39" + bip39 "github.com/cosmos/go-bip39" "github.com/pkg/errors" "github.com/tendermint/crypto/bcrypt" tmcrypto "github.com/tendermint/tendermint/crypto" diff --git a/crypto/keyring/keyring_test.go b/crypto/keyring/keyring_test.go index 1daf0164f4..4b63b1efd3 100644 --- a/crypto/keyring/keyring_test.go +++ b/crypto/keyring/keyring_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/99designs/keyring" - "github.com/cosmos/go-bip39" + bip39 "github.com/cosmos/go-bip39" "github.com/stretchr/testify/require" tmcrypto "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" diff --git a/crypto/types/multisig/codec.go b/crypto/types/multisig/codec.go index 052b4f8556..970601dc2b 100644 --- a/crypto/types/multisig/codec.go +++ b/crypto/types/multisig/codec.go @@ -1,7 +1,7 @@ package multisig import ( - "github.com/tendermint/go-amino" + amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" diff --git a/telemetry/metrics.go b/telemetry/metrics.go index f402e92909..ca9bf78908 100644 --- a/telemetry/metrics.go +++ b/telemetry/metrics.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" metricsprom "github.com/armon/go-metrics/prometheus" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/expfmt" diff --git a/telemetry/metrics_test.go b/telemetry/metrics_test.go index aa4c934bfb..39ffd85b90 100644 --- a/telemetry/metrics_test.go +++ b/telemetry/metrics_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" "github.com/prometheus/common/expfmt" "github.com/stretchr/testify/require" ) diff --git a/telemetry/wrapper.go b/telemetry/wrapper.go index 56584e296e..62f50eeacb 100644 --- a/telemetry/wrapper.go +++ b/telemetry/wrapper.go @@ -3,7 +3,7 @@ package telemetry import ( "time" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" ) // Common metric key constants diff --git a/testutil/testdata/test_helper.go b/testutil/testdata/test_helper.go index 4703a556e5..8952ebbe07 100644 --- a/testutil/testdata/test_helper.go +++ b/testutil/testdata/test_helper.go @@ -1,7 +1,7 @@ package testdata import ( - "github.com/tendermint/go-amino" + amino "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/codec/types" ) diff --git a/x/auth/keeper/grpc_query.go b/x/auth/keeper/grpc_query.go index 45e16d8a1d..3b54b1faa8 100644 --- a/x/auth/keeper/grpc_query.go +++ b/x/auth/keeper/grpc_query.go @@ -17,17 +17,17 @@ import ( var _ types.QueryServer = AccountKeeper{} // Account returns account details based on address -func (k AccountKeeper) Account(c context.Context, req *types.QueryAccountRequest) (*types.QueryAccountResponse, error) { +func (ak AccountKeeper) Account(c context.Context, req *types.QueryAccountRequest) (*types.QueryAccountResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } if req.Address.Empty() { - return nil, status.Errorf(codes.InvalidArgument, "invalid request") + return nil, status.Error(codes.InvalidArgument, "Address cannot be empty") } ctx := sdk.UnwrapSDKContext(c) - account := k.GetAccount(ctx, req.Address) + account := ak.GetAccount(ctx, req.Address) if account == nil { return nil, status.Errorf(codes.NotFound, "account %s not found", req.Address) } @@ -41,12 +41,12 @@ func (k AccountKeeper) Account(c context.Context, req *types.QueryAccountRequest } // Params returns parameters of auth module -func (k AccountKeeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (ak AccountKeeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") + return nil, status.Error(codes.InvalidArgument, "empty request") } ctx := sdk.UnwrapSDKContext(c) - params := k.GetParams(ctx) + params := ak.GetParams(ctx) return &types.QueryParamsResponse{Params: params}, nil } diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index 54dabc46c3..eaefead6c2 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -183,15 +183,15 @@ func (ak AccountKeeper) decodeAccount(bz []byte) types.AccountI { return acc } -// MarshalEvidence marshals an Evidence interface. If the given type implements +// MarshalAccount marshals an Account interface. If the given type implements // the Marshaler interface, it is treated as a Proto-defined message and // serialized that way. Otherwise, it falls back on the internal Amino codec. func (ak AccountKeeper) MarshalAccount(accountI types.AccountI) ([]byte, error) { return codec.MarshalAny(ak.cdc, accountI) } -// UnmarshalEvidence returns an Evidence interface from raw encoded evidence -// bytes of a Proto-based Evidence type. An error is returned upon decoding +// UnmarshalAccount returns an Account interface from raw encoded account +// bytes of a Proto-based Account type. An error is returned upon decoding // failure. func (ak AccountKeeper) UnmarshalAccount(bz []byte) (types.AccountI, error) { var acc types.AccountI diff --git a/x/auth/vesting/types/period.go b/x/auth/vesting/types/period.go index 27b7a65c75..a3b32fcaf7 100644 --- a/x/auth/vesting/types/period.go +++ b/x/auth/vesting/types/period.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" ) // Periods stores all vesting periods passed as part of a PeriodicVestingAccount diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 0f34228a02..5354189a13 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -4,13 +4,14 @@ import ( "errors" "time" + yaml "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/codec/legacy" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" "github.com/tendermint/tendermint/crypto" - "gopkg.in/yaml.v2" ) // Compile-time type assertions diff --git a/x/bank/handler.go b/x/bank/handler.go index 0dc8daa1fc..5d4b7fe970 100644 --- a/x/bank/handler.go +++ b/x/bank/handler.go @@ -1,7 +1,7 @@ package bank import ( - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go index 244ea55086..c3901481e9 100644 --- a/x/bank/keeper/grpc_query.go +++ b/x/bank/keeper/grpc_query.go @@ -17,15 +17,15 @@ var _ types.QueryServer = BaseKeeper{} // Balance implements the Query/Balance gRPC method func (q BaseKeeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error) { if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") + return nil, status.Error(codes.InvalidArgument, "empty request") } - if len(req.Address) == 0 { - return nil, status.Errorf(codes.InvalidArgument, "invalid address") + if req.Address.Empty() { + return nil, status.Error(codes.InvalidArgument, "address cannot be empty") } if req.Denom == "" { - return nil, status.Errorf(codes.InvalidArgument, "invalid denom") + return nil, status.Error(codes.InvalidArgument, "invalid denom") } ctx := sdk.UnwrapSDKContext(c) @@ -37,12 +37,12 @@ func (q BaseKeeper) Balance(c context.Context, req *types.QueryBalanceRequest) ( // AllBalances implements the Query/AllBalances gRPC method func (q BaseKeeper) AllBalances(c context.Context, req *types.QueryAllBalancesRequest) (*types.QueryAllBalancesResponse, error) { if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") + return nil, status.Error(codes.InvalidArgument, "empty request") } addr := req.Address - if len(addr) == 0 { - return nil, status.Errorf(codes.InvalidArgument, "invalid address") + if addr.Empty() { + return nil, status.Errorf(codes.InvalidArgument, "address cannot be empty") } ctx := sdk.UnwrapSDKContext(c) @@ -80,11 +80,11 @@ func (q BaseKeeper) TotalSupply(c context.Context, _ *types.QueryTotalSupplyRequ // SupplyOf implements the Query/SupplyOf gRPC method func (q BaseKeeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*types.QuerySupplyOfResponse, error) { if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") + return nil, status.Error(codes.InvalidArgument, "empty request") } if req.Denom == "" { - return nil, status.Errorf(codes.InvalidArgument, "invalid denom") + return nil, status.Error(codes.InvalidArgument, "invalid denom") } ctx := sdk.UnwrapSDKContext(c) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 6776ffed5a..77cc747bea 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -5,20 +5,15 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank/types" ) func (suite *IntegrationTestSuite) TestQueryBalance() { - app, ctx := suite.app, suite.ctx + app, ctx, queryClient := suite.app, suite.ctx, suite.queryClient _, _, addr := testdata.KeyTestPubAddr() - queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, app.BankKeeper) - queryClient := types.NewQueryClient(queryHelper) - _, err := queryClient.Balance(gocontext.Background(), &types.QueryBalanceRequest{}) suite.Require().Error(err) @@ -44,13 +39,8 @@ func (suite *IntegrationTestSuite) TestQueryBalance() { } func (suite *IntegrationTestSuite) TestQueryAllBalances() { - app, ctx := suite.app, suite.ctx + app, ctx, queryClient := suite.app, suite.ctx, suite.queryClient _, _, addr := testdata.KeyTestPubAddr() - - queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, app.BankKeeper) - queryClient := types.NewQueryClient(queryHelper) - _, err := queryClient.AllBalances(gocontext.Background(), &types.QueryAllBalancesRequest{}) suite.Require().Error(err) @@ -93,14 +83,10 @@ func (suite *IntegrationTestSuite) TestQueryAllBalances() { } func (suite *IntegrationTestSuite) TestQueryTotalSupply() { - app, ctx := suite.app, suite.ctx + app, ctx, queryClient := suite.app, suite.ctx, suite.queryClient expectedTotalSupply := types.NewSupply(sdk.NewCoins(sdk.NewInt64Coin("test", 400000000))) app.BankKeeper.SetSupply(ctx, expectedTotalSupply) - queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, app.BankKeeper) - queryClient := types.NewQueryClient(queryHelper) - res, err := queryClient.TotalSupply(gocontext.Background(), &types.QueryTotalSupplyRequest{}) suite.Require().NoError(err) suite.Require().NotNil(res) @@ -109,17 +95,13 @@ func (suite *IntegrationTestSuite) TestQueryTotalSupply() { } func (suite *IntegrationTestSuite) TestQueryTotalSupplyOf() { - app, ctx := suite.app, suite.ctx + app, ctx, queryClient := suite.app, suite.ctx, suite.queryClient test1Supply := sdk.NewInt64Coin("test1", 4000000) test2Supply := sdk.NewInt64Coin("test2", 700000000) expectedTotalSupply := types.NewSupply(sdk.NewCoins(test1Supply, test2Supply)) app.BankKeeper.SetSupply(ctx, expectedTotalSupply) - queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, app.BankKeeper) - queryClient := types.NewQueryClient(queryHelper) - _, err := queryClient.SupplyOf(gocontext.Background(), &types.QuerySupplyOfRequest{}) suite.Require().Error(err) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index b080195b21..3c67b67158 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -9,6 +9,7 @@ import ( tmkv "github.com/tendermint/tendermint/libs/kv" tmtime "github.com/tendermint/tendermint/types/time" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -60,8 +61,9 @@ func getCoinsByName(ctx sdk.Context, bk keeper.Keeper, ak types.AccountKeeper, m type IntegrationTestSuite struct { suite.Suite - app *simapp.SimApp - ctx sdk.Context + app *simapp.SimApp + ctx sdk.Context + queryClient types.QueryClient } func (suite *IntegrationTestSuite) SetupTest() { @@ -71,8 +73,13 @@ func (suite *IntegrationTestSuite) SetupTest() { app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams()) app.BankKeeper.SetParams(ctx, types.DefaultParams()) + queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, app.BankKeeper) + queryClient := types.NewQueryClient(queryHelper) + suite.app = app suite.ctx = ctx + suite.queryClient = queryClient } func (suite *IntegrationTestSuite) TestSupply() { diff --git a/x/capability/types/types.go b/x/capability/types/types.go index e53efa5c4a..2dcceb8c88 100644 --- a/x/capability/types/types.go +++ b/x/capability/types/types.go @@ -4,7 +4,7 @@ import ( "fmt" "sort" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) diff --git a/x/distribution/handler.go b/x/distribution/handler.go index 121629b193..0f9417e770 100644 --- a/x/distribution/handler.go +++ b/x/distribution/handler.go @@ -1,7 +1,7 @@ package distribution import ( - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/distribution/types/params.go b/x/distribution/types/params.go index 0cea1814fe..ecd04ece67 100644 --- a/x/distribution/types/params.go +++ b/x/distribution/types/params.go @@ -3,7 +3,7 @@ package types import ( "fmt" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/evidence/module.go b/x/evidence/module.go index d20b8dca7f..01009b5a34 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -144,7 +144,9 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc codec.JSONMarshaler) s // RegisterQueryService registers a GRPC query service to respond to the // module-specific GRPC queries. -func (am AppModule) RegisterQueryService(grpc.Server) {} +func (am AppModule) RegisterQueryService(server grpc.Server) { + types.RegisterQueryServer(server, am.keeper) +} // RegisterInvariants registers the evidence module's invariants. func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} diff --git a/x/evidence/types/evidence.go b/x/evidence/types/evidence.go index 3049d6110b..471b5b1456 100644 --- a/x/evidence/types/evidence.go +++ b/x/evidence/types/evidence.go @@ -4,13 +4,13 @@ import ( "fmt" "time" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/evidence/exported" - abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/tmhash" tmbytes "github.com/tendermint/tendermint/libs/bytes" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/evidence/exported" ) // Evidence type constants diff --git a/x/gov/handler.go b/x/gov/handler.go index d2b1b234a7..9d5a4c21bd 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/gov/types/deposit.go b/x/gov/types/deposit.go index d9f72a83fd..63ff26f60d 100644 --- a/x/gov/types/deposit.go +++ b/x/gov/types/deposit.go @@ -3,7 +3,7 @@ package types import ( "fmt" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/gov/types/params.go b/x/gov/types/params.go index 3321e3e40a..5a9dfcc53e 100644 --- a/x/gov/types/params.go +++ b/x/gov/types/params.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/gov/types/tally.go b/x/gov/types/tally.go index d8acbeacd6..a4e9ee9086 100644 --- a/x/gov/types/tally.go +++ b/x/gov/types/tally.go @@ -1,7 +1,7 @@ package types import ( - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/gov/types/vote.go b/x/gov/types/vote.go index 11ec05ecea..3dea5de0dd 100644 --- a/x/gov/types/vote.go +++ b/x/gov/types/vote.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/mint/types/params.go b/x/mint/types/params.go index 674c04d489..f0f9ef494b 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/params/types/proposal/proposal.go b/x/params/types/proposal/proposal.go index 4480795789..3a2f97a772 100644 --- a/x/params/types/proposal/proposal.go +++ b/x/params/types/proposal/proposal.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) diff --git a/x/staking/handler.go b/x/staking/handler.go index da7c9fa368..43dd7441fe 100644 --- a/x/staking/handler.go +++ b/x/staking/handler.go @@ -3,7 +3,7 @@ package staking import ( "time" - "github.com/armon/go-metrics" + metrics "github.com/armon/go-metrics" gogotypes "github.com/gogo/protobuf/types" tmstrings "github.com/tendermint/tendermint/libs/strings" tmtypes "github.com/tendermint/tendermint/types" diff --git a/x/staking/module.go b/x/staking/module.go index 84dc2c5826..dffecd95ed 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -129,7 +129,10 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc codec.JSONMarshaler) s // RegisterQueryService registers a GRPC query service to respond to the // module-specific GRPC queries. -func (am AppModule) RegisterQueryService(grpc.Server) {} +func (am AppModule) RegisterQueryService(server grpc.Server) { + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(server, querier) +} // InitGenesis performs genesis initialization for the staking module. It returns // no validator updates.