Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix queries' API REST endpoint path #2196

Merged
merged 8 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 12 additions & 46 deletions proto/interchain_security/ccv/provider/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
rpc QueryConsumerGenesis(QueryConsumerGenesisRequest)
returns (QueryConsumerGenesisResponse) {
option (google.api.http) = {
// [DEPRECATED] use the {consumer_id} endpoint instead.
get: "/interchain_security/ccv/provider/consumer_genesis/{chain_id}";
additional_bindings {
get: "/interchain_security/ccv/provider/consumer_genesis/{consumer_id}";
}
get: "/interchain_security/ccv/provider/consumer_genesis/{consumer_id}";
};
}

Expand Down Expand Up @@ -74,11 +70,7 @@
QueryAllPairsValConAddrByConsumerChainIDRequest)
returns (QueryAllPairsValConAddrByConsumerChainIDResponse) {
option (google.api.http) = {
// [DEPRECATED] use the {consumer_id} endpoint instead.
get: "/interchain_security/ccv/provider/{chain_id}";
additional_bindings {
get: "/interchain_security/ccv/provider/{consumer_id}";
}
get: "/interchain_security/ccv/provider/address_pairs/{consumer_id}";
};
}

Expand All @@ -95,11 +87,7 @@
QueryConsumerChainOptedInValidatorsRequest)
returns (QueryConsumerChainOptedInValidatorsResponse) {
option (google.api.http) = {
// [DEPRECATED] use the {consumer_id} endpoint instead.
get: "/interchain_security/ccv/provider/opted_in_validators/{chain_id}";
additional_bindings {
get: "/interchain_security/ccv/provider/opted_in_validators/{consumer_id}";
}
get: "/interchain_security/ccv/provider/opted_in_validators/{consumer_id}";
};
}

Expand All @@ -118,11 +106,7 @@
QueryValidatorConsumerCommissionRateRequest)
returns (QueryValidatorConsumerCommissionRateResponse) {
option (google.api.http) = {
// [DEPRECATED] use the {consumer_id} endpoint instead.
get: "/interchain_security/ccv/provider/consumer_commission_rate/{chain_id}/{provider_address}";
additional_bindings {
get: "/interchain_security/ccv/provider/consumer_commission_rate/{consumer_id}/{provider_address}";
}
};
}

Expand All @@ -132,11 +116,7 @@
rpc QueryConsumerValidators(QueryConsumerValidatorsRequest)
returns (QueryConsumerValidatorsResponse) {
option (google.api.http) = {
// [DEPRECATED] use the {consumer_id} endpoint instead.
get: "/interchain_security/ccv/provider/consumer_validators/{chain_id}";
additional_bindings {
get: "/interchain_security/ccv/provider/consumer_validators/{consumer_id}";
}
};
}

Expand Down Expand Up @@ -165,10 +145,8 @@
}
}

message QueryConsumerGenesisRequest {

Check failure on line 148 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Previously present field "2" with name "consumer_id" on message "QueryConsumerGenesisRequest" was deleted.
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
string consumer_id = 2;
string consumer_id = 1;

Check failure on line 149 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "1" with name "consumer_id" on message "QueryConsumerGenesisRequest" changed option "json_name" from "chainId" to "consumerId".

Check failure on line 149 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "1" on message "QueryConsumerGenesisRequest" changed name from "chain_id" to "consumer_id".
}

message QueryConsumerGenesisResponse {
Expand Down Expand Up @@ -215,15 +193,13 @@
bool allow_inactive_vals = 12;
}

message QueryValidatorConsumerAddrRequest {

Check failure on line 196 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Previously present field "3" with name "consumer_id" on message "QueryValidatorConsumerAddrRequest" was deleted.
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
// The consensus address of the validator on the provider chain
string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];

Check failure on line 200 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "1" with name "provider_address" on message "QueryValidatorConsumerAddrRequest" changed option "json_name" from "chainId" to "providerAddress".

Check failure on line 200 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "1" on message "QueryValidatorConsumerAddrRequest" changed name from "chain_id" to "provider_address".
// The id of the consumer chain
string consumer_id = 3;
string consumer_id = 2;

Check failure on line 202 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "2" with name "consumer_id" on message "QueryValidatorConsumerAddrRequest" changed option "json_name" from "providerAddress" to "consumerId".

Check failure on line 202 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "2" on message "QueryValidatorConsumerAddrRequest" changed name from "provider_address" to "consumer_id".
}

message QueryValidatorConsumerAddrResponse {
Expand All @@ -231,15 +207,13 @@
string consumer_address = 1;
}

message QueryValidatorProviderAddrRequest {

Check failure on line 210 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Previously present field "3" with name "consumer_id" on message "QueryValidatorProviderAddrRequest" was deleted.
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
// The consensus address of the validator on the consumer chain
string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
string consumer_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];

Check failure on line 214 in proto/interchain_security/ccv/provider/v1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "1" with name "consumer_address" on message "QueryValidatorProviderAddrRequest" changed option "json_name" from "chainId" to "consumerAddress".
// The id of the consumer chain
string consumer_id = 3;
string consumer_id = 2;
}

message QueryValidatorProviderAddrResponse {
Expand Down Expand Up @@ -268,10 +242,8 @@
}

message QueryAllPairsValConAddrByConsumerChainIDRequest {
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
// The id of the consumer chain
string consumer_id = 2;
string consumer_id = 1;
}

message QueryAllPairsValConAddrByConsumerChainIDResponse {
Expand All @@ -293,9 +265,7 @@
}

message QueryConsumerChainOptedInValidatorsRequest {
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
string consumer_id = 2;
string consumer_id = 1;
}

message QueryConsumerChainOptedInValidatorsResponse {
Expand All @@ -304,9 +274,7 @@
}

message QueryConsumerValidatorsRequest {
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
string consumer_id = 2;
string consumer_id = 1;
}

message QueryConsumerValidatorsValidator {
Expand Down Expand Up @@ -368,11 +336,9 @@
}

message QueryValidatorConsumerCommissionRateRequest {
// [DEPRECATED] use `consumer_id` instead
string chain_id = 1 [deprecated = true];
string consumer_id = 1;
// The consensus address of the validator on the provider chain
string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
string consumer_id = 3;
}

message QueryValidatorConsumerCommissionRateResponse {
Expand Down
15 changes: 1 addition & 14 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ func (k Keeper) QueryConsumerGenesis(c context.Context, req *types.QueryConsumer

if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

consumerId := req.ConsumerId
Expand Down Expand Up @@ -163,8 +161,6 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai
func (k Keeper) QueryValidatorConsumerAddr(goCtx context.Context, req *types.QueryValidatorConsumerAddrRequest) (*types.QueryValidatorConsumerAddrResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down Expand Up @@ -198,8 +194,6 @@ func (k Keeper) QueryValidatorConsumerAddr(goCtx context.Context, req *types.Que
func (k Keeper) QueryValidatorProviderAddr(goCtx context.Context, req *types.QueryValidatorProviderAddrRequest) (*types.QueryValidatorProviderAddrResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down Expand Up @@ -255,8 +249,6 @@ func (k Keeper) QueryRegisteredConsumerRewardDenoms(goCtx context.Context, req *
func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context, req *types.QueryAllPairsValConAddrByConsumerChainIDRequest) (*types.QueryAllPairsValConAddrByConsumerChainIDResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

consumerId := req.ConsumerId
Expand Down Expand Up @@ -302,8 +294,6 @@ func (k Keeper) QueryParams(goCtx context.Context, req *types.QueryParamsRequest
func (k Keeper) QueryConsumerChainOptedInValidators(goCtx context.Context, req *types.QueryConsumerChainOptedInValidatorsRequest) (*types.QueryConsumerChainOptedInValidatorsResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

consumerId := req.ConsumerId
Expand Down Expand Up @@ -331,9 +321,8 @@ func (k Keeper) QueryConsumerChainOptedInValidators(goCtx context.Context, req *
func (k Keeper) QueryConsumerValidators(goCtx context.Context, req *types.QueryConsumerValidatorsRequest) (*types.QueryConsumerValidatorsResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

consumerId := req.ConsumerId
if err := types.ValidateConsumerId(consumerId); err != nil {
return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error())
Expand Down Expand Up @@ -524,8 +513,6 @@ func (k Keeper) hasToValidate(
func (k Keeper) QueryValidatorConsumerCommissionRate(goCtx context.Context, req *types.QueryValidatorConsumerCommissionRateRequest) (*types.QueryValidatorConsumerCommissionRateResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
} else if req.ChainId != "" {
return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.")
}

consumerId := req.ConsumerId
Expand Down
6 changes: 3 additions & 3 deletions x/ccv/provider/types/legacy_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func TestMsgUpdateConsumerValidateBasic(t *testing.T) {
Top_N: 50,
ValidatorsPowerCap: 100,
ValidatorSetCap: 34,
Allowlist: []string{"addr1"},
Allowlist: []string{"cosmosvalcons1arwg2sh5fd2wq4mwl6d05pyz4nrwls2mayg36j"},
Denylist: nil,
MinStake: 0,
AllowInactiveVals: false,
Expand Down Expand Up @@ -591,8 +591,8 @@ func TestMsgUpdateConsumerValidateBasic(t *testing.T) {
Top_N: 54,
ValidatorsPowerCap: 92,
ValidatorSetCap: 0,
Allowlist: []string{"addr1"},
Denylist: []string{"addr2", "addr3"},
Allowlist: []string{"cosmosvalcons1arwg2sh5fd2wq4mwl6d05pyz4nrwls2mayg36j"},
Denylist: []string{"cosmosvalcons1arwg2sh5fd2wq4mwl6d05pyz4nrwls2mayg36j", "cosmosvalcons1arwg2sh5fd2wq4mwl6d05pyz4nrwls2mayg36j"},
MinStake: 0,
AllowInactiveVals: false,
},
Expand Down
Loading
Loading