-
Notifications
You must be signed in to change notification settings - Fork 332
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
Implement ADR 009: ChainEndpoint
and ChainHandle
methods standardization
#2200
Conversation
There are only 2 "proto types" left in query reponses: |
We already have one for Let's therefore introduce one for |
I just noticed that the I suggest we remove the // previous
fn query_channel(&self, request: QueryChannelRequest) -> Result<ChannelEnd, Error>;
fn proven_channel(&self, request: QueryChannelRequest) -> Result<(ChannelEnd, MerkleProof), Error>;
// new
fn query_channel(&self, request: QueryChannelRequest, include_proof: PerformQuery) -> Result<(ChannelEnd, Option<MerkleProof>), Error>;
enum PerformQuery {
WithProof,
WithoutProof,
}; I introduced Example calls: chain.query_channel(request, PerformQuery::WithProof);
chain.query_channel(request, PerformQuery::WithoutProof); An alternative name for enum IncludeProof {
Yes,
No,
};
chain.query_channel(request, IncludeProof::Yes);
chain.query_channel(request, IncludeProof::No); I personally prefer merging the two functions into one, as we expose fewer methods while preserving the same functionality. |
I think it makes sense. A note though that the simple
wrt to query height, if you look at the gRPC request proto defs they do not contain the height at which the query should be done. This is "hidden" in the gRPC metadata. For and example on how this is done with gRPC you can take a look at https://github.com/informalsystems/ibc-rs/blob/c5c89dc82b1466101066e69d1228cda439da1d4b/relayer/src/chain/cosmos.rs#L931-L937 Also I don't know if there is a way to make a gRPC request and specify that there shouldn't be any proof included. If that's the case, we should look at performance differences between abci queries without proof and gRCP (with proof always??), especially if the APIs used by the packet relaying are affected. |
@@ -51,6 +51,22 @@ impl From<RawMerkleProof> for MerkleProof { | |||
} | |||
} | |||
|
|||
impl From<MerkleProof> for RawMerkleProof { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: What's a RawMerkleProof
and when is it appropriate to use it vs. a "regular" MerkleProof
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RawMerkleProof
is the type that is defined in ibc-go's protobuf files. MerkleProof
here is our own domain type for it, and hence we should use it everywhere in our codebase except when it's time to interact with a gRPC endpoint (where we convert our MerkleProof
back into a RawMerkleProof
to be sent on the wire)
ChainEndpoint
and ChainHandle
methods standardization
…ization (informalsystems#2200) * QueryChannelClientStateRequest domain type * QueryChannelClientStateRequest domain type * QueryChannelRequest domain type * QueryChannelClientStateRequest: remove unused Protobuf * clippy * PageRequest domain type * QueryClientStatesRequest domain type * QueryClientStateRequest domain type * QueryConsensusStatesRequest domain type * bunch of domain types * bunch of domain types * rest of domain types * changelog * Update relayer-cli/src/commands/misbehaviour.rs Co-authored-by: Romain Ruetschi <[email protected]> * remove extraneous `request` vars * Use MerkleProof domain type * Remove `PacketState` return from queries * Use existing Sequence domain type Co-authored-by: Romain Ruetschi <[email protected]>
Closes: #2192
Description
I chose not to implement
tendermint_proto::Protobuf
on the new domain types, as we never need to encode/decode the request itself. We eithertonic
, orabci_query
using fields inside the requestPR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.