-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove
ChainHandle
deps in ChannelHandshakePayloadBuilder
p1
- Loading branch information
Showing
9 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
crates/cosmos/cosmos-chain-components/src/impls/queries/channel.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// use cgp_core::prelude::*; | ||
// use cgp_core::CanRaiseError; | ||
use hermes_relayer_components::chain::traits::queries::channel::ChannelBytesQuerier; | ||
use hermes_relayer_components::chain::traits::types::ibc::HasIbcChainTypes; | ||
use ibc_relayer_types::core::ics24_host::identifier::{PortId, ChannelId}; | ||
use ibc_relayer_types::Height; | ||
|
||
use crate::traits::abci_query::CanQueryAbci; | ||
|
||
pub struct QueryCosmosChannelFromAbci; | ||
|
||
pub const IBC_QUERY_PATH: &str = "store/ibc/key"; | ||
|
||
impl<Chain, Counterparty> ChannelBytesQuerier<Chain, Counterparty> | ||
for QueryCosmosChannelFromAbci | ||
where | ||
Chain: HasIbcChainTypes<Counterparty, PortId = PortId, ChannelId = ChannelId, Height = Height> + CanQueryAbci, | ||
{ | ||
async fn query_channel_bytes( | ||
chain: &Chain, | ||
port_id: &PortId, | ||
channel_id: &ChannelId, | ||
height: &Height, | ||
) -> Result<Vec<u8>, Chain::Error> { | ||
let channel_ends_path = format!("channelEnds/ports/{port_id}/channels/{channel_id}"); | ||
|
||
let channel_bytes = chain | ||
.query_abci(IBC_QUERY_PATH, channel_ends_path.as_bytes(), height) | ||
.await?; | ||
|
||
Ok(channel_bytes) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
crates/relayer/relayer-components/src/chain/impls/delegate/queries/channel.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use core::marker::PhantomData; | ||
|
||
use cgp_core::{DelegateComponent, HasErrorType}; | ||
|
||
use crate::chain::traits::{queries::channel::ChannelQuerier, types::{channel::HasChannelEndsType, ibc::HasIbcChainTypes}}; | ||
|
||
pub struct DelegateQueryChannel<Components>(pub PhantomData<Components>); | ||
|
||
impl<Chain, Counterparty, Components, Delegate> ChannelQuerier<Chain, Counterparty> | ||
for DelegateQueryChannel<Components> | ||
where | ||
Chain: HasIbcChainTypes<Counterparty> + HasErrorType, | ||
Counterparty: HasChannelEndsType<Chain>, | ||
Components: DelegateComponent<Counterparty, Delegate = Delegate>, | ||
Delegate: ChannelQuerier<Chain, Counterparty>, | ||
{ | ||
async fn query_channel( | ||
chain: &Chain, | ||
port_id: &Chain::PortId, | ||
channel_id: &Chain::ChannelId, | ||
height: &Chain::Height, | ||
) -> Result<Counterparty::ChannelEnd, Chain::Error> { | ||
Delegate::query_channel(chain, port_id, channel_id, height).await | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
crates/relayer/relayer-components/src/chain/impls/delegate/queries/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod client_state; | ||
pub mod consensus_state; | ||
pub mod channel; |
32 changes: 32 additions & 0 deletions
32
crates/relayer/relayer-components/src/chain/traits/queries/channel.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use alloc::vec::Vec; | ||
use cgp_core::prelude::*; | ||
|
||
use crate::chain::traits::types::{channel::HasChannelEndsType, ibc::HasIbcChainTypes}; | ||
|
||
#[derive_component(ChannelQuerierComponent, ChannelQuerier<Chain>)] | ||
#[async_trait] | ||
pub trait CanQueryChannel<Counterparty>: HasIbcChainTypes<Counterparty> + HasErrorType | ||
where | ||
Counterparty: HasChannelEndsType<Self>, | ||
{ | ||
async fn query_channel( | ||
&self, | ||
port_id: &Self::PortId, | ||
channel_id: &Self::ChannelId, | ||
height: &Self::Height, | ||
) -> Result<Counterparty::ChannelEnd, Self::Error>; | ||
} | ||
|
||
#[derive_component(ChannelBytesQuerierComponent, ChannelBytesQuerier<Chain>)] | ||
#[async_trait] | ||
pub trait CanQueryChannelBytes<Counterparty>: | ||
HasIbcChainTypes<Counterparty> + HasErrorType | ||
{ | ||
async fn query_channel_bytes( | ||
&self, | ||
port_id: &Self::PortId, | ||
channel_id: &Self::ChannelId, | ||
height: &Self::Height, | ||
) -> Result<Vec<u8>, Self::Error>; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters