Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Co #13637: Remove Weight::without_{ref_time, proof_size} (#2346)
Browse files Browse the repository at this point in the history
* Remove Weight::without_{ref_time, proof_size}

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* update lockfile for {"substrate", "polkadot"}

* add missing pallet-xcm-benchmarks function

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: parity-processbot <>
Co-authored-by: acatangiu <[email protected]>
  • Loading branch information
ggwpez and acatangiu authored Mar 24, 2023
1 parent 020a024 commit 67e7fcd
Show file tree
Hide file tree
Showing 7 changed files with 294 additions and 260 deletions.
512 changes: 256 additions & 256 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions parachains/runtimes/assets/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,11 @@ impl_runtime_apis! {
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down Expand Up @@ -1287,8 +1292,10 @@ mod tests {
#[test]
fn full_block_fee_ratio() {
let block = RuntimeBlockWeights::get().max_block;
let time_fee: Balance = fee::WeightToFee::weight_to_fee(&block.without_proof_size());
let proof_fee: Balance = fee::WeightToFee::weight_to_fee(&block.without_ref_time());
let time_fee: Balance =
fee::WeightToFee::weight_to_fee(&Weight::from_parts(block.ref_time(), 0));
let proof_fee: Balance =
fee::WeightToFee::weight_to_fee(&Weight::from_parts(0, block.proof_size()));

let proof_o_time = proof_fee.checked_div(time_fee).unwrap_or_default();
assert!(proof_o_time <= 30, "{} should be at most 30", proof_o_time);
Expand Down
11 changes: 9 additions & 2 deletions parachains/runtimes/assets/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,11 @@ impl_runtime_apis! {
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down Expand Up @@ -1138,8 +1143,10 @@ mod tests {
#[test]
fn full_block_fee_ratio() {
let block = RuntimeBlockWeights::get().max_block;
let time_fee: Balance = fee::WeightToFee::weight_to_fee(&block.without_proof_size());
let proof_fee: Balance = fee::WeightToFee::weight_to_fee(&block.without_ref_time());
let time_fee: Balance =
fee::WeightToFee::weight_to_fee(&Weight::from_parts(block.ref_time(), 0));
let proof_fee: Balance =
fee::WeightToFee::weight_to_fee(&Weight::from_parts(0, block.proof_size()));

let proof_o_time = proof_fee.checked_div(time_fee).unwrap_or_default();
assert!(proof_o_time <= 30, "{} should be at most 30", proof_o_time);
Expand Down
5 changes: 5 additions & 0 deletions parachains/runtimes/assets/westmint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,11 @@ impl_runtime_apis! {
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
5 changes: 5 additions & 0 deletions parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ impl_runtime_apis! {
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ impl_runtime_apis! {
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
5 changes: 5 additions & 0 deletions parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,11 @@ impl_runtime_apis! {
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down

0 comments on commit 67e7fcd

Please sign in to comment.