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
This commit is contained in:
Keith Yeung
2023-04-21 22:16:50 +08:00
committed by GitHub
parent e277f95b3b
commit 8b0b86651f
3 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -441,5 +441,5 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() {
let weight = <XcmConfig as xcm_executor::Config>::Weigher::weight(&mut xcm) let weight = <XcmConfig as xcm_executor::Config>::Weigher::weight(&mut xcm)
.expect("weighing XCM failed"); .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));
} }
+5 -2
View File
@@ -108,7 +108,10 @@ type LocalOriginConverter = (
parameter_types! { parameter_types! {
/// The amount of weight an XCM operation takes. This is a safe overestimate. /// 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 /// Maximum number of instructions in a single XCM fragment. A sanity check against weight
/// calculations getting too crazy. /// calculations getting too crazy.
pub const MaxInstructions: u32 = 100; pub const MaxInstructions: u32 = 100;
@@ -323,7 +326,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type UniversalLocation = UniversalLocation; type UniversalLocation = UniversalLocation;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>; type Weigher = FixedWeightBounds<TempFixedXcmWeight, RuntimeCall, MaxInstructions>;
// The weight trader piggybacks on the existing transaction-fee conversion logic. // The weight trader piggybacks on the existing transaction-fee conversion logic.
type Trader = type Trader =
UsingComponents<WeightToFee, TokenLocation, AccountId, Balances, ToAuthor<Runtime>>; UsingComponents<WeightToFee, TokenLocation, AccountId, Balances, ToAuthor<Runtime>>;
+3 -2
View File
@@ -1191,8 +1191,9 @@ impl<Call> TryFrom<OldXcm<Call>> for Xcm<Call> {
} }
} }
/// Default value for the proof size weight component. Set at 64 KB. /// Default value for the proof size weight component. Set at 0 KB.
const DEFAULT_PROOF_SIZE: u64 = 64 * 1024; /// 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. // Convert from a v2 instruction to a v3 instruction.
impl<Call> TryFrom<OldInstruction<Call>> for Instruction<Call> { impl<Call> TryFrom<OldInstruction<Call>> for Instruction<Call> {