Skip to content

Commit

Permalink
fix non-existence proof generation for mock-client
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Kimura <[email protected]>
  • Loading branch information
bluele committed Feb 14, 2024
1 parent 0ae64f4 commit fd56278
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions pkg/testing/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,25 +910,21 @@ func (chain *Chain) TimeoutOnClose(
}
proofUnreceived = proof.Data
} else {
if chain.ClientType() == ibcclient.MockClient {
proofUnreceived = []byte{}
} else {
rc, err := counterparty.IBCHandler.GetPacketReceipt(
counterparty.CallOpts(ctx, RelayerKeyIndex),
packet.DestinationPort, packet.DestinationChannel, packet.Sequence,
)
if err != nil {
return err
}
if rc == 1 {
return fmt.Errorf("packet receipt exists: port=%v channel=%v sequence=%v", packet.DestinationPort, packet.DestinationChannel, packet.Sequence)
}
p, err := counterparty.QueryPacketReceiptProof(chain, channel.ClientID, packet, proofHeight)
if err != nil {
return err
}
proofUnreceived = p.Data
rc, err := counterparty.IBCHandler.GetPacketReceipt(
counterparty.CallOpts(ctx, RelayerKeyIndex),
packet.DestinationPort, packet.DestinationChannel, packet.Sequence,
)
if err != nil {
return err
}
if rc == 1 {
return fmt.Errorf("packet receipt exists: port=%v channel=%v sequence=%v", packet.DestinationPort, packet.DestinationChannel, packet.Sequence)
}
p, err := counterparty.QueryPacketReceiptProof(chain, channel.ClientID, packet, proofHeight)
if err != nil {
return err
}
proofUnreceived = p.Data
}

nextSequenceRecv, err := counterparty.IBCHandler.GetNextSequenceRecv(
Expand Down Expand Up @@ -1326,7 +1322,7 @@ func (chain *Chain) QueryPacketReceiptProof(counterparty *Chain, counterpartyCli
if rc == 1 {
return nil, errors.New("an existence proof of packet receipt not supported")
} else {
proof.Data = []byte{}
proof.Data = chain.generateMockClientProof(proof.Height, host.PacketReceiptPath(packetFromCounterparty.DestinationPort, packetFromCounterparty.DestinationChannel, packetFromCounterparty.Sequence), []byte{})
}
}
return proof, nil
Expand Down

0 comments on commit fd56278

Please sign in to comment.