cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.24k stars 3.61k forks source link

ibc: need blockID to verify commit #34

Closed ebuchman closed 7 years ago

ebuchman commented 7 years ago

On IBCUpdateChainTx, We need to check the commit matches the header, but a commit is for a blockID, which we can't derive from the header alone. So either we:

  1. Fetch the LastBlockID from the next block and include it with the Header and Commit in the IBCUpdateChainTx. We actually only need the PartSetHeader from the BlockID, since we can compute the Hash from the Header. So to prepare such a tx we would fetch the header from block H and the LastBlockID and LastCommit from block H+1.

  2. Write a new VerifyCommit that returns the blockID with +2/3 of the power. This would leave IBCUpdateChainTx unchanged. Currently, VerifyCommit takes a BlockID as argument and ignores votes for other IDs. We could have an alternative, VerifyCommitReturnBlockID that instead returns the BlockID that has +2/3, if there is one.

ebuchman commented 7 years ago

we don't really need to verify the the partsheader, so block hash is enough - just can't use tendermint/types.VerifyCommit ... use light-client https://github.com/tendermint/basecoin/issues/38