From ffaccacd27bf28df113297dc2b12924c3ce67276 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Sat, 11 Jan 2025 14:27:12 +0100 Subject: [PATCH] fix(voyager): recv/writeAck require src to be read on counterparty --- .../event-source/cosmos-sdk/src/main.rs | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/voyager/plugins/event-source/cosmos-sdk/src/main.rs b/voyager/plugins/event-source/cosmos-sdk/src/main.rs index 37eb0d6389..ed726c353b 100644 --- a/voyager/plugins/event-source/cosmos-sdk/src/main.rs +++ b/voyager/plugins/event-source/cosmos-sdk/src/main.rs @@ -1600,18 +1600,6 @@ impl PluginServer for Module { IbcEvent::UnionRecvPacket(recv_packet) => { let packet = recv_packet.packet; - let source_channel = voyager_client - .query_ibc_state( - self.chain_id.clone(), - QueryHeight::Specific(height), - ibc_union_spec::ChannelPath { - channel_id: packet.source_channel, - }, - ) - .await? - .state - .unwrap(); - let destination_channel = voyager_client .query_ibc_state( self.chain_id.clone(), @@ -1651,6 +1639,18 @@ impl PluginServer for Module { ) .await?; + let source_channel = voyager_client + .query_ibc_state( + client_meta.chain_id.clone(), + QueryHeight::Specific(height), + ibc_union_spec::ChannelPath { + channel_id: packet.source_channel, + }, + ) + .await? + .state + .unwrap(); + let event = ibc_union_spec::PacketRecv { packet_data: packet.data.into(), packet: ibc_union_spec::PacketMetadata { @@ -1694,18 +1694,6 @@ impl PluginServer for Module { IbcEvent::UnionWriteAck(write_ack) => { let packet = write_ack.packet; - let source_channel = voyager_client - .query_ibc_state( - self.chain_id.clone(), - QueryHeight::Specific(height), - ibc_union_spec::ChannelPath { - channel_id: packet.source_channel, - }, - ) - .await? - .state - .unwrap(); - let destination_channel = voyager_client .query_ibc_state( self.chain_id.clone(), @@ -1745,6 +1733,18 @@ impl PluginServer for Module { ) .await?; + let source_channel = voyager_client + .query_ibc_state( + client_meta.chain_id.clone(), + QueryHeight::Specific(height), + ibc_union_spec::ChannelPath { + channel_id: packet.source_channel, + }, + ) + .await? + .state + .unwrap(); + let event = ibc_union_spec::WriteAck { packet_data: packet.data.into(), packet: ibc_union_spec::PacketMetadata {