Skip to content

Commit

Permalink
Include client updates for supporting messages when assembling messag…
Browse files Browse the repository at this point in the history
…es to relay from the operational data (#3468)

* Include client updates for supporting messages when assembling messages to relay from the operational data

* Add changelog entry
  • Loading branch information
romac committed Jul 14, 2023
1 parent b10d758 commit a929e05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .changelog/unreleased/bug-fixes/ibc-relayer/3465-3565.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Fix a bug where Hermes would discard the client updates
corresponding to the supporting headers returned by the light
client when assembling messages to relay from the operational data
([\#3465](https://github.com/informalsystems/hermes/issues/3465))
18 changes: 8 additions & 10 deletions crates/relayer/src/link/operational_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,24 @@ impl OperationalData {
relay_path: &RelayPath<ChainA, ChainB>,
) -> Result<TrackedMsgs, LinkError> {
// For zero delay we prepend the client update msgs.
let client_update_msg = if !self.conn_delay_needed() {
let client_update_msgs = if !self.conn_delay_needed() {
let update_height = self.proofs_height.increment();

debug!(
"prepending {} client update at height {}",
self.target, update_height
);

// Fetch the client update message. Vector may be empty if the client already has the header
// for the requested height.
let mut client_update_opt = match self.target {
// Fetch the client update messages.
// Vector may be empty if the client already has the header for the requested height.
match self.target {
OperationalDataTarget::Source => {
relay_path.build_update_client_on_src(update_height)?
}
OperationalDataTarget::Destination => {
relay_path.build_update_client_on_dst(update_height)?
}
};

client_update_opt.pop()
}
} else {
let (client_state, _) = match self.target {
OperationalDataTarget::Source => relay_path
Expand Down Expand Up @@ -205,12 +203,12 @@ impl OperationalData {

if client_state.is_frozen() {
return Ok(TrackedMsgs::new(vec![], self.tracking_id));
} else {
None
}

vec![]
};

let msgs = client_update_msg
let msgs = client_update_msgs
.into_iter()
.chain(self.batch.iter().map(|gm| gm.msg.clone()))
.collect();
Expand Down

0 comments on commit a929e05

Please sign in to comment.