Skip to content

hermes crashes on clear packets when full node indexing #851

Closed
@ancazamfir

Description

Crate

relayer

Summary of Bug

When hermes is started immediately after a packet send, it is possible that query_tx() does not find the Tx for the send or ack packets if full node indexing is not finished. This bug was introduced by informalsystems/ibc-rs#827.

Version

master

Steps to Reproduce

  1. setup a channel using hermes create channel... between ibc-0 and ibc-1
  2. from one terminal issue hermes tx raw ft-transfer ibc-1 ibc-0 transfer channel-0 9999 150 -n 1
  3. from another terminal hermes start ibc-0 ibc-1 -p transfer -c channel-0

time between 2 and 3 should be very small, otherwise the bug cannot be reproduced. The logs look like this:

Apr 26 19:15:13.046  INFO ibc_relayer::link: [ibc-1 -> ibc-0] clearing old packets
Apr 26 19:15:13.052 DEBUG ibc_relayer::link: [ibc-1 -> ibc-0] packets that have acknowledgments on ibc-1 [1, 15, 2]
Apr 26 19:15:13.054 DEBUG ibc_relayer::link: [ibc-1 -> ibc-0] ack packets to send out to ibc-0 of the ones with acknowledgments on ibc-1: [Sequence(15)]
The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: relayer/src/chain/cosmos.rs:1001

Acceptance Criteria

  • hermes should not crash. A quick try with the diffs below avoids the crash
+++ b/relayer/src/chain/cosmos.rs
@@ -992,6 +992,10 @@ impl Chain for CosmosSdkChain {
                         "packet_from_tx_search_response: unexpected number of txs"
                     );

+                    if response.txs.is_empty() {
+                        continue;
+                    }
+
                     if let Some(event) = packet_from_tx_search_response(
                         self.id(),
                         &request,

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Assignees

Labels

A: bugAdmin: something isn't workingI: logicInternal: related to the relaying logic

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions