Skip to content

Commit f9e32b4

Browse files
committed
fix from comments
1 parent 850af55 commit f9e32b4

File tree

11 files changed

+1624
-1626
lines changed

11 files changed

+1624
-1626
lines changed

grogu/querier/feed.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (q *FeedQuerier) QueryValidValidator(valAddress sdk.ValAddress) (*feeds.Que
3939
}
4040

4141
in := feeds.QueryValidValidatorRequest{
42-
Validator: valAddress.String(),
42+
ValidatorAddress: valAddress.String(),
4343
}
4444

4545
return getMaxBlockHeightResponse(fs, &in, q.maxBlockHeight)
@@ -72,7 +72,7 @@ func (q *FeedQuerier) QueryValidatorPrices(valAddress sdk.ValAddress) (*feeds.Qu
7272
}
7373

7474
in := feeds.QueryValidatorPricesRequest{
75-
Validator: valAddress.String(),
75+
ValidatorAddress: valAddress.String(),
7676
}
7777
return getMaxBlockHeightResponse(fs, &in, q.maxBlockHeight)
7878
}

proto/feeds/v1beta1/query.proto

Lines changed: 102 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,39 @@ import "feeds/v1beta1/params.proto";
1212

1313
// Query defines the gRPC querier service.
1414
service Query {
15-
// Prices is an RPC method that returns all prices.
16-
rpc Prices(QueryPricesRequest) returns (QueryPricesResponse) {
17-
option (google.api.http).get = "/feeds/v1beta1/prices";
15+
// CurrentFeeds is an RPC method that returns a list of current supported feeds.
16+
rpc CurrentFeeds(QueryCurrentFeedsRequest) returns (QueryCurrentFeedsResponse) {
17+
option (google.api.http).get = "/feeds/v1beta1/current-feeds";
18+
}
19+
20+
// DelegatorSignals is an RPC method that returns signals of a delegator.
21+
rpc DelegatorSignals(QueryDelegatorSignalsRequest) returns (QueryDelegatorSignalsResponse) {
22+
option (google.api.http).get = "/feeds/v1beta1/delegators/{delegator_address}/signals";
23+
}
24+
25+
// IsFeeder is an RPC method that returns whether an account is a feeder for a specified validator.
26+
rpc IsFeeder(QueryIsFeederRequest) returns (QueryIsFeederResponse) {
27+
option (google.api.http).get = "/feeds/v1beta1/feeder/{validator_address}/{feeder_address}";
28+
}
29+
30+
// Params is an RPC method that returns all parameters of the module.
31+
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
32+
option (google.api.http).get = "/feeds/v1beta1/params";
1833
}
1934

2035
// Price is an RPC method that returns price by signal id.
2136
rpc Price(QueryPriceRequest) returns (QueryPriceResponse) {
2237
option (google.api.http).get = "/feeds/v1beta1/prices/{signal_id}";
2338
}
2439

25-
// ValidatorPrices is an RPC method that returns prices of a validator.
26-
rpc ValidatorPrices(QueryValidatorPricesRequest) returns (QueryValidatorPricesResponse) {
27-
option (google.api.http).get = "/feeds/v1beta1/validators/{validator}/prices";
40+
// Prices is an RPC method that returns all prices.
41+
rpc Prices(QueryPricesRequest) returns (QueryPricesResponse) {
42+
option (google.api.http).get = "/feeds/v1beta1/prices";
2843
}
2944

30-
// ValidValidator is an RPC method that returns flag to show if the validator is required to send prices.
31-
rpc ValidValidator(QueryValidValidatorRequest) returns (QueryValidValidatorResponse) {
32-
option (google.api.http).get = "/feeds/v1beta1/validators/{validator}";
45+
// ReferenceSourceConfig is an RPC method that returns information on the reference price source.
46+
rpc ReferenceSourceConfig(QueryReferenceSourceConfigRequest) returns (QueryReferenceSourceConfigResponse) {
47+
option (google.api.http).get = "/feeds/v1beta1/reference-source-config";
3348
}
3449

3550
// SignalTotalPowers is an RPC method that returns all signal-total-powers or specified signal-total-power by signal
@@ -38,48 +53,59 @@ service Query {
3853
option (google.api.http).get = "/feeds/v1beta1/signal-total-powers";
3954
}
4055

41-
// Params is an RPC method that returns all parameters of the module.
42-
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
43-
option (google.api.http).get = "/feeds/v1beta1/params";
56+
// ValidValidator is an RPC method that returns a flag to show if the validator is required to send prices.
57+
rpc ValidValidator(QueryValidValidatorRequest) returns (QueryValidValidatorResponse) {
58+
option (google.api.http).get = "/feeds/v1beta1/valid/{validator_address}";
4459
}
4560

46-
// ReferenceSourceConfig is an RPC method that returns information of reference price source.
47-
rpc ReferenceSourceConfig(QueryReferenceSourceConfigRequest) returns (QueryReferenceSourceConfigResponse) {
48-
option (google.api.http).get = "/feeds/v1beta1/reference-source-config";
61+
// ValidatorPrices is an RPC method that returns prices of a validator.
62+
rpc ValidatorPrices(QueryValidatorPricesRequest) returns (QueryValidatorPricesResponse) {
63+
option (google.api.http).get = "/feeds/v1beta1/validators/{validator_address}/prices";
4964
}
65+
}
5066

51-
// DelegatorSignals is an RPC method that returns signals of a delegator.
52-
rpc DelegatorSignals(QueryDelegatorSignalsRequest) returns (QueryDelegatorSignalsResponse) {
53-
option (google.api.http).get = "/feeds/v1beta1/delegators/{delegator}/signals";
54-
}
67+
// QueryCurrentFeedsRequest is the request type for the Query/CurrentFeeds RPC method.
68+
message QueryCurrentFeedsRequest {}
5569

56-
// CurrentFeeds is an RPC method that returns a list of current supported feeds.
57-
rpc CurrentFeeds(QueryCurrentFeedsRequest) returns (QueryCurrentFeedsResponse) {
58-
option (google.api.http).get = "/feeds/v1beta1/current-feeds";
59-
}
70+
// QueryCurrentFeedsResponse is the response type for the Query/CurrentFeeds RPC method.
71+
message QueryCurrentFeedsResponse {
72+
// current_feeds is a list of currently supported feed-with-deviations, and its last update time and block.
73+
CurrentFeedWithDeviations current_feeds = 1 [(gogoproto.nullable) = false];
74+
}
6075

61-
// IsFeeder is an RPC method that returns whether an account is a feeder for specified validator.
62-
rpc IsFeeder(QueryIsFeederRequest) returns (QueryIsFeederResponse) {
63-
option (google.api.http).get = "/feeds/v1beta1/feeder/{validator_address}/{feeder_address}";
64-
}
76+
// QueryDelegatorSignalsRequest is the request type for the Query/DelegatorSignals RPC method.
77+
message QueryDelegatorSignalsRequest {
78+
// delegator_address is the delegator address to query signal for.
79+
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
6580
}
6681

67-
// QueryPricesRequest is the request type for the Query/Prices RPC method.
68-
message QueryPricesRequest {
69-
// signal_ids is a list of signal ids to query prices for.
70-
repeated string signal_ids = 1;
82+
// QueryDelegatorSignalsResponse is the response type for the Query/DelegatorSignals RPC method.
83+
message QueryDelegatorSignalsResponse {
84+
// signals is a list of signals submitted by the delegator.
85+
repeated Signal signals = 1 [(gogoproto.nullable) = false];
86+
}
7187

72-
// pagination is the pagination for the request.
73-
cosmos.base.query.v1beta1.PageRequest pagination = 2;
88+
// QueryIsFeederRequest is the request type for the Query/IsFeeder RPC method.
89+
message QueryIsFeederRequest {
90+
// validator_address is a validator address.
91+
string validator_address = 1;
92+
// feeder_address is a candidate account.
93+
string feeder_address = 2;
7494
}
7595

76-
// QueryPricesResponse is the response type for the Query/Prices RPC method.
77-
message QueryPricesResponse {
78-
// prices is a list of prices.
79-
repeated Price prices = 1;
96+
// QueryIsFeederResponse is the response type for the Query/IsFeeder RPC method.
97+
message QueryIsFeederResponse {
98+
// is_feeder is true if this account has been granted by validator.
99+
bool is_feeder = 1;
100+
}
80101

81-
// pagination is the pagination information in the response.
82-
cosmos.base.query.v1beta1.PageResponse pagination = 2;
102+
// QueryParamsRequest is the request type for the Query/Params RPC method.
103+
message QueryParamsRequest {}
104+
105+
// QueryParamsResponse is the response type for the Query/Params RPC method.
106+
message QueryParamsResponse {
107+
// params is the parameters of the module.
108+
Params params = 1 [(gogoproto.nullable) = false];
83109
}
84110

85111
// QueryPriceRequest is the request type for the Query/Price RPC method.
@@ -94,31 +120,31 @@ message QueryPriceResponse {
94120
Price price = 1 [(gogoproto.nullable) = false];
95121
}
96122

97-
// QueryValidatorPricesRequest is the request type for the Query/ValidatorPrices RPC method.
98-
message QueryValidatorPricesRequest {
99-
// validator is the validator address to query prices for.
100-
string validator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
123+
// QueryPricesRequest is the request type for the Query/Prices RPC method.
124+
message QueryPricesRequest {
125+
// signal_ids is a list of signal ids to query prices for.
126+
repeated string signal_ids = 1;
101127

102-
// signal_ids is the list of signal ids to query the price for.
103-
repeated string signal_ids = 2;
128+
// pagination is the pagination for the request.
129+
cosmos.base.query.v1beta1.PageRequest pagination = 2;
104130
}
105131

106-
// QueryValidatorPricesResponse is the response type for the Query/ValidatorPrices RPC method.
107-
message QueryValidatorPricesResponse {
108-
// validator_prices is a list of prices submitted by the validator.
109-
repeated ValidatorPrice validator_prices = 1 [(gogoproto.nullable) = false];
110-
}
132+
// QueryPricesResponse is the response type for the Query/Prices RPC method.
133+
message QueryPricesResponse {
134+
// prices is a list of prices.
135+
repeated Price prices = 1;
111136

112-
// QueryValidValidatorRequest is the request type for the Query/ValidValidator RPC method.
113-
message QueryValidValidatorRequest {
114-
// validator is the validator address to query the flag.
115-
string validator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
137+
// pagination is the pagination information in the response.
138+
cosmos.base.query.v1beta1.PageResponse pagination = 2;
116139
}
117140

118-
// QueryValidValidatorResponse is the response type for the Query/ValidValidator RPC method.
119-
message QueryValidValidatorResponse {
120-
// valid is a valid flag.
121-
bool valid = 1;
141+
// QueryReferenceSourceConfigRequest is the request type for the Query/ReferenceSourceConfig RPC method.
142+
message QueryReferenceSourceConfigRequest {}
143+
144+
// QueryReferenceSourceConfigResponse is the response type for the Query/ReferenceSourceConfig RPC method.
145+
message QueryReferenceSourceConfigResponse {
146+
// reference_source_config is the information about the reference price source.
147+
ReferenceSourceConfig reference_source_config = 1 [(gogoproto.nullable) = false];
122148
}
123149

124150
// QuerySignalTotalPowersRequest is the request type for the Query/SignalTotalPowers RPC method.
@@ -139,56 +165,29 @@ message QuerySignalTotalPowersResponse {
139165
cosmos.base.query.v1beta1.PageResponse pagination = 2;
140166
}
141167

142-
// QueryParamsRequest is the request type for the Query/Params RPC method.
143-
message QueryParamsRequest {}
144-
145-
// QueryParamsResponse is the response type for the Query/Params RPC method.
146-
message QueryParamsResponse {
147-
// params is the parameters of the module.
148-
Params params = 1 [(gogoproto.nullable) = false];
149-
}
150-
151-
// QueryReferenceSourceConfigRequest is the request type for the Query/ReferenceSourceConfig RPC method.
152-
message QueryReferenceSourceConfigRequest {}
153-
154-
// QueryReferenceSourceConfigResponse is the response type for the Query/ReferenceSourceConfig RPC method.
155-
message QueryReferenceSourceConfigResponse {
156-
// reference_source_config is the information about reference price source.
157-
ReferenceSourceConfig reference_source_config = 1 [(gogoproto.nullable) = false];
158-
}
159-
160-
// QueryDelegatorSignalsRequest is the request type for the Query/DelegatorSignals RPC method.
161-
message QueryDelegatorSignalsRequest {
162-
// delegator is the delegator address to query signal for.
163-
string delegator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
168+
// QueryValidValidatorRequest is the request type for the Query/ValidValidator RPC method.
169+
message QueryValidValidatorRequest {
170+
// validator_address is the validator address to query the flag.
171+
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
164172
}
165173

166-
// QueryDelegatorSignalsResponse is the response type for the Query/DelegatorSignals RPC method.
167-
message QueryDelegatorSignalsResponse {
168-
// signals is a list of signals submitted by the delegator.
169-
repeated Signal signals = 1 [(gogoproto.nullable) = false];
174+
// QueryValidValidatorResponse is the response type for the Query/ValidValidator RPC method.
175+
message QueryValidValidatorResponse {
176+
// valid is a valid flag.
177+
bool valid = 1;
170178
}
171179

172-
// QueryCurrentFeedsRequest is the request type for the Query/CurrentFeeds RPC method.
173-
message QueryCurrentFeedsRequest {}
174-
175-
// QueryCurrentFeedsResponse is the response type for the Query/CurrentFeeds RPC method.
176-
message QueryCurrentFeedsResponse {
177-
// current_feeds is a list of currently supported feed-with-deviations, and its last update time and
178-
// block.
179-
CurrentFeedWithDeviations current_feeds = 1 [(gogoproto.nullable) = false];
180-
}
180+
// QueryValidatorPricesRequest is the request type for the Query/ValidatorPrices RPC method.
181+
message QueryValidatorPricesRequest {
182+
// validator_address is the validator address to query prices for.
183+
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
181184

182-
// QueryIsFeederRequest is the request type for the Query/IsFeeder RPC method.
183-
message QueryIsFeederRequest {
184-
// validator_address is a validator address.
185-
string validator_address = 1;
186-
// feeder_address is a candidate account.
187-
string feeder_address = 2;
185+
// signal_ids is the list of signal ids to query the price for.
186+
repeated string signal_ids = 2;
188187
}
189188

190-
// QueryIsFeederResponse is the response type for the Query/IsFeeder RPC method.
191-
message QueryIsFeederResponse {
192-
// is_feeder is true if this account has been granted by validator.
193-
bool is_feeder = 1;
189+
// QueryValidatorPricesResponse is the response type for the Query/ValidatorPrices RPC method.
190+
message QueryValidatorPricesResponse {
191+
// validator_prices is a list of prices submitted by the validator.
192+
repeated ValidatorPrice validator_prices = 1 [(gogoproto.nullable) = false];
194193
}

x/feeds/client/cli/query.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func GetQueryCmdDelegatorSignals() *cobra.Command {
4949

5050
res, err := queryClient.DelegatorSignals(
5151
context.Background(),
52-
&types.QueryDelegatorSignalsRequest{Delegator: args[0]},
52+
&types.QueryDelegatorSignalsRequest{DelegatorAddress: args[0]},
5353
)
5454
if err != nil {
5555
return err
@@ -160,8 +160,8 @@ func GetQueryCmdValidatorPrices() *cobra.Command {
160160
}
161161

162162
res, err := queryClient.ValidatorPrices(context.Background(), &types.QueryValidatorPricesRequest{
163-
Validator: args[0],
164-
SignalIds: signalIds,
163+
ValidatorAddress: args[0],
164+
SignalIds: signalIds,
165165
})
166166
if err != nil {
167167
return err
@@ -189,7 +189,7 @@ func GetQueryCmdValidValidator() *cobra.Command {
189189

190190
res, err := queryClient.ValidValidator(
191191
context.Background(),
192-
&types.QueryValidValidatorRequest{Validator: args[0]},
192+
&types.QueryValidValidatorRequest{ValidatorAddress: args[0]},
193193
)
194194
if err != nil {
195195
return err

x/feeds/keeper/grpc_query.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (q queryServer) DelegatorSignals(
3030
) (*types.QueryDelegatorSignalsResponse, error) {
3131
ctx := sdk.UnwrapSDKContext(goCtx)
3232

33-
delegator, err := sdk.AccAddressFromBech32(req.Delegator)
33+
delegator, err := sdk.AccAddressFromBech32(req.DelegatorAddress)
3434
if err != nil {
3535
return nil, err
3636
}
@@ -110,7 +110,7 @@ func (q queryServer) ValidatorPrices(
110110
) (*types.QueryValidatorPricesResponse, error) {
111111
ctx := sdk.UnwrapSDKContext(goCtx)
112112

113-
val, err := sdk.ValAddressFromBech32(req.Validator)
113+
val, err := sdk.ValAddressFromBech32(req.ValidatorAddress)
114114
if err != nil {
115115
return nil, err
116116
}
@@ -154,7 +154,7 @@ func (q queryServer) ValidValidator(
154154
) (*types.QueryValidValidatorResponse, error) {
155155
ctx := sdk.UnwrapSDKContext(goCtx)
156156

157-
val, err := sdk.ValAddressFromBech32(req.Validator)
157+
val, err := sdk.ValAddressFromBech32(req.ValidatorAddress)
158158
if err != nil {
159159
return nil, err
160160
}

0 commit comments

Comments
 (0)