mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 23:51:05 +00:00
f9c24ef0db
b2099c5c Bump Substrate to `b094edaf` (#958) 3f037094 Bump endowment amounts on Rialto and Millau (#957) b21fd07c Bump Substrate WASM builder (#947) 30ccd07c Bump Substrate to `ec180313` (#955) a7422ab1 Upgrade to GitHub-native Dependabot (#945) ed20ef34 Move pallet-bridge-dispatch types to primitives (#948) 2070c4d6 Endow accounts and add `bridgeIds` to chainspec. (#951) f43c9243 Fix account derivation in CLI (#952) 9ac07e73 Add backbone configuration of cargo-spellcheck (#924) 2761c3fe Message dispatch support multiple instances (#942) 801c99f3 Add Wococo<>Rococo Header Relayer (#925) 21f49051 Remove Westend<>Rococo header sync (#940) 06235f16 do not panic if pallet is not yet initialized (#937) a13ee0bc Bump Substrate (#939) f8680cbf jsonrpsee alpha6 (#938) 6163bcbf reonnect to failed client in on-demand relay background task (#936) 14e82bea Do not spawn additional task for on-demand relays (#933) b1557b88 Relay at least one header for every source chain session (#923) 9420649c Remove deprecated Runtime Header APIs (#932) 9627011e Update README.md (#931) 7b736b9c Truncate output in logs. (#930) faad06e3 Make sure that relayers have dates in logs. (#927) 07734535 Update dump-logs script. (#928) c2d56b2e Add pruning to bechmarks & update weights. (#918) a30c51dc Add properties to Chain Spec (#917) d691c73e Fix issue with on-demand headers relay not starting (#921) 8ee55c1e Fix image publishing. (#922) f51fb59d Prefix in relay loops logs (#920) git-subtree-dir: bridges git-subtree-split: b2099c5c0baf569e2ec7228507b6e4f3972143cc
97 lines
3.0 KiB
Rust
97 lines
3.0 KiB
Rust
// 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 <http://www.gnu.org/licenses/>.
|
|
|
|
use structopt::clap::arg_enum;
|
|
|
|
arg_enum! {
|
|
#[derive(Debug, PartialEq, Eq)]
|
|
/// Supported full bridges (headers + messages).
|
|
pub enum FullBridge {
|
|
MillauToRialto,
|
|
RialtoToMillau,
|
|
}
|
|
}
|
|
|
|
impl FullBridge {
|
|
/// Return instance index of the bridge pallet in source runtime.
|
|
pub fn bridge_instance_index(&self) -> u8 {
|
|
match self {
|
|
Self::MillauToRialto => MILLAU_TO_RIALTO_INDEX,
|
|
Self::RialtoToMillau => RIALTO_TO_MILLAU_INDEX,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub const RIALTO_TO_MILLAU_INDEX: u8 = 0;
|
|
pub const MILLAU_TO_RIALTO_INDEX: u8 = 0;
|
|
|
|
/// The macro allows executing bridge-specific code without going fully generic.
|
|
///
|
|
/// It matches on the [`FullBridge`] enum, sets bridge-specific types or imports and injects
|
|
/// the `$generic` code at every variant.
|
|
#[macro_export]
|
|
macro_rules! select_full_bridge {
|
|
($bridge: expr, $generic: tt) => {
|
|
match $bridge {
|
|
FullBridge::MillauToRialto => {
|
|
type Source = relay_millau_client::Millau;
|
|
#[allow(dead_code)]
|
|
type Target = relay_rialto_client::Rialto;
|
|
|
|
// Derive-account
|
|
#[allow(unused_imports)]
|
|
use bp_rialto::derive_account_from_millau_id as derive_account;
|
|
|
|
// Relay-messages
|
|
#[allow(unused_imports)]
|
|
use crate::chains::millau_messages_to_rialto::run as relay_messages;
|
|
|
|
// Send-message / Estimate-fee
|
|
#[allow(unused_imports)]
|
|
use bp_rialto::TO_RIALTO_ESTIMATE_MESSAGE_FEE_METHOD as ESTIMATE_MESSAGE_FEE_METHOD;
|
|
// Send-message
|
|
#[allow(unused_imports)]
|
|
use millau_runtime::rialto_account_ownership_digest as account_ownership_digest;
|
|
|
|
$generic
|
|
}
|
|
FullBridge::RialtoToMillau => {
|
|
type Source = relay_rialto_client::Rialto;
|
|
#[allow(dead_code)]
|
|
type Target = relay_millau_client::Millau;
|
|
|
|
// Derive-account
|
|
#[allow(unused_imports)]
|
|
use bp_millau::derive_account_from_rialto_id as derive_account;
|
|
|
|
// Relay-messages
|
|
#[allow(unused_imports)]
|
|
use crate::chains::rialto_messages_to_millau::run as relay_messages;
|
|
|
|
// Send-message / Estimate-fee
|
|
#[allow(unused_imports)]
|
|
use bp_millau::TO_MILLAU_ESTIMATE_MESSAGE_FEE_METHOD as ESTIMATE_MESSAGE_FEE_METHOD;
|
|
|
|
// Send-message
|
|
#[allow(unused_imports)]
|
|
use rialto_runtime::millau_account_ownership_digest as account_ownership_digest;
|
|
|
|
$generic
|
|
}
|
|
}
|
|
};
|
|
}
|