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

feat(x): add module_query_safe on queries #22095

Closed
wants to merge 8 commits into from
Closed
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
618 changes: 312 additions & 306 deletions api/cosmos/distribution/v1beta1/query.pulsar.go

Large diffs are not rendered by default.

421 changes: 213 additions & 208 deletions api/cosmos/gov/v1beta1/query.pulsar.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions x/distribution/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Improvements

* [#20790](https://github.com/cosmos/cosmos-sdk/pull/20790) `x/distribution` does not depend on `x/protocolpool` anymore, now `x/distribution` only does token transfers and `x/protocolpool` does the rest.
* [#20219](https://github.com/cosmos/cosmos-sdk/issues/20219#event-14494455201) Mark more queries with module_query_safe.

### API Breaking Changes

Expand Down
40 changes: 25 additions & 15 deletions x/distribution/proto/cosmos/distribution/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/distribution/v1beta1/distribution.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/query/v1/query.proto";
import "amino/amino.proto";

option go_package = "cosmossdk.io/x/distribution/types";
Expand All @@ -15,55 +16,64 @@ option go_package = "cosmossdk.io/x/distribution/types";
service Query {
// Params queries params of the distribution module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/params";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/params";
}

// ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator
rpc ValidatorDistributionInfo(QueryValidatorDistributionInfoRequest)
returns (QueryValidatorDistributionInfoResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}";
}

// ValidatorOutstandingRewards queries rewards of a validator address.
rpc ValidatorOutstandingRewards(QueryValidatorOutstandingRewardsRequest)
returns (QueryValidatorOutstandingRewardsResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/"
"{validator_address}/outstanding_rewards";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/"
"{validator_address}/outstanding_rewards";
}

// ValidatorCommission queries accumulated commission for a validator.
rpc ValidatorCommission(QueryValidatorCommissionRequest) returns (QueryValidatorCommissionResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/"
"{validator_address}/commission";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/"
"{validator_address}/commission";
}

// ValidatorSlashes queries slash events of a validator.
rpc ValidatorSlashes(QueryValidatorSlashesRequest) returns (QueryValidatorSlashesResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}/slashes";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}/slashes";
}

// DelegationRewards queries the total rewards accrued by a delegation.
rpc DelegationRewards(QueryDelegationRewardsRequest) returns (QueryDelegationRewardsResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/"
"{validator_address}";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/"
"{validator_address}";
}

// DelegationTotalRewards queries the total rewards accrued by each
// validator.
rpc DelegationTotalRewards(QueryDelegationTotalRewardsRequest) returns (QueryDelegationTotalRewardsResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards";
}

// DelegatorValidators queries the validators of a delegator.
rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/"
"{delegator_address}/validators";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/"
"{delegator_address}/validators";
}

// DelegatorWithdrawAddress queries withdraw address of a delegator.
rpc DelegatorWithdrawAddress(QueryDelegatorWithdrawAddressRequest) returns (QueryDelegatorWithdrawAddressResponse) {
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/"
"{delegator_address}/withdraw_address";
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/"
"{delegator_address}/withdraw_address";
}

// CommunityPool queries the community pool coins.
Expand Down Expand Up @@ -265,4 +275,4 @@ message QueryCommunityPoolResponse {
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}
}
Loading
Loading