removed extra *_RUNTIME_VERSION consts from relay code (#1330)

This commit is contained in:
Svyatoslav Nikolsky
2022-02-25 11:34:57 +03:00
committed by Bastian Köcher
parent e29b590785
commit 60f82cf459
11 changed files with 19 additions and 145 deletions
@@ -77,11 +77,6 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)] #[allow(unused_imports)]
use millau_runtime::millau_to_rialto_account_ownership_digest as account_ownership_digest; use millau_runtime::millau_to_rialto_account_ownership_digest as account_ownership_digest;
#[allow(dead_code)]
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(millau_runtime::VERSION);
#[allow(dead_code)]
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(rialto_runtime::VERSION);
$generic $generic
} }
FullBridge::RialtoToMillau => { FullBridge::RialtoToMillau => {
@@ -105,11 +100,6 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)] #[allow(unused_imports)]
use rialto_runtime::rialto_to_millau_account_ownership_digest as account_ownership_digest; use rialto_runtime::rialto_to_millau_account_ownership_digest as account_ownership_digest;
#[allow(dead_code)]
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(rialto_runtime::VERSION);
#[allow(dead_code)]
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(millau_runtime::VERSION);
$generic $generic
} }
FullBridge::RococoToWococo => { FullBridge::RococoToWococo => {
@@ -132,11 +122,6 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)] #[allow(unused_imports)]
use relay_rococo_client::runtime::rococo_to_wococo_account_ownership_digest as account_ownership_digest; use relay_rococo_client::runtime::rococo_to_wococo_account_ownership_digest as account_ownership_digest;
#[allow(dead_code)]
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_rococo::VERSION);
#[allow(dead_code)]
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_wococo::VERSION);
$generic $generic
} }
FullBridge::WococoToRococo => { FullBridge::WococoToRococo => {
@@ -159,11 +144,6 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)] #[allow(unused_imports)]
use relay_wococo_client::runtime::wococo_to_rococo_account_ownership_digest as account_ownership_digest; use relay_wococo_client::runtime::wococo_to_rococo_account_ownership_digest as account_ownership_digest;
#[allow(dead_code)]
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_wococo::VERSION);
#[allow(dead_code)]
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_rococo::VERSION);
$generic $generic
} }
FullBridge::KusamaToPolkadot => { FullBridge::KusamaToPolkadot => {
@@ -186,11 +166,6 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)] #[allow(unused_imports)]
use relay_kusama_client::runtime::kusama_to_polkadot_account_ownership_digest as account_ownership_digest; use relay_kusama_client::runtime::kusama_to_polkadot_account_ownership_digest as account_ownership_digest;
#[allow(dead_code)]
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_kusama::VERSION);
#[allow(dead_code)]
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_polkadot::VERSION);
$generic $generic
} }
FullBridge::PolkadotToKusama => { FullBridge::PolkadotToKusama => {
@@ -213,11 +188,6 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)] #[allow(unused_imports)]
use relay_polkadot_client::runtime::polkadot_to_kusama_account_ownership_digest as account_ownership_digest; use relay_polkadot_client::runtime::polkadot_to_kusama_account_ownership_digest as account_ownership_digest;
#[allow(dead_code)]
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_polkadot::VERSION);
#[allow(dead_code)]
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> = Some(bp_kusama::VERSION);
$generic $generic
} }
} }
@@ -46,7 +46,7 @@ impl EstimateFee {
let Self { source, bridge, lane, payload } = self; let Self { source, bridge, lane, payload } = self;
select_full_bridge!(bridge, { select_full_bridge!(bridge, {
let source_client = source.to_client::<Source>(SOURCE_RUNTIME_VERSION).await?; let source_client = source.to_client::<Source>().await?;
let lane = lane.into(); let lane = lane.into();
let payload = let payload =
Source::encode_message(payload).map_err(|e| anyhow::format_err!("{:?}", e))?; Source::encode_message(payload).map_err(|e| anyhow::format_err!("{:?}", e))?;
@@ -56,10 +56,6 @@ macro_rules! select_bridge {
InitBridgeName::MillauToRialto => { InitBridgeName::MillauToRialto => {
type Source = relay_millau_client::Millau; type Source = relay_millau_client::Millau;
type Target = relay_rialto_client::Rialto; type Target = relay_rialto_client::Rialto;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -78,10 +74,6 @@ macro_rules! select_bridge {
InitBridgeName::RialtoToMillau => { InitBridgeName::RialtoToMillau => {
type Source = relay_rialto_client::Rialto; type Source = relay_rialto_client::Rialto;
type Target = relay_millau_client::Millau; type Target = relay_millau_client::Millau;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -100,10 +92,6 @@ macro_rules! select_bridge {
InitBridgeName::WestendToMillau => { InitBridgeName::WestendToMillau => {
type Source = relay_westend_client::Westend; type Source = relay_westend_client::Westend;
type Target = relay_millau_client::Millau; type Target = relay_millau_client::Millau;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_westend::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -126,10 +114,6 @@ macro_rules! select_bridge {
InitBridgeName::RococoToWococo => { InitBridgeName::RococoToWococo => {
type Source = relay_rococo_client::Rococo; type Source = relay_rococo_client::Rococo;
type Target = relay_wococo_client::Wococo; type Target = relay_wococo_client::Wococo;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_rococo::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_wococo::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -146,10 +130,6 @@ macro_rules! select_bridge {
InitBridgeName::WococoToRococo => { InitBridgeName::WococoToRococo => {
type Source = relay_wococo_client::Wococo; type Source = relay_wococo_client::Wococo;
type Target = relay_rococo_client::Rococo; type Target = relay_rococo_client::Rococo;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_wococo::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_rococo::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -166,10 +146,6 @@ macro_rules! select_bridge {
InitBridgeName::KusamaToPolkadot => { InitBridgeName::KusamaToPolkadot => {
type Source = relay_kusama_client::Kusama; type Source = relay_kusama_client::Kusama;
type Target = relay_polkadot_client::Polkadot; type Target = relay_polkadot_client::Polkadot;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_kusama::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_polkadot::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -186,10 +162,6 @@ macro_rules! select_bridge {
InitBridgeName::PolkadotToKusama => { InitBridgeName::PolkadotToKusama => {
type Source = relay_polkadot_client::Polkadot; type Source = relay_polkadot_client::Polkadot;
type Target = relay_kusama_client::Kusama; type Target = relay_kusama_client::Kusama;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_polkadot::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_kusama::VERSION);
fn encode_init_bridge( fn encode_init_bridge(
init_data: InitializationData<<Source as ChainBase>::Header>, init_data: InitializationData<<Source as ChainBase>::Header>,
@@ -211,8 +183,8 @@ impl InitBridge {
/// Run the command. /// Run the command.
pub async fn run(self) -> anyhow::Result<()> { pub async fn run(self) -> anyhow::Result<()> {
select_bridge!(self.bridge, { select_bridge!(self.bridge, {
let source_client = self.source.to_client::<Source>(SOURCE_RUNTIME_VERSION).await?; let source_client = self.source.to_client::<Source>().await?;
let target_client = self.target.to_client::<Target>(TARGET_RUNTIME_VERSION).await?; let target_client = self.target.to_client::<Target>().await?;
let target_sign = self.target_sign.to_keypair::<Target>()?; let target_sign = self.target_sign.to_keypair::<Target>()?;
let (spec_version, transaction_version) = let (spec_version, transaction_version) =
+3 -5
View File
@@ -541,11 +541,10 @@ macro_rules! declare_chain_options {
/// Convert connection params into Substrate client. /// Convert connection params into Substrate client.
pub async fn to_client<Chain: CliChain>( pub async fn to_client<Chain: CliChain>(
&self, &self,
bundle_runtime_version: Option<sp_version::RuntimeVersion>
) -> anyhow::Result<relay_substrate_client::Client<Chain>> { ) -> anyhow::Result<relay_substrate_client::Client<Chain>> {
let chain_runtime_version = self let chain_runtime_version = self
.[<$chain_prefix _runtime_version>] .[<$chain_prefix _runtime_version>]
.into_runtime_version(bundle_runtime_version)?; .into_runtime_version(Some(Chain::RUNTIME_VERSION))?;
Ok(relay_substrate_client::Client::new(relay_substrate_client::ConnectionParams { Ok(relay_substrate_client::Client::new(relay_substrate_client::ConnectionParams {
host: self.[<$chain_prefix _host>].clone(), host: self.[<$chain_prefix _host>].clone(),
port: self.[<$chain_prefix _port>], port: self.[<$chain_prefix _port>],
@@ -562,14 +561,13 @@ macro_rules! declare_chain_options {
#[allow(dead_code)] #[allow(dead_code)]
pub async fn selected_chain_spec_version<Chain: CliChain>( pub async fn selected_chain_spec_version<Chain: CliChain>(
&self, &self,
bundle_runtime_version: Option<sp_version::RuntimeVersion>,
) -> anyhow::Result<u32> { ) -> anyhow::Result<u32> {
let chain_runtime_version = self let chain_runtime_version = self
.[<$chain_prefix _runtime_version>] .[<$chain_prefix _runtime_version>]
.into_runtime_version(bundle_runtime_version.clone())?; .into_runtime_version(Some(Chain::RUNTIME_VERSION))?;
Ok(match chain_runtime_version { Ok(match chain_runtime_version {
ChainRuntimeVersion::Auto => self ChainRuntimeVersion::Auto => self
.to_client::<Chain>(bundle_runtime_version) .to_client::<Chain>()
.await? .await?
.simple_runtime_version() .simple_runtime_version()
.await? .await?
@@ -84,11 +84,6 @@ macro_rules! select_bridge {
use bp_rialto::{PARAS_PALLET_NAME, PARAS_REGISTRAR_PALLET_NAME}; use bp_rialto::{PARAS_PALLET_NAME, PARAS_REGISTRAR_PALLET_NAME};
const RELAY_CHAIN_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
const PARA_CHAIN_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_parachain_runtime::VERSION);
$generic $generic
}, },
} }
@@ -99,13 +94,9 @@ impl RegisterParachain {
/// Run the command. /// Run the command.
pub async fn run(self) -> anyhow::Result<()> { pub async fn run(self) -> anyhow::Result<()> {
select_bridge!(self.parachain, { select_bridge!(self.parachain, {
let relay_client = self let relay_client = self.relay_connection.to_client::<Relaychain>().await?;
.relay_connection
.to_client::<Relaychain>(RELAY_CHAIN_RUNTIME_VERSION)
.await?;
let relay_sign = self.relay_sign.to_keypair::<Relaychain>()?; let relay_sign = self.relay_sign.to_keypair::<Relaychain>()?;
let para_client = let para_client = self.para_connection.to_client::<Parachain>().await?;
self.para_connection.to_client::<Parachain>(PARA_CHAIN_RUNTIME_VERSION).await?;
// hopefully we're the only actor that is registering parachain right now // hopefully we're the only actor that is registering parachain right now
// => read next parachain id // => read next parachain id
@@ -64,10 +64,6 @@ macro_rules! select_bridge {
type Source = relay_millau_client::Millau; type Source = relay_millau_client::Millau;
type Target = relay_rialto_client::Rialto; type Target = relay_rialto_client::Rialto;
type Finality = crate::chains::millau_headers_to_rialto::MillauFinalityToRialto; type Finality = crate::chains::millau_headers_to_rialto::MillauFinalityToRialto;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
$generic $generic
}, },
@@ -75,10 +71,6 @@ macro_rules! select_bridge {
type Source = relay_rialto_client::Rialto; type Source = relay_rialto_client::Rialto;
type Target = relay_millau_client::Millau; type Target = relay_millau_client::Millau;
type Finality = crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau; type Finality = crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
$generic $generic
}, },
@@ -86,10 +78,6 @@ macro_rules! select_bridge {
type Source = relay_westend_client::Westend; type Source = relay_westend_client::Westend;
type Target = relay_millau_client::Millau; type Target = relay_millau_client::Millau;
type Finality = crate::chains::westend_headers_to_millau::WestendFinalityToMillau; type Finality = crate::chains::westend_headers_to_millau::WestendFinalityToMillau;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_westend::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
$generic $generic
}, },
@@ -97,10 +85,6 @@ macro_rules! select_bridge {
type Source = relay_rococo_client::Rococo; type Source = relay_rococo_client::Rococo;
type Target = relay_wococo_client::Wococo; type Target = relay_wococo_client::Wococo;
type Finality = crate::chains::rococo_headers_to_wococo::RococoFinalityToWococo; type Finality = crate::chains::rococo_headers_to_wococo::RococoFinalityToWococo;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_rococo::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_wococo::VERSION);
$generic $generic
}, },
@@ -108,10 +92,6 @@ macro_rules! select_bridge {
type Source = relay_wococo_client::Wococo; type Source = relay_wococo_client::Wococo;
type Target = relay_rococo_client::Rococo; type Target = relay_rococo_client::Rococo;
type Finality = crate::chains::wococo_headers_to_rococo::WococoFinalityToRococo; type Finality = crate::chains::wococo_headers_to_rococo::WococoFinalityToRococo;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_wococo::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_rococo::VERSION);
$generic $generic
}, },
@@ -119,10 +99,6 @@ macro_rules! select_bridge {
type Source = relay_kusama_client::Kusama; type Source = relay_kusama_client::Kusama;
type Target = relay_polkadot_client::Polkadot; type Target = relay_polkadot_client::Polkadot;
type Finality = crate::chains::kusama_headers_to_polkadot::KusamaFinalityToPolkadot; type Finality = crate::chains::kusama_headers_to_polkadot::KusamaFinalityToPolkadot;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_kusama::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_polkadot::VERSION);
$generic $generic
}, },
@@ -130,10 +106,6 @@ macro_rules! select_bridge {
type Source = relay_polkadot_client::Polkadot; type Source = relay_polkadot_client::Polkadot;
type Target = relay_kusama_client::Kusama; type Target = relay_kusama_client::Kusama;
type Finality = crate::chains::polkadot_headers_to_kusama::PolkadotFinalityToKusama; type Finality = crate::chains::polkadot_headers_to_kusama::PolkadotFinalityToKusama;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_polkadot::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_kusama::VERSION);
$generic $generic
}, },
@@ -145,8 +117,8 @@ impl RelayHeaders {
/// Run the command. /// Run the command.
pub async fn run(self) -> anyhow::Result<()> { pub async fn run(self) -> anyhow::Result<()> {
select_bridge!(self.bridge, { select_bridge!(self.bridge, {
let source_client = self.source.to_client::<Source>(SOURCE_RUNTIME_VERSION).await?; let source_client = self.source.to_client::<Source>().await?;
let target_client = self.target.to_client::<Target>(TARGET_RUNTIME_VERSION).await?; let target_client = self.target.to_client::<Target>().await?;
let target_transactions_mortality = self.target_sign.target_transactions_mortality; let target_transactions_mortality = self.target_sign.target_transactions_mortality;
let target_sign = self.target_sign.to_keypair::<Target>()?; let target_sign = self.target_sign.to_keypair::<Target>()?;
@@ -133,11 +133,6 @@ macro_rules! select_bridge {
type LeftAccountIdConverter = bp_millau::AccountIdConverter; type LeftAccountIdConverter = bp_millau::AccountIdConverter;
type RightAccountIdConverter = bp_rialto::AccountIdConverter; type RightAccountIdConverter = bp_rialto::AccountIdConverter;
const LEFT_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
const RIGHT_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
use crate::chains::{ use crate::chains::{
millau_messages_to_rialto::{ millau_messages_to_rialto::{
update_rialto_to_millau_conversion_rate as update_right_to_left_conversion_rate, update_rialto_to_millau_conversion_rate as update_right_to_left_conversion_rate,
@@ -181,11 +176,6 @@ macro_rules! select_bridge {
type LeftAccountIdConverter = bp_rococo::AccountIdConverter; type LeftAccountIdConverter = bp_rococo::AccountIdConverter;
type RightAccountIdConverter = bp_wococo::AccountIdConverter; type RightAccountIdConverter = bp_wococo::AccountIdConverter;
const LEFT_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_rococo::VERSION);
const RIGHT_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_wococo::VERSION);
use crate::chains::{ use crate::chains::{
rococo_messages_to_wococo::RococoMessagesToWococo as LeftToRightMessageLane, rococo_messages_to_wococo::RococoMessagesToWococo as LeftToRightMessageLane,
wococo_messages_to_rococo::WococoMessagesToRococo as RightToLeftMessageLane, wococo_messages_to_rococo::WococoMessagesToRococo as RightToLeftMessageLane,
@@ -259,11 +249,6 @@ macro_rules! select_bridge {
type LeftAccountIdConverter = bp_kusama::AccountIdConverter; type LeftAccountIdConverter = bp_kusama::AccountIdConverter;
type RightAccountIdConverter = bp_polkadot::AccountIdConverter; type RightAccountIdConverter = bp_polkadot::AccountIdConverter;
const LEFT_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_kusama::VERSION);
const RIGHT_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_polkadot::VERSION);
use crate::chains::{ use crate::chains::{
kusama_messages_to_polkadot::{ kusama_messages_to_polkadot::{
update_polkadot_to_kusama_conversion_rate as update_right_to_left_conversion_rate, update_polkadot_to_kusama_conversion_rate as update_right_to_left_conversion_rate,
@@ -335,12 +320,12 @@ impl RelayHeadersAndMessages {
select_bridge!(self, { select_bridge!(self, {
let params: Params = self.into(); let params: Params = self.into();
let left_client = params.left.to_client::<Left>(LEFT_RUNTIME_VERSION).await?; let left_client = params.left.to_client::<Left>().await?;
let left_transactions_mortality = params.left_sign.transactions_mortality()?; let left_transactions_mortality = params.left_sign.transactions_mortality()?;
let left_sign = params.left_sign.to_keypair::<Left>()?; let left_sign = params.left_sign.to_keypair::<Left>()?;
let left_messages_pallet_owner = let left_messages_pallet_owner =
params.left_messages_pallet_owner.to_keypair::<Left>()?; params.left_messages_pallet_owner.to_keypair::<Left>()?;
let right_client = params.right.to_client::<Right>(RIGHT_RUNTIME_VERSION).await?; let right_client = params.right.to_client::<Right>().await?;
let right_transactions_mortality = params.right_sign.transactions_mortality()?; let right_transactions_mortality = params.right_sign.transactions_mortality()?;
let right_sign = params.right_sign.to_keypair::<Right>()?; let right_sign = params.right_sign.to_keypair::<Right>()?;
let right_messages_pallet_owner = let right_messages_pallet_owner =
@@ -75,10 +75,10 @@ impl RelayMessages {
/// Run the command. /// Run the command.
pub async fn run(self) -> anyhow::Result<()> { pub async fn run(self) -> anyhow::Result<()> {
select_full_bridge!(self.bridge, { select_full_bridge!(self.bridge, {
let source_client = self.source.to_client::<Source>(SOURCE_RUNTIME_VERSION).await?; let source_client = self.source.to_client::<Source>().await?;
let source_sign = self.source_sign.to_keypair::<Source>()?; let source_sign = self.source_sign.to_keypair::<Source>()?;
let source_transactions_mortality = self.source_sign.transactions_mortality()?; let source_transactions_mortality = self.source_sign.transactions_mortality()?;
let target_client = self.target.to_client::<Target>(TARGET_RUNTIME_VERSION).await?; let target_client = self.target.to_client::<Target>().await?;
let target_sign = self.target_sign.to_keypair::<Target>()?; let target_sign = self.target_sign.to_keypair::<Target>()?;
let target_transactions_mortality = self.target_sign.transactions_mortality()?; let target_transactions_mortality = self.target_sign.transactions_mortality()?;
let relayer_mode = self.relayer_mode.into(); let relayer_mode = self.relayer_mode.into();
@@ -92,24 +92,18 @@ macro_rules! select_bridge {
RelayChain::Millau => { RelayChain::Millau => {
type Target = relay_millau_client::Millau; type Target = relay_millau_client::Millau;
type TargetSign = relay_millau_client::Millau; type TargetSign = relay_millau_client::Millau;
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
$generic $generic
}, },
RelayChain::Kusama => { RelayChain::Kusama => {
type Target = relay_kusama_client::Kusama; type Target = relay_kusama_client::Kusama;
type TargetSign = relay_kusama_client::Kusama; type TargetSign = relay_kusama_client::Kusama;
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_kusama::VERSION);
$generic $generic
}, },
RelayChain::Polkadot => { RelayChain::Polkadot => {
type Target = relay_polkadot_client::Polkadot; type Target = relay_polkadot_client::Polkadot;
type TargetSign = relay_polkadot_client::Polkadot; type TargetSign = relay_polkadot_client::Polkadot;
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(bp_polkadot::VERSION);
$generic $generic
}, },
@@ -122,7 +116,7 @@ impl ResubmitTransactions {
pub async fn run(self) -> anyhow::Result<()> { pub async fn run(self) -> anyhow::Result<()> {
select_bridge!(self.chain, { select_bridge!(self.chain, {
let relay_loop_name = format!("ResubmitTransactions{}", Target::NAME); let relay_loop_name = format!("ResubmitTransactions{}", Target::NAME);
let client = self.target.to_client::<Target>(TARGET_RUNTIME_VERSION).await?; let client = self.target.to_client::<Target>().await?;
let transaction_params = TransactionParams { let transaction_params = TransactionParams {
signer: self.target_sign.to_keypair::<Target>()?, signer: self.target_sign.to_keypair::<Target>()?,
mortality: self.target_sign.target_transactions_mortality, mortality: self.target_sign.target_transactions_mortality,
@@ -116,10 +116,7 @@ impl SendMessage {
encode_call::preprocess_call::<Source, Target>(message, bridge.bridge_instance_index()); encode_call::preprocess_call::<Source, Target>(message, bridge.bridge_instance_index());
let target_call = Target::encode_call(message)?; let target_call = Target::encode_call(message)?;
let target_spec_version = self let target_spec_version = self.target.selected_chain_spec_version::<Target>().await?;
.target
.selected_chain_spec_version::<Target>(Some(Target::RUNTIME_VERSION))
.await?;
let payload = { let payload = {
let target_call_weight = prepare_call_dispatch_weight( let target_call_weight = prepare_call_dispatch_weight(
@@ -168,7 +165,7 @@ impl SendMessage {
crate::select_full_bridge!(self.bridge, { crate::select_full_bridge!(self.bridge, {
let payload = self.encode_payload().await?; let payload = self.encode_payload().await?;
let source_client = self.source.to_client::<Source>(SOURCE_RUNTIME_VERSION).await?; let source_client = self.source.to_client::<Source>().await?;
let source_sign = self.source_sign.to_keypair::<Source>()?; let source_sign = self.source_sign.to_keypair::<Source>()?;
let lane = self.lane.clone().into(); let lane = self.lane.clone().into();
@@ -101,11 +101,6 @@ macro_rules! select_bridge {
const SOURCE_SPEC_VERSION: u32 = millau_runtime::VERSION.spec_version; const SOURCE_SPEC_VERSION: u32 = millau_runtime::VERSION.spec_version;
const TARGET_SPEC_VERSION: u32 = rialto_runtime::VERSION.spec_version; const TARGET_SPEC_VERSION: u32 = rialto_runtime::VERSION.spec_version;
const SOURCE_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(millau_runtime::VERSION);
const TARGET_RUNTIME_VERSION: Option<sp_version::RuntimeVersion> =
Some(rialto_runtime::VERSION);
type FromSwapToThisAccountIdConverter = bp_rialto::AccountIdConverter; type FromSwapToThisAccountIdConverter = bp_rialto::AccountIdConverter;
use bp_millau::{ use bp_millau::{
@@ -134,9 +129,9 @@ impl SwapTokens {
/// Run the command. /// Run the command.
pub async fn run(self) -> anyhow::Result<()> { pub async fn run(self) -> anyhow::Result<()> {
select_bridge!(self.bridge, { select_bridge!(self.bridge, {
let source_client = self.source.to_client::<Source>(SOURCE_RUNTIME_VERSION).await?; let source_client = self.source.to_client::<Source>().await?;
let source_sign = self.source_sign.to_keypair::<Target>()?; let source_sign = self.source_sign.to_keypair::<Target>()?;
let target_client = self.target.to_client::<Target>(TARGET_RUNTIME_VERSION).await?; let target_client = self.target.to_client::<Target>().await?;
let target_sign = self.target_sign.to_keypair::<Target>()?; let target_sign = self.target_sign.to_keypair::<Target>()?;
// names of variables in this function are matching names used by the // names of variables in this function are matching names used by the