Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport changes in solomachine branch to relayer-next #3527

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/relayer-all-in-one/src/all_for_one/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub trait AfoRelay:
+ HasAfoRuntime
+ HasLoggerWithBaseLevels
+ HasRelayChains<SrcChain = Self::AfoSrcChain, DstChain = Self::AfoDstChain>
+ HasRelayPacket<SrcChainWithPacket = Self::AfoSrcChain>
+ HasRelayPacket<SrcChainWithPacket = Self::AfoSrcChain, DstChainWithPacket = Self::AfoDstChain>
+ CanBuildUpdateClientMessage<SourceTarget>
+ CanBuildUpdateClientMessage<DestinationTarget>
+ CanSendIbcMessages<SourceTarget>
Expand Down Expand Up @@ -72,7 +72,7 @@ where
+ HasAfoRuntime
+ HasLoggerWithBaseLevels
+ HasRelayChains<SrcChain = SrcChain, DstChain = DstChain>
+ HasRelayPacket<SrcChainWithPacket = SrcChain>
+ HasRelayPacket<SrcChainWithPacket = SrcChain, DstChainWithPacket = DstChain>
+ CanBuildUpdateClientMessage<SourceTarget>
+ CanBuildUpdateClientMessage<DestinationTarget>
+ CanSendIbcMessages<SourceTarget>
Expand Down
27 changes: 15 additions & 12 deletions crates/relayer-all-in-one/src/one_for_all/impls/chain/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ use ibc_relayer_components::chain::traits::types::ibc_events::channel::{
HasChannelOpenInitEvent, HasChannelOpenTryEvent,
};

use crate::one_for_all::traits::chain::OfaIbcChain;
use crate::one_for_all::traits::chain::{OfaChainTypes, OfaIbcChain};
use crate::one_for_all::types::chain::OfaChainWrapper;
use crate::std_prelude::*;

impl<Chain, Counterparty> HasChannelHandshakePayloads<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type ChannelOpenTryPayload = Chain::ChannelOpenTryPayload;

Expand All @@ -30,8 +30,8 @@ where
impl<Chain, Counterparty> HasInitChannelOptionsType<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type InitChannelOptions = Chain::InitChannelOptions;
}
Expand All @@ -40,7 +40,7 @@ impl<Chain, Counterparty> HasChannelOpenInitEvent<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
type ChannelOpenInitEvent = Chain::ChannelOpenInitEvent;

Expand All @@ -61,7 +61,7 @@ impl<Chain, Counterparty> HasChannelOpenTryEvent<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
type ChannelOpenTryEvent = Chain::ChannelOpenTryEvent;

Expand All @@ -81,38 +81,41 @@ impl<Chain, Counterparty> CanBuildChannelHandshakePayloads<OfaChainWrapper<Count
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_channel_open_try_payload(
&self,
client_state: &Self::ClientState,
height: &Self::Height,
port_id: &Self::PortId,
channel_id: &Self::ChannelId,
) -> Result<Self::ChannelOpenTryPayload, Self::Error> {
self.chain
.build_channel_open_try_payload(height, port_id, channel_id)
.build_channel_open_try_payload(client_state, height, port_id, channel_id)
.await
}

async fn build_channel_open_ack_payload(
&self,
client_state: &Self::ClientState,
height: &Self::Height,
port_id: &Self::PortId,
channel_id: &Self::ChannelId,
) -> Result<Self::ChannelOpenAckPayload, Self::Error> {
self.chain
.build_channel_open_ack_payload(height, port_id, channel_id)
.build_channel_open_ack_payload(client_state, height, port_id, channel_id)
.await
}

async fn build_channel_open_confirm_payload(
&self,
client_state: &Self::ClientState,
height: &Self::Height,
port_id: &Self::PortId,
channel_id: &Self::ChannelId,
) -> Result<Self::ChannelOpenConfirmPayload, Self::Error> {
self.chain
.build_channel_open_confirm_payload(height, port_id, channel_id)
.build_channel_open_confirm_payload(client_state, height, port_id, channel_id)
.await
}
}
Expand All @@ -122,7 +125,7 @@ impl<Chain, Counterparty> CanBuildChannelHandshakeMessages<OfaChainWrapper<Count
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_channel_open_init_message(
&self,
Expand Down
34 changes: 17 additions & 17 deletions crates/relayer-all-in-one/src/one_for_all/impls/chain/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ use ibc_relayer_components::chain::traits::types::client_state::{
HasClientStateFields, HasClientStateType,
};

use crate::one_for_all::traits::chain::OfaIbcChain;
use crate::one_for_all::traits::chain::{OfaChainTypes, OfaIbcChain};
use crate::one_for_all::types::chain::OfaChainWrapper;
use crate::std_prelude::*;

impl<Chain, Counterparty> HasCreateClientOptions<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type CreateClientPayloadOptions = Chain::CreateClientPayloadOptions;
}

impl<Chain, Counterparty> HasCreateClientPayload<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type CreateClientPayload = Chain::CreateClientPayload;
}
Expand All @@ -38,7 +38,7 @@ impl<Chain, Counterparty> HasCreateClientEvent<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
type CreateClientEvent = Chain::CreateClientEvent;

Expand All @@ -56,7 +56,7 @@ impl<Chain, Counterparty> CanBuildCreateClientPayload<OfaChainWrapper<Counterpar
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_create_client_payload(
&self,
Expand All @@ -73,7 +73,7 @@ impl<Chain, Counterparty> CanBuildCreateClientMessage<OfaChainWrapper<Counterpar
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_create_client_message(
&self,
Expand All @@ -89,8 +89,8 @@ where
impl<Chain, Counterparty> HasClientStateType<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type ClientState = Chain::ClientState;
}
Expand All @@ -99,8 +99,8 @@ where
impl<Chain, Counterparty> HasUpdateClientPayload<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type UpdateClientPayload = Chain::UpdateClientPayload;
}
Expand All @@ -110,7 +110,7 @@ impl<Chain, Counterparty> CanBuildUpdateClientPayload<OfaChainWrapper<Counterpar
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_update_client_payload(
&self,
Expand All @@ -129,7 +129,7 @@ impl<Chain, Counterparty> CanBuildUpdateClientMessage<OfaChainWrapper<Counterpar
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_update_client_message(
&self,
Expand All @@ -147,7 +147,7 @@ impl<Chain, Counterparty> CanFindConsensusStateHeight<OfaChainWrapper<Counterpar
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn find_consensus_state_height_before(
&self,
Expand All @@ -164,7 +164,7 @@ impl<Chain, Counterparty> HasClientStateFields<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
fn client_state_latest_height(client_state: &Self::ClientState) -> &Self::Height {
Chain::client_state_latest_height(client_state)
Expand All @@ -176,7 +176,7 @@ impl<Chain, Counterparty> CanQueryClientState<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn query_client_state(
&self,
Expand Down
40 changes: 23 additions & 17 deletions crates/relayer-all-in-one/src/one_for_all/impls/chain/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ use ibc_relayer_components::chain::traits::types::ibc_events::connection::{
HasConnectionOpenInitEvent, HasConnectionOpenTryEvent,
};

use crate::one_for_all::traits::chain::OfaIbcChain;
use crate::one_for_all::traits::chain::{OfaChainTypes, OfaIbcChain};
use crate::one_for_all::types::chain::OfaChainWrapper;
use crate::std_prelude::*;

impl<Chain, Counterparty> HasConnectionHandshakePayloads<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type ConnectionOpenInitPayload = Chain::ConnectionOpenInitPayload;

Expand All @@ -32,26 +32,26 @@ where
impl<Chain, Counterparty> HasInitConnectionOptionsType<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type InitConnectionOptions = Chain::InitConnectionOptions;
}

impl<Chain, Counterparty> HasConnectionVersionType<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type ConnectionVersion = Chain::ConnectionVersion;
}

impl<Chain, Counterparty> HasConnectionDetailsType<OfaChainWrapper<Counterparty>>
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Chain: OfaChainTypes,
Counterparty: OfaChainTypes,
{
type ConnectionDetails = Chain::ConnectionDetails;
}
Expand All @@ -60,7 +60,7 @@ impl<Chain, Counterparty> HasConnectionOpenInitEvent<OfaChainWrapper<Counterpart
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
type ConnectionOpenInitEvent = Chain::ConnectionOpenInitEvent;

Expand All @@ -81,7 +81,7 @@ impl<Chain, Counterparty> HasConnectionOpenTryEvent<OfaChainWrapper<Counterparty
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
type ConnectionOpenTryEvent = Chain::ConnectionOpenTryEvent;

Expand All @@ -103,44 +103,50 @@ impl<Chain, Counterparty> CanBuildConnectionHandshakePayloads<OfaChainWrapper<Co
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_connection_open_init_payload(
&self,
client_state: &Self::ClientState,
) -> Result<Self::ConnectionOpenInitPayload, Self::Error> {
self.chain.build_connection_open_init_payload().await
self.chain
.build_connection_open_init_payload(client_state)
.await
}

async fn build_connection_open_try_payload(
&self,
client_state: &Self::ClientState,
height: &Self::Height,
client_id: &Self::ClientId,
connection_id: &Self::ConnectionId,
) -> Result<Self::ConnectionOpenTryPayload, Self::Error> {
self.chain
.build_connection_open_try_payload(height, client_id, connection_id)
.build_connection_open_try_payload(client_state, height, client_id, connection_id)
.await
}

async fn build_connection_open_ack_payload(
&self,
client_state: &Self::ClientState,
height: &Self::Height,
client_id: &Self::ClientId,
connection_id: &Self::ConnectionId,
) -> Result<Self::ConnectionOpenAckPayload, Self::Error> {
self.chain
.build_connection_open_ack_payload(height, client_id, connection_id)
.build_connection_open_ack_payload(client_state, height, client_id, connection_id)
.await
}

async fn build_connection_open_confirm_payload(
&self,
client_state: &Self::ClientState,
height: &Self::Height,
client_id: &Self::ClientId,
connection_id: &Self::ConnectionId,
) -> Result<Self::ConnectionOpenConfirmPayload, Self::Error> {
self.chain
.build_connection_open_confirm_payload(height, client_id, connection_id)
.build_connection_open_confirm_payload(client_state, height, client_id, connection_id)
.await
}
}
Expand All @@ -150,7 +156,7 @@ impl<Chain, Counterparty> CanBuildConnectionHandshakeMessages<OfaChainWrapper<Co
for OfaChainWrapper<Chain>
where
Chain: OfaIbcChain<Counterparty>,
Counterparty: OfaIbcChain<Chain>,
Counterparty: OfaChainTypes,
{
async fn build_connection_open_init_message(
&self,
Expand Down
Loading
Loading