Cosmos-sdk: Queriers don't return proofs

Created on 14 Nov 2019  ·  8Comments  ·  Source: cosmos/cosmos-sdk

Summary of Bug

ibc connection end --prove does not return valid proof

Version

https://github.com/cosmos/gaia/commit/6b448b6059ff58ff5ab7c359d3ff453f7942a2c1

Steps to Reproduce

Following the guide in https://gist.github.com/jackzampolin/2a7f90105fb5e778c3a3081681f10675 but make all the handshake steps manually.

This works up until the proof part:

gaiacli q ibc client path --node $NODE0 --chain-id $CHAINID0 > counterparty_prefix.json
echo -e '12345678\n' | gaiacli --node $NODE0 --chain-id $CHAINID0 tx ibc connection open-init $CONNID0 $CLIENT0 $CONNID1 $CLIENT1 \
    counterparty_prefix.json 'x' --from validator-key  --yes
gaiacli q ibc client header --node $NODE0 --chain-id $CHAINID0 > header.json
echo -e '12345678\n' | gaiacli --node $NODE1 --chain-id $CHAINID1 tx ibc client update $CLIENT1 header.json --from $KEY1 --yes

gaiacli q ibc connection end $CONNID1 --prove --node $NODE1 --chain-id $CHAINID1 > proof_init.json
gaiacli q ibc client path --node $NODE1 --chain-id $CHAINID1 > counterparty_prefix.json
gaiacli --node $NODE1 --chain-id $CHAINID1 tx ibc connection open-try $CONNID1 $CLIENT1 $CONNID0 $CLIENT0 \
    counterparty_prefix.json "v1.0.0" proof_init.json

gaiacli q ibc connection end $CONNID1 --prove --node $NODE1 --chain-id $CHAINID1 > proof_init.json
should return a proof, but returns:

{"type":"ibc/connection/ConnectionEnd","value":{"state":"OPEN","client_id":"ibczeroclient","counterparty":{"client_id":"ibconeclient","connection_id":"ibconeconn","prefix":{"type":"ibc/commitment/merkle/Prefix","value":{"key_prefix":"aWJj"}}},"versions":["1.0.0"]}}

instead. A valid proof is needed to be able to make the handshake commands work.


For Admin Use

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

Most helpful comment

There is already an issue for this (proofs for querier queries) -- it won't be as trivial as direct key/subspace queries because we'll have to trace all KVStore calls.

All 8 comments

It seems that the issue here is that Queriers don't actually return proofs:
https://github.com/cosmos/cosmos-sdk/blob/5be87e40cef3f58419d76b236c246d3e4032a7a3/baseapp/abci.go#L395-L453

cc: @AdityaSripal @chengwenxi

I'll change the current implementation to use store/<storeName>/key so that we can return valid merkle proofs for the demo (@jackzampolin).

But the ideal case would be to return valid proofs with the Queriers too.

But if it returns a list, it's hard to provide the proof, such as staking.QueryValidators.

But if it returns a list, it's hard to provide the proof, such as staking.QueryValidators.

That's right. It would be possible if queriers used a sort of tracing store that collected proofs for all queries which were made to it, and then the client checked these proofs upon receipt of the querier response. I'm not sure if this is an SDK priority but it is an option in the future (cc @fedekunze).

There is already an issue for this (proofs for querier queries) -- it won't be as trivial as direct key/subspace queries because we'll have to trace all KVStore calls.

Removing this issue from the IBC 1.0.0 milestone as we can query the store directly in the meantime.

IBC-related proofs should not be using queriers. Ref https://github.com/cosmos/relayer/issues/19#issuecomment-587144441.

Let's close this then 👍

Was this page helpful?
0 / 5 - 0 ratings