Skip to content

Commit

Permalink
fix(voyager): query channel and connection state at execution height
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo committed Nov 2, 2023
1 parent 82d09b3 commit ab04da7
Showing 1 changed file with 46 additions and 26 deletions.
72 changes: 46 additions & 26 deletions voyager/src/chain/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,19 @@ impl LightClientBase for CometblsMainnet {
port_id: unionlabs::id::PortId,
at: HeightOf<Self::HostChain>,
) -> impl Future<Output = unionlabs::ibc::core::channel::channel::Channel> + '_ {
read_ibc_state::<ChainOf<Self::Counterparty>, _, _>(
&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::<ChainOf<Self::Counterparty>, _, _>(
&self.chain,
ChannelEndPath {
port_id,
channel_id,
},
execution_block_number,
)
.await
}
}

fn connection(
Expand All @@ -236,11 +241,16 @@ impl LightClientBase for CometblsMainnet {
String,
>,
> + '_ {
read_ibc_state::<ChainOf<Self::Counterparty>, _, _>(
&self.chain,
ConnectionPath { connection_id },
at.revision_height(),
)
async move {
let execution_block_number = self.chain.execution_height(at).await;

read_ibc_state::<ChainOf<Self::Counterparty>, _, _>(
&self.chain,
ConnectionPath { connection_id },
execution_block_number,
)
.await
}
}

fn query_client_state(
Expand Down Expand Up @@ -311,14 +321,19 @@ impl LightClientBase for CometblsMinimal {
port_id: unionlabs::id::PortId,
at: HeightOf<Self::HostChain>,
) -> impl Future<Output = unionlabs::ibc::core::channel::channel::Channel> + '_ {
read_ibc_state::<ChainOf<Self::Counterparty>, _, _>(
&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::<ChainOf<Self::Counterparty>, _, _>(
&self.chain,
ChannelEndPath {
port_id,
channel_id,
},
execution_block_number,
)
.await
}
}

fn connection(
Expand All @@ -332,11 +347,16 @@ impl LightClientBase for CometblsMinimal {
String,
>,
> + '_ {
read_ibc_state::<ChainOf<Self::Counterparty>, _, _>(
&self.chain,
ConnectionPath { connection_id },
at.revision_height(),
)
async move {
let execution_block_number = self.chain.execution_height(at).await;

read_ibc_state::<ChainOf<Self::Counterparty>, _, _>(
&self.chain,
ConnectionPath { connection_id },
execution_block_number,
)
.await
}
}

fn query_client_state(
Expand Down

0 comments on commit ab04da7

Please sign in to comment.