Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Nov 15, 2023
1 parent b2d4cf7 commit 8d22f55
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion docs/proto/proto-docs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion proto/axelar/reward/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 2 additions & 4 deletions x/reward/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions x/reward/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion x/reward/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d22f55

Please sign in to comment.