mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
BridgeHubKusama - initial setup - (chain_spec + basic runtime without any bridging pallets) (#1764)
* [BridgeHub] Setup Rococo backbone parachain * [BridgeHub] Setup Wococo parachain backbone (reused from Rococo) [Bridge-Backport] Rebase-fix BridgeHub] Added zombienet startup tomls for Rococo/Wococo Fix typo * [BridgeHub] Added chain_spec for live Rococo/Wococo * [BridgeHub] Clean bridge-hub-rococo runtime * [BridgeHub] Add bridge-hub-rococo to CI pipelines * [BridgeHub] Added bridge-hub-kusama - empty runtime/chain_spec setup * Fixes * Fixes for BH * Fixes for other runtimes - align all * Fixes - const * Fixes const * Fixes * Fix kusama-local * Sample zombienet runs * Fixes * Fixes for benchmarking * Fixes CI * Fixes * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs frame_system * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_collator_selection * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_balances * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_session * Fixes name * Fixes readme * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_timestamp * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs cumulus_pallet_xcmp_queue * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_collator_selection * Fixes * Fixes * rustfmt * Fixes * Added pallet_utility/pallet_multisig * Blind try for regex pr-custom-review.yml (added bridge-hub-kusama + collectives-polkadot) * Fixes * Fixes * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_utility * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_multisig * Trying to fix sed expression? * Added license headers + correct "DAG:" desc Co-authored-by: command-bot <>
This commit is contained in:
@@ -35,7 +35,7 @@ use frame_support::{
|
||||
construct_runtime,
|
||||
dispatch::DispatchClass,
|
||||
parameter_types,
|
||||
traits::{AsEnsureOriginWithArg, Everything},
|
||||
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, Everything},
|
||||
weights::{
|
||||
constants::WEIGHT_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
|
||||
WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||
@@ -322,37 +322,27 @@ impl frame_system::Config for Runtime {
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const UncleGenerations: u32 = 0;
|
||||
}
|
||||
|
||||
impl pallet_authorship::Config for Runtime {
|
||||
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
|
||||
type UncleGenerations = UncleGenerations;
|
||||
type UncleGenerations = ConstU32<0>;
|
||||
type FilterUncle = ();
|
||||
type EventHandler = (CollatorSelection,);
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const MaxLocks: u32 = 50;
|
||||
pub const MaxReserves: u32 = 50;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Runtime {
|
||||
type MaxLocks = MaxLocks;
|
||||
type MaxLocks = ConstU32<50>;
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// The ubiquitous event type.
|
||||
@@ -361,14 +351,13 @@ impl pallet_balances::Config for Runtime {
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
|
||||
type MaxReserves = MaxReserves;
|
||||
type MaxReserves = ConstU32<50>;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
/// Relay Chain `TransactionByteFee` / 10
|
||||
pub const TransactionByteFee: Balance = 10 * MICROUNIT;
|
||||
pub const OperationalFeeMultiplier: u8 = 5;
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
@@ -377,7 +366,7 @@ impl pallet_transaction_payment::Config for Runtime {
|
||||
type WeightToFee = WeightToFee;
|
||||
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
|
||||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
|
||||
type OperationalFeeMultiplier = OperationalFeeMultiplier;
|
||||
type OperationalFeeMultiplier = ConstU8<5>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -456,7 +445,6 @@ impl cumulus_pallet_dmp_queue::Config for Runtime {
|
||||
parameter_types! {
|
||||
pub const Period: u32 = 6 * HOURS;
|
||||
pub const Offset: u32 = 0;
|
||||
pub const MaxAuthorities: u32 = 100_000;
|
||||
}
|
||||
|
||||
impl pallet_session::Config for Runtime {
|
||||
@@ -467,7 +455,7 @@ impl pallet_session::Config for Runtime {
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionManager = CollatorSelection;
|
||||
// Essentially just Aura, but lets be pedantic.
|
||||
// Essentially just Aura, but let's be pedantic.
|
||||
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
|
||||
type Keys = SessionKeys;
|
||||
type WeightInfo = ();
|
||||
@@ -476,7 +464,7 @@ impl pallet_session::Config for Runtime {
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
type DisabledValidators = ();
|
||||
type MaxAuthorities = MaxAuthorities;
|
||||
type MaxAuthorities = ConstU32<100_000>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -28,7 +28,7 @@ use super::{
|
||||
};
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{
|
||||
log, match_types, parameter_types,
|
||||
match_types, parameter_types,
|
||||
traits::{
|
||||
fungibles::{self, Balanced, CreditOf},
|
||||
Contains, Everything, Get, Nothing,
|
||||
@@ -36,10 +36,11 @@ use frame_support::{
|
||||
};
|
||||
use pallet_asset_tx_payment::HandleCredit;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry};
|
||||
use polkadot_parachain::primitives::Sibling;
|
||||
use polkadot_runtime_common::impls::ToAuthor;
|
||||
use sp_runtime::traits::Zero;
|
||||
use xcm::latest::{prelude::*, Weight as XCMWeight};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
|
||||
@@ -50,7 +51,7 @@ use xcm_builder::{
|
||||
UsingComponents,
|
||||
};
|
||||
use xcm_executor::{
|
||||
traits::{FilterAssetLocation, JustTry, ShouldExecute},
|
||||
traits::{FilterAssetLocation, JustTry},
|
||||
XcmExecutor,
|
||||
};
|
||||
|
||||
@@ -149,69 +150,6 @@ match_types! {
|
||||
};
|
||||
}
|
||||
|
||||
//TODO: move DenyThenTry to polkadot's xcm module.
|
||||
/// Deny executing the xcm message if it matches any of the Deny filter regardless of anything else.
|
||||
/// If it passes the Deny, and matches one of the Allow cases then it is let through.
|
||||
pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)
|
||||
where
|
||||
Deny: ShouldExecute,
|
||||
Allow: ShouldExecute;
|
||||
|
||||
impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>
|
||||
where
|
||||
Deny: ShouldExecute,
|
||||
Allow: ShouldExecute,
|
||||
{
|
||||
fn should_execute<RuntimeCall>(
|
||||
origin: &MultiLocation,
|
||||
message: &mut Xcm<RuntimeCall>,
|
||||
max_weight: XCMWeight,
|
||||
weight_credit: &mut XCMWeight,
|
||||
) -> Result<(), ()> {
|
||||
Deny::should_execute(origin, message, max_weight, weight_credit)?;
|
||||
Allow::should_execute(origin, message, max_weight, weight_credit)
|
||||
}
|
||||
}
|
||||
|
||||
// See issue <https://github.com/paritytech/polkadot/issues/5233>
|
||||
pub struct DenyReserveTransferToRelayChain;
|
||||
impl ShouldExecute for DenyReserveTransferToRelayChain {
|
||||
fn should_execute<RuntimeCall>(
|
||||
origin: &MultiLocation,
|
||||
message: &mut Xcm<RuntimeCall>,
|
||||
_max_weight: XCMWeight,
|
||||
_weight_credit: &mut XCMWeight,
|
||||
) -> Result<(), ()> {
|
||||
if message.0.iter().any(|inst| {
|
||||
matches!(
|
||||
inst,
|
||||
InitiateReserveWithdraw {
|
||||
reserve: MultiLocation { parents: 1, interior: Here },
|
||||
..
|
||||
} | DepositReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. } |
|
||||
TransferReserveAsset {
|
||||
dest: MultiLocation { parents: 1, interior: Here },
|
||||
..
|
||||
}
|
||||
)
|
||||
}) {
|
||||
return Err(()) // Deny
|
||||
}
|
||||
|
||||
// allow reserve transfers to arrive from relay chain
|
||||
if matches!(origin, MultiLocation { parents: 1, interior: Here }) &&
|
||||
message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
|
||||
{
|
||||
log::warn!(
|
||||
target: "xcm::barriers",
|
||||
"Unexpected ReserveAssetDeposited from the relay chain",
|
||||
);
|
||||
}
|
||||
// Permit everything else
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub type Barrier = DenyThenTry<
|
||||
DenyReserveTransferToRelayChain,
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user