diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 53b0a27ff..810b9dc17 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -6729,7 +6729,8 @@ GenesisState represents the genesis state ### InflationRateRequest InflationRateRequest represents a message that queries the Axelar specific -inflation RPC method. +inflation RPC method. string is used for the validator address instead of +bytes so that it's supported as an arg in the generated REST API | Field | Type | Label | Description | diff --git a/proto/axelar/reward/v1beta1/query.proto b/proto/axelar/reward/v1beta1/query.proto index b207634f6..74effb026 100644 --- a/proto/axelar/reward/v1beta1/query.proto +++ b/proto/axelar/reward/v1beta1/query.proto @@ -9,7 +9,8 @@ import "axelar/reward/v1beta1/params.proto"; option (gogoproto.goproto_getters_all) = false; // InflationRateRequest represents a message that queries the Axelar specific -// inflation RPC method. +// inflation RPC method. string is used for the validator address instead of +// bytes so that it's supported as an arg in the generated REST API message InflationRateRequest { string validator = 1; } message InflationRateResponse { diff --git a/x/reward/client/cli/query.go b/x/reward/client/cli/query.go index d207f8425..61a8cda57 100644 --- a/x/reward/client/cli/query.go +++ b/x/reward/client/cli/query.go @@ -46,10 +46,8 @@ func GetCmdInflationRate() *cobra.Command { return err } - if *validator != "" { - if _, err := sdk.ValAddressFromBech32(*validator); err != nil { - return sdkerrors.Wrap(err, "invalid validator address") - } + if _, err := sdk.ValAddressFromBech32(*validator); *validator != "" && err != nil { + return sdkerrors.Wrap(err, "invalid validator address") } queryClient := types.NewQueryServiceClient(clientCtx) diff --git a/x/reward/keeper/grpc_query.go b/x/reward/keeper/grpc_query.go index 14c18db0a..f7100cd0a 100644 --- a/x/reward/keeper/grpc_query.go +++ b/x/reward/keeper/grpc_query.go @@ -38,8 +38,6 @@ func (q Querier) InflationRate(c context.Context, req *types.InflationRateReques keyManagementInflation := params.KeyMgmtRelativeInflationRate.Mul(baseInflation) validator := sdk.ValAddress{} - - // Get network inflation rate if no validator is specified if req.Validator != "" { var err error @@ -55,6 +53,8 @@ func (q Querier) InflationRate(c context.Context, req *types.InflationRateReques } maintainers := q.nexus.GetChainMaintainers(ctx, chain) + + // If no validator is specified, check if there are any maintainers to get the max network inflation rate if len(validator) == 0 { return len(maintainers) > 0 } diff --git a/x/reward/types/query.pb.go b/x/reward/types/query.pb.go index 684367f72..ba13d70d8 100644 --- a/x/reward/types/query.pb.go +++ b/x/reward/types/query.pb.go @@ -25,7 +25,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // InflationRateRequest represents a message that queries the Axelar specific -// inflation RPC method. +// inflation RPC method. string is used for the validator address instead of +// bytes so that it's supported as an arg in the generated REST API type InflationRateRequest struct { Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` }