osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

Enable Stargate Query with Json Marshalled Response

Open mattverse opened this issue 2 years ago • 0 comments

Background

The current implementation of enabling stargate queries(https://github.com/osmosis-labs/osmosis/pull/2190) proto marshals the response. Since we do not have set standards on how we want to support stargate queries in the contract side, either way of returning the response is possible: either by proto marshalling the response OR by json marshalling the response.

The advantage of Json Marshalling though, is that the cosmwasm std querier for stargate expects the response to be json marshalled by default. It'd be way easier for contracts to use stargate querier if the response from go side be json marshalled. Also, the process of unmarshalling proto marshalled responses that comes from the go side would be gnarly, having to query it in raw bytes, and having to find out a way to proto unmarshal it ( afaik, the proto library in rust is pretty heavy, we don't know if we want to include the heavy proto library in all contracts we have).

Suggested Design

We change https://github.com/osmosis-labs/osmosis/pull/2190 to return responses json marshalled, not proto marshalled.

Acceptance Criteria

  • stargate query responses return json marshalled responses.
  • We have a test case to prove that json marshalling the response is safe

mattverse avatar Aug 10 '22 08:08 mattverse