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

Weight v1.5: Opaque Struct #12138

Merged
merged 60 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
78f8104
initial idea
shawntabrizi Aug 28, 2022
7f01ecd
update frame_support
shawntabrizi Aug 28, 2022
3125a97
update a bunch more
shawntabrizi Aug 28, 2022
c6f9e89
add ord
shawntabrizi Aug 28, 2022
1ff21f3
adjust RuntimeDbWeight
shawntabrizi Aug 28, 2022
1b750b6
frame_system builds
shawntabrizi Aug 28, 2022
927cbfc
re-export
shawntabrizi Aug 28, 2022
abef86e
frame_support tests pass
shawntabrizi Aug 28, 2022
505291e
frame_executive compile
shawntabrizi Aug 28, 2022
58ca521
frame_executive builds
shawntabrizi Aug 29, 2022
155247e
frame_system tests passing
shawntabrizi Aug 29, 2022
57a9608
pallet-utility tests pass
shawntabrizi Aug 29, 2022
43a9822
fix a bunch of pallets
shawntabrizi Aug 29, 2022
18d13aa
more
shawntabrizi Aug 29, 2022
9c7e3c8
phragmen
shawntabrizi Aug 29, 2022
690b2d8
state-trie-migration
shawntabrizi Aug 29, 2022
694d8fc
scheduler and referenda
shawntabrizi Aug 29, 2022
2cf7413
pallet-election-provider-multi-phase
shawntabrizi Aug 29, 2022
32537ca
aura
shawntabrizi Aug 29, 2022
11ee8ae
staking
shawntabrizi Aug 29, 2022
58c95ee
more
shawntabrizi Aug 29, 2022
1568fe5
babe
shawntabrizi Aug 29, 2022
431085f
balances
shawntabrizi Aug 29, 2022
ee8d842
Merge branch 'master' into shawntabrizi-weight-v1.5
shawntabrizi Aug 29, 2022
afca016
bunch more
shawntabrizi Aug 29, 2022
6137298
sudo
shawntabrizi Aug 29, 2022
0ccec6d
transaction-payment
shawntabrizi Aug 29, 2022
9fb9378
asset-tx-payment
shawntabrizi Aug 29, 2022
4d6df92
last pallets
shawntabrizi Aug 29, 2022
06979b6
fix alliance merge
shawntabrizi Aug 29, 2022
06b0b50
fix node template runtime
shawntabrizi Aug 29, 2022
062e866
fix pallet-contracts cc @athei
shawntabrizi Aug 29, 2022
9c7f09a
fix node runtime
shawntabrizi Aug 29, 2022
7261a05
fix compile on runtime-benchmarks feature
shawntabrizi Aug 29, 2022
5a35f8d
comment
shawntabrizi Aug 29, 2022
6bc74aa
fix frame-support-test
shawntabrizi Aug 29, 2022
8a0a0c7
fix more tests
shawntabrizi Aug 29, 2022
ce87ef8
weight regex
shawntabrizi Aug 29, 2022
aed139b
frame system works
shawntabrizi Aug 29, 2022
d63e922
fix a bunch
shawntabrizi Aug 29, 2022
a9a6c66
more
shawntabrizi Aug 29, 2022
8adb1a4
more
shawntabrizi Aug 29, 2022
2d9d5a2
more
shawntabrizi Aug 30, 2022
2df2d77
more
shawntabrizi Aug 30, 2022
f5b5a77
more
shawntabrizi Aug 30, 2022
00a4d13
more fixes
shawntabrizi Aug 30, 2022
3694224
update templates
shawntabrizi Aug 30, 2022
5053f80
fix contracts benchmarks
shawntabrizi Aug 30, 2022
8df72dc
Update lib.rs
shawntabrizi Aug 30, 2022
3f00bff
Update lib.rs
shawntabrizi Aug 30, 2022
7c853e4
fix ui
shawntabrizi Aug 30, 2022
dfdbc3b
make scalar saturating mul const
shawntabrizi Aug 30, 2022
04fd22c
more const functions
shawntabrizi Aug 30, 2022
b0c262b
scalar div
shawntabrizi Aug 30, 2022
5c37fb8
refactor using constant functions
shawntabrizi Aug 31, 2022
8e973c0
move impl
shawntabrizi Aug 31, 2022
44246b5
fix overhead template
shawntabrizi Aug 31, 2022
e698cfe
Merge branch 'master' into shawntabrizi-weight-v1.5
shawntabrizi Aug 31, 2022
b6eb595
use compactas
shawntabrizi Aug 31, 2022
6b3a7d2
Update lib.rs
shawntabrizi Aug 31, 2022
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
4 changes: 2 additions & 2 deletions bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ mod multiplier_tests {
4294967295,
BlockWeights::get().max_block / 2,
BlockWeights::get().max_block,
Weight::max_value() / 2,
Weight::max_value(),
Weight::MAX / 2,
Weight::MAX,
]
.into_iter()
.for_each(|i| {
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 2 seconds of compute with a 6 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(2 * WEIGHT_PER_SECOND);

parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
Expand Down
4 changes: 2 additions & 2 deletions docs/Upgrading-2.0-to-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ And update the overall definition for weights on frame and a few related types a
+/// by Operational extrinsics.
+const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
+/// We allow for 2 seconds of compute with a 6 second average block time.
+const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
+const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(2 * WEIGHT_PER_SECOND);
+
parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
- /// We allow for 2 seconds of compute with a 6 second average block time.
- pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
- pub const MaximumBlockWeight: Weight = Weight::from_ref_time(2 * WEIGHT_PER_SECOND);
- pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
- /// Assume 10% of weight for average on_initialize calls.
- pub MaximumExtrinsicWeight: Weight =
Expand Down
8 changes: 4 additions & 4 deletions frame/alliance/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ benchmarks_instance_pallet! {
// Whitelist voter account from further DB operations.
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
Expand Down Expand Up @@ -417,7 +417,7 @@ benchmarks_instance_pallet! {
index,
true,
)?;
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
Expand Down Expand Up @@ -489,7 +489,7 @@ benchmarks_instance_pallet! {

System::<T>::set_block_number(T::BlockNumber::max_value());

}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
Expand Down Expand Up @@ -562,7 +562,7 @@ benchmarks_instance_pallet! {
// caller is prime, prime already votes aye by creating the proposal
System::<T>::set_block_number(T::BlockNumber::max_value());

}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
Expand Down
2 changes: 1 addition & 1 deletion frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub mod pallet {
T::EventHandler::note_author(author);
}

0
Weight::zero()
}

fn on_finalize(_: T::BlockNumber) {
Expand Down
8 changes: 5 additions & 3 deletions frame/babe/src/default_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use frame_support::weights::{

impl crate::WeightInfo for () {
fn plan_config_change() -> Weight {
DbWeight::get().writes(1)
Weight::from_ref_time(DbWeight::get().writes(1))
}

fn report_equivocation(validator_count: u32) -> Weight {
Expand All @@ -38,7 +38,7 @@ impl crate::WeightInfo for () {
const MAX_NOMINATORS: u64 = 200;

// checking membership proof
(35 * WEIGHT_PER_MICROS)
let ref_time_weight = (35 * WEIGHT_PER_MICROS)
.saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count))
.saturating_add(DbWeight::get().reads(5))
// check equivocation proof
Expand All @@ -47,6 +47,8 @@ impl crate::WeightInfo for () {
.saturating_add(110 * WEIGHT_PER_MICROS)
.saturating_add(25 * WEIGHT_PER_MICROS * MAX_NOMINATORS)
.saturating_add(DbWeight::get().reads(14 + 3 * MAX_NOMINATORS))
.saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS))
.saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS));

Weight::from_ref_time(ref_time_weight)
}
}
8 changes: 4 additions & 4 deletions frame/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ pub mod pallet {
/// Initialization
fn on_initialize(now: BlockNumberFor<T>) -> Weight {
Self::initialize(now);
0
Weight::zero()
}

/// Block finalization
Expand Down Expand Up @@ -880,15 +880,15 @@ impl<T: Config> frame_support::traits::EstimateNextSessionRotation<T::BlockNumbe
(
Some(Permill::from_rational(*elapsed, T::EpochDuration::get())),
// Read: Current Slot, Epoch Index, Genesis Slot
T::DbWeight::get().reads(3),
Weight::from_ref_time(T::DbWeight::get().reads(3)),
)
}

fn estimate_next_session_rotation(now: T::BlockNumber) -> (Option<T::BlockNumber>, Weight) {
(
Self::next_expected_epoch_change(now),
// Read: Current Slot, Epoch Index, Genesis Slot
T::DbWeight::get().reads(3),
Weight::from_ref_time(T::DbWeight::get().reads(3)),
)
}
}
Expand Down Expand Up @@ -1008,6 +1008,6 @@ pub mod migrations {

writes += 3;

T::DbWeight::get().writes(writes) + T::DbWeight::get().reads(reads)
Weight::from_ref_time(T::DbWeight::get().reads_writes(reads, writes))
}
}
2 changes: 1 addition & 1 deletion frame/balances/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight as Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weight functions needed for pallet_balances.
Expand Down
2 changes: 1 addition & 1 deletion frame/benchmarking/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub struct BenchmarkResult {

impl BenchmarkResult {
pub fn from_weight(w: Weight) -> Self {
Self { extrinsic_time: (w as u128) / 1_000, ..Default::default() }
Self { extrinsic_time: (w.ref_time() / 1_000) as u128, ..Default::default() }
}
}

Expand Down
2 changes: 1 addition & 1 deletion frame/child-bounties/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ frame_support::construct_runtime!(
);

parameter_types! {
pub const MaximumBlockWeight: Weight = 1024;
pub const MaximumBlockWeight= Weight::from_ref_time(1024);
shawntabrizi marked this conversation as resolved.
Show resolved Hide resolved
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
Expand Down
8 changes: 4 additions & 4 deletions frame/collective/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ benchmarks_instance_pallet! {
// Whitelist voter account from further DB operations.
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
}: close(SystemOrigin::Signed(voter), last_hash, index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
Expand Down Expand Up @@ -436,7 +436,7 @@ benchmarks_instance_pallet! {
index, approve,
)?;

}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
Expand Down Expand Up @@ -511,7 +511,7 @@ benchmarks_instance_pallet! {
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);

// Prime nay will close it as disapproved
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Disapproved { proposal_hash: last_hash }.into());
Expand Down Expand Up @@ -583,7 +583,7 @@ benchmarks_instance_pallet! {
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);

// Prime aye will close it as approved
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Err(DispatchError::BadOrigin) }.into());
Expand Down
8 changes: 4 additions & 4 deletions frame/contracts/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub type Weight = u64;
/// As 1 gas is equal to 1 weight we base this on the conducted benchmarks which
/// determined runtime weights:
/// <https://github.com/paritytech/substrate/pull/5446>
const GAS_PER_SECOND: Weight = 1_000_000_000_000;
const GAS_PER_SECOND: Weight = Weight::from_ref_time(1_000_000_000_000);

/// The maximum amount of weight that the call and instantiate rpcs are allowed to consume.
/// This puts a ceiling on the weight limit that is supplied to the rpc as an argument.
const GAS_LIMIT: Weight = 5 * GAS_PER_SECOND;
const GAS_LIMIT: Weight = Weight::from_ref_time(5 * GAS_PER_SECOND);

/// A private newtype for converting `ContractAccessError` into an RPC error.
struct ContractAccessError(pallet_contracts_primitives::ContractAccessError);
Expand Down Expand Up @@ -229,7 +229,7 @@ where
call_request;

let value: Balance = decode_hex(value, "balance")?;
let gas_limit: Weight = decode_hex(gas_limit, "weight")?;
let gas_limit = Weight::from_ref_time(decode_hex(gas_limit, "weight")?);
let storage_deposit_limit: Option<Balance> =
storage_deposit_limit.map(|l| decode_hex(l, "balance")).transpose()?;
limit_gas(gas_limit)?;
Expand Down Expand Up @@ -259,7 +259,7 @@ where
} = instantiate_request;

let value: Balance = decode_hex(value, "balance")?;
let gas_limit: Weight = decode_hex(gas_limit, "weight")?;
let gas_limit = Weight::from_ref_time(decode_hex(gas_limit, "weight")?);
let storage_deposit_limit: Option<Balance> =
storage_deposit_limit.map(|l| decode_hex(l, "balance")).transpose()?;
limit_gas(gas_limit)?;
Expand Down
6 changes: 3 additions & 3 deletions frame/contracts/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sp_std::{marker::PhantomData, prelude::*};
/// Wrapper for all migrations of this pallet, based on `StorageVersion`.
pub fn migrate<T: Config>() -> Weight {
let version = StorageVersion::get::<Pallet<T>>();
let mut weight: Weight = 0;
let mut weight = Weight::new();

if version < 4 {
weight = weight.saturating_add(v4::migrate::<T>());
Expand Down Expand Up @@ -127,7 +127,7 @@ mod v5 {
type DeletionQueue<T: Config> = StorageValue<Pallet<T>, Vec<DeletedContract>>;

pub fn migrate<T: Config>() -> Weight {
let mut weight: Weight = 0;
let mut weight = Weight::new();

<ContractInfoOf<T>>::translate(|_key, old: OldContractInfo<T>| {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
Expand Down Expand Up @@ -216,7 +216,7 @@ mod v6 {
type OwnerInfoOf<T: Config> = StorageMap<Pallet<T>, Identity, CodeHash<T>, OwnerInfo<T>>;

pub fn migrate<T: Config>() -> Weight {
let mut weight: Weight = 0;
let mut weight = Weight::new();

<ContractInfoOf<T>>::translate(|_key, old: OldContractInfo<T>| {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
Expand Down
8 changes: 4 additions & 4 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ pub const BOB: AccountId32 = AccountId32::new([2u8; 32]);
pub const CHARLIE: AccountId32 = AccountId32::new([3u8; 32]);
pub const DJANGO: AccountId32 = AccountId32::new([4u8; 32]);

pub const GAS_LIMIT: Weight = 100_000_000_000;
pub const GAS_LIMIT: Weight = Weight::from_ref_time(100_000_000_000);

pub struct ExtBuilder {
existential_deposit: u64,
Expand Down Expand Up @@ -1826,7 +1826,7 @@ fn lazy_removal_works() {
assert_matches!(child::get(trie, &[99]), Some(42));

// Run the lazy removal
Contracts::on_idle(System::block_number(), Weight::max_value());
Contracts::on_idle(System::block_number(), Weight::MAX);

// Value should be gone now
assert_matches!(child::get::<i32>(trie, &[99]), None);
Expand Down Expand Up @@ -1896,7 +1896,7 @@ fn lazy_batch_removal_works() {
}

// Run single lazy removal
Contracts::on_idle(System::block_number(), Weight::max_value());
Contracts::on_idle(System::block_number(), Weight::MAX);

// The single lazy removal should have removed all queued tries
for trie in tries.iter() {
Expand Down Expand Up @@ -2085,7 +2085,7 @@ fn lazy_removal_does_no_run_on_low_remaining_weight() {
assert_matches!(child::get::<i32>(trie, &[99]), Some(42));

// Run on_idle with max remaining weight, this should remove the value
Contracts::on_idle(System::block_number(), Weight::max_value());
Contracts::on_idle(System::block_number(), Weight::MAX);

// Value should be gone
assert_matches!(child::get::<i32>(trie, &[99]), None);
Expand Down
2 changes: 1 addition & 1 deletion frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ impl<T: Config> Pallet<T> {
/// # </weight>
fn begin_block(now: T::BlockNumber) -> Weight {
let max_block_weight = T::BlockWeights::get().max_block;
let mut weight = 0;
let mut weight = Weight::new();

let next = Self::lowest_unbaked();
let last = Self::referendum_count();
Expand Down
2 changes: 1 addition & 1 deletion frame/democracy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl frame_system::Config for Test {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
pub MaximumSchedulerWeight: Weight = Weight::from_ref_time(Perbill::from_percent(80) * BlockWeights::get().max_block);
}
impl pallet_scheduler::Config for Test {
type Event = Event;
Expand Down
4 changes: 2 additions & 2 deletions frame/election-provider-multi-phase/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ parameter_types! {
pub static SignedDepositByte: Balance = 0;
pub static SignedDepositWeight: Balance = 0;
pub static SignedRewardBase: Balance = 7;
pub static SignedMaxWeight: Weight = BlockWeights::get().max_block;
pub static SignedMaxWeight: Weight = Weight::from_ref_time(BlockWeights::get().max_block);
pub static MinerTxPriority: u64 = 100;
pub static BetterSignedThreshold: Perbill = Perbill::zero();
pub static BetterUnsignedThreshold: Perbill = Perbill::zero();
pub static OffchainRepeat: BlockNumber = 5;
pub static MinerMaxWeight: Weight = BlockWeights::get().max_block;
pub static MinerMaxWeight: Weight = Weight::from_ref_time(BlockWeights::get().max_block);
pub static MinerMaxLength: u32 = 256;
pub static MockWeightInfo: MockedWeightInfo = MockedWeightInfo::Real;
pub static MaxElectingVoters: VoterIndex = u32::max_value();
Expand Down
2 changes: 1 addition & 1 deletion frame/elections-phragmen/src/migrations/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub fn apply<V: V2ToV3, T: Config>(

StorageVersion::new(3).put::<Pallet<T>>();

Weight::max_value()
Weight::MAX
} else {
log::warn!(
target: "runtime::elections-phragmen",
Expand Down
2 changes: 1 addition & 1 deletion frame/elections-phragmen/src/migrations/v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::super::*;
/// situation where they could increase their free balance but still not be able to use their funds
/// because they were less than the lock.
pub fn migrate<T: Config>(to_migrate: Vec<T::AccountId>) -> Weight {
let mut weight = 0;
let mut weight = Weight::new();

for who in to_migrate.iter() {
if let Ok(mut voter) = Voting::<T>::try_get(who) {
Expand Down
2 changes: 1 addition & 1 deletion frame/executive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
// Do whatever you want.
0
frame_support::weights::Weight::zero()
}
}

Expand Down
Loading