Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong committed Jul 11, 2023
1 parent 08e5f62 commit 33b0ac7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
11 changes: 7 additions & 4 deletions runtime/crab/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ frame_support::parameter_types! {
X1(PalletInstance(<Balances as frame_support::traits::PalletInfoAccess>::index() as u8))
);
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024);
/// The amount of weight an XCM operation takes. This is a safe overestimate.
pub BaseXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 1024);
/// A temporary weight value for each XCM instruction.
/// NOTE: This should be removed after we account for PoV weights.
pub const TempFixedXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 0);
}

pub struct ToTreasury;
Expand Down Expand Up @@ -164,7 +167,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type UniversalAliases = frame_support::traits::Nothing;
// Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Weigher = xcm_builder::FixedWeightBounds<TempFixedXcmWeight, RuntimeCall, MaxInstructions>;
type XcmSender = XcmRouter;
}

Expand Down Expand Up @@ -204,7 +207,7 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type TrustedLockers = ();
type UniversalLocation = UniversalLocation;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Weigher = xcm_builder::FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type WeightInfo = pallet_xcm::TestWeightInfo;
type XcmExecuteFilter = frame_support::traits::Everything;
type XcmExecutor = xcm_executor::XcmExecutor<XcmExecutorConfig>;
Expand Down
13 changes: 7 additions & 6 deletions runtime/darwinia/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ frame_support::parameter_types! {
X1(PalletInstance(<Balances as frame_support::traits::PalletInfoAccess>::index() as u8))
);
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024);
/// The amount of weight an XCM operation takes. This is a safe overestimate.
pub BaseXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 1024);
/// A temporary weight value for each XCM instruction.
/// NOTE: This should be removed after we account for PoV weights.
pub const TempFixedXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 0);
}

pub struct ToTreasury;
Expand All @@ -129,8 +132,6 @@ impl xcm_builder::TakeRevenue for ToTreasury {
}
}

pub type XcmWeigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;

pub struct XcmCallDispatcher;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for XcmCallDispatcher {
fn dispatch(
Expand Down Expand Up @@ -194,7 +195,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type UniversalAliases = frame_support::traits::Nothing;
// Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Weigher = XcmWeigher;
type Weigher = xcm_builder::FixedWeightBounds<TempFixedXcmWeight, RuntimeCall, MaxInstructions>;
type XcmSender = XcmRouter;
}

Expand Down Expand Up @@ -234,7 +235,7 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type TrustedLockers = ();
type UniversalLocation = UniversalLocation;
type Weigher = XcmWeigher;
type Weigher = xcm_builder::FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type WeightInfo = pallet_xcm::TestWeightInfo;
type XcmExecuteFilter = frame_support::traits::Everything;
type XcmExecutor = xcm_executor::XcmExecutor<XcmExecutorConfig>;
Expand Down
13 changes: 7 additions & 6 deletions runtime/pangolin/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ frame_support::parameter_types! {
X1(PalletInstance(<Balances as frame_support::traits::PalletInfoAccess>::index() as u8))
);
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024);
/// The amount of weight an XCM operation takes. This is a safe overestimate.
pub BaseXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 1024);
/// A temporary weight value for each XCM instruction.
/// NOTE: This should be removed after we account for PoV weights.
pub const TempFixedXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 0);
}

pub struct ToTreasury;
Expand All @@ -129,8 +132,6 @@ impl xcm_builder::TakeRevenue for ToTreasury {
}
}

pub type XcmWeigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;

pub struct XcmCallDispatcher;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for XcmCallDispatcher {
fn dispatch(
Expand Down Expand Up @@ -194,7 +195,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type UniversalAliases = frame_support::traits::Nothing;
// Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Weigher = XcmWeigher;
type Weigher = xcm_builder::FixedWeightBounds<TempFixedXcmWeight, RuntimeCall, MaxInstructions>;
type XcmSender = XcmRouter;
}

Expand Down Expand Up @@ -234,7 +235,7 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type TrustedLockers = ();
type UniversalLocation = UniversalLocation;
type Weigher = XcmWeigher;
type Weigher = xcm_builder::FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type WeightInfo = pallet_xcm::TestWeightInfo;
type XcmExecuteFilter = frame_support::traits::Everything;
type XcmExecutor = xcm_executor::XcmExecutor<XcmExecutorConfig>;
Expand Down
13 changes: 7 additions & 6 deletions runtime/pangoro/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ frame_support::parameter_types! {
X1(PalletInstance(<Balances as frame_support::traits::PalletInfoAccess>::index() as u8))
);
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024);
/// The amount of weight an XCM operation takes. This is a safe overestimate.
pub BaseXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 1024);
/// A temporary weight value for each XCM instruction.
/// NOTE: This should be removed after we account for PoV weights.
pub const TempFixedXcmWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 0);
}

pub struct ToTreasury;
Expand All @@ -129,8 +132,6 @@ impl xcm_builder::TakeRevenue for ToTreasury {
}
}

pub type XcmWeigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;

pub struct XcmCallDispatcher;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for XcmCallDispatcher {
fn dispatch(
Expand Down Expand Up @@ -194,7 +195,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type UniversalAliases = frame_support::traits::Nothing;
// Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Weigher = XcmWeigher;
type Weigher = xcm_builder::FixedWeightBounds<TempFixedXcmWeight, RuntimeCall, MaxInstructions>;
type XcmSender = XcmRouter;
}

Expand Down Expand Up @@ -234,7 +235,7 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type TrustedLockers = ();
type UniversalLocation = UniversalLocation;
type Weigher = XcmWeigher;
type Weigher = xcm_builder::FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type WeightInfo = pallet_xcm::TestWeightInfo;
type XcmExecuteFilter = frame_support::traits::Everything;
type XcmExecutor = xcm_executor::XcmExecutor<XcmExecutorConfig>;
Expand Down

0 comments on commit 33b0ac7

Please sign in to comment.