From 8c7e95db3963c60d58da1d80e3ae1cc3b4248920 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 21 Apr 2023 22:16:50 +0800 Subject: [PATCH] Reduce base proof size weight component to zero (#7081) * Reduce base proof size weight component to 1KiB * Create TempFixedXcmWeight and set PoV weight to 0 * Set DEFAULT_PROOF_SIZE to 0 * Fix comment * Update test expectations * Fix comment --- runtime/polkadot/src/xcm_config.rs | 7 +++++-- xcm/src/v3/mod.rs | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 4f817093703a..198ef42299df 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -95,7 +95,10 @@ type LocalOriginConverter = ( parameter_types! { /// The amount of weight an XCM operation takes. This is a safe overestimate. - pub const BaseXcmWeight: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + pub const BaseXcmWeight: Weight = 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: Weight = Weight::from_parts(1_000_000_000, 0); /// Maximum number of instructions in a single XCM fragment. A sanity check against weight /// calculations getting too crazy. pub const MaxInstructions: u32 = 100; @@ -317,7 +320,7 @@ impl xcm_executor::Config for XcmConfig { type IsTeleporter = TrustedTeleporters; type UniversalLocation = UniversalLocation; type Barrier = Barrier; - type Weigher = FixedWeightBounds; + type Weigher = FixedWeightBounds; // The weight trader piggybacks on the existing transaction-fee conversion logic. type Trader = UsingComponents>; diff --git a/xcm/src/v3/mod.rs b/xcm/src/v3/mod.rs index fb3e3ba95c26..7aa624b60423 100644 --- a/xcm/src/v3/mod.rs +++ b/xcm/src/v3/mod.rs @@ -1224,8 +1224,9 @@ impl TryFrom> for Xcm { } } -/// Default value for the proof size weight component. Set at 64 KB. -const DEFAULT_PROOF_SIZE: u64 = 64 * 1024; +/// Default value for the proof size weight component. Set at 0 KB. +/// NOTE: Make sure this is removed after we properly account for PoV weights. +const DEFAULT_PROOF_SIZE: u64 = 0; // Convert from a v2 instruction to a v3 instruction. impl TryFrom> for Instruction {