mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 01:01:04 +00:00
Remove SOURCE_PARACHAIN_PARA_ID (#1716)
* Remove SOURCE_PARACHAIN_PARA_ID Remove SubstrateParachainsPipeline::SOURCE_PARACHAIN_PARA_ID * Avoid duplicate ChainBase and ParachainBase implementations * Replace ChainShadow with UnderlyingChainProvider
This commit is contained in:
committed by
Bastian Köcher
parent
7d55a0ffe2
commit
bde1629f86
@@ -192,12 +192,51 @@ pub trait Chain: Send + Sync + 'static {
|
||||
fn max_extrinsic_weight() -> Weight;
|
||||
}
|
||||
|
||||
/// A trait that provides the type of the underlying chain.
|
||||
pub trait UnderlyingChainProvider {
|
||||
/// Underlying chain type.
|
||||
type Chain: Chain;
|
||||
}
|
||||
|
||||
impl<T> Chain for T
|
||||
where
|
||||
T: Send + Sync + 'static + UnderlyingChainProvider,
|
||||
{
|
||||
type BlockNumber = <T::Chain as Chain>::BlockNumber;
|
||||
type Hash = <T::Chain as Chain>::Hash;
|
||||
type Hasher = <T::Chain as Chain>::Hasher;
|
||||
type Header = <T::Chain as Chain>::Header;
|
||||
type AccountId = <T::Chain as Chain>::AccountId;
|
||||
type Balance = <T::Chain as Chain>::Balance;
|
||||
type Index = <T::Chain as Chain>::Index;
|
||||
type Signature = <T::Chain as Chain>::Signature;
|
||||
|
||||
fn max_extrinsic_size() -> u32 {
|
||||
<T::Chain as Chain>::max_extrinsic_size()
|
||||
}
|
||||
|
||||
fn max_extrinsic_weight() -> Weight {
|
||||
<T::Chain as Chain>::max_extrinsic_weight()
|
||||
}
|
||||
}
|
||||
|
||||
/// Minimal parachain representation that may be used from no_std environment.
|
||||
pub trait Parachain: Chain {
|
||||
/// Parachain identifier.
|
||||
const PARACHAIN_ID: u32;
|
||||
}
|
||||
|
||||
impl<T> Parachain for T
|
||||
where
|
||||
T: Chain + UnderlyingChainProvider,
|
||||
<T as UnderlyingChainProvider>::Chain: Parachain,
|
||||
{
|
||||
const PARACHAIN_ID: u32 = <<T as UnderlyingChainProvider>::Chain as Parachain>::PARACHAIN_ID;
|
||||
}
|
||||
|
||||
/// Underlying chain type.
|
||||
pub type UnderlyingChainOf<C> = <C as UnderlyingChainProvider>::Chain;
|
||||
|
||||
/// Block number used by the chain.
|
||||
pub type BlockNumberOf<C> = <C as Chain>::BlockNumber;
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ use sp_std::{convert::TryFrom, fmt::Debug, vec, vec::Vec};
|
||||
|
||||
pub use chain::{
|
||||
AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain, EncodedOrDecodedCall, HashOf,
|
||||
HasherOf, HeaderOf, IndexOf, Parachain, SignatureOf, TransactionEraOf,
|
||||
HasherOf, HeaderOf, IndexOf, Parachain, SignatureOf, TransactionEraOf, UnderlyingChainOf,
|
||||
UnderlyingChainProvider,
|
||||
};
|
||||
pub use frame_support::storage::storage_prefix as storage_value_final_key;
|
||||
use num_traits::{CheckedSub, One};
|
||||
|
||||
Reference in New Issue
Block a user