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

Rename from_components to from_parts #12473

Merged
merged 4 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frame/contracts/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ where
pub fn nested(&mut self, amount: Weight) -> Result<Self, DispatchError> {
// NOTE that it is ok to allocate all available gas since it still ensured
// by `charge` that it doesn't reach zero.
let amount = Weight::from_components(
let amount = Weight::from_parts(
if amount.ref_time().is_zero() {
self.gas_left().ref_time()
} else {
Expand Down
2 changes: 1 addition & 1 deletion frame/election-provider-multi-phase/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ parameter_types! {
pub const ExistentialDeposit: u64 = 1;
pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights
::with_sensible_defaults(
Weight::from_components(2u64 * constants::WEIGHT_PER_SECOND.ref_time(), u64::MAX),
Weight::from_parts(2u64 * constants::WEIGHT_PER_SECOND.ref_time(), u64::MAX),
NORMAL_DISPATCH_RATIO,
);
}
Expand Down
2 changes: 1 addition & 1 deletion frame/system/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pub struct BlockWeights {
impl Default for BlockWeights {
fn default() -> Self {
Self::with_sensible_defaults(
Weight::from_components(constants::WEIGHT_PER_SECOND.ref_time(), u64::MAX),
Weight::from_parts(constants::WEIGHT_PER_SECOND.ref_time(), u64::MAX),
DEFAULT_NORMAL_RATIO,
)
}
Expand Down
8 changes: 4 additions & 4 deletions primitives/weights/src/weight_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ impl Weight {
Self { ref_time: 0, proof_size }
}

/// Construct [`Weight`] with weight components, namely reference time and storage size weights.
pub const fn from_components(ref_time: u64, proof_size: u64) -> Self {
/// Construct [`Weight`] from weight parts, namely reference time and proof size weights.
pub const fn from_parts(ref_time: u64, proof_size: u64) -> Self {
Self { ref_time, proof_size }
}

Expand Down Expand Up @@ -455,8 +455,8 @@ mod tests {
#[test]
fn is_zero_works() {
assert!(Weight::zero().is_zero());
assert!(!Weight::from_components(1, 0).is_zero());
assert!(!Weight::from_components(0, 1).is_zero());
assert!(!Weight::from_parts(1, 0).is_zero());
assert!(!Weight::from_parts(0, 1).is_zero());
assert!(!Weight::MAX.is_zero());
}
}