Skip to content

Commit

Permalink
Add warning if no packet data was pulled when clearing packets (#4073)
Browse files Browse the repository at this point in the history
* Add warning if 0 packet data was pulled when clearing packets

* Update filtered ICS20 packet logs from debug to warn and remove unnecessary context

* Add changelog entry

* Apply suggestions from code review

Co-authored-by: Romain Ruetschi <[email protected]>
Signed-off-by: Luca Joss <[email protected]>

* Add link to guide page when 0 packet data was pulled during packet clearing

---------

Signed-off-by: Luca Joss <[email protected]>
Co-authored-by: Romain Ruetschi <[email protected]>
  • Loading branch information
ljoss17 and romac authored Jul 16, 2024
1 parent 824cfdf commit 43f3e83
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Improve logs when clearing packet.
* When Hermes doesn't pull packet data it will now warn the user
instead of logging `pulled packet data for 0 events out of X`
* When ICS20 packets are filtered due to having a receiver or memo
field too big, the log will be at `warn` level instead of `debug`.
([\#4072](https://github.com/informalsystems/hermes/issues/4072))
23 changes: 15 additions & 8 deletions crates/relayer/src/link/packet_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,21 @@ where
Ok(events) => {
events_left -= chunk.len();

info!(
events.total = %events_total,
events.left = %events_left,
"pulled packet data for {} events out of {} sequences: {};",
events.len(),
chunk.len(),
chunk.iter().copied().collated().format(", "),
);
if events.is_empty() && !chunk.is_empty() {
warn!("no packet data was pulled at height {query_height} for sequences {}, this might be due to the data not being available on the configured endpoint. \
Please verify that the RPC endpoint has the required packet data, for more details see https://hermes.informal.systems/advanced/troubleshooting/cross-comp-config.html#uncleared-pending-packets",
chunk.iter().copied().collated().format(", "));
} else {
info!(
events.total = %events_total,
events.left = %events_left,
"pulled packet data for {} out of {} events: {}",
events.len(),
chunk.len(),
chunk.iter().copied().collated().format(", "),
);
}


// Because we use the first event height to do the client update,
// if the heights of the events differ, we get proof verification failures.
Expand Down
8 changes: 4 additions & 4 deletions crates/relayer/src/link/relay_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ impl<ChainA: ChainHandle, ChainB: ChainHandle> RelayPath<ChainA, ChainB> {
}
}

#[tracing::instrument(skip(data))]
#[tracing::instrument(skip_all)]
fn check_ics20_fields_size(
data: &[u8],
memo_limit: Ics20FieldSizeLimit,
Expand All @@ -1962,9 +1962,9 @@ fn check_ics20_fields_size(
(ValidationResult::Valid, ValidationResult::Valid) => true,

(memo_validity, receiver_validity) => {
debug!("found invalid ICS-20 packet data, not relaying packet!");
debug!(" ICS-20 memo: {memo_validity}");
debug!(" ICS-20 receiver: {receiver_validity}");
warn!("found invalid ICS-20 packet data, not relaying packet!");
warn!(" ICS-20 memo: {memo_validity}");
warn!(" ICS-20 receiver: {receiver_validity}");

false
}
Expand Down

0 comments on commit 43f3e83

Please sign in to comment.