From e51c5939c9940686e2845b109052a9b69a290999 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 14 Apr 2023 18:11:14 +0800 Subject: [PATCH 1/6] Reduce base proof size weight component to 1KiB --- runtime/polkadot/src/xcm_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 5aa841564bf5..b8e79b2bc311 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -102,7 +102,7 @@ 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); /// Maximum number of instructions in a single XCM fragment. A sanity check against weight /// calculations getting too crazy. pub const MaxInstructions: u32 = 100; From 78684bfc9fcb398db870ff4ed41992be0ade43b0 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 14 Apr 2023 19:52:11 +0800 Subject: [PATCH 2/6] Create TempFixedXcmWeight and set PoV weight to 0 --- runtime/polkadot/src/xcm_config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index b8e79b2bc311..224cfb1061dd 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -103,6 +103,9 @@ 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, 1024); + /// A temporary weight value for each XCM instruction. 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; @@ -340,7 +343,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>; From 35f74440e970e2124f67a0dd988246647f8e6272 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Mon, 17 Apr 2023 23:14:36 +0800 Subject: [PATCH 3/6] Set DEFAULT_PROOF_SIZE to 0 --- xcm/src/v3/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xcm/src/v3/mod.rs b/xcm/src/v3/mod.rs index 39a7ae32ee1e..6a29815c7f8d 100644 --- a/xcm/src/v3/mod.rs +++ b/xcm/src/v3/mod.rs @@ -1191,8 +1191,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 set back to 64 KB 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 { From d54203e21761c7293105999a7d4dfaf31ac252e3 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Mon, 17 Apr 2023 23:23:10 +0800 Subject: [PATCH 4/6] Fix comment --- runtime/polkadot/src/xcm_config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 224cfb1061dd..dd599fa352e1 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -103,8 +103,8 @@ 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, 1024); - /// A temporary weight value for each XCM instruction. Should be removed after we account for - /// PoV weights. + /// 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. From cdebf9463fba868cbbeda4910f48e2000f71229e Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Tue, 18 Apr 2023 00:30:13 +0800 Subject: [PATCH 5/6] Update test expectations --- runtime/kusama/src/xcm_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs index 289ea118d7bc..dfe3acfc1ee9 100644 --- a/runtime/kusama/src/xcm_config.rs +++ b/runtime/kusama/src/xcm_config.rs @@ -425,5 +425,5 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() { let weight = ::Weigher::weight(&mut xcm) .expect("weighing XCM failed"); - assert_eq!(weight, Weight::from_parts(20_313_281_000, 65536)); + assert_eq!(weight, Weight::from_parts(20_313_281_000, 0)); } From c8dfbfe9cbd228fa1977d323ff85e8a4e53b127b Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Wed, 19 Apr 2023 19:01:39 +0800 Subject: [PATCH 6/6] Fix comment --- xcm/src/v3/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/src/v3/mod.rs b/xcm/src/v3/mod.rs index 6a29815c7f8d..3c9720619ed1 100644 --- a/xcm/src/v3/mod.rs +++ b/xcm/src/v3/mod.rs @@ -1192,7 +1192,7 @@ impl TryFrom> for Xcm { } /// Default value for the proof size weight component. Set at 0 KB. -/// NOTE: Make sure this is set back to 64 KB after we properly account for PoV weights. +/// 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.