Polkadot <> Kusama relayers (#1122)

* relay headers between Kusama and Polkadot

* relay messages between Kusama and Polkadot

* complex Kusama <> Polkadot relayer

* expose relayer_fund_account_id from messages pallet

* create relayers fund accounts on Kusama/Polkadot + some more fixes

* fmt

* fix compilation

* compilation + clippy

* compilation

* MAXIMAL_BALANCE_DECREASE_PER_DAY for K<>P header relays

* fmt

* deduplicate tests

* Update modules/messages/src/lib.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* extract storage_parameter_key function

* other grumbles

* fix

* fmt

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
Svyatoslav Nikolsky
2021-09-21 16:53:37 +03:00
committed by Bastian Köcher
parent 417903f9e7
commit 2db84b74cc
31 changed files with 1936 additions and 68 deletions
@@ -24,6 +24,8 @@ pub enum FullBridge {
RialtoToMillau,
RococoToWococo,
WococoToRococo,
KusamaToPolkadot,
PolkadotToKusama,
}
impl FullBridge {
@@ -34,6 +36,8 @@ impl FullBridge {
Self::RialtoToMillau => RIALTO_TO_MILLAU_INDEX,
Self::RococoToWococo => ROCOCO_TO_WOCOCO_INDEX,
Self::WococoToRococo => WOCOCO_TO_ROCOCO_INDEX,
Self::KusamaToPolkadot => KUSAMA_TO_POLKADOT_INDEX,
Self::PolkadotToKusama => POLKADOT_TO_KUSAMA_INDEX,
}
}
}
@@ -42,6 +46,8 @@ pub const RIALTO_TO_MILLAU_INDEX: u8 = 0;
pub const MILLAU_TO_RIALTO_INDEX: u8 = 0;
pub const ROCOCO_TO_WOCOCO_INDEX: u8 = 0;
pub const WOCOCO_TO_ROCOCO_INDEX: u8 = 0;
pub const KUSAMA_TO_POLKADOT_INDEX: u8 = 0;
pub const POLKADOT_TO_KUSAMA_INDEX: u8 = 0;
/// The macro allows executing bridge-specific code without going fully generic.
///
@@ -138,6 +144,50 @@ macro_rules! select_full_bridge {
#[allow(unused_imports)]
use relay_wococo_client::runtime::wococo_to_rococo_account_ownership_digest as account_ownership_digest;
$generic
}
FullBridge::KusamaToPolkadot => {
type Source = relay_kusama_client::Kusama;
#[allow(dead_code)]
type Target = relay_polkadot_client::Polkadot;
// Derive-account
#[allow(unused_imports)]
use bp_polkadot::derive_account_from_kusama_id as derive_account;
// Relay-messages
#[allow(unused_imports)]
use crate::chains::kusama_messages_to_polkadot::run as relay_messages;
// Send-message / Estimate-fee
#[allow(unused_imports)]
use bp_polkadot::TO_POLKADOT_ESTIMATE_MESSAGE_FEE_METHOD as ESTIMATE_MESSAGE_FEE_METHOD;
// Send-message
#[allow(unused_imports)]
use relay_kusama_client::runtime::kusama_to_polkadot_account_ownership_digest as account_ownership_digest;
$generic
}
FullBridge::PolkadotToKusama => {
type Source = relay_polkadot_client::Polkadot;
#[allow(dead_code)]
type Target = relay_kusama_client::Kusama;
// Derive-account
#[allow(unused_imports)]
use bp_kusama::derive_account_from_polkadot_id as derive_account;
// Relay-messages
#[allow(unused_imports)]
use crate::chains::polkadot_messages_to_kusama::run as relay_messages;
// Send-message / Estimate-fee
#[allow(unused_imports)]
use bp_kusama::TO_KUSAMA_ESTIMATE_MESSAGE_FEE_METHOD as ESTIMATE_MESSAGE_FEE_METHOD;
// Send-message
#[allow(unused_imports)]
use relay_polkadot_client::runtime::polkadot_to_kusama_account_ownership_digest as account_ownership_digest;
$generic
}
}