-
Notifications
You must be signed in to change notification settings - Fork 342
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 QueryRequest::Grpc
#1966
Comments
There is basic protobuf bytes validation you can do in let's say wasmvm or wasmd. It won't tell you much about the content but should be good enough to differentiate protobuf from JSON.
This sense of "JSON everywhere" is changing and needs to change. A lot of advanced developers can't work without the Any message and need to parse protobuf message responses. Tooling-wise there are options:
Another thing I was thinking about is the interface name and fields. This is not really an Any. It's a gRPC request which consists of a path to the service and a request body. This looks similar, but I'd use the "grpc" naming instead. |
Agreed. What I meant to say is that it would be nice to make the use of protobuf more obvious through types.
That's exactly what I would hope to see! If we can get most chains to do this, then my point above will become less important. Maybe we can think about ways to make this easier for more chains in the future. Like code generation or something like that.
|
This is somewhere in https://crates.io/crates/osmosis-std. Examples: |
What determines this? When are the responses from |
To quote the original author: Note that this PR does not simply revert CosmWasm/wasmd#812, this PR includes converting the state machine response from a proto response to a json marsahlled response so that clients can use it directly by json unmarshalling. (This is also why we now feed codec as a parameter in StargateQuerier in this PR). |
After looking into this, I am wondering if it would make more sense to keep this query separate from the other QueryRequests. Instead, we could provide a separate function like |
All query responses are wrapped in two layers of result types. For the contract-contract query this made sense, but in many cases the double result is unnecessary overhead. I was expecting we just keep the structure for the sake of not opening up a can of worms. But maybe there is a way to route this through a separate channel. I'm open to ideas here. |
I didn't mean touching the result types originally, but I get what you mean now. |
One way to look at this is: we can always add a new route later on to increase encoding efficiency if needed. Adding it in the current system (response binary embedded in 2 levels of JSON result structures) is straight forward. |
We want this to be an improved version of the
QueryRequest::Stargate
query.Some of the pain points of the current
Stargate
query:We could add something like a
ProtobufBytes
wrapper type that does some basic validation.With that we could solve both points. Alternatively, for the first point, that validation could be done in wasmd to not burden the contract code with it.
However, the tricky part here is: How much can even be validated without knowing the concrete protobuf type? Does it become easier if we require all of them to by
Any
types?The text was updated successfully, but these errors were encountered: