Skip to content

Commit 88df2b3

Browse files
authored
Companion for #11415 (WeightToFee) (#5525)
* Companion for paritytech/substrate#11415 * Rename `WeightToFee::calc()` to `WeightToFee::wight_to_fee()` * Fix typo * Fix compile errors * update lockfile for {"substrate"} Co-authored-by: parity-processbot <>
1 parent da4d8cc commit 88df2b3

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

polkadot/runtime/kusama/constants/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ mod tests {
100100
fee::WeightToFee,
101101
};
102102
use crate::weights::ExtrinsicBaseWeight;
103-
use frame_support::weights::WeightToFeePolynomial;
103+
use frame_support::weights::WeightToFee as WeightToFeeT;
104104
use runtime_common::MAXIMUM_BLOCK_WEIGHT;
105105

106106
#[test]
107107
// Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds.
108108
fn full_block_fee_is_correct() {
109109
// A full block should cost between 1,000 and 10,000 CENTS.
110-
let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
110+
let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT);
111111
assert!(full_block >= 1_000 * CENTS);
112112
assert!(full_block <= 10_000 * CENTS);
113113
}
@@ -117,7 +117,7 @@ mod tests {
117117
fn extrinsic_base_fee_is_correct() {
118118
// `ExtrinsicBaseWeight` should cost 1/10 of a CENT
119119
println!("Base: {}", ExtrinsicBaseWeight::get());
120-
let x = WeightToFee::calc(&ExtrinsicBaseWeight::get());
120+
let x = WeightToFee::weight_to_fee(&ExtrinsicBaseWeight::get());
121121
let y = CENTS / 10;
122122
assert!(x.max(y) - x.min(y) < MILLICENTS);
123123
}

polkadot/runtime/kusama/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Tests for the Kusama Runtime Configuration
1818
1919
use crate::*;
20-
use frame_support::weights::{GetDispatchInfo, WeightToFeePolynomial};
20+
use frame_support::weights::{GetDispatchInfo, WeightToFee as WeightToFeeT};
2121
use keyring::Sr25519Keyring::Charlie;
2222
use pallet_transaction_payment::Multiplier;
2323
use parity_scale_codec::Encode;
@@ -68,7 +68,7 @@ fn payout_weight_portion() {
6868
#[ignore]
6969
fn block_cost() {
7070
let max_block_weight = BlockWeights::get().max_block;
71-
let raw_fee = WeightToFee::calc(&max_block_weight);
71+
let raw_fee = WeightToFee::weight_to_fee(&max_block_weight);
7272

7373
println!(
7474
"Full Block weight == {} // WeightToFee(full_block) == {} plank",

polkadot/runtime/polkadot/constants/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ mod tests {
102102
fee::WeightToFee,
103103
};
104104
use crate::weights::ExtrinsicBaseWeight;
105-
use frame_support::weights::WeightToFeePolynomial;
105+
use frame_support::weights::WeightToFee as WeightToFeeT;
106106
use runtime_common::MAXIMUM_BLOCK_WEIGHT;
107107

108108
#[test]
109109
// Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds.
110110
fn full_block_fee_is_correct() {
111111
// A full block should cost between 10 and 100 DOLLARS.
112-
let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
112+
let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT);
113113
assert!(full_block >= 10 * DOLLARS);
114114
assert!(full_block <= 100 * DOLLARS);
115115
}
@@ -119,7 +119,7 @@ mod tests {
119119
fn extrinsic_base_fee_is_correct() {
120120
// `ExtrinsicBaseWeight` should cost 1/10 of a CENT
121121
println!("Base: {}", ExtrinsicBaseWeight::get());
122-
let x = WeightToFee::calc(&ExtrinsicBaseWeight::get());
122+
let x = WeightToFee::weight_to_fee(&ExtrinsicBaseWeight::get());
123123
let y = CENTS / 10;
124124
assert!(x.max(y) - x.min(y) < MILLICENTS);
125125
}

polkadot/runtime/polkadot/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ sp_api::impl_runtime_apis! {
20092009
#[cfg(test)]
20102010
mod test_fees {
20112011
use super::*;
2012-
use frame_support::weights::{GetDispatchInfo, WeightToFeePolynomial};
2012+
use frame_support::weights::{GetDispatchInfo, WeightToFee as WeightToFeeT};
20132013
use keyring::Sr25519Keyring::Charlie;
20142014
use pallet_transaction_payment::Multiplier;
20152015
use runtime_common::MinimumMultiplier;
@@ -2038,7 +2038,7 @@ mod test_fees {
20382038
#[ignore]
20392039
fn block_cost() {
20402040
let max_block_weight = BlockWeights::get().max_block;
2041-
let raw_fee = WeightToFee::calc(&max_block_weight);
2041+
let raw_fee = WeightToFee::weight_to_fee(&max_block_weight);
20422042

20432043
println!(
20442044
"Full Block weight == {} // WeightToFee(full_block) == {} plank",

polkadot/runtime/rococo/constants/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ mod tests {
100100
fee::WeightToFee,
101101
};
102102
use crate::weights::ExtrinsicBaseWeight;
103-
use frame_support::weights::WeightToFeePolynomial;
103+
use frame_support::weights::WeightToFee as WeightToFeeT;
104104
use runtime_common::MAXIMUM_BLOCK_WEIGHT;
105105

106106
#[test]
107107
// Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds.
108108
fn full_block_fee_is_correct() {
109109
// A full block should cost between 10 and 100 DOLLARS.
110-
let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
110+
let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT);
111111
assert!(full_block >= 10 * DOLLARS);
112112
assert!(full_block <= 100 * DOLLARS);
113113
}
@@ -117,7 +117,7 @@ mod tests {
117117
fn extrinsic_base_fee_is_correct() {
118118
// `ExtrinsicBaseWeight` should cost 1/10 of a CENT
119119
println!("Base: {}", ExtrinsicBaseWeight::get());
120-
let x = WeightToFee::calc(&ExtrinsicBaseWeight::get());
120+
let x = WeightToFee::weight_to_fee(&ExtrinsicBaseWeight::get());
121121
let y = CENTS / 10;
122122
assert!(x.max(y) - x.min(y) < MILLICENTS);
123123
}

polkadot/runtime/westend/constants/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ mod tests {
100100
fee::WeightToFee,
101101
};
102102
use crate::weights::ExtrinsicBaseWeight;
103-
use frame_support::weights::WeightToFeePolynomial;
103+
use frame_support::weights::WeightToFee as WeightToFeeT;
104104
use runtime_common::MAXIMUM_BLOCK_WEIGHT;
105105

106106
#[test]
107107
// Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds.
108108
fn full_block_fee_is_correct() {
109109
// A full block should cost between 10 and 100 UNITS.
110-
let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
110+
let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT);
111111
assert!(full_block >= 10 * UNITS);
112112
assert!(full_block <= 100 * UNITS);
113113
}
@@ -117,7 +117,7 @@ mod tests {
117117
fn extrinsic_base_fee_is_correct() {
118118
// `ExtrinsicBaseWeight` should cost 1/10 of a CENT
119119
println!("Base: {}", ExtrinsicBaseWeight::get());
120-
let x = WeightToFee::calc(&ExtrinsicBaseWeight::get());
120+
let x = WeightToFee::weight_to_fee(&ExtrinsicBaseWeight::get());
121121
let y = CENTS / 10;
122122
assert!(x.max(y) - x.min(y) < MILLICENTS);
123123
}

0 commit comments

Comments
 (0)