Skip to content

Commit a6525cb

Browse files
authored
Merge pull request #646 from neutron-org/feat/refactor-icq-module-documentation
2 parents 6a28b65 + dd24540 commit a6525cb

File tree

11 files changed

+1205
-543
lines changed

11 files changed

+1205
-543
lines changed

docs/static/swagger.yaml

Lines changed: 702 additions & 304 deletions
Large diffs are not rendered by default.

proto/neutron/interchainqueries/genesis.proto

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,59 @@ import "neutron/interchainqueries/params.proto";
88

99
option go_package = "github.com/neutron-org/neutron/v5/x/interchainqueries/types";
1010

11+
// Information about an Interchain Query registered in the interchainqueries module.
1112
message RegisteredQuery {
1213
// The unique id of the registered query.
1314
uint64 id = 1;
14-
15-
// The address that registered the query.
15+
// The address of the contract that registered the query.
1616
string owner = 2;
17-
18-
// The query type identifier: `kv` or `tx` now
17+
// The query type identifier: `kv` or `tx`.
1918
string query_type = 3;
20-
21-
// The KV-storage keys for which we want to get values from remote chain
19+
// The KV-storage keys for which to get values from the remote chain. Only applicable for the
20+
// KV Interchain Queries. Max amount of keys is limited by the module's `max_kv_query_keys_count`
21+
// parameters.
2222
repeated KVKey keys = 4;
23-
24-
// The filter for transaction search ICQ
23+
// A stringified list of filters for remote transactions search. Only applicable for the TX
24+
// Interchain Queries. Example: "[{\"field\":\"tx.height\",\"op\":\"Gte\",\"value\":2644737}]".
25+
// Supported operators: "eq", "lt", "gt", "lte", "gte". Max amount of filter conditions is limited
26+
// by the module's `max_transactions_filters` parameters.
2527
string transactions_filter = 5;
26-
27-
// The IBC connection ID for getting ConsensusState to verify proofs
28+
// The IBC connection ID to the remote chain (the source of querying data). Is used for getting
29+
// ConsensusState from the respective IBC client to verify query result proofs.
2830
string connection_id = 6;
29-
30-
// Parameter that defines how often the query must be updated.
31+
// Parameter that defines the minimal delay between consecutive query executions (i.e. the
32+
// minimal delay between query results update).
3133
uint64 update_period = 7;
32-
33-
// The local chain last block height when the query result was updated.
34+
// The local chain block height of the last query results update.
3435
uint64 last_submitted_result_local_height = 8;
35-
36-
// The remote chain last block height when the query result was updated.
36+
// The remote chain block height that corresponds to the last query result update.
3737
ibc.core.client.v1.Height last_submitted_result_remote_height = 9;
38-
39-
// Amount of coins deposited for the query.
38+
// Amount of coins paid for the Interchain Query registration. The deposit is paid back to the
39+
// remover. The remover can be either the query owner (during the submit timeout) or anybody.
4040
repeated cosmos.base.v1beta1.Coin deposit = 10 [
4141
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
4242
(gogoproto.nullable) = false
4343
];
44-
45-
// Timeout before query becomes available for everybody to remove.
44+
// The duration, measured in blocks, that must pass since the query's registration or its last
45+
// result submission before the query becomes eligible for removal by anyone.
4646
uint64 submit_timeout = 11;
47-
48-
// The local chain height when the query was registered.
47+
// The local chain block height of the Interchain Query registration.
4948
uint64 registered_at_height = 12;
5049
}
5150

51+
// Represents a path to an IAVL storage node.
5252
message KVKey {
53-
// Path (storage prefix) to the storage where you want to read value by key
54-
// (usually name of cosmos-sdk module: 'staking', 'bank', etc.)
53+
// The substore name used in an Interchain Query. Typically, this corresponds to the keeper's
54+
// storeKey, usually the module's name, such as "bank", "staking", etc.
5555
string path = 1;
56-
// Key you want to read from the storage
56+
// A bytes field representing the key for specific data in the module's storage.
5757
bytes key = 2;
5858
}
5959

60-
// GenesisState defines the interchainqueries module's genesis state.
60+
// The interchainqueries module's genesis state model.
6161
message GenesisState {
62+
// The parameters of the module.
6263
Params params = 1 [(gogoproto.nullable) = false];
64+
// A list of registered Interchain Queries.
6365
repeated RegisteredQuery registered_queries = 2;
6466
}

proto/neutron/interchainqueries/params.proto

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ import "gogoproto/gogo.proto";
66

77
option go_package = "github.com/neutron-org/neutron/v5/x/interchainqueries/types";
88

9-
// Params defines the parameters for the module.
9+
// The parameters for the module.
1010
message Params {
1111
option (gogoproto.goproto_stringer) = false;
12-
// Defines amount of blocks required before query becomes available for
13-
// removal by anybody
12+
// The duration, measured in blocks, that must pass since the query's registration or its last
13+
// result submission before the query becomes eligible for removal by anyone. Is used to set
14+
// `submit_timeout` on Interchain Query registration.
1415
uint64 query_submit_timeout = 1;
15-
16-
// Amount of coins deposited for the query.
16+
// Amount of coins required to be provided as deposit on Interchain Query registration.
1717
repeated cosmos.base.v1beta1.Coin query_deposit = 2 [
1818
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
1919
(gogoproto.nullable) = false
2020
];
21-
22-
// Amount of tx hashes to be removed during a single EndBlock. Can vary to
23-
// balance between network cleaning speed and EndBlock duration. A zero value
24-
// means no limit.
21+
// Amount of tx hashes to be removed during a single EndBlock. Can vary to balance between
22+
// network cleaning speed and EndBlock duration. A zero value means no limit.
2523
uint64 tx_query_removal_limit = 3;
2624

2725
// Maximum amount of keys in a registered key value query

proto/neutron/interchainqueries/query.proto

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,87 @@ import "neutron/interchainqueries/tx.proto";
1010

1111
option go_package = "github.com/neutron-org/neutron/v5/x/interchainqueries/types";
1212

13-
// Query defines the gRPC querier service.
13+
// Defines the Query interface of the module.
1414
service Query {
15-
// Parameters queries the parameters of the module.
15+
// Fetches the current parameters of the interchainqueries module.
1616
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
1717
option (google.api.http).get = "/neutron/interchainqueries/params";
1818
}
19-
19+
// Retrieves all registered Interchain Queries in the module, with optional filtering by owner
20+
// and/or connection ID.
2021
rpc RegisteredQueries(QueryRegisteredQueriesRequest) returns (QueryRegisteredQueriesResponse) {
2122
option (google.api.http).get = "/neutron/interchainqueries/registered_queries";
2223
}
23-
24+
// Fetches details of a registered Interchain Query using its ID.
2425
rpc RegisteredQuery(QueryRegisteredQueryRequest) returns (QueryRegisteredQueryResponse) {
2526
option (google.api.http).get = "/neutron/interchainqueries/registered_query";
2627
}
27-
28+
// Retrieves the most recent successfully submitted result of an Interchain Query. This is only
29+
// applicable for KV Interchain Queries.
2830
rpc QueryResult(QueryRegisteredQueryResultRequest) returns (QueryRegisteredQueryResultResponse) {
2931
option (google.api.http).get = "/neutron/interchainqueries/query_result";
3032
}
31-
33+
// Retrieves the most recent height of a remote chain as known by the IBC client associated with
34+
// a given connection ID.
3235
rpc LastRemoteHeight(QueryLastRemoteHeight) returns (QueryLastRemoteHeightResponse) {
3336
option (google.api.http).get = "/neutron/interchainqueries/remote_height";
3437
}
3538
}
3639

37-
// QueryParamsRequest is request type for the Query/Params RPC method.
40+
// Request type for the Query/Params RPC method.
3841
message QueryParamsRequest {}
3942

40-
// QueryParamsResponse is response type for the Query/Params RPC method.
43+
// Response type for the Query/Params RPC method.
4144
message QueryParamsResponse {
42-
// params holds all the parameters of this module.
45+
// Contains all parameters of the module.
4346
Params params = 1 [(gogoproto.nullable) = false];
4447
}
4548

49+
// Request type for the Query/RegisteredQueries RPC method.
4650
message QueryRegisteredQueriesRequest {
51+
// A list of owners of Interchain Queries. Query response will contain only Interchain Queries
52+
// that are owned by one of the owners in the list. If none, Interchain Queries are not filtered
53+
// out by the owner field.
4754
repeated string owners = 1;
55+
// IBC connection ID. Query response will contain only Interchain Queries that have the same IBC
56+
// connection ID parameter. If none, Interchain Queries are not filtered out by the connection ID
57+
// field.
4858
string connection_id = 2;
59+
// Pagination parameters for the request. Use values from previous response in the next request
60+
// in consecutive requests with paginated responses.
4961
cosmos.base.query.v1beta1.PageRequest pagination = 3;
5062
}
5163

64+
// Response type for the Query/RegisteredQueries RPC method.
5265
message QueryRegisteredQueriesResponse {
66+
// A list of registered Interchain Queries.
5367
repeated RegisteredQuery registered_queries = 1 [(gogoproto.nullable) = false];
54-
55-
// pagination defines the pagination in the response.
68+
// Current page information. Use values from previous response in the next request in consecutive
69+
// requests with paginated responses.
5670
cosmos.base.query.v1beta1.PageResponse pagination = 2;
5771
}
5872

73+
// Request type for the Query/RegisteredQuery RPC method.
5974
message QueryRegisteredQueryRequest {
75+
// ID of an Interchain Query.
6076
uint64 query_id = 1;
6177
}
6278

79+
// Response type for the Query/RegisteredQuery RPC method.
6380
message QueryRegisteredQueryResponse {
81+
// A registered Interchain Query.
6482
RegisteredQuery registered_query = 1;
6583
}
6684

85+
// Request type for the Query/QueryResult RPC method.
6786
message QueryRegisteredQueryResultRequest {
87+
// ID of an Interchain Query.
6888
uint64 query_id = 1;
6989
}
7090

91+
// Response type for the Query/QueryResult RPC method.
7192
message QueryRegisteredQueryResultResponse {
93+
// The last successfully submitted result of an Interchain Query.
7294
QueryResult result = 1;
7395
}
7496

@@ -78,10 +100,17 @@ message Transaction {
78100
bytes data = 3;
79101
}
80102

103+
// Request type for the Query/LastRemoteHeight RPC method.
81104
message QueryLastRemoteHeight {
105+
// Connection ID of an IBC connection to a remote chain. Determines the IBC client used in query
106+
// handling.
82107
string connection_id = 1;
83108
}
84109

110+
// Response type for the Query/LastRemoteHeight RPC method.
85111
message QueryLastRemoteHeightResponse {
112+
// The height of the chain that the IBC client is currently on.
86113
uint64 height = 1;
114+
// The revision of the chain that the IBC client is currently on.
115+
uint64 revision = 2;
87116
}

0 commit comments

Comments
 (0)