referrerpolicy=no-referrer-when-downgrade
relay_substrate_client

Trait ChainBase

pub trait ChainBase:
    Send
    + Sync
    + 'static {
    type BlockNumber: Parameter + Member + MaybeSerializeDeserialize + Hash + Copy + Default + MaybeDisplay + AtLeast32BitUnsigned + FromStr + AsPrimitive<usize> + Saturating + MaxEncodedLen;
    type Hash: Parameter + Member + MaybeSerializeDeserialize + Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + AsRef<[u8]> + AsMut<[u8]> + MaxEncodedLen;
    type Hasher: Hash<Output = Self::Hash>;
    type Header: Parameter + Header<Number = Self::BlockNumber, Hash = Self::Hash> + HeaderIdProvider<Self::Header> + MaybeSerializeDeserialize;
    type AccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord + MaxEncodedLen;
    type Balance: AtLeast32BitUnsigned + FixedPointOperand + Parameter + Member + MaybeSerializeDeserialize + Clone + Copy + Bounded + CheckedSub + PartialOrd + SaturatingAdd + Zero + TryFrom<U256> + MaxEncodedLen;
    type Nonce: Parameter + Member + MaybeSerialize + Debug + Default + MaybeDisplay + MaybeSerializeDeserialize + AtLeast32Bit + Copy + MaxEncodedLen;
    type Signature: Parameter + Verify;

    const ID: [u8; 4];
    const STATE_VERSION: StateVersion;

    // Required methods
    fn max_extrinsic_size() -> u32;
    fn max_extrinsic_weight() -> Weight;
}
Expand description

Minimal Substrate-based chain representation that may be used from no_std environment.

Required Associated Constants§

const ID: [u8; 4]

Chain id.

const STATE_VERSION: StateVersion

Version of the state implementation used by this chain. This is directly related with the TrieLayout configuration used by the storage.

Required Associated Types§

type BlockNumber: Parameter + Member + MaybeSerializeDeserialize + Hash + Copy + Default + MaybeDisplay + AtLeast32BitUnsigned + FromStr + AsPrimitive<usize> + Saturating + MaxEncodedLen

A type that fulfills the abstract idea of what a Substrate block number is.

type Hash: Parameter + Member + MaybeSerializeDeserialize + Hash + Ord + Copy + MaybeDisplay + Default + SimpleBitOps + AsRef<[u8]> + AsMut<[u8]> + MaxEncodedLen

A type that fulfills the abstract idea of what a Substrate hash is.

type Hasher: Hash<Output = Self::Hash>

A type that fulfills the abstract idea of what a Substrate hasher (a type that produces hashes) is.

type Header: Parameter + Header<Number = Self::BlockNumber, Hash = Self::Hash> + HeaderIdProvider<Self::Header> + MaybeSerializeDeserialize

A type that fulfills the abstract idea of what a Substrate header is.

type AccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord + MaxEncodedLen

The user account identifier type for the runtime.

type Balance: AtLeast32BitUnsigned + FixedPointOperand + Parameter + Member + MaybeSerializeDeserialize + Clone + Copy + Bounded + CheckedSub + PartialOrd + SaturatingAdd + Zero + TryFrom<U256> + MaxEncodedLen

Balance of an account in native tokens.

The chain may support multiple tokens, but this particular type is for token that is used to pay for transaction dispatch, to reward different relayers (headers, messages), etc.

type Nonce: Parameter + Member + MaybeSerialize + Debug + Default + MaybeDisplay + MaybeSerializeDeserialize + AtLeast32Bit + Copy + MaxEncodedLen

Nonce of a transaction used by the chain.

type Signature: Parameter + Verify

Signature type, used on this chain.

Required Methods§

fn max_extrinsic_size() -> u32

Get the maximum size (in bytes) of a Normal extrinsic at this chain.

fn max_extrinsic_weight() -> Weight

Get the maximum weight (compute time) that a Normal extrinsic at this chain can use.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Chain for TestChain

Source§

const ID: ChainId = _

Source§

const STATE_VERSION: StateVersion = StateVersion::V1

Source§

type BlockNumber = u32

Source§

type Hash = H256

Source§

type Hasher = BlakeTwo256

Source§

type Header = Header<u32, BlakeTwo256>

Source§

type AccountId = u32

Source§

type Balance = u32

Source§

type Nonce = u32

Source§

type Signature = TestSignature

Source§

impl Chain for TestParachainBase

Source§

const ID: ChainId = _

Source§

const STATE_VERSION: StateVersion = StateVersion::V1

Source§

type BlockNumber = u32

Source§

type Hash = H256

Source§

type Hasher = BlakeTwo256

Source§

type Header = Header<u32, BlakeTwo256>

Source§

type AccountId = u32

Source§

type Balance = u32

Source§

type Nonce = u32

Source§

type Signature = TestSignature

§

impl<T> Chain for T
where T: Send + Sync + 'static + UnderlyingChainProvider,

§

const ID: [u8; 4] = <T::Chain as Chain>::ID

§

const STATE_VERSION: StateVersion = <T::Chain as Chain>::STATE_VERSION

§

type BlockNumber = <<T as UnderlyingChainProvider>::Chain as Chain>::BlockNumber

§

type Hash = <<T as UnderlyingChainProvider>::Chain as Chain>::Hash

§

type Hasher = <<T as UnderlyingChainProvider>::Chain as Chain>::Hasher

§

type Header = <<T as UnderlyingChainProvider>::Chain as Chain>::Header

§

type AccountId = <<T as UnderlyingChainProvider>::Chain as Chain>::AccountId

§

type Balance = <<T as UnderlyingChainProvider>::Chain as Chain>::Balance

§

type Nonce = <<T as UnderlyingChainProvider>::Chain as Chain>::Nonce

§

type Signature = <<T as UnderlyingChainProvider>::Chain as Chain>::Signature

impl Chain for AssetHubRococo

impl Chain for AssetHubWestend

impl Chain for BridgeHubRococo

impl Chain for BridgeHubWestend

impl Chain for PolkadotBulletin

impl Chain for Rococo

impl Chain for Westend