Port safe commits from master to polkadot-staging (#2761)

* introduce bp_messages::ChainWithMessages (#2171)

* Move Chain::ID from relay-level Chain to primitives-level Chain (#2181)

* move Chain::ID from relay-level Chain to primitives-level Chain

* removed chain IDs from bp-runtime

* add missing file header

* Some code grooming (#2276)

* some code grooming: enable warn(missing_docs) for all piblic crates + added missing documentation + removed obsolete clippy/deny workarounds

* removed strange allow + added comment related to other allow

* removed incorrect_clone_impl_on_copy_type which is unknown to CI clippy
This commit is contained in:
Svyatoslav Nikolsky
2024-01-11 12:39:23 +03:00
committed by Bastian Köcher
parent 37bb1e7909
commit 4004742e85
56 changed files with 389 additions and 268 deletions
+10 -33
View File
@@ -16,6 +16,7 @@
//! Primitives that may be used at (bridges) runtime level.
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, Encode, FullCodec, MaxEncodedLen};
@@ -61,36 +62,6 @@ pub use sp_runtime::paste;
/// Use this when something must be shared among all instances.
pub const NO_INSTANCE_ID: ChainId = [0, 0, 0, 0];
/// Polkadot chain id.
pub const POLKADOT_CHAIN_ID: ChainId = *b"pdot";
/// Polkadot Bulletin chain id.
pub const POLKADOT_BULLETIN_CHAIN_ID: ChainId = *b"pdbc";
/// Kusama chain id.
pub const KUSAMA_CHAIN_ID: ChainId = *b"ksma";
/// Westend chain id.
pub const WESTEND_CHAIN_ID: ChainId = *b"wend";
/// `AssetHubWestmint` chain id.
pub const ASSET_HUB_WESTEND_CHAIN_ID: ChainId = *b"ahwe";
/// Rococo chain id.
pub const ROCOCO_CHAIN_ID: ChainId = *b"roco";
/// BridgeHubRococo chain id.
pub const BRIDGE_HUB_ROCOCO_CHAIN_ID: ChainId = *b"bhro";
/// BridgeHubWestend chain id.
pub const BRIDGE_HUB_WESTEND_CHAIN_ID: ChainId = *b"bhwd";
/// BridgeHubKusama chain id.
pub const BRIDGE_HUB_KUSAMA_CHAIN_ID: ChainId = *b"bhks";
/// BridgeHubPolkadot chain id.
pub const BRIDGE_HUB_POLKADOT_CHAIN_ID: ChainId = *b"bhpd";
/// Generic header Id.
#[derive(
RuntimeDebug,
@@ -126,10 +97,10 @@ pub type HeaderIdOf<C> = HeaderId<HashOf<C>, BlockNumberOf<C>>;
/// Generic header id provider.
pub trait HeaderIdProvider<Header: HeaderT> {
// Get the header id.
/// Get the header id.
fn id(&self) -> HeaderId<Header::Hash, Header::Number>;
// Get the header id for the parent block.
/// Get the header id for the parent block.
fn parent_id(&self) -> Option<HeaderId<Header::Hash, Header::Number>>;
}
@@ -350,7 +321,7 @@ pub enum OwnedBridgeModuleError {
/// Operating mode for a bridge module.
pub trait OperatingMode: Send + Copy + Debug + FullCodec {
// Returns true if the bridge module is halted.
/// Returns true if the bridge module is halted.
fn is_halted(&self) -> bool;
}
@@ -392,8 +363,11 @@ pub trait OwnedBridgeModule<T: frame_system::Config> {
/// The target that will be used when publishing logs related to this module.
const LOG_TARGET: &'static str;
/// A storage entry that holds the module `Owner` account.
type OwnerStorage: StorageValue<T::AccountId, Query = Option<T::AccountId>>;
/// Operating mode type of the pallet.
type OperatingMode: OperatingMode;
/// A storage value that holds the pallet operating mode.
type OperatingModeStorage: StorageValue<Self::OperatingMode, Query = Self::OperatingMode>;
/// Check if the module is halted.
@@ -469,9 +443,11 @@ impl WeightExtraOps for Weight {
/// Trait that provides a static `str`.
pub trait StaticStrProvider {
/// Static string.
const STR: &'static str;
}
/// A macro that generates `StaticStrProvider` with the string set to its stringified argument.
#[macro_export]
macro_rules! generate_static_str_provider {
($str:expr) => {
@@ -485,6 +461,7 @@ macro_rules! generate_static_str_provider {
};
}
/// Error message that is only dispayable in `std` environment.
#[derive(Encode, Decode, Clone, Eq, PartialEq, PalletError, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct StrippableError<T> {