From ab04da74f4b15203c67912fb605a0edf5eb6288e Mon Sep 17 00:00:00 2001 From: benluelo Date: Thu, 2 Nov 2023 15:52:52 +0000 Subject: [PATCH] fix(voyager): query channel and connection state at execution height --- voyager/src/chain/evm.rs | 72 +++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/voyager/src/chain/evm.rs b/voyager/src/chain/evm.rs index ffeb414baf..f90eeaab5b 100644 --- a/voyager/src/chain/evm.rs +++ b/voyager/src/chain/evm.rs @@ -215,14 +215,19 @@ impl LightClientBase for CometblsMainnet { port_id: unionlabs::id::PortId, at: HeightOf, ) -> impl Future + '_ { - read_ibc_state::, _, _>( - &self.chain, - ChannelEndPath { - port_id, - channel_id, - }, - at.revision_height(), - ) + async move { + let execution_block_number = self.chain.execution_height(at).await; + + read_ibc_state::, _, _>( + &self.chain, + ChannelEndPath { + port_id, + channel_id, + }, + execution_block_number, + ) + .await + } } fn connection( @@ -236,11 +241,16 @@ impl LightClientBase for CometblsMainnet { String, >, > + '_ { - read_ibc_state::, _, _>( - &self.chain, - ConnectionPath { connection_id }, - at.revision_height(), - ) + async move { + let execution_block_number = self.chain.execution_height(at).await; + + read_ibc_state::, _, _>( + &self.chain, + ConnectionPath { connection_id }, + execution_block_number, + ) + .await + } } fn query_client_state( @@ -311,14 +321,19 @@ impl LightClientBase for CometblsMinimal { port_id: unionlabs::id::PortId, at: HeightOf, ) -> impl Future + '_ { - read_ibc_state::, _, _>( - &self.chain, - ChannelEndPath { - port_id, - channel_id, - }, - at.revision_height(), - ) + async move { + let execution_block_number = self.chain.execution_height(at).await; + + read_ibc_state::, _, _>( + &self.chain, + ChannelEndPath { + port_id, + channel_id, + }, + execution_block_number, + ) + .await + } } fn connection( @@ -332,11 +347,16 @@ impl LightClientBase for CometblsMinimal { String, >, > + '_ { - read_ibc_state::, _, _>( - &self.chain, - ConnectionPath { connection_id }, - at.revision_height(), - ) + async move { + let execution_block_number = self.chain.execution_height(at).await; + + read_ibc_state::, _, _>( + &self.chain, + ConnectionPath { connection_id }, + execution_block_number, + ) + .await + } } fn query_client_state(