diff --git a/CHANGELOG.md b/CHANGELOG.md index 105028e1e6..f14f51bf6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ * (swagger) [\#391] (https://github.com/line/lbm-sdk/pull/391) fix swagger's config path for wasm * (x/wasm) [\#393] (https://github.com/line/lbm-sdk/pull/393) fix bug where `StoreCodeAndInstantiateContract`, `UpdateContractStatus`, `UpdateContractStatusProposal` API does not work * (x/slashing) [\#407] (https://github.com/line/lbm-sdk/pull/407) Fix query signing infos command +* (x/consortium) [\#411] (https://github.com/line/lbm-sdk/pull/411) Validate validator addresses in update-validator-auths proposal ### Breaking Changes diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 2b6141ce33..569fa29817 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -6106,8 +6106,8 @@ Query defines the gRPC querier service for consortium module. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `Params` | [QueryParamsRequest](#lbm.consortium.v1.QueryParamsRequest) | [QueryParamsResponse](#lbm.consortium.v1.QueryParamsResponse) | Params queries the module params. | GET|/lbm/consortium/v1/params| -| `ValidatorAuths` | [QueryValidatorAuthsRequest](#lbm.consortium.v1.QueryValidatorAuthsRequest) | [QueryValidatorAuthsResponse](#lbm.consortium.v1.QueryValidatorAuthsResponse) | ValidatorAuths queries authorization infos of validators. | GET|/lbm/consortium/v1/validators| | `ValidatorAuth` | [QueryValidatorAuthRequest](#lbm.consortium.v1.QueryValidatorAuthRequest) | [QueryValidatorAuthResponse](#lbm.consortium.v1.QueryValidatorAuthResponse) | ValidatorAuth queries authorization info of a validator. | GET|/lbm/consortium/v1/validators/{validator_address}| +| `ValidatorAuths` | [QueryValidatorAuthsRequest](#lbm.consortium.v1.QueryValidatorAuthsRequest) | [QueryValidatorAuthsResponse](#lbm.consortium.v1.QueryValidatorAuthsResponse) | ValidatorAuths queries authorization infos of validators. | GET|/lbm/consortium/v1/validators| diff --git a/proto/lbm/consortium/v1/query.proto b/proto/lbm/consortium/v1/query.proto index 4e71c18142..1e693cc0ff 100644 --- a/proto/lbm/consortium/v1/query.proto +++ b/proto/lbm/consortium/v1/query.proto @@ -14,15 +14,15 @@ service Query { option (google.api.http).get = "/lbm/consortium/v1/params"; } - // ValidatorAuths queries authorization infos of validators. - rpc ValidatorAuths(QueryValidatorAuthsRequest) returns (QueryValidatorAuthsResponse) { - option (google.api.http).get = "/lbm/consortium/v1/validators"; - } - // ValidatorAuth queries authorization info of a validator. rpc ValidatorAuth(QueryValidatorAuthRequest) returns (QueryValidatorAuthResponse) { option (google.api.http).get = "/lbm/consortium/v1/validators/{validator_address}"; } + + // ValidatorAuths queries authorization infos of validators. + rpc ValidatorAuths(QueryValidatorAuthsRequest) returns (QueryValidatorAuthsResponse) { + option (google.api.http).get = "/lbm/consortium/v1/validators"; + } } // QueryParamsRequest is the request type for the Query/Params RPC method. @@ -33,6 +33,19 @@ message QueryParamsResponse { Params params = 1; } +// QueryValidatorAuthRequest is the request type for the +// Query/ValidatorAuth RPC method. +message QueryValidatorAuthRequest { + // validator_address defines the validator address to query for. + string validator_address = 1; +} + +// QueryValidatorAuthResponse is the request type for the +// Query/ValidatorAuth RPC method. +message QueryValidatorAuthResponse { + ValidatorAuth auth = 1; +} + // QueryValidatorAuthsRequest is the request type for the // Query/ValidatorAuths RPC method. message QueryValidatorAuthsRequest { @@ -48,16 +61,3 @@ message QueryValidatorAuthsResponse { // pagination defines the pagination in the response. lbm.base.query.v1.PageResponse pagination = 2; } - -// QueryValidatorAuthRequest is the request type for the -// Query/ValidatorAuth RPC method. -message QueryValidatorAuthRequest { - // validator_address defines the validator address to query for. - string validator_address = 1; -} - -// QueryValidatorAuthResponse is the request type for the -// Query/ValidatorAuth RPC method. -message QueryValidatorAuthResponse { - ValidatorAuth auth = 1; -} diff --git a/testutil/rest/rest.go b/testutil/rest/rest.go new file mode 100644 index 0000000000..17dddaa6a5 --- /dev/null +++ b/testutil/rest/rest.go @@ -0,0 +1,44 @@ +// Package rest provides HTTP types and primitives for REST +// requests validation and responses handling. +package rest + +import ( + "bytes" + "fmt" + "io/ioutil" + "net/http" +) + +// GetRequest defines a wrapper around an HTTP GET request with a provided URL. +// An error is returned if the request or reading the body fails. +func GetRequest(url string) ([]byte, error) { + res, err := http.Get(url) // nolint:gosec + if err != nil { + return nil, err + } + defer res.Body.Close() + + body, err := ioutil.ReadAll(res.Body) + if err != nil { + return nil, err + } + + return body, nil +} + +// PostRequest defines a wrapper around an HTTP POST request with a provided URL and data. +// An error is returned if the request or reading the body fails. +func PostRequest(url string, contentType string, data []byte) ([]byte, error) { + res, err := http.Post(url, contentType, bytes.NewBuffer(data)) // nolint:gosec + if err != nil { + return nil, fmt.Errorf("error while sending post request: %w", err) + } + defer res.Body.Close() + + bz, err := ioutil.ReadAll(res.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + + return bz, nil +} diff --git a/x/consortium/client/cli/query.go b/x/consortium/client/cli/query.go index 001ddd1956..a472e563b1 100644 --- a/x/consortium/client/cli/query.go +++ b/x/consortium/client/cli/query.go @@ -11,24 +11,24 @@ import ( "github.com/line/lbm-sdk/x/consortium/types" ) -// GetQueryCmd returns the parent command for all x/consortium CLi query commands. -func GetQueryCmd() *cobra.Command { +// NewQueryCmd returns the parent command for all x/consortium CLi query commands. +func NewQueryCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, Short: "Querying commands for the consortium module", } cmd.AddCommand( - GetParamsCmd(), - GetValidatorAuthsCmd(), - GetValidatorAuthCmd(), + NewQueryCmdParams(), + NewQueryCmdValidatorAuth(), + NewQueryCmdValidatorAuths(), ) return cmd } -// GetParamsCmd returns the query consortium parameters command. -func GetParamsCmd() *cobra.Command { +// NewQueryCmdParams returns the query consortium parameters command. +func NewQueryCmdParams() *cobra.Command { cmd := &cobra.Command{ Use: "params", Short: "Query consortium params", @@ -56,13 +56,13 @@ func GetParamsCmd() *cobra.Command { return cmd } -// GetValidatorAuthsCmd returns validator authorization by consortium -func GetValidatorAuthsCmd() *cobra.Command { +// NewQueryCmdValidatorAuth returns validator authorization by consortium +func NewQueryCmdValidatorAuth() *cobra.Command { cmd := &cobra.Command{ - Use: "validator-auths", - Short: "Query validator authorizations", - Long: "Gets validator authorizations by consortium", - Args: cobra.NoArgs, + Use: "validator-auth [validator-address]", + Short: "Query validator authorization", + Long: "Gets validator authorization by consortium", + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -70,13 +70,13 @@ func GetValidatorAuthsCmd() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { + valAddr := args[0] + if err = sdk.ValidateValAddress(valAddr); err != nil { return err } - params := types.QueryValidatorAuthsRequest{Pagination: pageReq} - res, err := queryClient.ValidatorAuths(context.Background(), ¶ms) + params := types.QueryValidatorAuthRequest{ValidatorAddress: valAddr} + res, err := queryClient.ValidatorAuth(context.Background(), ¶ms) if err != nil { return err } @@ -86,18 +86,17 @@ func GetValidatorAuthsCmd() *cobra.Command { } flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "validator auths") return cmd } -// GetValidatorAuthCmd returns validator authorizations by consortium -func GetValidatorAuthCmd() *cobra.Command { +// NewQueryCmdValidatorAuths returns validator authorizations by consortium +func NewQueryCmdValidatorAuths() *cobra.Command { cmd := &cobra.Command{ - Use: "validator-auth [validator-address]", - Short: "Query validator authorization", - Long: "Gets validator authorization by consortium", - Args: cobra.ExactArgs(1), + Use: "validator-auths", + Short: "Query validator authorizations", + Long: "Gets validator authorizations by consortium", + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -105,13 +104,13 @@ func GetValidatorAuthCmd() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - valAddr := args[0] - if err = sdk.ValidateValAddress(valAddr); err != nil { + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { return err } - params := types.QueryValidatorAuthRequest{ValidatorAddress: valAddr} - res, err := queryClient.ValidatorAuth(context.Background(), ¶ms) + params := types.QueryValidatorAuthsRequest{Pagination: pageReq} + res, err := queryClient.ValidatorAuths(context.Background(), ¶ms) if err != nil { return err } @@ -121,6 +120,7 @@ func GetValidatorAuthCmd() *cobra.Command { } flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "validator auths") return cmd } diff --git a/x/consortium/client/cli/tx.go b/x/consortium/client/cli/tx.go index 9ce67e5663..4ed5bc5a7f 100644 --- a/x/consortium/client/cli/tx.go +++ b/x/consortium/client/cli/tx.go @@ -9,7 +9,6 @@ import ( "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/client/tx" sdk "github.com/line/lbm-sdk/types" - sdkerrors "github.com/line/lbm-sdk/types/errors" "github.com/line/lbm-sdk/version" "github.com/line/lbm-sdk/x/consortium/types" "github.com/line/lbm-sdk/x/gov/client/cli" @@ -22,8 +21,8 @@ const ( FlagAllowedValidatorDelete = "delete" ) -// NewCmdSubmitUpdateConsortiumParamsProposal implements the command to submit an update-consortium-params proposal -func NewCmdSubmitUpdateConsortiumParamsProposal() *cobra.Command { +// NewProposalCmdUpdateConsortiumParams implements the command to submit an update-consortium-params proposal +func NewProposalCmdUpdateConsortiumParams() *cobra.Command { cmd := &cobra.Command{ Use: "update-consortium-params", Args: cobra.NoArgs, @@ -69,7 +68,6 @@ $ %s tx gov submit-proposal update-consortium-params [flags] Enabled: false, } content := types.NewUpdateConsortiumParamsProposal(title, description, params) - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) if err != nil { return err @@ -90,8 +88,8 @@ $ %s tx gov submit-proposal update-consortium-params [flags] return cmd } -// NewCmdSubmitUpdateValidatorAuthsProposal implements the command to submit an update-validator-auths proposal -func NewCmdSubmitUpdateValidatorAuthsProposal() *cobra.Command { +// NewProposalCmdUpdateValidatorAuths implements the command to submit an update-validator-auths proposal +func NewProposalCmdUpdateValidatorAuths() *cobra.Command { cmd := &cobra.Command{ Use: "update-validator-auths", Args: cobra.NoArgs, @@ -151,18 +149,8 @@ $ %s tx gov submit-proposal update-validator-auths [flags] } deletingValidators := parseCommaSeparated(deletingValidatorsStr) - createAuths := func(addings, deletings []string) ([]*types.ValidatorAuth, error) { + createAuths := func(addings, deletings []string) []*types.ValidatorAuth { var auths []*types.ValidatorAuth - - // check duplications - usedAddrs := map[string]bool{} - for _, addr := range append(addings, deletings...) { - if usedAddrs[addr] { - return auths, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "multiple auths for same validator: %s", addr) - } - usedAddrs[addr] = true - } - for _, addr := range addings { auth := &types.ValidatorAuth{ OperatorAddress: addr, @@ -178,15 +166,11 @@ $ %s tx gov submit-proposal update-validator-auths [flags] auths = append(auths, auth) } - return auths, nil + return auths } - auths, err := createAuths(addingValidators, deletingValidators) - if err != nil { - return err - } + auths := createAuths(addingValidators, deletingValidators) content := types.NewUpdateValidatorAuthsProposal(title, description, auths) - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) if err != nil { return err diff --git a/x/consortium/client/proposal_handler.go b/x/consortium/client/proposal_handler.go index ae1a50936b..e166b4c778 100644 --- a/x/consortium/client/proposal_handler.go +++ b/x/consortium/client/proposal_handler.go @@ -6,5 +6,5 @@ import ( govclient "github.com/line/lbm-sdk/x/gov/client" ) -var UpdateConsortiumParamsProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpdateConsortiumParamsProposal, rest.DummyRESTHandler) -var UpdateValidatorAuthsProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpdateValidatorAuthsProposal, rest.DummyRESTHandler) +var UpdateConsortiumParamsProposalHandler = govclient.NewProposalHandler(cli.NewProposalCmdUpdateConsortiumParams, rest.DummyRESTHandler) +var UpdateValidatorAuthsProposalHandler = govclient.NewProposalHandler(cli.NewProposalCmdUpdateValidatorAuths, rest.DummyRESTHandler) diff --git a/x/consortium/client/testutil/cli_test.go b/x/consortium/client/testutil/cli_test.go new file mode 100644 index 0000000000..a0d9d3381c --- /dev/null +++ b/x/consortium/client/testutil/cli_test.go @@ -0,0 +1,17 @@ +// +build norace + +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/line/lbm-sdk/testutil/network" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/consortium/client/testutil/grpc.go b/x/consortium/client/testutil/grpc.go new file mode 100644 index 0000000000..2cab6362e6 --- /dev/null +++ b/x/consortium/client/testutil/grpc.go @@ -0,0 +1,135 @@ +package testutil + +import ( + "fmt" + + "github.com/gogo/protobuf/proto" + + "github.com/line/lbm-sdk/testutil" + "github.com/line/lbm-sdk/testutil/rest" + "github.com/line/lbm-sdk/x/consortium/types" +) + +func (s *IntegrationTestSuite) TestGRPCParams() { + val := s.network.Validators[0] + + testCases := []struct { + name string + url string + expErr bool + respType proto.Message + expectResp proto.Message + }{ + { + "valid request", + fmt.Sprintf("%s/lbm/consortium/v1/params", val.APIAddress), + false, + &types.QueryParamsResponse{}, + &types.QueryParamsResponse{ + Params: &types.Params{ + Enabled: true, + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := rest.GetRequest(tc.url) + s.Require().NoError(err) + + err = s.cfg.Codec.UnmarshalJSON(resp, tc.respType) + + if tc.expErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().Equal(tc.expectResp.String(), tc.respType.String()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCValidatorAuth() { + val := s.network.Validators[0] + + apiTemplate := "%s/lbm/consortium/v1/validators/%s" + testCases := []struct { + name string + url string + expErr bool + }{ + { + "with an empty validator address", + fmt.Sprintf(apiTemplate, val.APIAddress, ""), + true, + }, + { + "with an invalid validator address", + fmt.Sprintf(apiTemplate, val.APIAddress, "this-is-an-invalid-address"), + true, + }, + { + "valid request", + fmt.Sprintf(apiTemplate, val.APIAddress, val.ValAddress), + false, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := rest.GetRequest(tc.url) + s.Require().NoError(err) + + var auth types.QueryValidatorAuthResponse + err = s.cfg.Codec.UnmarshalJSON(resp, &auth) + + if tc.expErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NotNil(auth.Auth) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCValidatorAuths() { + val := s.network.Validators[0] + + testCases := []struct { + name string + url string + headers map[string]string + wantNumAuths int + expErr bool + }{ + { + "valid request", + fmt.Sprintf("%s/lbm/consortium/v1/validators", val.APIAddress), + map[string]string{}, + 1, + false, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Require().NoError(err) + + var auths types.QueryValidatorAuthsResponse + err = s.cfg.Codec.UnmarshalJSON(resp, &auths) + + if tc.expErr { + s.Require().Empty(auths.Auths) + } else { + s.Require().NoError(err) + s.Require().Len(auths.Auths, tc.wantNumAuths) + } + }) + } +} diff --git a/x/consortium/client/testutil/query.go b/x/consortium/client/testutil/query.go new file mode 100644 index 0000000000..e589f07f59 --- /dev/null +++ b/x/consortium/client/testutil/query.go @@ -0,0 +1,173 @@ +package testutil + +import ( + "fmt" + "strings" + + "github.com/line/lbm-sdk/client/flags" + clitestutil "github.com/line/lbm-sdk/testutil/cli" + "github.com/line/lbm-sdk/x/consortium/client/cli" + ostcli "github.com/line/ostracon/libs/cli" +) + +func (s *IntegrationTestSuite) TestNewQueryCmdParams() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + expectedOutput string + }{ + { + "json output", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + fmt.Sprintf("--%s=json", ostcli.OutputFlag), + }, + `{"params":{"enabled":true}}`, + }, + { + "text output", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + fmt.Sprintf("--%s=text", ostcli.OutputFlag), + }, + `params: + enabled: true`, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewQueryCmdParams() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + s.Require().NoError(err) + s.Require().Equal(tc.expectedOutput, strings.TrimSpace(out.String())) + }) + } +} + +func (s *IntegrationTestSuite) TestNewQueryCmdValidatorAuth() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + expectErr bool + expectedOutput string + }{ + { + "json output", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + fmt.Sprintf("--%s=json", ostcli.OutputFlag), + val.ValAddress.String(), + }, + false, + fmt.Sprintf(`{"auth":{"operator_address":"%s","creation_allowed":true}}`, + val.ValAddress.String(), + ), + }, + { + "text output", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + fmt.Sprintf("--%s=text", ostcli.OutputFlag), + val.ValAddress.String(), + }, + false, + fmt.Sprintf(`auth: + creation_allowed: true + operator_address: %s`, + val.ValAddress.String(), + ), + }, + { + "with no args", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + }, + true, + "", + }, + { + "with an invalid address", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + "this-is-an-invalid-address", + }, + true, + "", + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewQueryCmdValidatorAuth() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().Equal(tc.expectedOutput, strings.TrimSpace(out.String())) + } + }) + } +} + +func (s *IntegrationTestSuite) TestNewQueryCmdValidatorAuths() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + expectedOutput string + }{ + { + "json output", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + fmt.Sprintf("--%s=json", ostcli.OutputFlag), + }, + fmt.Sprintf(`{"auths":[{"operator_address":"%s","creation_allowed":true}],"pagination":{"next_key":null,"total":"0"}}`, + val.ValAddress.String(), + ), + }, + { + "text output", + []string{ + fmt.Sprintf("--%s=1", flags.FlagHeight), + fmt.Sprintf("--%s=text", ostcli.OutputFlag), + }, + fmt.Sprintf(`auths: +- creation_allowed: true + operator_address: %s +pagination: + next_key: null + total: "0"`, + val.ValAddress.String(), + ), + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewQueryCmdValidatorAuths() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + s.Require().NoError(err) + s.Require().Equal(tc.expectedOutput, strings.TrimSpace(out.String())) + }) + } +} diff --git a/x/consortium/client/testutil/suite.go b/x/consortium/client/testutil/suite.go new file mode 100644 index 0000000000..bde3b0a925 --- /dev/null +++ b/x/consortium/client/testutil/suite.go @@ -0,0 +1,49 @@ +package testutil + +import ( + "github.com/stretchr/testify/suite" + + "github.com/line/lbm-sdk/testutil/network" + "github.com/line/lbm-sdk/x/consortium/types" +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + + genesisState := s.cfg.GenesisState + + var consortiumData types.GenesisState + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[types.ModuleName], &consortiumData)) + + // enable consortium + params := &types.Params{ + Enabled: true, + } + consortiumData.Params = params + + consortiumDataBz, err := s.cfg.Codec.MarshalJSON(&consortiumData) + s.Require().NoError(err) + genesisState[types.ModuleName] = consortiumDataBz + s.cfg.GenesisState = genesisState + + s.network = network.New(s.T(), s.cfg) + + _, err = s.network.WaitForHeight(1) + s.Require().NoError(err) +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} diff --git a/x/consortium/client/testutil/tx.go b/x/consortium/client/testutil/tx.go new file mode 100644 index 0000000000..21d66fcc36 --- /dev/null +++ b/x/consortium/client/testutil/tx.go @@ -0,0 +1,153 @@ +package testutil + +import ( + "fmt" + + "github.com/gogo/protobuf/proto" + + "github.com/line/lbm-sdk/client/flags" + clitestutil "github.com/line/lbm-sdk/testutil/cli" + sdk "github.com/line/lbm-sdk/types" + "github.com/line/lbm-sdk/x/consortium/client/cli" +) + +func (s *IntegrationTestSuite) TestNewProposalCmdUpdateConsortiumParams() { + val := s.network.Validators[0] + + commonFlags := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + + testCases := []struct { + name string + args []string + expectErr bool + expectedCode uint32 + respType proto.Message + }{ + { + "with wrong # of args", + append([]string{ + "no-args-expected", + }, commonFlags...), + true, 0, nil, + }, + { + "valid transaction", + commonFlags, + false, 0, &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewProposalCmdUpdateConsortiumParams() + clientCtx := val.ClientCtx + flags.AddTxFlagsToCmd(cmd) + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + + txResp := tc.respType.(*sdk.TxResponse) + s.Require().Equal(tc.expectedCode, txResp.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestNewProposalCmdUpdateValidatorAuths() { + val := s.network.Validators[0] + + commonFlags := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + } + + testCases := []struct { + name string + args []string + expectErr bool + expectedCode uint32 + respType proto.Message + }{ + { + "with no args", + commonFlags, + true, 0, nil, + }, + { + "with an invalid address", + append([]string{ + fmt.Sprintf("--%s=%s", + cli.FlagAllowedValidatorAdd, + "this-is-an-invalid-address", + ), + }, commonFlags...), + true, 0, nil, + }, + { + "with duplicated validators in add", + append([]string{ + fmt.Sprintf("--%s=%s,%s", + cli.FlagAllowedValidatorAdd, + val.ValAddress.String(), + val.ValAddress.String(), + ), + }, commonFlags...), + true, 0, nil, + }, + { + "with same validators in both add and delete", + append([]string{ + fmt.Sprintf("--%s=%s", + cli.FlagAllowedValidatorAdd, + val.ValAddress.String()), + fmt.Sprintf("--%s=%s", + cli.FlagAllowedValidatorDelete, + val.ValAddress.String()), + }, commonFlags...), + true, 0, nil, + }, + { + "valid transaction", + append([]string{ + fmt.Sprintf("--%s=%s", + cli.FlagAllowedValidatorDelete, + val.ValAddress.String()), + }, commonFlags...), + false, 0, &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := cli.NewProposalCmdUpdateValidatorAuths() + clientCtx := val.ClientCtx + flags.AddTxFlagsToCmd(cmd) + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expectErr { + s.Require().Error(err) + } else { + s.Require().NoError(err) + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + + txResp := tc.respType.(*sdk.TxResponse) + s.Require().Equal(tc.expectedCode, txResp.Code) + } + }) + } +} diff --git a/x/consortium/keeper/grpc_query.go b/x/consortium/keeper/grpc_query.go index c78b961c59..533394b24b 100644 --- a/x/consortium/keeper/grpc_query.go +++ b/x/consortium/keeper/grpc_query.go @@ -24,44 +24,44 @@ func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types return &types.QueryParamsResponse{Params: q.GetParams(ctx)}, nil } -func (q Keeper) ValidatorAuths(c context.Context, req *types.QueryValidatorAuthsRequest) (*types.QueryValidatorAuthsResponse, error) { +func (q Keeper) ValidatorAuth(c context.Context, req *types.QueryValidatorAuthRequest) (*types.QueryValidatorAuthResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - var auths []*types.ValidatorAuth + if req.ValidatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty validator address") + } + ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(q.storeKey) - validatorStore := prefix.NewStore(store, types.ValidatorAuthKeyPrefix) - pageRes, err := query.Paginate(validatorStore, req.Pagination, func(key []byte, value []byte) error { - var auth types.ValidatorAuth - q.cdc.MustUnmarshalBinaryBare(value, &auth) - auths = append(auths, &auth) - return nil - }) + + addr := sdk.ValAddress(req.ValidatorAddress) + auth, err := q.GetValidatorAuth(ctx, addr) if err != nil { return nil, err } - return &types.QueryValidatorAuthsResponse{Auths: auths, Pagination: pageRes}, nil + return &types.QueryValidatorAuthResponse{Auth: auth}, nil } -func (q Keeper) ValidatorAuth(c context.Context, req *types.QueryValidatorAuthRequest) (*types.QueryValidatorAuthResponse, error) { +func (q Keeper) ValidatorAuths(c context.Context, req *types.QueryValidatorAuthsRequest) (*types.QueryValidatorAuthsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - if req.ValidatorAddress == "" { - return nil, status.Error(codes.InvalidArgument, "empty validator address") - } - + var auths []*types.ValidatorAuth ctx := sdk.UnwrapSDKContext(c) - - addr := sdk.ValAddress(req.ValidatorAddress) - auth, err := q.GetValidatorAuth(ctx, addr) + store := ctx.KVStore(q.storeKey) + validatorStore := prefix.NewStore(store, types.ValidatorAuthKeyPrefix) + pageRes, err := query.Paginate(validatorStore, req.Pagination, func(key []byte, value []byte) error { + var auth types.ValidatorAuth + q.cdc.MustUnmarshalBinaryBare(value, &auth) + auths = append(auths, &auth) + return nil + }) if err != nil { return nil, err } - return &types.QueryValidatorAuthResponse{Auth: auth}, nil + return &types.QueryValidatorAuthsResponse{Auths: auths, Pagination: pageRes}, nil } diff --git a/x/consortium/keeper/grpc_query_test.go b/x/consortium/keeper/grpc_query_test.go index 1f2346b497..9f8f4efe82 100644 --- a/x/consortium/keeper/grpc_query_test.go +++ b/x/consortium/keeper/grpc_query_test.go @@ -89,7 +89,7 @@ func (suite *ConsortiumTestSuite) TestQueryValidatorAuth() { { "with non-existent auth", func() { - req = &types.QueryValidatorAuthRequest{ValidatorAddress: string(valAddr)} + req = &types.QueryValidatorAuthRequest{ValidatorAddress: valAddr.String()} expResponse = types.QueryValidatorAuthResponse{} }, false, @@ -98,12 +98,12 @@ func (suite *ConsortiumTestSuite) TestQueryValidatorAuth() { "with existing auth", func() { auth := &types.ValidatorAuth{ - OperatorAddress: string(valAddr), + OperatorAddress: valAddr.String(), CreationAllowed: true, } suite.app.ConsortiumKeeper.SetValidatorAuth(suite.ctx, auth) - req = &types.QueryValidatorAuthRequest{ValidatorAddress: string(valAddr)} + req = &types.QueryValidatorAuthRequest{ValidatorAddress: valAddr.String()} expResponse = types.QueryValidatorAuthResponse{Auth: auth} }, true, @@ -162,7 +162,7 @@ func (suite *ConsortiumTestSuite) TestQueryValidatorAuths() { "with non-empty auths", func() { auth := &types.ValidatorAuth{ - OperatorAddress: string(valAddr), + OperatorAddress: valAddr.String(), CreationAllowed: true, } suite.app.ConsortiumKeeper.SetValidatorAuth(suite.ctx, auth) diff --git a/x/consortium/keeper/keeper_test.go b/x/consortium/keeper/keeper_test.go index 792221bf05..ef28ff421b 100644 --- a/x/consortium/keeper/keeper_test.go +++ b/x/consortium/keeper/keeper_test.go @@ -26,7 +26,7 @@ func TestCleanup(t *testing.T) { // add auths auth := &types.ValidatorAuth{ - OperatorAddress: string(valAddr), + OperatorAddress: valAddr.String(), CreationAllowed: true, } require.NoError(t, k.SetValidatorAuth(ctx, auth)) diff --git a/x/consortium/keeper/validator_test.go b/x/consortium/keeper/validator_test.go index 3673a56562..83d7e7a422 100644 --- a/x/consortium/keeper/validator_test.go +++ b/x/consortium/keeper/validator_test.go @@ -22,7 +22,7 @@ func TestGetSetValidatorAuth(t *testing.T) { // test adding creation allowed validators expected := &types.ValidatorAuth{ - OperatorAddress: string(valAddr), + OperatorAddress: valAddr.String(), CreationAllowed: true, } require.NoError(t, k.SetValidatorAuth(ctx, expected)) diff --git a/x/consortium/module.go b/x/consortium/module.go index 6292f3379b..c502f40e70 100644 --- a/x/consortium/module.go +++ b/x/consortium/module.go @@ -71,7 +71,7 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r // GetQueryCmd returns the cli query commands for this module func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() + return cli.NewQueryCmd() } // GetTxCmd returns the transaction commands for this module diff --git a/x/consortium/types/proposal.go b/x/consortium/types/proposal.go index b5c872f7ba..6015491545 100644 --- a/x/consortium/types/proposal.go +++ b/x/consortium/types/proposal.go @@ -3,6 +3,7 @@ package types import ( "fmt" + sdk "github.com/line/lbm-sdk/types" sdkerrors "github.com/line/lbm-sdk/types/errors" govtypes "github.com/line/lbm-sdk/x/gov/types" ) @@ -71,6 +72,9 @@ func (p *UpdateValidatorAuthsProposal) ValidateBasic() error { usedAddrs := map[string]bool{} for _, auth := range p.Auths { addr := auth.OperatorAddress + if err := sdk.ValidateValAddress(addr); err != nil { + return err + } if usedAddrs[addr] { return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "multiple auths for same validator: %s", addr) } diff --git a/x/consortium/types/query.pb.go b/x/consortium/types/query.pb.go index 70b0006f0b..ddb24c4028 100644 --- a/x/consortium/types/query.pb.go +++ b/x/consortium/types/query.pb.go @@ -111,25 +111,25 @@ func (m *QueryParamsResponse) GetParams() *Params { return nil } -// QueryValidatorAuthsRequest is the request type for the -// Query/ValidatorAuths RPC method. -type QueryValidatorAuthsRequest struct { - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +// QueryValidatorAuthRequest is the request type for the +// Query/ValidatorAuth RPC method. +type QueryValidatorAuthRequest struct { + // validator_address defines the validator address to query for. + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } -func (m *QueryValidatorAuthsRequest) Reset() { *m = QueryValidatorAuthsRequest{} } -func (m *QueryValidatorAuthsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorAuthsRequest) ProtoMessage() {} -func (*QueryValidatorAuthsRequest) Descriptor() ([]byte, []int) { +func (m *QueryValidatorAuthRequest) Reset() { *m = QueryValidatorAuthRequest{} } +func (m *QueryValidatorAuthRequest) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorAuthRequest) ProtoMessage() {} +func (*QueryValidatorAuthRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e916717a75144447, []int{2} } -func (m *QueryValidatorAuthsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryValidatorAuthRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryValidatorAuthsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryValidatorAuthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryValidatorAuthsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryValidatorAuthRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -139,45 +139,43 @@ func (m *QueryValidatorAuthsRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryValidatorAuthsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorAuthsRequest.Merge(m, src) +func (m *QueryValidatorAuthRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorAuthRequest.Merge(m, src) } -func (m *QueryValidatorAuthsRequest) XXX_Size() int { +func (m *QueryValidatorAuthRequest) XXX_Size() int { return m.Size() } -func (m *QueryValidatorAuthsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorAuthsRequest.DiscardUnknown(m) +func (m *QueryValidatorAuthRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorAuthRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryValidatorAuthsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryValidatorAuthRequest proto.InternalMessageInfo -func (m *QueryValidatorAuthsRequest) GetPagination() *query.PageRequest { +func (m *QueryValidatorAuthRequest) GetValidatorAddress() string { if m != nil { - return m.Pagination + return m.ValidatorAddress } - return nil + return "" } -// QueryValidatorAuthsResponse is the response type for the -// Query/ValidatorAuths RPC method. -type QueryValidatorAuthsResponse struct { - Auths []*ValidatorAuth `protobuf:"bytes,1,rep,name=auths,proto3" json:"auths,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +// QueryValidatorAuthResponse is the request type for the +// Query/ValidatorAuth RPC method. +type QueryValidatorAuthResponse struct { + Auth *ValidatorAuth `protobuf:"bytes,1,opt,name=auth,proto3" json:"auth,omitempty"` } -func (m *QueryValidatorAuthsResponse) Reset() { *m = QueryValidatorAuthsResponse{} } -func (m *QueryValidatorAuthsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorAuthsResponse) ProtoMessage() {} -func (*QueryValidatorAuthsResponse) Descriptor() ([]byte, []int) { +func (m *QueryValidatorAuthResponse) Reset() { *m = QueryValidatorAuthResponse{} } +func (m *QueryValidatorAuthResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorAuthResponse) ProtoMessage() {} +func (*QueryValidatorAuthResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e916717a75144447, []int{3} } -func (m *QueryValidatorAuthsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryValidatorAuthResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryValidatorAuthsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryValidatorAuthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryValidatorAuthsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryValidatorAuthResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -187,51 +185,44 @@ func (m *QueryValidatorAuthsResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryValidatorAuthsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorAuthsResponse.Merge(m, src) +func (m *QueryValidatorAuthResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorAuthResponse.Merge(m, src) } -func (m *QueryValidatorAuthsResponse) XXX_Size() int { +func (m *QueryValidatorAuthResponse) XXX_Size() int { return m.Size() } -func (m *QueryValidatorAuthsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorAuthsResponse.DiscardUnknown(m) +func (m *QueryValidatorAuthResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorAuthResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryValidatorAuthsResponse proto.InternalMessageInfo - -func (m *QueryValidatorAuthsResponse) GetAuths() []*ValidatorAuth { - if m != nil { - return m.Auths - } - return nil -} +var xxx_messageInfo_QueryValidatorAuthResponse proto.InternalMessageInfo -func (m *QueryValidatorAuthsResponse) GetPagination() *query.PageResponse { +func (m *QueryValidatorAuthResponse) GetAuth() *ValidatorAuth { if m != nil { - return m.Pagination + return m.Auth } return nil } -// QueryValidatorAuthRequest is the request type for the -// Query/ValidatorAuth RPC method. -type QueryValidatorAuthRequest struct { - // validator_address defines the validator address to query for. - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +// QueryValidatorAuthsRequest is the request type for the +// Query/ValidatorAuths RPC method. +type QueryValidatorAuthsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryValidatorAuthRequest) Reset() { *m = QueryValidatorAuthRequest{} } -func (m *QueryValidatorAuthRequest) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorAuthRequest) ProtoMessage() {} -func (*QueryValidatorAuthRequest) Descriptor() ([]byte, []int) { +func (m *QueryValidatorAuthsRequest) Reset() { *m = QueryValidatorAuthsRequest{} } +func (m *QueryValidatorAuthsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorAuthsRequest) ProtoMessage() {} +func (*QueryValidatorAuthsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e916717a75144447, []int{4} } -func (m *QueryValidatorAuthRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryValidatorAuthsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryValidatorAuthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryValidatorAuthsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryValidatorAuthRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryValidatorAuthsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -241,43 +232,45 @@ func (m *QueryValidatorAuthRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryValidatorAuthRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorAuthRequest.Merge(m, src) +func (m *QueryValidatorAuthsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorAuthsRequest.Merge(m, src) } -func (m *QueryValidatorAuthRequest) XXX_Size() int { +func (m *QueryValidatorAuthsRequest) XXX_Size() int { return m.Size() } -func (m *QueryValidatorAuthRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorAuthRequest.DiscardUnknown(m) +func (m *QueryValidatorAuthsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorAuthsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryValidatorAuthRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryValidatorAuthsRequest proto.InternalMessageInfo -func (m *QueryValidatorAuthRequest) GetValidatorAddress() string { +func (m *QueryValidatorAuthsRequest) GetPagination() *query.PageRequest { if m != nil { - return m.ValidatorAddress + return m.Pagination } - return "" + return nil } -// QueryValidatorAuthResponse is the request type for the -// Query/ValidatorAuth RPC method. -type QueryValidatorAuthResponse struct { - Auth *ValidatorAuth `protobuf:"bytes,1,opt,name=auth,proto3" json:"auth,omitempty"` +// QueryValidatorAuthsResponse is the response type for the +// Query/ValidatorAuths RPC method. +type QueryValidatorAuthsResponse struct { + Auths []*ValidatorAuth `protobuf:"bytes,1,rep,name=auths,proto3" json:"auths,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryValidatorAuthResponse) Reset() { *m = QueryValidatorAuthResponse{} } -func (m *QueryValidatorAuthResponse) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorAuthResponse) ProtoMessage() {} -func (*QueryValidatorAuthResponse) Descriptor() ([]byte, []int) { +func (m *QueryValidatorAuthsResponse) Reset() { *m = QueryValidatorAuthsResponse{} } +func (m *QueryValidatorAuthsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorAuthsResponse) ProtoMessage() {} +func (*QueryValidatorAuthsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e916717a75144447, []int{5} } -func (m *QueryValidatorAuthResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryValidatorAuthsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryValidatorAuthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryValidatorAuthsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryValidatorAuthResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryValidatorAuthsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -287,21 +280,28 @@ func (m *QueryValidatorAuthResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryValidatorAuthResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorAuthResponse.Merge(m, src) +func (m *QueryValidatorAuthsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorAuthsResponse.Merge(m, src) } -func (m *QueryValidatorAuthResponse) XXX_Size() int { +func (m *QueryValidatorAuthsResponse) XXX_Size() int { return m.Size() } -func (m *QueryValidatorAuthResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorAuthResponse.DiscardUnknown(m) +func (m *QueryValidatorAuthsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorAuthsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryValidatorAuthResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryValidatorAuthsResponse proto.InternalMessageInfo -func (m *QueryValidatorAuthResponse) GetAuth() *ValidatorAuth { +func (m *QueryValidatorAuthsResponse) GetAuths() []*ValidatorAuth { if m != nil { - return m.Auth + return m.Auths + } + return nil +} + +func (m *QueryValidatorAuthsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } return nil } @@ -309,47 +309,47 @@ func (m *QueryValidatorAuthResponse) GetAuth() *ValidatorAuth { func init() { proto.RegisterType((*QueryParamsRequest)(nil), "lbm.consortium.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "lbm.consortium.v1.QueryParamsResponse") - proto.RegisterType((*QueryValidatorAuthsRequest)(nil), "lbm.consortium.v1.QueryValidatorAuthsRequest") - proto.RegisterType((*QueryValidatorAuthsResponse)(nil), "lbm.consortium.v1.QueryValidatorAuthsResponse") proto.RegisterType((*QueryValidatorAuthRequest)(nil), "lbm.consortium.v1.QueryValidatorAuthRequest") proto.RegisterType((*QueryValidatorAuthResponse)(nil), "lbm.consortium.v1.QueryValidatorAuthResponse") + proto.RegisterType((*QueryValidatorAuthsRequest)(nil), "lbm.consortium.v1.QueryValidatorAuthsRequest") + proto.RegisterType((*QueryValidatorAuthsResponse)(nil), "lbm.consortium.v1.QueryValidatorAuthsResponse") } func init() { proto.RegisterFile("lbm/consortium/v1/query.proto", fileDescriptor_e916717a75144447) } var fileDescriptor_e916717a75144447 = []byte{ - // 488 bytes of a gzipped FileDescriptorProto + // 483 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x41, 0x6b, 0xd4, 0x40, - 0x14, 0xc7, 0x77, 0x5a, 0xbb, 0xe0, 0x2b, 0x8a, 0x1d, 0x3d, 0x74, 0x53, 0x9b, 0xae, 0x81, 0x4a, - 0x51, 0x77, 0x86, 0xdd, 0x8a, 0xe0, 0x45, 0xa9, 0x78, 0xe8, 0x51, 0x73, 0xf0, 0x20, 0x82, 0x4c, - 0xba, 0x43, 0x1a, 0x4c, 0x32, 0x69, 0x66, 0xb2, 0x58, 0xc5, 0x8b, 0x9f, 0x40, 0x10, 0xfa, 0x15, - 0xfc, 0x26, 0xe2, 0xb1, 0xe0, 0xc5, 0xa3, 0xec, 0xfa, 0x41, 0x24, 0x33, 0xb3, 0xdb, 0x0d, 0x49, - 0xbb, 0x7b, 0x7d, 0xf3, 0xff, 0xff, 0xdf, 0xef, 0xbd, 0x3c, 0x02, 0xdb, 0x71, 0x90, 0xd0, 0x23, - 0x91, 0x4a, 0x91, 0xab, 0xa8, 0x48, 0xe8, 0xa8, 0x4f, 0x4f, 0x0a, 0x9e, 0x9f, 0x92, 0x2c, 0x17, - 0x4a, 0xe0, 0x8d, 0x38, 0x48, 0xc8, 0xc5, 0x33, 0x19, 0xf5, 0x1d, 0xaf, 0x74, 0x04, 0x4c, 0x72, - 0x23, 0x2c, 0x1d, 0x19, 0x0b, 0xa3, 0x94, 0xa9, 0x48, 0xa4, 0xc6, 0xe6, 0xdc, 0x0d, 0x85, 0x08, - 0x63, 0x4e, 0x59, 0x16, 0x51, 0x96, 0xa6, 0x42, 0xe9, 0x47, 0x69, 0x5f, 0xbd, 0x7a, 0xcf, 0xb9, - 0x16, 0x5a, 0xe3, 0xdd, 0x01, 0xfc, 0xba, 0x8c, 0x7f, 0xc5, 0x72, 0x96, 0x48, 0x9f, 0x9f, 0x14, - 0x5c, 0x2a, 0xef, 0x10, 0x6e, 0x57, 0xaa, 0x32, 0x13, 0xa9, 0xe4, 0xb8, 0x0f, 0xed, 0x4c, 0x57, - 0x36, 0x51, 0x17, 0xed, 0xad, 0x0f, 0x3a, 0xa4, 0x86, 0x4d, 0xac, 0xc5, 0x0a, 0xbd, 0x77, 0xe0, - 0xe8, 0xa4, 0x37, 0x2c, 0x8e, 0x86, 0x4c, 0x89, 0xfc, 0xa0, 0x50, 0xc7, 0xd3, 0x3e, 0xf8, 0x19, - 0xc0, 0xc5, 0x4c, 0x36, 0xd4, 0xd5, 0xa1, 0xe5, 0xe0, 0xc4, 0x6c, 0x48, 0x87, 0x86, 0xdc, 0x7a, - 0xfc, 0x39, 0x87, 0x77, 0x86, 0x60, 0xab, 0x31, 0xde, 0x02, 0x3f, 0x81, 0x35, 0x56, 0x16, 0x36, - 0x51, 0x77, 0x75, 0x6f, 0x7d, 0xd0, 0x6d, 0xe0, 0xad, 0x38, 0x7d, 0x23, 0xc7, 0xcf, 0x2b, 0x5c, - 0x2b, 0x9a, 0x6b, 0xe7, 0x52, 0x2e, 0xd3, 0xac, 0x02, 0x76, 0x08, 0x9d, 0x3a, 0xd7, 0x74, 0xea, - 0x87, 0xb0, 0x31, 0x9a, 0xd6, 0xdf, 0xb3, 0xe1, 0x30, 0xe7, 0xd2, 0x6c, 0xf4, 0xba, 0x7f, 0x6b, - 0xf6, 0x70, 0x60, 0xea, 0x9e, 0xdf, 0xb4, 0xc0, 0xd9, 0x80, 0x8f, 0xe1, 0x5a, 0x49, 0x6c, 0x57, - 0xb7, 0x78, 0x3e, 0xad, 0x1e, 0xfc, 0x5c, 0x85, 0x35, 0x1d, 0x8a, 0x3f, 0x41, 0xdb, 0x7c, 0x30, - 0xbc, 0xdb, 0xe0, 0xad, 0x5f, 0x86, 0x73, 0x7f, 0x91, 0xcc, 0x80, 0x79, 0xf7, 0xbe, 0xfe, 0xfe, - 0xf7, 0x7d, 0x65, 0x0b, 0x77, 0x68, 0xfd, 0x08, 0xcd, 0x69, 0xe0, 0x33, 0x04, 0x37, 0xab, 0xdf, - 0x0d, 0xf7, 0x2e, 0x4b, 0x6f, 0x3c, 0x1f, 0x87, 0x2c, 0x2b, 0xb7, 0x50, 0xbb, 0x1a, 0x6a, 0x07, - 0x6f, 0x37, 0x40, 0xcd, 0x16, 0x2f, 0xf1, 0x0f, 0x04, 0x37, 0x2a, 0x09, 0xf8, 0xd1, 0x52, 0x8d, - 0xa6, 0x58, 0xbd, 0x25, 0xd5, 0x96, 0xea, 0xa9, 0xa6, 0xda, 0xc7, 0xfd, 0x2b, 0xa9, 0xe8, 0xe7, - 0xda, 0xcd, 0x7c, 0x79, 0xf1, 0xf2, 0xd7, 0xd8, 0x45, 0xe7, 0x63, 0x17, 0xfd, 0x1d, 0xbb, 0xe8, - 0xdb, 0xc4, 0x6d, 0x9d, 0x4f, 0xdc, 0xd6, 0x9f, 0x89, 0xdb, 0x7a, 0xfb, 0x20, 0x8c, 0xd4, 0x71, - 0x11, 0x90, 0x23, 0x91, 0xd0, 0x38, 0x4a, 0x79, 0x99, 0xdd, 0x93, 0xc3, 0x0f, 0xf4, 0xe3, 0x7c, - 0x07, 0x75, 0x9a, 0x71, 0x19, 0xb4, 0xf5, 0xaf, 0x60, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf2, 0x7a, 0x5d, 0xb4, 0xa4, 0x04, 0x00, 0x00, + 0x14, 0xc7, 0x77, 0x5a, 0xbb, 0xe0, 0x13, 0xc5, 0x8e, 0x1e, 0xdc, 0xd4, 0xa6, 0x75, 0xa0, 0x22, + 0x6a, 0x67, 0xd8, 0x56, 0x04, 0x2f, 0x4a, 0xc5, 0x43, 0x8f, 0xba, 0x07, 0x0f, 0x22, 0xc8, 0xa4, + 0x3b, 0x64, 0x83, 0x49, 0x26, 0xcd, 0x4c, 0x16, 0xab, 0x78, 0xf1, 0x13, 0x08, 0x42, 0xbf, 0x82, + 0xdf, 0x44, 0x3c, 0x16, 0xbc, 0x78, 0x94, 0x5d, 0x3f, 0x88, 0x64, 0x66, 0xba, 0x4d, 0x48, 0x6a, + 0x73, 0x7d, 0xef, 0xff, 0xfe, 0xff, 0x5f, 0xe6, 0x3d, 0x02, 0xeb, 0x71, 0x90, 0xb0, 0x03, 0x99, + 0x2a, 0x99, 0xeb, 0xa8, 0x48, 0xd8, 0x74, 0xc8, 0x0e, 0x0b, 0x91, 0x1f, 0xd1, 0x2c, 0x97, 0x5a, + 0xe2, 0xd5, 0x38, 0x48, 0xe8, 0x59, 0x9b, 0x4e, 0x87, 0x1e, 0x29, 0x27, 0x02, 0xae, 0x84, 0x15, + 0x96, 0x13, 0x19, 0x0f, 0xa3, 0x94, 0xeb, 0x48, 0xa6, 0x76, 0xcc, 0xbb, 0x1d, 0x4a, 0x19, 0xc6, + 0x82, 0xf1, 0x2c, 0x62, 0x3c, 0x4d, 0xa5, 0x36, 0x4d, 0xe5, 0xba, 0xa4, 0x99, 0x59, 0x89, 0x30, + 0x1a, 0x72, 0x13, 0xf0, 0xab, 0xd2, 0xfe, 0x25, 0xcf, 0x79, 0xa2, 0x46, 0xe2, 0xb0, 0x10, 0x4a, + 0x93, 0x7d, 0xb8, 0x51, 0xab, 0xaa, 0x4c, 0xa6, 0x4a, 0xe0, 0x21, 0xf4, 0x33, 0x53, 0xb9, 0x85, + 0x36, 0xd1, 0xbd, 0x2b, 0x3b, 0x03, 0xda, 0xc0, 0xa6, 0x6e, 0xc4, 0x09, 0xc9, 0x3e, 0x0c, 0x8c, + 0xd3, 0x6b, 0x1e, 0x47, 0x63, 0xae, 0x65, 0xbe, 0x57, 0xe8, 0x89, 0x8b, 0xc1, 0x0f, 0x60, 0x75, + 0x7a, 0x5a, 0x7f, 0xc7, 0xc7, 0xe3, 0x5c, 0x28, 0x6b, 0x7d, 0x79, 0x74, 0x7d, 0xd1, 0xd8, 0xb3, + 0x75, 0x32, 0x02, 0xaf, 0xcd, 0xc9, 0xa1, 0x3d, 0x82, 0x4b, 0xbc, 0xd0, 0x13, 0x07, 0xb6, 0xd9, + 0x02, 0x56, 0x9f, 0x33, 0x6a, 0xf2, 0xb6, 0xcd, 0xf3, 0xf4, 0x15, 0xf0, 0x53, 0x80, 0xb3, 0x17, + 0x77, 0xce, 0xbe, 0x71, 0x2e, 0xd7, 0x42, 0xed, 0xfe, 0xcc, 0x27, 0x87, 0xc2, 0xcd, 0x8c, 0x2a, + 0x13, 0xe4, 0x18, 0xc1, 0x5a, 0xab, 0xbd, 0x63, 0x7e, 0x0c, 0x2b, 0x25, 0x45, 0xf9, 0xc9, 0xcb, + 0x9d, 0xa0, 0xad, 0x1c, 0x3f, 0xab, 0x71, 0x2d, 0x19, 0xae, 0x8d, 0x73, 0xb9, 0x6c, 0x58, 0x15, + 0x6c, 0xe7, 0xc7, 0x32, 0xac, 0x18, 0x30, 0xfc, 0x11, 0xfa, 0x76, 0x61, 0x78, 0xab, 0x25, 0xbd, + 0x79, 0x19, 0xde, 0xdd, 0x8b, 0x64, 0x36, 0x8e, 0xdc, 0xf9, 0xf2, 0xeb, 0xef, 0xb7, 0xa5, 0x35, + 0x3c, 0x60, 0xcd, 0x23, 0xb4, 0xa7, 0x81, 0xbf, 0x23, 0xb8, 0x5a, 0xfb, 0x3e, 0xfc, 0xf0, 0x3c, + 0xf3, 0xb6, 0xeb, 0xf1, 0xb6, 0x3b, 0xaa, 0x1d, 0xd1, 0x13, 0x43, 0xb4, 0x8b, 0x87, 0x2d, 0x44, + 0x8b, 0x63, 0x53, 0xec, 0x53, 0xe3, 0x22, 0x3f, 0xe3, 0x63, 0x04, 0xd7, 0xea, 0x3b, 0xc4, 0xdd, + 0xc2, 0x17, 0xcf, 0x46, 0xbb, 0xca, 0x1d, 0xec, 0x96, 0x81, 0xdd, 0xc0, 0xeb, 0xff, 0x85, 0x7d, + 0xfe, 0xe2, 0xe7, 0xcc, 0x47, 0x27, 0x33, 0x1f, 0xfd, 0x99, 0xf9, 0xe8, 0xeb, 0xdc, 0xef, 0x9d, + 0xcc, 0xfd, 0xde, 0xef, 0xb9, 0xdf, 0x7b, 0x73, 0x3f, 0x8c, 0xf4, 0xa4, 0x08, 0xe8, 0x81, 0x4c, + 0x58, 0x1c, 0xa5, 0xa2, 0xf4, 0xd9, 0x56, 0xe3, 0xf7, 0xec, 0x43, 0xd5, 0x4d, 0x1f, 0x65, 0x42, + 0x05, 0x7d, 0xf3, 0x2b, 0xd8, 0xfd, 0x17, 0x00, 0x00, 0xff, 0xff, 0x95, 0x93, 0xc7, 0xd0, 0xa4, + 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -366,10 +366,10 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Params queries the module params. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // ValidatorAuths queries authorization infos of validators. - ValidatorAuths(ctx context.Context, in *QueryValidatorAuthsRequest, opts ...grpc.CallOption) (*QueryValidatorAuthsResponse, error) // ValidatorAuth queries authorization info of a validator. ValidatorAuth(ctx context.Context, in *QueryValidatorAuthRequest, opts ...grpc.CallOption) (*QueryValidatorAuthResponse, error) + // ValidatorAuths queries authorization infos of validators. + ValidatorAuths(ctx context.Context, in *QueryValidatorAuthsRequest, opts ...grpc.CallOption) (*QueryValidatorAuthsResponse, error) } type queryClient struct { @@ -389,18 +389,18 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) ValidatorAuths(ctx context.Context, in *QueryValidatorAuthsRequest, opts ...grpc.CallOption) (*QueryValidatorAuthsResponse, error) { - out := new(QueryValidatorAuthsResponse) - err := c.cc.Invoke(ctx, "/lbm.consortium.v1.Query/ValidatorAuths", in, out, opts...) +func (c *queryClient) ValidatorAuth(ctx context.Context, in *QueryValidatorAuthRequest, opts ...grpc.CallOption) (*QueryValidatorAuthResponse, error) { + out := new(QueryValidatorAuthResponse) + err := c.cc.Invoke(ctx, "/lbm.consortium.v1.Query/ValidatorAuth", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ValidatorAuth(ctx context.Context, in *QueryValidatorAuthRequest, opts ...grpc.CallOption) (*QueryValidatorAuthResponse, error) { - out := new(QueryValidatorAuthResponse) - err := c.cc.Invoke(ctx, "/lbm.consortium.v1.Query/ValidatorAuth", in, out, opts...) +func (c *queryClient) ValidatorAuths(ctx context.Context, in *QueryValidatorAuthsRequest, opts ...grpc.CallOption) (*QueryValidatorAuthsResponse, error) { + out := new(QueryValidatorAuthsResponse) + err := c.cc.Invoke(ctx, "/lbm.consortium.v1.Query/ValidatorAuths", in, out, opts...) if err != nil { return nil, err } @@ -411,10 +411,10 @@ func (c *queryClient) ValidatorAuth(ctx context.Context, in *QueryValidatorAuthR type QueryServer interface { // Params queries the module params. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // ValidatorAuths queries authorization infos of validators. - ValidatorAuths(context.Context, *QueryValidatorAuthsRequest) (*QueryValidatorAuthsResponse, error) // ValidatorAuth queries authorization info of a validator. ValidatorAuth(context.Context, *QueryValidatorAuthRequest) (*QueryValidatorAuthResponse, error) + // ValidatorAuths queries authorization infos of validators. + ValidatorAuths(context.Context, *QueryValidatorAuthsRequest) (*QueryValidatorAuthsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -424,12 +424,12 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) ValidatorAuths(ctx context.Context, req *QueryValidatorAuthsRequest) (*QueryValidatorAuthsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidatorAuths not implemented") -} func (*UnimplementedQueryServer) ValidatorAuth(ctx context.Context, req *QueryValidatorAuthRequest) (*QueryValidatorAuthResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidatorAuth not implemented") } +func (*UnimplementedQueryServer) ValidatorAuths(ctx context.Context, req *QueryValidatorAuthsRequest) (*QueryValidatorAuthsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorAuths not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -453,38 +453,38 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_ValidatorAuths_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorAuthsRequest) +func _Query_ValidatorAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorAuthRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ValidatorAuths(ctx, in) + return srv.(QueryServer).ValidatorAuth(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.consortium.v1.Query/ValidatorAuths", + FullMethod: "/lbm.consortium.v1.Query/ValidatorAuth", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidatorAuths(ctx, req.(*QueryValidatorAuthsRequest)) + return srv.(QueryServer).ValidatorAuth(ctx, req.(*QueryValidatorAuthRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ValidatorAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorAuthRequest) +func _Query_ValidatorAuths_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorAuthsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ValidatorAuth(ctx, in) + return srv.(QueryServer).ValidatorAuths(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.consortium.v1.Query/ValidatorAuth", + FullMethod: "/lbm.consortium.v1.Query/ValidatorAuths", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidatorAuth(ctx, req.(*QueryValidatorAuthRequest)) + return srv.(QueryServer).ValidatorAuths(ctx, req.(*QueryValidatorAuthsRequest)) } return interceptor(ctx, in, info, handler) } @@ -497,14 +497,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "ValidatorAuths", - Handler: _Query_ValidatorAuths_Handler, - }, { MethodName: "ValidatorAuth", Handler: _Query_ValidatorAuth_Handler, }, + { + MethodName: "ValidatorAuths", + Handler: _Query_ValidatorAuths_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "lbm/consortium/v1/query.proto", @@ -568,7 +568,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryValidatorAuthsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorAuthRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -578,32 +578,27 @@ func (m *QueryValidatorAuthsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryValidatorAuthsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryValidatorAuthsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryValidatorAuthsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorAuthResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -613,19 +608,19 @@ func (m *QueryValidatorAuthsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryValidatorAuthsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryValidatorAuthsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { + if m.Auth != nil { { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Auth.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -633,26 +628,12 @@ func (m *QueryValidatorAuthsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if len(m.Auths) > 0 { - for iNdEx := len(m.Auths) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Auths[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryValidatorAuthRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorAuthsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -662,27 +643,32 @@ func (m *QueryValidatorAuthRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryValidatorAuthRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryValidatorAuthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress))) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryValidatorAuthResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryValidatorAuthsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -692,19 +678,19 @@ func (m *QueryValidatorAuthResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryValidatorAuthResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryValidatorAuthResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryValidatorAuthsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Auth != nil { + if m.Pagination != nil { { - size, err := m.Auth.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -712,7 +698,21 @@ func (m *QueryValidatorAuthResponse) MarshalToSizedBuffer(dAtA []byte) (int, err i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if len(m.Auths) > 0 { + for iNdEx := len(m.Auths) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auths[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -750,59 +750,59 @@ func (m *QueryParamsResponse) Size() (n int) { return n } -func (m *QueryValidatorAuthsRequest) Size() (n int) { +func (m *QueryValidatorAuthRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() + l = len(m.ValidatorAddress) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryValidatorAuthsResponse) Size() (n int) { +func (m *QueryValidatorAuthResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Auths) > 0 { - for _, e := range m.Auths { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() + if m.Auth != nil { + l = m.Auth.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryValidatorAuthRequest) Size() (n int) { +func (m *QueryValidatorAuthsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ValidatorAddress) - if l > 0 { + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryValidatorAuthResponse) Size() (n int) { +func (m *QueryValidatorAuthsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Auth != nil { - l = m.Auth.Size() + if len(m.Auths) > 0 { + for _, e := range m.Auths { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -950,7 +950,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorAuthsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorAuthRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -973,17 +973,17 @@ func (m *QueryValidatorAuthsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorAuthsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorAuthRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorAuthsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorAuthRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -993,27 +993,23 @@ func (m *QueryValidatorAuthsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1036,7 +1032,7 @@ func (m *QueryValidatorAuthsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorAuthsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorAuthResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1059,49 +1055,15 @@ func (m *QueryValidatorAuthsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorAuthsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorAuthResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorAuthsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorAuthResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auths", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Auths = append(m.Auths, &ValidatorAuth{}) - if err := m.Auths[len(m.Auths)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Auth", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1128,10 +1090,10 @@ func (m *QueryValidatorAuthsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + if m.Auth == nil { + m.Auth = &ValidatorAuth{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Auth.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1156,7 +1118,7 @@ func (m *QueryValidatorAuthsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorAuthRequest) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorAuthsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1179,17 +1141,17 @@ func (m *QueryValidatorAuthRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorAuthRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorAuthsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorAuthRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorAuthsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1199,23 +1161,27 @@ func (m *QueryValidatorAuthRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1238,7 +1204,7 @@ func (m *QueryValidatorAuthRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorAuthResponse) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorAuthsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1261,15 +1227,15 @@ func (m *QueryValidatorAuthResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorAuthResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorAuthsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorAuthResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorAuthsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auth", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Auths", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1296,10 +1262,44 @@ func (m *QueryValidatorAuthResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Auth == nil { - m.Auth = &ValidatorAuth{} + m.Auths = append(m.Auths, &ValidatorAuth{}) + if err := m.Auths[len(m.Auths)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.Auth.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/consortium/types/query.pb.gw.go b/x/consortium/types/query.pb.gw.go index ebdf63d1bf..b797a072fa 100644 --- a/x/consortium/types/query.pb.gw.go +++ b/x/consortium/types/query.pb.gw.go @@ -49,42 +49,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -var ( - filter_Query_ValidatorAuths_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ValidatorAuths_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryValidatorAuthsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidatorAuths_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ValidatorAuths(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ValidatorAuths_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryValidatorAuthsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidatorAuths_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ValidatorAuths(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_ValidatorAuth_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryValidatorAuthRequest var metadata runtime.ServerMetadata @@ -139,6 +103,42 @@ func local_request_Query_ValidatorAuth_0(ctx context.Context, marshaler runtime. } +var ( + filter_Query_ValidatorAuths_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ValidatorAuths_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorAuthsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidatorAuths_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ValidatorAuths(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ValidatorAuths_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorAuthsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidatorAuths_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ValidatorAuths(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -165,7 +165,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ValidatorAuths_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ValidatorAuth_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -174,18 +174,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ValidatorAuths_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ValidatorAuth_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ValidatorAuths_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ValidatorAuth_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ValidatorAuth_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ValidatorAuths_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -194,14 +194,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ValidatorAuth_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ValidatorAuths_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ValidatorAuth_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ValidatorAuths_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -266,7 +266,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ValidatorAuths_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ValidatorAuth_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -275,18 +275,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ValidatorAuths_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ValidatorAuth_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ValidatorAuths_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ValidatorAuth_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ValidatorAuth_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ValidatorAuths_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -295,14 +295,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ValidatorAuth_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ValidatorAuths_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ValidatorAuth_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ValidatorAuths_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -312,15 +312,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "consortium", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_ValidatorAuths_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "consortium", "v1", "validators"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_ValidatorAuth_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"lbm", "consortium", "v1", "validators", "validator_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ValidatorAuths_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "consortium", "v1", "validators"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_ValidatorAuths_0 = runtime.ForwardResponseMessage - forward_Query_ValidatorAuth_0 = runtime.ForwardResponseMessage + + forward_Query_ValidatorAuths_0 = runtime.ForwardResponseMessage )