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

Add height request field to all gRPC queries #248

Closed
wants to merge 2 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
45 changes: 45 additions & 0 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `hash` | [string](#string) | | hash (in hex format) of the denomination trace information. |
| `height` | [uint64](#uint64) | | |



Expand Down Expand Up @@ -400,6 +401,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |
| `height` | [uint64](#uint64) | | |



Expand Down Expand Up @@ -429,6 +431,11 @@ method.
QueryParamsRequest is the request type for the Query/Params RPC method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [uint64](#uint64) | | |





Expand Down Expand Up @@ -918,6 +925,7 @@ RPC method
| ----- | ---- | ----- | ----------- |
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -955,6 +963,7 @@ Query/ConsensusState RPC method
| `channel_id` | [string](#string) | | channel unique identifier |
| `revision_number` | [uint64](#uint64) | | revision number of the consensus state |
| `revision_height` | [uint64](#uint64) | | revision height of the consensus state |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -990,6 +999,7 @@ QueryChannelRequest is the request type for the Query/Channel RPC method
| ----- | ---- | ----- | ----------- |
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1024,6 +1034,7 @@ QueryChannelsRequest is the request type for the Query/Channels RPC method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination request |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1058,6 +1069,7 @@ Query/QueryConnectionChannels RPC method
| ----- | ---- | ----- | ----------- |
| `connection` | [string](#string) | | connection unique identifier |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination request |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1093,6 +1105,7 @@ Query/QueryNextSequenceReceiveRequest RPC method
| ----- | ---- | ----- | ----------- |
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1129,6 +1142,7 @@ Query/PacketAcknowledgement RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `sequence` | [uint64](#uint64) | | packet sequence |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1166,6 +1180,7 @@ Query/QueryPacketCommitments RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination request |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1202,6 +1217,7 @@ Query/PacketCommitment RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `sequence` | [uint64](#uint64) | | packet sequence |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1239,6 +1255,7 @@ Query/QueryPacketCommitments RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination request |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1275,6 +1292,7 @@ Query/PacketReceipt RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `sequence` | [uint64](#uint64) | | packet sequence |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1312,6 +1330,7 @@ Query/UnreceivedAcks RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `packet_ack_sequences` | [uint64](#uint64) | repeated | list of acknowledgement sequences |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1347,6 +1366,7 @@ Query/UnreceivedPackets RPC method
| `port_id` | [string](#string) | | port unique identifier |
| `channel_id` | [string](#string) | | channel unique identifier |
| `packet_commitment_sequences` | [uint64](#uint64) | repeated | list of packet sequences |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1818,6 +1838,11 @@ QueryClientParamsRequest is the request type for the Query/ClientParams RPC
method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [uint64](#uint64) | | query height |





Expand Down Expand Up @@ -1848,6 +1873,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | client state unique identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1883,6 +1909,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination request |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1916,6 +1943,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | client unique identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1952,6 +1980,7 @@ from which the proof was retrieved.
| `revision_number` | [uint64](#uint64) | | consensus state revision number |
| `revision_height` | [uint64](#uint64) | | consensus state revision height |
| `latest_height` | [bool](#bool) | | latest_height overrrides the height field and queries the latest stored ConsensusState |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -1987,6 +2016,7 @@ RPC method.
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | client identifier |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination request |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -2017,6 +2047,11 @@ QueryUpgradedClientStateRequest is the request type for the
Query/UpgradedClientState RPC method


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [uint64](#uint64) | | query height |





Expand Down Expand Up @@ -2044,6 +2079,11 @@ QueryUpgradedConsensusStateRequest is the request type for the
Query/UpgradedConsensusState RPC method


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [uint64](#uint64) | | query height |





Expand Down Expand Up @@ -2524,6 +2564,7 @@ Query/ClientConnections RPC method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | client identifier associated with a connection |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -2558,6 +2599,7 @@ Query/ConnectionClientState RPC method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `connection_id` | [string](#string) | | connection identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -2594,6 +2636,7 @@ Query/ConnectionConsensusState RPC method
| `connection_id` | [string](#string) | | connection identifier |
| `revision_number` | [uint64](#uint64) | | |
| `revision_height` | [uint64](#uint64) | | |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -2629,6 +2672,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `connection_id` | [string](#string) | | connection unique identifier |
| `height` | [uint64](#uint64) | | query height |



Expand Down Expand Up @@ -2664,6 +2708,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |
| `height` | [uint64](#uint64) | | query height |



Expand Down
7 changes: 6 additions & 1 deletion modules/apps/transfer/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func (q Keeper) DenomTrace(c context.Context, req *types.QueryDenomTraceRequest)
}

ctx := sdk.UnwrapSDKContext(c)
ctx = ctx.WithBlockHeight(int64(req.Height))

denomTrace, found := q.GetDenomTrace(ctx, hash)
if !found {
return nil, status.Error(
Expand All @@ -48,6 +50,7 @@ func (q Keeper) DenomTraces(c context.Context, req *types.QueryDenomTracesReques
}

ctx := sdk.UnwrapSDKContext(c)
ctx = ctx.WithBlockHeight(int64(req.Height))

traces := types.Traces{}
store := prefix.NewStore(ctx.KVStore(q.storeKey), types.DenomTraceKey)
Expand All @@ -73,8 +76,10 @@ func (q Keeper) DenomTraces(c context.Context, req *types.QueryDenomTracesReques
}

// Params implements the Query/Params gRPC method
func (q Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
ctx = ctx.WithBlockHeight(int64(req.Height))

params := q.GetParams(ctx)

return &types.QueryParamsResponse{
Expand Down
Loading