Skip to content

fix: eventbus index removal, ordered channel query logging, and dst chain log#4431

Open
hitchhooker wants to merge 1 commit intoinformalsystems:masterfrom
hitchhooker:fix/eventbus-index-removal-and-ordered-channel-query
Open

fix: eventbus index removal, ordered channel query logging, and dst chain log#4431
hitchhooker wants to merge 1 commit intoinformalsystems:masterfrom
hitchhooker:fix/eventbus-index-removal-and-ordered-channel-query

Conversation

@hitchhooker
Copy link
Copy Markdown

Summary

fixes three bugs that could cause events to be lost or make debugging harder.

Changes

1. EventBus: fix index removal when multiple subscribers disconnect

File: crates/relayer/src/event/bus.rs

When multiple subscribers disconnected simultaneously, removing indices in ascending order caused off-by-one errors:

// Before: indices [1, 3] - removing 1 shifts 3 to 2, then removing 3 removes wrong element
for idx in disconnected {
    self.txs.remove(idx);
}

// After: remove in reverse order to preserve correct indices
for idx in disconnected.into_iter().rev() {
    self.txs.remove(idx);
}

Added test to verify correct behavior with multiple disconnected subscribers.

2. Packet worker: log errors when querying next_sequence_receive fails

File: crates/relayer/src/worker/packet.rs

Previously errors were silently swallowed with .ok(). Now logs a warning so operators can see query failures while preserving the fallback behavior (triggering packet clearing).

3. Supervisor: fix wrong chain id in log message

File: crates/relayer/src/supervisor.rs

Was logging src_chain_id when dst_chain_id failed to spawn. Now correctly logs dst_chain_id for easier debugging.

Test Plan

  • cargo check -p ibc-relayer passes
  • cargo test -p ibc-relayer --lib passes (73 tests, +1 new)
  • new test multiple_disconnected_subscribers verifies EventBus fix

…hain log

fixes three bugs that could cause events to be lost or make debugging harder:

1. eventbus: fix index removal when multiple subscribers disconnect
   - removing indices in ascending order caused off-by-one errors because
     each removal shifts subsequent indices
   - now removes in reverse order to preserve correct indices
   - added test to verify correct behavior

2. packet worker: log errors when querying next_sequence_receive fails
   - previously silently swallowed with .ok()
   - now logs warning so operators can see query failures
   - fallback behavior (triggering clear) is preserved

3. supervisor: fix wrong chain id in log message
   - was logging src_chain_id when dst_chain_id failed to spawn
   - now correctly logs dst_chain_id for easier debugging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant