mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 23:18:01 +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;
|
||||
|
||||
@@ -14,12 +14,7 @@
|
||||
// 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/>.
|
||||
|
||||
//! A mock runtime for testing different stuff in the crate. We've been using Millau
|
||||
//! runtime for that before, but it has two drawbacks:
|
||||
//!
|
||||
//! - circular dependencies between this crate and Millau runtime;
|
||||
//!
|
||||
//! - we can't use (e.g. as git subtree or by copying) this crate in repo without Millau.
|
||||
//! A mock runtime for testing different stuff in the crate.
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ use frame_support::traits::Get;
|
||||
use sp_runtime::transaction_validity::TransactionPriority;
|
||||
|
||||
// reexport everything from `integrity_tests` module
|
||||
#[allow(unused_imports)]
|
||||
pub use integrity_tests::*;
|
||||
|
||||
/// Compute priority boost for message delivery transaction that delivers
|
||||
|
||||
Reference in New Issue
Block a user