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

remove proof path from IBC queries #7725

Merged
merged 5 commits into from
Oct 29, 2020
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
24 changes: 6 additions & 18 deletions proto/ibc/core/channel/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ message QueryChannelResponse {
ibc.core.channel.v1.Channel channel = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryChannelsRequest is the request type for the Query/Channels RPC method
Expand Down Expand Up @@ -152,10 +150,8 @@ message QueryChannelClientStateResponse {
ibc.core.client.v1.IdentifiedClientState identified_client_state = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryChannelConsensusStateRequest is the request type for the
Expand All @@ -180,10 +176,8 @@ message QueryChannelConsensusStateResponse {
string client_id = 2;
// merkle proof of existence
bytes proof = 3;
// merkle proof path
string proof_path = 4;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
}

// QueryPacketCommitmentRequest is the request type for the
Expand All @@ -205,10 +199,8 @@ message QueryPacketCommitmentResponse {
bytes commitment = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryPacketCommitmentsRequest is the request type for the
Expand Down Expand Up @@ -251,10 +243,8 @@ message QueryPacketAcknowledgementResponse {
bytes acknowledgement = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryUnreceivedPacketsRequest is the request type for the
Expand Down Expand Up @@ -313,8 +303,6 @@ message QueryNextSequenceReceiveResponse {
uint64 next_sequence_receive = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}
8 changes: 2 additions & 6 deletions proto/ibc/core/client/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ message QueryClientStateResponse {
google.protobuf.Any client_state = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryClientStatesRequest is the request type for the Query/ClientStates RPC
Expand Down Expand Up @@ -94,10 +92,8 @@ message QueryConsensusStateResponse {
google.protobuf.Any consensus_state = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryConsensusStatesRequest is the request type for the Query/ConsensusStates
Expand Down
16 changes: 4 additions & 12 deletions proto/ibc/core/connection/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ message QueryConnectionResponse {
ibc.core.connection.v1.ConnectionEnd connection = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryConnectionsRequest is the request type for the Query/Connections RPC
Expand Down Expand Up @@ -94,10 +92,8 @@ message QueryClientConnectionsResponse {
repeated string connection_paths = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was generated
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryConnectionClientStateRequest is the request type for the
Expand All @@ -114,10 +110,8 @@ message QueryConnectionClientStateResponse {
ibc.core.client.v1.IdentifiedClientState identified_client_state = 1;
// merkle proof of existence
bytes proof = 2;
// merkle proof path
string proof_path = 3;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false];
}

// QueryConnectionConsensusStateRequest is the request type for the
Expand All @@ -138,8 +132,6 @@ message QueryConnectionConsensusStateResponse {
string client_id = 2;
// merkle proof of existence
bytes proof = 3;
// merkle proof path
string proof_path = 4;
// height at which the proof was retrieved
ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false];
ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false];
}
4 changes: 2 additions & 2 deletions x/ibc/core/02-client/client/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func QueryClientStateABCI(
return nil, err
}

clientStateRes := types.NewQueryClientStateResponse(clientID, anyClientState, proofBz, proofHeight)
clientStateRes := types.NewQueryClientStateResponse(anyClientState, proofBz, proofHeight)
return clientStateRes, nil
}

Expand Down Expand Up @@ -115,7 +115,7 @@ func QueryConsensusStateABCI(
return nil, err
}

return types.NewQueryConsensusStateResponse(clientID, anyConsensusState, proofBz, proofHeight), nil
return types.NewQueryConsensusStateResponse(anyConsensusState, proofBz, proofHeight), nil
}

// QueryTendermintHeader takes a client context and returns the appropriate
Expand Down
12 changes: 2 additions & 10 deletions x/ibc/core/02-client/types/query.go
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
package types

import (
"strings"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
)

// NewQueryClientStateResponse creates a new QueryClientStateResponse instance.
func NewQueryClientStateResponse(
clientID string, clientStateAny *codectypes.Any, proof []byte, height Height,
clientStateAny *codectypes.Any, proof []byte, height Height,
) *QueryClientStateResponse {
path := commitmenttypes.NewMerklePath(append([]string{clientID}, strings.Split(host.ClientStatePath(), "/")...))
return &QueryClientStateResponse{
ClientState: clientStateAny,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: height,
}
}

// NewQueryConsensusStateResponse creates a new QueryConsensusStateResponse instance.
func NewQueryConsensusStateResponse(
clientID string, consensusStateAny *codectypes.Any, proof []byte, height Height,
consensusStateAny *codectypes.Any, proof []byte, height Height,
) *QueryConsensusStateResponse {
path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(clientID, host.ConsensusStatePath(height)), "/"))
return &QueryConsensusStateResponse{
ConsensusState: consensusStateAny,
Proof: proof,
ProofPath: path.Pretty(),
ProofHeight: height,
}
}
Loading