From f967c1dc073ff03db971d66544824bd640c5194a Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 8 Sep 2017 17:48:27 +0200 Subject: [PATCH] Modify IBC to work with new proof serialization --- modules/ibc/commands/query.go | 9 +++++++-- modules/ibc/test_helpers.go | 2 +- modules/ibc/tx.go | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/ibc/commands/query.go b/modules/ibc/commands/query.go index 3b0e595286..e4fec6953f 100644 --- a/modules/ibc/commands/query.go +++ b/modules/ibc/commands/query.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/stack" wire "github.com/tendermint/go-wire" "github.com/tendermint/go-wire/data" + "github.com/tendermint/iavl" ) // TODO: query seeds (register/update) @@ -201,18 +202,22 @@ func packetQueryCmd(cmd *cobra.Command, args []string) error { if err != nil { return err } + if len(bs) == 0 { + // TODO: what info here? + return errors.New("no such packet") + } + err = wire.ReadBinaryBytes(bs, &packet) if err != nil { return err } - // create the post packet here. post := ibc.PostPacketTx{ FromChainID: commands.GetChainID(), FromChainHeight: height, Key: key, Packet: packet, - Proof: proof, + Proof: proof.(*iavl.KeyExistsProof), } // print json direct, as we don't need to wrap with the height diff --git a/modules/ibc/test_helpers.go b/modules/ibc/test_helpers.go index b89c4d2918..d29ea72690 100644 --- a/modules/ibc/test_helpers.go +++ b/modules/ibc/test_helpers.go @@ -70,7 +70,7 @@ func makePostPacket(tree *iavl.IAVLTree, packet Packet, fromID string, fromHeigh return PostPacketTx{ FromChainID: fromID, FromChainHeight: uint64(fromHeight), - Proof: proof, + Proof: proof.(*iavl.KeyExistsProof), Key: key, Packet: packet, } diff --git a/modules/ibc/tx.go b/modules/ibc/tx.go index b07f3e9263..89a86d0672 100644 --- a/modules/ibc/tx.go +++ b/modules/ibc/tx.go @@ -115,9 +115,9 @@ type PostPacketTx struct { // The block height in which Packet was committed, to check Proof FromChainHeight uint64 `json:"src_height"` // this proof must match the header and the packet.Bytes() - Proof iavl.KeyProof `json:"proof"` - Key data.Bytes `json:"key"` - Packet Packet `json:"packet"` + Proof *iavl.KeyExistsProof `json:"proof"` + Key data.Bytes `json:"key"` + Packet Packet `json:"packet"` } // ValidateBasic makes sure this is consistent - used to satisfy TxInner