mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 11:21:08 +00:00
* drop Rialto <> Millau bridges * clippy
This commit is contained in:
committed by
Bastian Köcher
parent
1c2b6b21da
commit
7a8c87a450
@@ -22,7 +22,6 @@ use crate::messages_call_ext::MessagesCallSubType;
|
||||
use pallet_bridge_grandpa::CallSubType as GrandpaCallSubType;
|
||||
use pallet_bridge_parachains::CallSubType as ParachainsCallSubtype;
|
||||
use sp_runtime::transaction_validity::TransactionValidity;
|
||||
use xcm::v3::NetworkId;
|
||||
|
||||
pub mod messages;
|
||||
pub mod messages_api;
|
||||
@@ -92,8 +91,8 @@ where
|
||||
/// ```nocompile
|
||||
/// generate_bridge_reject_obsolete_headers_and_messages!{
|
||||
/// Call, AccountId
|
||||
/// BridgeRialtoGrandpa, BridgeWestendGrandpa,
|
||||
/// BridgeRialtoParachains
|
||||
/// BridgeRococoGrandpa, BridgeRococoMessages,
|
||||
/// BridgeRococoParachains
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
@@ -147,42 +146,6 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
|
||||
};
|
||||
}
|
||||
|
||||
/// A mapping over `NetworkId`.
|
||||
/// Since `NetworkId` doesn't include `Millau`, `Rialto` and `RialtoParachain`, we create some
|
||||
/// synthetic associations between these chains and `NetworkId` chains.
|
||||
pub enum CustomNetworkId {
|
||||
/// The Millau network ID, associated with Kusama.
|
||||
Millau,
|
||||
/// The Rialto network ID, associated with Polkadot.
|
||||
Rialto,
|
||||
/// The RialtoParachain network ID, associated with Westend.
|
||||
RialtoParachain,
|
||||
}
|
||||
|
||||
impl TryFrom<bp_runtime::ChainId> for CustomNetworkId {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(chain: bp_runtime::ChainId) -> Result<Self, Self::Error> {
|
||||
Ok(match chain {
|
||||
bp_runtime::MILLAU_CHAIN_ID => Self::Millau,
|
||||
bp_runtime::RIALTO_CHAIN_ID => Self::Rialto,
|
||||
bp_runtime::RIALTO_PARACHAIN_CHAIN_ID => Self::RialtoParachain,
|
||||
_ => return Err(()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl CustomNetworkId {
|
||||
/// Converts self to XCM' network id.
|
||||
pub const fn as_network_id(&self) -> NetworkId {
|
||||
match *self {
|
||||
CustomNetworkId::Millau => NetworkId::Kusama,
|
||||
CustomNetworkId::Rialto => NetworkId::Polkadot,
|
||||
CustomNetworkId::RialtoParachain => NetworkId::Westend,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::BridgeRuntimeFilterCall;
|
||||
|
||||
Reference in New Issue
Block a user