/// Can be extended to serve further use-cases besides just UMP. Is stored in storage, so any change
/// The message came from a snowbridge channel. It will be processed by `snowbridge_pallet_outbound_queue`.
/// The message came from a snowbridge channel, and it's a custom message that only exists in Tanssi.
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
/// Submits a transaction with the node's public and signature type. Adheres to the signed extension
/// This is not a good value for para-chains since the `Scheduler` already uses up to 80% block weight.
pub MessageQueueServiceWeight: Weight = Perbill::from_percent(20) * BlockWeights::get().max_block;
/// Message processor to handle any messages that were enqueued into the `MessageQueue` pallet.
// If you change this, make sure the `Assignment` type of the new provider is binary compatible,
pub ExternalRewardsEraInflationProvider: u128 = ValidatorsInflationRatePerEra::get() * Balances::total_issuance();
pub const FreeCollatorAssignmentCredits: u32 = FreeBlockProductionCredits::get()/EpochDurationInBlocks::get();
// Computation is implemented in tests/inflation_rates.rs, with a test ensuring values from the
// runtime match the formulas. We write the results as constants here to ensure we don't perform
pub const CollatorsInflationRatePerBlock: Perbill = { prod: Perbill::from_parts(9), fast: Perbill::from_parts(9) };
pub const ValidatorsInflationRatePerEra: Perbill = { prod: Perbill::from_parts(32641), fast: Perbill::from_parts(272) };
impl frame_support::traits::OnUnbalanced<Credit<AccountId, Balances>> for OnUnbalancedInflation {
type StakingRewardsDistributor = InvulnerableRewardDistribution<Self, Balances, PooledStaking>;
// Authorship must be before session in order to note author in the correct session and era.
pub struct InnerDancelightRegistrar<Runtime, AccountId, RegistrarManager, RegistrarWeightInfo>(
pub const MigController: AccountId = AccountId::from(hex_literal::hex!("52bc71c1eca5353749542dfdf0af97bf764f9c2f44e860cd485f1cd86400f649"));
[runtime_parachains::disputes::slashing, pallet_alt_benchmarks::bench_parachains_slashing::Pallet::<Runtime>]
fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
XcmPallet::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call)
fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
XcmPallet::dry_run_xcm::<Runtime, xcm_config::XcmRouter, RuntimeCall, xcm_config::XcmConfig>(origin_location, xcm)
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, XcmPaymentApiError> {
impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn inherent_extrinsics(data: inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
fn candidate_pending_availability(para_id: ParaId) -> Option<CommittedCandidateReceiptV2<Hash>> {
fn para_backing_state(para_id: ParaId) -> Option<primitives::vstaging::async_backing::BackingState> {
fn candidates_pending_availability(para_id: ParaId) -> Vec<CommittedCandidateReceiptV2<Hash>> {
fn verify_proof(leaves: Vec<mmr::EncodableOpaqueLeaf>, proof: mmr::LeafProof<mmr::Hash>)
let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect();
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// We could potentially predict whether the next block will yield a session change as in dancebox but this
// is innecesary: the dancelight blocks are being produced by validators, and therefore it should never
// stall because of any collator-rotation. Therefore it suffices for collators to predict the chain in
impl pallet_registrar_runtime_api::OnDemandBlockProductionApi<Block, ParaId, Slot> for Runtime {
/// Returns slot frequency for particular para thread. Slot frequency specifies amount of slot
/// need to be passed between two parathread blocks. It is expressed as `(min, max)` pair where `min`
/// indicates amount of slot must pass before we produce another block and `max` indicates amount of
/// Simply put, parathread must produce a block after `min` but before `(min+max)` slots.
impl pallet_author_noting_runtime_api::AuthorNotingApi<Block, AccountId, BlockNumber, ParaId> for Runtime
impl pallet_external_validators_rewards_runtime_api::ExternalValidatorsRewardsApi<Block, AccountId, EraIndex> for Runtime
fn generate_rewards_merkle_proof(account_id: AccountId, era_index: EraIndex) -> Option<MerkleProof> {
let assigned_authorities = TanssiAuthorityAssignment::collator_container_chain(session_index)?;
let assigned_authorities = TanssiAuthorityAssignment::collator_container_chain(session_index)?;
let assigned_authorities = TanssiAuthorityAssignment::collator_container_chain(session_index)?;
impl pallet_services_payment_runtime_api::ServicesPaymentApi<Block, Balance, ParaId> for Runtime {
let (block_production_costs, _) = <Runtime as pallet_services_payment::Config>::ProvideBlockProductionCost::block_cost(¶_id);
let (collator_assignment_costs, _) = <Runtime as pallet_services_payment::Config>::ProvideCollatorAssignmentCost::collator_assignment_cost(¶_id);
impl snowbridge_outbound_queue_runtime_api::OutboundQueueApi<Block, Balance> for Runtime {
fn calculate_fee(command: Command, parameters: Option<PricingParameters<Balance>>) -> Fee<Balance> {
pub AssetHubParaId: ParaId = dancelight_runtime_constants::system_parachain::ASSET_HUB_ID.into();
// Relay supports only native token, either reserve transfer it to non-system parachains,
fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
impl pallet_alt_benchmarks::bench_parachains_slashing::Validators<AccountId> for SessionBenchValidators {
/// Sets the validators to properly run a benchmark. Should take care of everything that
let mut whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
let treasury_key = frame_system::Account::<Runtime>::hashed_key_for(Treasury::account_id());
/// This ensures that the randomness will be different on different pallets, as long as the subject is different.
pub fn mix_randomness<T: frame_system::Config>(vrf_output: [u8; 32], subject: &[u8]) -> T::Hash {
impl frame_support::traits::Randomness<Hash, BlockNumber> for BabeCurrentBlockRandomnessGetter {
if pallet_services_payment::Pallet::<Runtime>::burn_collator_assignment_free_credit_for_para(¶_id).is_err() {
<Runtime as pallet_services_payment::Config>::ProvideCollatorAssignmentCost::collator_assignment_cost(¶_id);
<Runtime as pallet_services_payment::Config>::OnChargeForCollatorAssignment::on_unbalanced(assignment_imbalance);
// We are not making any assumptions about number of configurations existing in pending config
// We do not have to check for session ending as new session always starts at block initialization which means
// as on block initialization epoch index have been incremented and by extension session has been changed.