Skip to content

Commit

Permalink
update proto file
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Nov 11, 2024
1 parent 1f91c2b commit 5aa3180
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 135 deletions.
6 changes: 3 additions & 3 deletions proto/exocore/operator/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ service Query {
// Validator queries validator info for given validator address.
rpc Validator(QueryValidatorRequest) returns (QueryValidatorResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/exocore/operator/v1/validator/{validator_addr}/{chain}";
option (google.api.http).get = "/exocore/operator/v1/validator/{validator_acc_addr}/{chain}";
}
}
// QueryValidatorsRequest is request type for Query/Validators RPC method.
Expand All @@ -342,8 +342,8 @@ message QueryValidatorsResponse {

// QueryValidatorRequest is response type for the Query/Validator RPC method
message QueryValidatorRequest {
// validator_addr defines the validator address to query for.
string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// validator_acc_addr defines the validator address to query for.
string validator_acc_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// chain is the id of the chain served by the operator. here chain_id is not used since the
// Linter complains about capitalization, which can be set with a gogoproto.custom_name but
// that is not compatible with google.api.http.get in the Query service below.
Expand Down
2 changes: 1 addition & 1 deletion proto/exocore/operator/v1/validator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ message Validator {
// jailed defined whether the validator has been jailed from bonded status or not
bool jailed = 6;
// status is the validator status (bonded/unbonding/unbonded)
cosmos.staking.v1beta1.BondStatus status =7;
cosmos.staking.v1beta1.BondStatus status = 7;
// voting_power define the validator voting power
string voting_power = 8 [
(cosmos_proto.scalar) = "cosmos.Dec",
Expand Down
8 changes: 4 additions & 4 deletions x/operator/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (k *Keeper) Validator(c context.Context, req *types.QueryValidatorRequest)
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
if req.ValidatorAddr == "" {
if req.ValidatorAccAddr == "" {
return nil, status.Error(codes.InvalidArgument, "validator address cannot be empty")
}
ctx := sdk.UnwrapSDKContext(c)
Expand All @@ -313,7 +313,7 @@ func (k *Keeper) Validator(c context.Context, req *types.QueryValidatorRequest)
} else {
chainIDWithoutRevision = avstypes.ChainIDWithoutRevision(req.Chain)
}
accAddr, err := sdk.AccAddressFromBech32(req.ValidatorAddr)
accAddr, err := sdk.AccAddressFromBech32(req.ValidatorAccAddr)
if err != nil {
return nil, err
}
Expand All @@ -326,14 +326,14 @@ func (k *Keeper) Validator(c context.Context, req *types.QueryValidatorRequest)
if err != nil {
return nil, err
}
return nil, status.Errorf(codes.NotFound, "validator %s not found", req.ValidatorAddr)
return nil, status.Errorf(codes.NotFound, "validator %s not found", req.ValidatorAccAddr)
}

val, found := k.GetValidatorByConsAddrForChainID(
ctx, wrappedKey.ToConsAddr(), avstypes.ChainIDWithoutRevision(ctx.ChainID()),
)
if !found {
return nil, status.Errorf(codes.NotFound, "validator %s not found", req.ValidatorAddr)
return nil, status.Errorf(codes.NotFound, "validator %s not found", req.ValidatorAccAddr)
}

return &types.QueryValidatorResponse{Validator: val}, nil
Expand Down
Loading

0 comments on commit 5aa3180

Please sign in to comment.