#![cfg_attr(not(feature = "std"), no_std)]
pub use bp_bridge_hub_cumulus::{
BlockLength, BlockWeights, Hasher, Nonce, SignedBlock, AVERAGE_BLOCK_INTERVAL,
MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
};
use bp_messages::{ChainWithMessages, MessageNonce};
use bp_runtime::{
decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, Chain, ChainId, Parachain,
};
use frame_support::{dispatch::DispatchClass, weights::Weight};
pub use moonbeam_core_primitives::{AccountId, Balance, BlockNumber, Hash, Header, Signature};
use sp_runtime::StateVersion;
use xcm::latest::prelude::{Junction, Location, NetworkId};
pub type LaneId = bp_messages::HashedLaneId;
pub struct Moonbeam;
impl Chain for Moonbeam {
const ID: ChainId = *b"mnbm";
type BlockNumber = BlockNumber;
type Hash = Hash;
type Hasher = Hasher;
type Header = Header;
type AccountId = AccountId;
type Balance = Balance;
type Nonce = Nonce;
type Signature = Signature;
const STATE_VERSION: StateVersion = StateVersion::V1;
fn max_extrinsic_size() -> u32 {
*BlockLength::get().max.get(DispatchClass::Normal)
}
fn max_extrinsic_weight() -> Weight {
BlockWeights::get()
.get(DispatchClass::Normal)
.max_extrinsic
.unwrap_or(Weight::MAX)
}
}
impl Parachain for Moonbeam {
const PARACHAIN_ID: u32 = PARACHAIN_ID;
const MAX_HEADER_SIZE: u32 = 4_096;
}
impl ChainWithMessages for Moonbeam {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
WITH_MOONBEAM_POLKADOT_MESSAGES_PALLET_NAME;
const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
}
pub const PARACHAIN_ID: u32 = 2004;
pub const WITH_MOONBEAM_POLKADOT_MESSAGES_PALLET_NAME: &str = "BridgePolkadotMessages";
decl_bridge_finality_runtime_apis!(moonbeam_polkadot);
decl_bridge_messages_runtime_apis!(moonbeam_polkadot, LaneId);
frame_support::parameter_types! {
pub GlobalConsensusLocation: Location = Location::new(
2,
[
Junction::GlobalConsensus(NetworkId::Polkadot),
Junction::Parachain(Moonbeam::PARACHAIN_ID)
]
);
}