diff --git a/bridges/relays/bin-substrate/src/chains/millau.rs b/bridges/relays/bin-substrate/src/chains/millau.rs new file mode 100644 index 000000000000..ac5e611fdbcb --- /dev/null +++ b/bridges/relays/bin-substrate/src/chains/millau.rs @@ -0,0 +1,101 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Millau chain specification for CLI. + +use crate::cli::{ + bridge, + encode_call::{self, Call, CliEncodeCall}, + encode_message, send_message, CliChain, +}; +use codec::Decode; +use frame_support::weights::{GetDispatchInfo, Weight}; +use pallet_bridge_dispatch::{CallOrigin, MessagePayload}; +use relay_millau_client::Millau; +use sp_version::RuntimeVersion; + +impl CliEncodeCall for Millau { + fn max_extrinsic_size() -> u32 { + bp_millau::max_extrinsic_size() + } + + fn encode_call(call: &Call) -> anyhow::Result { + Ok(match call { + Call::Raw { data } => Decode::decode(&mut &*data.0)?, + Call::Remark { remark_payload, .. } => millau_runtime::Call::System(millau_runtime::SystemCall::remark( + remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), + )), + Call::Transfer { recipient, amount } => millau_runtime::Call::Balances( + millau_runtime::BalancesCall::transfer(recipient.raw_id(), amount.cast()), + ), + Call::BridgeSendMessage { + lane, + payload, + fee, + bridge_instance_index, + } => match *bridge_instance_index { + bridge::MILLAU_TO_RIALTO_INDEX => { + let payload = Decode::decode(&mut &*payload.0)?; + millau_runtime::Call::BridgeRialtoMessages(millau_runtime::MessagesCall::send_message( + lane.0, + payload, + fee.cast(), + )) + } + _ => anyhow::bail!( + "Unsupported target bridge pallet with instance index: {}", + bridge_instance_index + ), + }, + }) + } +} + +impl CliChain for Millau { + const RUNTIME_VERSION: RuntimeVersion = millau_runtime::VERSION; + + type KeyPair = sp_core::sr25519::Pair; + type MessagePayload = MessagePayload>; + + fn ss58_format() -> u16 { + millau_runtime::SS58Prefix::get() as u16 + } + + fn max_extrinsic_weight() -> Weight { + bp_millau::max_extrinsic_weight() + } + + // TODO [#854|#843] support multiple bridges? + fn encode_message(message: encode_message::MessagePayload) -> Result { + match message { + encode_message::MessagePayload::Raw { data } => MessagePayload::decode(&mut &*data.0) + .map_err(|e| format!("Failed to decode Millau's MessagePayload: {:?}", e)), + encode_message::MessagePayload::Call { mut call, mut sender } => { + type Source = Millau; + type Target = relay_rialto_client::Rialto; + + sender.enforce_chain::(); + let spec_version = Target::RUNTIME_VERSION.spec_version; + let origin = CallOrigin::SourceAccount(sender.raw_id()); + encode_call::preprocess_call::(&mut call, bridge::MILLAU_TO_RIALTO_INDEX); + let call = Target::encode_call(&call).map_err(|e| e.to_string())?; + let weight = call.get_dispatch_info().weight; + + Ok(send_message::message_payload(spec_version, weight, origin, &call)) + } + } + } +} diff --git a/bridges/relays/bin-substrate/src/rialto_millau/millau_headers_to_rialto.rs b/bridges/relays/bin-substrate/src/chains/millau_headers_to_rialto.rs similarity index 100% rename from bridges/relays/bin-substrate/src/rialto_millau/millau_headers_to_rialto.rs rename to bridges/relays/bin-substrate/src/chains/millau_headers_to_rialto.rs diff --git a/bridges/relays/bin-substrate/src/rialto_millau/millau_messages_to_rialto.rs b/bridges/relays/bin-substrate/src/chains/millau_messages_to_rialto.rs similarity index 100% rename from bridges/relays/bin-substrate/src/rialto_millau/millau_messages_to_rialto.rs rename to bridges/relays/bin-substrate/src/chains/millau_messages_to_rialto.rs diff --git a/bridges/relays/bin-substrate/src/rialto_millau/mod.rs b/bridges/relays/bin-substrate/src/chains/mod.rs similarity index 63% rename from bridges/relays/bin-substrate/src/rialto_millau/mod.rs rename to bridges/relays/bin-substrate/src/chains/mod.rs index cf86f781c0af..1f6b4134ce84 100644 --- a/bridges/relays/bin-substrate/src/rialto_millau/mod.rs +++ b/bridges/relays/bin-substrate/src/chains/mod.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -//! Rialto <> Millau Bridge commands. +//! Chain-specific relayer configuration. pub mod millau_headers_to_rialto; pub mod millau_messages_to_rialto; @@ -24,20 +24,12 @@ pub mod rococo_headers_to_westend; pub mod westend_headers_to_millau; pub mod westend_headers_to_rococo; -use crate::cli::{ - bridge, - encode_call::{self, Call, CliEncodeCall}, - encode_message, send_message, CliChain, -}; -use codec::Decode; -use frame_support::weights::{GetDispatchInfo, Weight}; -use pallet_bridge_dispatch::{CallOrigin, MessagePayload}; -use relay_millau_client::Millau; -use relay_rialto_client::Rialto; -use relay_rococo_client::Rococo; +mod millau; +mod rialto; +mod rococo; +mod westend; + use relay_utils::metrics::{FloatJsonValueMetric, MetricsParams}; -use relay_westend_client::Westend; -use sp_version::RuntimeVersion; pub(crate) fn add_polkadot_kusama_price_metrics( params: MetricsParams, @@ -72,192 +64,14 @@ pub(crate) fn add_polkadot_kusama_price_metrics u32 { - bp_millau::max_extrinsic_size() - } - - fn encode_call(call: &Call) -> anyhow::Result { - Ok(match call { - Call::Raw { data } => Decode::decode(&mut &*data.0)?, - Call::Remark { remark_payload, .. } => millau_runtime::Call::System(millau_runtime::SystemCall::remark( - remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), - )), - Call::Transfer { recipient, amount } => millau_runtime::Call::Balances( - millau_runtime::BalancesCall::transfer(recipient.raw_id(), amount.cast()), - ), - Call::BridgeSendMessage { - lane, - payload, - fee, - bridge_instance_index, - } => match *bridge_instance_index { - bridge::MILLAU_TO_RIALTO_INDEX => { - let payload = Decode::decode(&mut &*payload.0)?; - millau_runtime::Call::BridgeRialtoMessages(millau_runtime::MessagesCall::send_message( - lane.0, - payload, - fee.cast(), - )) - } - _ => anyhow::bail!( - "Unsupported target bridge pallet with instance index: {}", - bridge_instance_index - ), - }, - }) - } -} - -impl CliChain for Millau { - const RUNTIME_VERSION: RuntimeVersion = millau_runtime::VERSION; - - type KeyPair = sp_core::sr25519::Pair; - type MessagePayload = MessagePayload>; - - fn ss58_format() -> u16 { - millau_runtime::SS58Prefix::get() as u16 - } - - fn max_extrinsic_weight() -> Weight { - bp_millau::max_extrinsic_weight() - } - - // TODO [#854|#843] support multiple bridges? - fn encode_message(message: encode_message::MessagePayload) -> Result { - match message { - encode_message::MessagePayload::Raw { data } => MessagePayload::decode(&mut &*data.0) - .map_err(|e| format!("Failed to decode Millau's MessagePayload: {:?}", e)), - encode_message::MessagePayload::Call { mut call, mut sender } => { - type Source = Millau; - type Target = Rialto; - - sender.enforce_chain::(); - let spec_version = Target::RUNTIME_VERSION.spec_version; - let origin = CallOrigin::SourceAccount(sender.raw_id()); - encode_call::preprocess_call::(&mut call, bridge::MILLAU_TO_RIALTO_INDEX); - let call = Target::encode_call(&call).map_err(|e| e.to_string())?; - let weight = call.get_dispatch_info().weight; - - Ok(send_message::message_payload(spec_version, weight, origin, &call)) - } - } - } -} - -impl CliEncodeCall for Rialto { - fn max_extrinsic_size() -> u32 { - bp_rialto::max_extrinsic_size() - } - - fn encode_call(call: &Call) -> anyhow::Result { - Ok(match call { - Call::Raw { data } => Decode::decode(&mut &*data.0)?, - Call::Remark { remark_payload, .. } => rialto_runtime::Call::System(rialto_runtime::SystemCall::remark( - remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), - )), - Call::Transfer { recipient, amount } => { - rialto_runtime::Call::Balances(rialto_runtime::BalancesCall::transfer(recipient.raw_id(), amount.0)) - } - Call::BridgeSendMessage { - lane, - payload, - fee, - bridge_instance_index, - } => match *bridge_instance_index { - bridge::RIALTO_TO_MILLAU_INDEX => { - let payload = Decode::decode(&mut &*payload.0)?; - rialto_runtime::Call::BridgeMillauMessages(rialto_runtime::MessagesCall::send_message( - lane.0, payload, fee.0, - )) - } - _ => anyhow::bail!( - "Unsupported target bridge pallet with instance index: {}", - bridge_instance_index - ), - }, - }) - } -} - -impl CliChain for Rialto { - const RUNTIME_VERSION: RuntimeVersion = rialto_runtime::VERSION; - - type KeyPair = sp_core::sr25519::Pair; - type MessagePayload = MessagePayload>; - - fn ss58_format() -> u16 { - rialto_runtime::SS58Prefix::get() as u16 - } - - fn max_extrinsic_weight() -> Weight { - bp_rialto::max_extrinsic_weight() - } - - fn encode_message(message: encode_message::MessagePayload) -> Result { - match message { - encode_message::MessagePayload::Raw { data } => MessagePayload::decode(&mut &*data.0) - .map_err(|e| format!("Failed to decode Rialto's MessagePayload: {:?}", e)), - encode_message::MessagePayload::Call { mut call, mut sender } => { - type Source = Rialto; - type Target = Millau; - - sender.enforce_chain::(); - let spec_version = Target::RUNTIME_VERSION.spec_version; - let origin = CallOrigin::SourceAccount(sender.raw_id()); - encode_call::preprocess_call::(&mut call, bridge::RIALTO_TO_MILLAU_INDEX); - let call = Target::encode_call(&call).map_err(|e| e.to_string())?; - let weight = call.get_dispatch_info().weight; - - Ok(send_message::message_payload(spec_version, weight, origin, &call)) - } - } - } -} - -impl CliChain for Westend { - const RUNTIME_VERSION: RuntimeVersion = bp_westend::VERSION; - - type KeyPair = sp_core::sr25519::Pair; - type MessagePayload = (); - - fn ss58_format() -> u16 { - 42 - } - - fn max_extrinsic_weight() -> Weight { - 0 - } - - fn encode_message(_message: encode_message::MessagePayload) -> Result { - Err("Sending messages from Westend is not yet supported.".into()) - } -} - -impl CliChain for Rococo { - const RUNTIME_VERSION: RuntimeVersion = bp_rococo::VERSION; - - type KeyPair = sp_core::sr25519::Pair; - type MessagePayload = (); - - fn ss58_format() -> u16 { - 42 - } - - fn max_extrinsic_weight() -> Weight { - 0 - } - - fn encode_message(_message: encode_message::MessagePayload) -> Result { - Err("Sending messages from Rococo is not yet supported.".into()) - } -} - #[cfg(test)] mod tests { - use super::*; + use crate::cli::{encode_call, send_message}; use bp_messages::source_chain::TargetHeaderChain; use codec::Encode; + use frame_support::dispatch::GetDispatchInfo; + use relay_millau_client::Millau; + use relay_rialto_client::Rialto; use relay_substrate_client::TransactionSignScheme; use sp_core::Pair; use sp_runtime::traits::{IdentifyAccount, Verify}; diff --git a/bridges/relays/bin-substrate/src/chains/rialto.rs b/bridges/relays/bin-substrate/src/chains/rialto.rs new file mode 100644 index 000000000000..25c1ab04c9fd --- /dev/null +++ b/bridges/relays/bin-substrate/src/chains/rialto.rs @@ -0,0 +1,98 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Rialto chain specification for CLI. + +use crate::cli::{ + bridge, + encode_call::{self, Call, CliEncodeCall}, + encode_message, send_message, CliChain, +}; +use codec::Decode; +use frame_support::weights::{GetDispatchInfo, Weight}; +use pallet_bridge_dispatch::{CallOrigin, MessagePayload}; +use relay_rialto_client::Rialto; +use sp_version::RuntimeVersion; + +impl CliEncodeCall for Rialto { + fn max_extrinsic_size() -> u32 { + bp_rialto::max_extrinsic_size() + } + + fn encode_call(call: &Call) -> anyhow::Result { + Ok(match call { + Call::Raw { data } => Decode::decode(&mut &*data.0)?, + Call::Remark { remark_payload, .. } => rialto_runtime::Call::System(rialto_runtime::SystemCall::remark( + remark_payload.as_ref().map(|x| x.0.clone()).unwrap_or_default(), + )), + Call::Transfer { recipient, amount } => { + rialto_runtime::Call::Balances(rialto_runtime::BalancesCall::transfer(recipient.raw_id(), amount.0)) + } + Call::BridgeSendMessage { + lane, + payload, + fee, + bridge_instance_index, + } => match *bridge_instance_index { + bridge::RIALTO_TO_MILLAU_INDEX => { + let payload = Decode::decode(&mut &*payload.0)?; + rialto_runtime::Call::BridgeMillauMessages(rialto_runtime::MessagesCall::send_message( + lane.0, payload, fee.0, + )) + } + _ => anyhow::bail!( + "Unsupported target bridge pallet with instance index: {}", + bridge_instance_index + ), + }, + }) + } +} + +impl CliChain for Rialto { + const RUNTIME_VERSION: RuntimeVersion = rialto_runtime::VERSION; + + type KeyPair = sp_core::sr25519::Pair; + type MessagePayload = MessagePayload>; + + fn ss58_format() -> u16 { + rialto_runtime::SS58Prefix::get() as u16 + } + + fn max_extrinsic_weight() -> Weight { + bp_rialto::max_extrinsic_weight() + } + + fn encode_message(message: encode_message::MessagePayload) -> Result { + match message { + encode_message::MessagePayload::Raw { data } => MessagePayload::decode(&mut &*data.0) + .map_err(|e| format!("Failed to decode Rialto's MessagePayload: {:?}", e)), + encode_message::MessagePayload::Call { mut call, mut sender } => { + type Source = Rialto; + type Target = relay_millau_client::Millau; + + sender.enforce_chain::(); + let spec_version = Target::RUNTIME_VERSION.spec_version; + let origin = CallOrigin::SourceAccount(sender.raw_id()); + encode_call::preprocess_call::(&mut call, bridge::RIALTO_TO_MILLAU_INDEX); + let call = Target::encode_call(&call).map_err(|e| e.to_string())?; + let weight = call.get_dispatch_info().weight; + + Ok(send_message::message_payload(spec_version, weight, origin, &call)) + } + } + } +} diff --git a/bridges/relays/bin-substrate/src/rialto_millau/rialto_headers_to_millau.rs b/bridges/relays/bin-substrate/src/chains/rialto_headers_to_millau.rs similarity index 100% rename from bridges/relays/bin-substrate/src/rialto_millau/rialto_headers_to_millau.rs rename to bridges/relays/bin-substrate/src/chains/rialto_headers_to_millau.rs diff --git a/bridges/relays/bin-substrate/src/rialto_millau/rialto_messages_to_millau.rs b/bridges/relays/bin-substrate/src/chains/rialto_messages_to_millau.rs similarity index 100% rename from bridges/relays/bin-substrate/src/rialto_millau/rialto_messages_to_millau.rs rename to bridges/relays/bin-substrate/src/chains/rialto_messages_to_millau.rs diff --git a/bridges/relays/bin-substrate/src/chains/rococo.rs b/bridges/relays/bin-substrate/src/chains/rococo.rs new file mode 100644 index 000000000000..0bcf388c3462 --- /dev/null +++ b/bridges/relays/bin-substrate/src/chains/rococo.rs @@ -0,0 +1,39 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +use crate::cli::{encode_message, CliChain}; +use frame_support::weights::Weight; +use relay_rococo_client::Rococo; +use sp_version::RuntimeVersion; + +impl CliChain for Rococo { + const RUNTIME_VERSION: RuntimeVersion = bp_rococo::VERSION; + + type KeyPair = sp_core::sr25519::Pair; + type MessagePayload = (); + + fn ss58_format() -> u16 { + 42 + } + + fn max_extrinsic_weight() -> Weight { + 0 + } + + fn encode_message(_message: encode_message::MessagePayload) -> Result { + Err("Sending messages from Rococo is not yet supported.".into()) + } +} diff --git a/bridges/relays/bin-substrate/src/rialto_millau/rococo_headers_to_westend.rs b/bridges/relays/bin-substrate/src/chains/rococo_headers_to_westend.rs similarity index 96% rename from bridges/relays/bin-substrate/src/rialto_millau/rococo_headers_to_westend.rs rename to bridges/relays/bin-substrate/src/chains/rococo_headers_to_westend.rs index 82905b4d89b7..dca91adb3df6 100644 --- a/bridges/relays/bin-substrate/src/rialto_millau/rococo_headers_to_westend.rs +++ b/bridges/relays/bin-substrate/src/chains/rococo_headers_to_westend.rs @@ -35,7 +35,7 @@ impl SubstrateFinalitySyncPipeline for RococoFinalityToWestend { type TargetChain = Westend; fn customize_metrics(params: MetricsParams) -> anyhow::Result { - crate::rialto_millau::add_polkadot_kusama_price_metrics::(params) + crate::chains::add_polkadot_kusama_price_metrics::(params) } fn transactions_author(&self) -> bp_westend::AccountId { diff --git a/bridges/relays/bin-substrate/src/chains/westend.rs b/bridges/relays/bin-substrate/src/chains/westend.rs new file mode 100644 index 000000000000..27621472d6d9 --- /dev/null +++ b/bridges/relays/bin-substrate/src/chains/westend.rs @@ -0,0 +1,41 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Westend chain specification for CLI. + +use crate::cli::{encode_message, CliChain}; +use frame_support::weights::Weight; +use relay_westend_client::Westend; +use sp_version::RuntimeVersion; + +impl CliChain for Westend { + const RUNTIME_VERSION: RuntimeVersion = bp_westend::VERSION; + + type KeyPair = sp_core::sr25519::Pair; + type MessagePayload = (); + + fn ss58_format() -> u16 { + 42 + } + + fn max_extrinsic_weight() -> Weight { + 0 + } + + fn encode_message(_message: encode_message::MessagePayload) -> Result { + Err("Sending messages from Westend is not yet supported.".into()) + } +} diff --git a/bridges/relays/bin-substrate/src/rialto_millau/westend_headers_to_millau.rs b/bridges/relays/bin-substrate/src/chains/westend_headers_to_millau.rs similarity index 97% rename from bridges/relays/bin-substrate/src/rialto_millau/westend_headers_to_millau.rs rename to bridges/relays/bin-substrate/src/chains/westend_headers_to_millau.rs index 798cc7c611cf..1523dc1be584 100644 --- a/bridges/relays/bin-substrate/src/rialto_millau/westend_headers_to_millau.rs +++ b/bridges/relays/bin-substrate/src/chains/westend_headers_to_millau.rs @@ -35,7 +35,7 @@ impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau { type TargetChain = Millau; fn customize_metrics(params: MetricsParams) -> anyhow::Result { - crate::rialto_millau::add_polkadot_kusama_price_metrics::(params) + crate::chains::add_polkadot_kusama_price_metrics::(params) } fn transactions_author(&self) -> bp_millau::AccountId { diff --git a/bridges/relays/bin-substrate/src/rialto_millau/westend_headers_to_rococo.rs b/bridges/relays/bin-substrate/src/chains/westend_headers_to_rococo.rs similarity index 96% rename from bridges/relays/bin-substrate/src/rialto_millau/westend_headers_to_rococo.rs rename to bridges/relays/bin-substrate/src/chains/westend_headers_to_rococo.rs index b57cc75781f4..577a858d9229 100644 --- a/bridges/relays/bin-substrate/src/rialto_millau/westend_headers_to_rococo.rs +++ b/bridges/relays/bin-substrate/src/chains/westend_headers_to_rococo.rs @@ -35,7 +35,7 @@ impl SubstrateFinalitySyncPipeline for WestendFinalityToRococo { type TargetChain = Rococo; fn customize_metrics(params: MetricsParams) -> anyhow::Result { - crate::rialto_millau::add_polkadot_kusama_price_metrics::(params) + crate::chains::add_polkadot_kusama_price_metrics::(params) } fn transactions_author(&self) -> bp_rococo::AccountId { diff --git a/bridges/relays/bin-substrate/src/cli/bridge.rs b/bridges/relays/bin-substrate/src/cli/bridge.rs index 5a5715699cf0..faf4417d1e99 100644 --- a/bridges/relays/bin-substrate/src/cli/bridge.rs +++ b/bridges/relays/bin-substrate/src/cli/bridge.rs @@ -57,7 +57,7 @@ macro_rules! select_full_bridge { // Relay-messages #[allow(unused_imports)] - use crate::rialto_millau::millau_messages_to_rialto::run as relay_messages; + use crate::chains::millau_messages_to_rialto::run as relay_messages; // Send-message / Estimate-fee #[allow(unused_imports)] @@ -79,7 +79,7 @@ macro_rules! select_full_bridge { // Relay-messages #[allow(unused_imports)] - use crate::rialto_millau::rialto_messages_to_millau::run as relay_messages; + use crate::chains::rialto_messages_to_millau::run as relay_messages; // Send-message / Estimate-fee #[allow(unused_imports)] diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers.rs b/bridges/relays/bin-substrate/src/cli/relay_headers.rs index 8137f8a240da..346790f2ae74 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers.rs @@ -53,35 +53,35 @@ macro_rules! select_bridge { RelayHeadersBridge::MillauToRialto => { type Source = relay_millau_client::Millau; type Target = relay_rialto_client::Rialto; - type Finality = crate::rialto_millau::millau_headers_to_rialto::MillauFinalityToRialto; + type Finality = crate::chains::millau_headers_to_rialto::MillauFinalityToRialto; $generic } RelayHeadersBridge::RialtoToMillau => { type Source = relay_rialto_client::Rialto; type Target = relay_millau_client::Millau; - type Finality = crate::rialto_millau::rialto_headers_to_millau::RialtoFinalityToMillau; + type Finality = crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau; $generic } RelayHeadersBridge::WestendToMillau => { type Source = relay_westend_client::Westend; type Target = relay_millau_client::Millau; - type Finality = crate::rialto_millau::westend_headers_to_millau::WestendFinalityToMillau; + type Finality = crate::chains::westend_headers_to_millau::WestendFinalityToMillau; $generic } RelayHeadersBridge::WestendToRococo => { type Source = relay_westend_client::Westend; type Target = relay_rococo_client::Rococo; - type Finality = crate::rialto_millau::westend_headers_to_rococo::WestendFinalityToRococo; + type Finality = crate::chains::westend_headers_to_rococo::WestendFinalityToRococo; $generic } RelayHeadersBridge::RococoToWestend => { type Source = relay_rococo_client::Rococo; type Target = relay_westend_client::Westend; - type Finality = crate::rialto_millau::rococo_headers_to_westend::RococoFinalityToWestend; + type Finality = crate::chains::rococo_headers_to_westend::RococoFinalityToWestend; $generic } diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages.rs b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages.rs index ded79e0f4c9f..98ff1268fae9 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages.rs @@ -90,14 +90,14 @@ macro_rules! select_bridge { type Left = relay_millau_client::Millau; type Right = relay_rialto_client::Rialto; - type LeftToRightFinality = crate::rialto_millau::millau_headers_to_rialto::MillauFinalityToRialto; - type RightToLeftFinality = crate::rialto_millau::rialto_headers_to_millau::RialtoFinalityToMillau; + type LeftToRightFinality = crate::chains::millau_headers_to_rialto::MillauFinalityToRialto; + type RightToLeftFinality = crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau; - type LeftToRightMessages = crate::rialto_millau::millau_messages_to_rialto::MillauMessagesToRialto; - type RightToLeftMessages = crate::rialto_millau::rialto_messages_to_millau::RialtoMessagesToMillau; + type LeftToRightMessages = crate::chains::millau_messages_to_rialto::MillauMessagesToRialto; + type RightToLeftMessages = crate::chains::rialto_messages_to_millau::RialtoMessagesToMillau; - use crate::rialto_millau::millau_messages_to_rialto::run as left_to_right_messages; - use crate::rialto_millau::rialto_messages_to_millau::run as right_to_left_messages; + use crate::chains::millau_messages_to_rialto::run as left_to_right_messages; + use crate::chains::rialto_messages_to_millau::run as right_to_left_messages; $generic } diff --git a/bridges/relays/bin-substrate/src/main.rs b/bridges/relays/bin-substrate/src/main.rs index 81da25fcb7de..6bf7561fcdb3 100644 --- a/bridges/relays/bin-substrate/src/main.rs +++ b/bridges/relays/bin-substrate/src/main.rs @@ -20,6 +20,7 @@ use relay_utils::initialize::initialize_logger; +mod chains; mod cli; mod finality_pipeline; mod finality_target; @@ -29,8 +30,6 @@ mod messages_source; mod messages_target; mod on_demand_headers; -mod rialto_millau; - fn main() { initialize_logger(false); let command = cli::parse_args();