Cosmos-sdk: gRPC proof support

Created on 13 Aug 2020  Â·  2Comments  Â·  Source: cosmos/cosmos-sdk

Summary

gRPC calls should support returning proofs for the query.

Problem Definition

Currently gRPC just uses the module's keeper to return the desired information. No proofs are generated for the query. In IBC, we need to generate proofs for almost every interaction so the current workaround is to essentially create wrapper functions around our gRPC calls that do ABCI queries and inject the proof into the response. It is quite redundant to do the same query twice via different mechanisms and for IBC, gRPC is unnecessary without proofs.

I imagine users might want to do a gRPC via an untrusted node and verify the returned proof via their light client.

Proposal

One probably shorter term solution is to expose a function that can generate proofs based on a key and value. That way if I do a gRPC to query object V with key K, then I'd like to be able to call GenerateProof(K, V) and get back a proof and height for the proof.

I think there has been possible discussion of adding some sort of proto headers to handle proofs, but I have no idea how this would look. I just wanted to open this issue to begin discussion around this topic since I couldn't find an existing issue.


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
gRPC

Most helpful comment

Great thanks @colin-axner. Yeah, I previously mentioned the idea of doing proofs via headers. It's probably a fair amount of work, but I think it can be done for at least simple key/value queries. Proofs that for index scans would be more involved but are also I think doable. The one big challenge is making sure the protobuf encoding of the response doesn't change at some intermediate serialization step because the proof depends on the serialized store bytes.

All 2 comments

Great thanks @colin-axner. Yeah, I previously mentioned the idea of doing proofs via headers. It's probably a fair amount of work, but I think it can be done for at least simple key/value queries. Proofs that for index scans would be more involved but are also I think doable. The one big challenge is making sure the protobuf encoding of the response doesn't change at some intermediate serialization step because the proof depends on the serialized store bytes.

8116 work-around to generating proofs via keepers seems relevant

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fedekunze picture fedekunze  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

ValarDragon picture ValarDragon  Â·  3Comments

kevlubkcm picture kevlubkcm  Â·  3Comments

ValarDragon picture ValarDragon  Â·  3Comments