diff --git a/client/cli/src/commands/export_blocks_cmd.rs b/client/cli/src/commands/export_blocks_cmd.rs index e175d498941b8..497531ad393ba 100644 --- a/client/cli/src/commands/export_blocks_cmd.rs +++ b/client/cli/src/commands/export_blocks_cmd.rs @@ -85,7 +85,7 @@ impl ExportBlocksCmd { info!("DB path: {}", path.display()); } - let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1); + let from = self.from.as_ref().and_then(|f| f.parse().ok()).unwrap_or(1u32); let to = self.to.as_ref().and_then(|t| t.parse().ok()); let binary = self.binary; diff --git a/client/finality-grandpa/src/voting_rule.rs b/client/finality-grandpa/src/voting_rule.rs index 60493867ce1f4..700b0aeb551cd 100644 --- a/client/finality-grandpa/src/voting_rule.rs +++ b/client/finality-grandpa/src/voting_rule.rs @@ -241,7 +241,7 @@ impl Default for VotingRulesBuilder where { fn default() -> Self { VotingRulesBuilder::new() - .add(BeforeBestBlockBy(2.into())) + .add(BeforeBestBlockBy(2u32.into())) .add(ThreeQuartersOfTheUnfinalizedChain) } } diff --git a/client/informant/src/display.rs b/client/informant/src/display.rs index aa2d883b5baa0..5c8f5f8ef84aa 100644 --- a/client/informant/src/display.rs +++ b/client/informant/src/display.rs @@ -166,7 +166,7 @@ fn speed( } else { // If the number of blocks can't be converted to a regular integer, then we need a more // algebraic approach and we stay within the realm of integers. - let one_thousand = NumberFor::::from(1_000); + let one_thousand = NumberFor::::from(1_000u32); let elapsed = NumberFor::::from( >::try_from(elapsed_ms).unwrap_or(u32::max_value()) ); diff --git a/client/network/src/light_client_handler.rs b/client/network/src/light_client_handler.rs index c1ff14fc82a22..d1c407c99695b 100644 --- a/client/network/src/light_client_handler.rs +++ b/client/network/src/light_client_handler.rs @@ -1429,7 +1429,7 @@ mod tests { _: ChangesProof ) -> Result, u32)>, ClientError> { match self.ok { - true => Ok(vec![(100.into(), 2)]), + true => Ok(vec![(100u32.into(), 2)]), false => Err(ClientError::Backend("Test error".into())), } } diff --git a/client/service/src/chain_ops/export_blocks.rs b/client/service/src/chain_ops/export_blocks.rs index 2f32cbf7fbdb7..3d2dbcbb9d00f 100644 --- a/client/service/src/chain_ops/export_blocks.rs +++ b/client/service/src/chain_ops/export_blocks.rs @@ -87,7 +87,7 @@ where // Reached end of the chain. None => return Poll::Ready(Ok(())), } - if (block % 10000.into()).is_zero() { + if (block % 10000u32.into()).is_zero() { info!("#{}", block); } if block == last { diff --git a/client/service/src/chain_ops/import_blocks.rs b/client/service/src/chain_ops/import_blocks.rs index 46ad0d0501d93..74a33c6557c9a 100644 --- a/client/service/src/chain_ops/import_blocks.rs +++ b/client/service/src/chain_ops/import_blocks.rs @@ -200,7 +200,7 @@ impl Speedometer { /// Creates a fresh Speedometer. fn new() -> Self { Self { - best_number: NumberFor::::from(0), + best_number: NumberFor::::from(0u32), last_number: None, last_update: Instant::now(), } @@ -232,7 +232,7 @@ impl Speedometer { } else { // If the number of blocks can't be converted to a regular integer, then we need a more // algebraic approach and we stay within the realm of integers. - let one_thousand = NumberFor::::from(1_000); + let one_thousand = NumberFor::::from(1_000u32); let elapsed = NumberFor::::from( >::try_from(elapsed_ms).unwrap_or(u32::max_value()) ); diff --git a/client/service/src/client/client.rs b/client/service/src/client/client.rs index 64b00f81905dc..1b07e6b4f7b2c 100644 --- a/client/service/src/client/client.rs +++ b/client/service/src/client/client.rs @@ -40,7 +40,7 @@ use sp_runtime::{ generic::{BlockId, SignedBlock, DigestItem}, traits::{ Block as BlockT, Header as HeaderT, Zero, NumberFor, - HashFor, SaturatedConversion, One, DigestFor, + HashFor, SaturatedConversion, One, DigestFor, UniqueSaturatedInto, }, }; use sp_state_machine::{ @@ -1141,7 +1141,7 @@ impl Client where let mut ancestor = load_header(ancestor_hash)?; let mut uncles = Vec::new(); - for _generation in 0..max_generation.saturated_into() { + for _generation in 0u32..UniqueSaturatedInto::::unique_saturated_into(max_generation) { let children = self.backend.blockchain().children(ancestor_hash)?; uncles.extend(children.into_iter().filter(|h| h != ¤t_hash)); current_hash = ancestor_hash; diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index 0af393b53f517..d3ad780b5be62 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -316,9 +316,9 @@ impl MetricsService { ); if let Some(metrics) = self.metrics.as_ref() { - let best_seen_block = net_status + let best_seen_block: Option = net_status .best_seen_block - .map(|num: NumberFor| num.unique_saturated_into() as u64); + .map(|num: NumberFor| UniqueSaturatedInto::::unique_saturated_into(num)); if let Some(best_seen_block) = best_seen_block { metrics.block_height.with_label_values(&["sync_target"]).set(best_seen_block); diff --git a/client/transaction-pool/src/lib.rs b/client/transaction-pool/src/lib.rs index 0b6a1e935b9d0..e03c01bd1d816 100644 --- a/client/transaction-pool/src/lib.rs +++ b/client/transaction-pool/src/lib.rs @@ -569,7 +569,7 @@ impl MaintainedTransactionPool for BasicPool let next_action = self.revalidation_strategy.lock().next( block_number, Some(std::time::Duration::from_secs(60)), - Some(20.into()), + Some(20u32.into()), ); let revalidation_strategy = self.revalidation_strategy.clone(); let revalidation_queue = self.revalidation_queue.clone(); diff --git a/frame/aura/src/lib.rs b/frame/aura/src/lib.rs index ca3d1f15f421b..e8e0e616bc0dc 100644 --- a/frame/aura/src/lib.rs +++ b/frame/aura/src/lib.rs @@ -74,7 +74,7 @@ pub trait Trait: pallet_timestamp::Trait { decl_storage! { trait Store for Module as Aura { /// The last timestamp. - LastTimestamp get(fn last) build(|_| 0.into()): T::Moment; + LastTimestamp get(fn last): T::Moment; /// The current authorities pub Authorities get(fn authorities): Vec; @@ -196,7 +196,7 @@ impl Module { pub fn slot_duration() -> T::Moment { // we double the minimum block-period so each author can always propose within // the majority of its slot. - ::MinimumPeriod::get().saturating_mul(2.into()) + ::MinimumPeriod::get().saturating_mul(2u32.into()) } fn on_timestamp_set(now: T::Moment, slot_duration: T::Moment) { diff --git a/frame/babe/src/lib.rs b/frame/babe/src/lib.rs index efada5f18cbf8..8cab698fda093 100644 --- a/frame/babe/src/lib.rs +++ b/frame/babe/src/lib.rs @@ -379,7 +379,7 @@ impl Module { pub fn slot_duration() -> T::Moment { // we double the minimum block-period so each author can always propose within // the majority of their slot. - ::MinimumPeriod::get().saturating_mul(2.into()) + ::MinimumPeriod::get().saturating_mul(2u32.into()) } /// Determine whether an epoch change should take place at this block. diff --git a/frame/benchmarking/src/lib.rs b/frame/benchmarking/src/lib.rs index b189cdb6e705e..284b0545d03a5 100644 --- a/frame/benchmarking/src/lib.rs +++ b/frame/benchmarking/src/lib.rs @@ -820,7 +820,7 @@ macro_rules! impl_benchmark { // Set the block number to at least 1 so events are deposited. if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { - frame_system::Module::::set_block_number(1.into()); + frame_system::Module::::set_block_number(1u32.into()); } // Commit the externalities to the database, flushing the DB cache. @@ -966,7 +966,7 @@ macro_rules! impl_benchmark_test { // Set the block number to at least 1 so events are deposited. if $crate::Zero::is_zero(&frame_system::Module::::block_number()) { - frame_system::Module::::set_block_number(1.into()); + frame_system::Module::::set_block_number(1u32.into()); } // Run execution + verification diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index d966ff85d9652..7d8ce26678c09 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -717,7 +717,7 @@ define_env!(Env, , let value: BalanceOf<::T> = read_sandbox_memory_as(ctx, value_ptr, value_len)?; let input_data = read_sandbox_memory(ctx, input_data_ptr, input_data_len)?; - if value > 0.into() { + if value > 0u32.into() { charge_gas(ctx, RuntimeToken::CallSurchargeTransfer)?; } diff --git a/frame/example-offchain-worker/src/lib.rs b/frame/example-offchain-worker/src/lib.rs index 8e02a09484ef5..5fd5eff19bd73 100644 --- a/frame/example-offchain-worker/src/lib.rs +++ b/frame/example-offchain-worker/src/lib.rs @@ -269,7 +269,7 @@ decl_module! { // to the storage and other included pallets. // // We can easily import `frame_system` and retrieve a block hash of the parent block. - let parent_hash = >::block_hash(block_number - 1.into()); + let parent_hash = >::block_hash(block_number - 1u32.into()); debug::debug!("Current block: {:?} (parent hash: {:?})", block_number, parent_hash); // It's a good practice to keep `fn offchain_worker()` function minimal, and move most @@ -364,10 +364,10 @@ impl Module { // transactions in a row. If a strict order is desired, it's better to use // the storage entry for that. (for instance store both block number and a flag // indicating the type of next transaction to send). - let transaction_type = block_number % 3.into(); + let transaction_type = block_number % 3u32.into(); if transaction_type == Zero::zero() { TransactionType::Signed } - else if transaction_type == T::BlockNumber::from(1) { TransactionType::UnsignedForAny } - else if transaction_type == T::BlockNumber::from(2) { TransactionType::UnsignedForAll } + else if transaction_type == T::BlockNumber::from(1u32) { TransactionType::UnsignedForAny } + else if transaction_type == T::BlockNumber::from(2u32) { TransactionType::UnsignedForAll } else { TransactionType::Raw } }, // We are in the grace period, we should not send a transaction this time. diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index bbd077227a29e..43500bef90bb6 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -468,7 +468,7 @@ where >::offchain_worker( // to maintain backward compatibility we call module offchain workers // with parent block number. - header.number().saturating_sub(1.into()) + header.number().saturating_sub(1u32.into()) ) } } diff --git a/frame/grandpa/src/benchmarking.rs b/frame/grandpa/src/benchmarking.rs index 048f99fff7a9b..bac2c24584464 100644 --- a/frame/grandpa/src/benchmarking.rs +++ b/frame/grandpa/src/benchmarking.rs @@ -65,8 +65,8 @@ benchmarks! { } note_stalled { - let delay = 1000.into(); - let best_finalized_block_number = 1.into(); + let delay = 1000u32.into(); + let best_finalized_block_number = 1u32.into(); }: _(RawOrigin::Root, delay, best_finalized_block_number) verify { diff --git a/frame/grandpa/src/lib.rs b/frame/grandpa/src/lib.rs index d4612e1760057..fe836ac913cb6 100644 --- a/frame/grandpa/src/lib.rs +++ b/frame/grandpa/src/lib.rs @@ -446,7 +446,7 @@ impl Module { // only allow the next forced change when twice the window has passed since // this one. - >::put(scheduled_at + in_blocks * 2.into()); + >::put(scheduled_at + in_blocks * 2u32.into()); } >::put(StoredPendingChange { diff --git a/frame/im-online/src/lib.rs b/frame/im-online/src/lib.rs index ef9c6b9182af6..716a2cbcb786c 100644 --- a/frame/im-online/src/lib.rs +++ b/frame/im-online/src/lib.rs @@ -594,7 +594,7 @@ impl Module { // clear the lock in case we have failed to send transaction. if res.is_err() { - new_status.sent_at = 0.into(); + new_status.sent_at = 0u32.into(); storage.set(&new_status); } @@ -635,7 +635,7 @@ impl pallet_session::OneSessionHandler for Module { // Since we consider producing blocks as being online, // the heartbeat is deferred a bit to prevent spamming. let block_number = >::block_number(); - let half_session = T::SessionDuration::get() / 2.into(); + let half_session = T::SessionDuration::get() / 2u32.into(); >::put(block_number + half_session); // Remember who the authorities are for the new session. @@ -723,7 +723,7 @@ impl frame_support::unsigned::ValidateUnsigned for Module { .priority(T::UnsignedPriority::get()) .and_provides((current_session, authority_id)) .longevity(TryInto::::try_into( - T::SessionDuration::get() / 2.into() + T::SessionDuration::get() / 2u32.into() ).unwrap_or(64_u64)) .propagate(true) .build() diff --git a/frame/offences/benchmarking/src/lib.rs b/frame/offences/benchmarking/src/lib.rs index e35050992368a..47055eab73d4a 100644 --- a/frame/offences/benchmarking/src/lib.rs +++ b/frame/offences/benchmarking/src/lib.rs @@ -87,7 +87,7 @@ struct Offender { } fn bond_amount() -> BalanceOf { - T::Currency::minimum_balance().saturating_mul(10_000.into()) + T::Currency::minimum_balance().saturating_mul(10_000u32.into()) } fn create_offender(n: u32, nominators: u32) -> Result, &'static str> { @@ -97,7 +97,7 @@ fn create_offender(n: u32, nominators: u32) -> Result, &'s let reward_destination = RewardDestination::Staked; let raw_amount = bond_amount::(); // add twice as much balance to prevent the account from being killed. - let free_amount = raw_amount.saturating_mul(2.into()); + let free_amount = raw_amount.saturating_mul(2u32.into()); T::Currency::make_free_balance_be(&stash, free_amount); let amount: BalanceOf = raw_amount.into(); Staking::::bond( @@ -243,7 +243,8 @@ benchmarks! { verify { // make sure the report was not deferred assert!(Offences::::deferred_offences().is_empty()); - let slash_amount = slash_fraction * bond_amount::().unique_saturated_into() as u32; + let bond_amount: u32 = UniqueSaturatedInto::::unique_saturated_into(bond_amount::()); + let slash_amount = slash_fraction * bond_amount; let reward_amount = slash_amount * (1 + n) / 2; let mut slash_events = raw_offenders.into_iter() .flat_map(|offender| { @@ -379,7 +380,7 @@ benchmarks! { Offences::::set_deferred_offences(deferred_offences); assert!(!Offences::::deferred_offences().is_empty()); }: { - Offences::::on_initialize(0.into()); + Offences::::on_initialize(0u32.into()); } verify { // make sure that all deferred offences were reported with Ok status. diff --git a/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index 6b1b9f4f37448..c1747669dab07 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/frame/randomness-collective-flip/src/lib.rs @@ -69,7 +69,7 @@ const RANDOM_MATERIAL_LEN: u32 = 81; fn block_number_to_index(block_number: T::BlockNumber) -> usize { // on_initialize is called on the first block after genesis - let index = (block_number - 1.into()) % RANDOM_MATERIAL_LEN.into(); + let index = (block_number - 1u32.into()) % RANDOM_MATERIAL_LEN.into(); index.try_into().ok().expect("Something % 81 is always smaller than usize; qed") } diff --git a/frame/staking/src/benchmarking.rs b/frame/staking/src/benchmarking.rs index e9467fa50be15..d2f769b069435 100644 --- a/frame/staking/src/benchmarking.rs +++ b/frame/staking/src/benchmarking.rs @@ -101,7 +101,7 @@ pub fn create_validator_with_nominators( // Create reward pool let total_payout = T::Currency::minimum_balance() .saturating_mul(upper_bound.into()) - .saturating_mul(1000.into()); + .saturating_mul(1000u32.into()); >::insert(current_era, total_payout); Ok((v_stash, nominators)) @@ -117,7 +117,7 @@ benchmarks! { let controller = create_funded_user::("controller", USER_SEED, 100); let controller_lookup: ::Source = T::Lookup::unlookup(controller.clone()); let reward_destination = RewardDestination::Staked; - let amount = T::Currency::minimum_balance() * 10.into(); + let amount = T::Currency::minimum_balance() * 10u32.into(); whitelist_account!(stash); }: _(RawOrigin::Signed(stash.clone()), controller_lookup, amount, reward_destination) verify { @@ -127,7 +127,7 @@ benchmarks! { bond_extra { let (stash, controller) = create_stash_controller::(USER_SEED, 100, Default::default())?; - let max_additional = T::Currency::minimum_balance() * 10.into(); + let max_additional = T::Currency::minimum_balance() * 10u32.into(); let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; let original_bonded: BalanceOf = ledger.active; whitelist_account!(stash); @@ -140,7 +140,7 @@ benchmarks! { unbond { let (_, controller) = create_stash_controller::(USER_SEED, 100, Default::default())?; - let amount = T::Currency::minimum_balance() * 10.into(); + let amount = T::Currency::minimum_balance() * 10u32.into(); let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; let original_bonded: BalanceOf = ledger.active; whitelist_account!(controller); @@ -157,7 +157,7 @@ benchmarks! { let s in 0 .. MAX_SPANS; let (stash, controller) = create_stash_controller::(0, 100, Default::default())?; add_slashing_spans::(&stash, s); - let amount = T::Currency::minimum_balance() * 5.into(); // Half of total + let amount = T::Currency::minimum_balance() * 5u32.into(); // Half of total Staking::::unbond(RawOrigin::Signed(controller.clone()).into(), amount)?; CurrentEra::put(EraIndex::max_value()); let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; @@ -176,7 +176,7 @@ benchmarks! { let s in 0 .. MAX_SPANS; let (stash, controller) = create_stash_controller::(0, 100, Default::default())?; add_slashing_spans::(&stash, s); - let amount = T::Currency::minimum_balance() * 10.into(); + let amount = T::Currency::minimum_balance() * 10u32.into(); Staking::::unbond(RawOrigin::Signed(controller.clone()).into(), amount)?; CurrentEra::put(EraIndex::max_value()); let ledger = Ledger::::get(&controller).ok_or("ledger not created before")?; @@ -362,7 +362,7 @@ benchmarks! { let (_, controller) = create_stash_controller::(USER_SEED, 100, Default::default())?; let mut staking_ledger = Ledger::::get(controller.clone()).unwrap(); let unlock_chunk = UnlockChunk::> { - value: 1.into(), + value: 1u32.into(), era: EraIndex::zero(), }; for _ in 0 .. l { @@ -400,7 +400,7 @@ benchmarks! { let s in 1 .. MAX_SPANS; let (stash, controller) = create_stash_controller::(0, 100, Default::default())?; add_slashing_spans::(&stash, s); - T::Currency::make_free_balance_be(&stash, 0.into()); + T::Currency::make_free_balance_be(&stash, 0u32.into()); whitelist_account!(controller); }: _(RawOrigin::Signed(controller), stash.clone(), s) verify { @@ -447,7 +447,7 @@ benchmarks! { ErasRewardPoints::::insert(current_era, reward); // Create reward pool - let total_payout = T::Currency::minimum_balance() * 1000.into(); + let total_payout = T::Currency::minimum_balance() * 1000u32.into(); >::insert(current_era, total_payout); let caller: T::AccountId = whitelisted_caller(); @@ -463,14 +463,14 @@ benchmarks! { let (stash, controller) = create_stash_controller::(0, 100, Default::default())?; let mut staking_ledger = Ledger::::get(controller.clone()).unwrap(); let unlock_chunk = UnlockChunk::> { - value: 1.into(), + value: 1u32.into(), era: EraIndex::zero(), }; for _ in 0 .. l { staking_ledger.unlocking.push(unlock_chunk.clone()) } Ledger::::insert(controller, staking_ledger); - let slash_amount = T::Currency::minimum_balance() * 10.into(); + let slash_amount = T::Currency::minimum_balance() * 10u32.into(); let balance_before = T::Currency::free_balance(&stash); }: { crate::slashing::do_slash::( diff --git a/frame/system/benchmarking/src/lib.rs b/frame/system/benchmarking/src/lib.rs index 9b630520e65d7..b631d00e47c50 100644 --- a/frame/system/benchmarking/src/lib.rs +++ b/frame/system/benchmarking/src/lib.rs @@ -139,17 +139,17 @@ benchmarks! { suicide { let caller: T::AccountId = whitelisted_caller(); let account_info = AccountInfo:: { - nonce: 1337.into(), + nonce: 1337u32.into(), refcount: 0, data: T::AccountData::default() }; frame_system::Account::::insert(&caller, account_info); let new_account_info = System::::account(caller.clone()); - assert_eq!(new_account_info.nonce, 1337.into()); + assert_eq!(new_account_info.nonce, 1337u32.into()); }: _(RawOrigin::Signed(caller.clone())) verify { let account_info = System::::account(&caller); - assert_eq!(account_info.nonce, 0.into()); + assert_eq!(account_info.nonce, 0u32.into()); } } diff --git a/frame/system/src/offchain.rs b/frame/system/src/offchain.rs index 6e6284b57fdc3..ba5cfb8536f24 100644 --- a/frame/system/src/offchain.rs +++ b/frame/system/src/offchain.rs @@ -183,7 +183,7 @@ impl, X> Signer .enumerate() .map(|(index, key)| { let generic_public = C::GenericPublic::from(key); - let public = generic_public.into(); + let public: T::Public = generic_public.into(); let account_id = public.clone().into_account(); Account::new(index, account_id, public) }) diff --git a/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index f2a74d36e0231..e03037f2e8e18 100644 --- a/frame/timestamp/src/lib.rs +++ b/frame/timestamp/src/lib.rs @@ -200,7 +200,7 @@ decl_module! { decl_storage! { trait Store for Module as Timestamp { /// Current time for the current block. - pub Now get(fn now) build(|_| 0.into()): T::Moment; + pub Now get(fn now): T::Moment; /// Did the timestamp get updated in this block? DidUpdate: bool; diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index 7173f7c524fc4..a61f64e907d82 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -1410,7 +1410,12 @@ impl, I: Instance> Module { BountyCount::::put(index + 1); let bounty = Bounty { - proposer, value, fee: 0.into(), curator_deposit: 0.into(), bond, status: BountyStatus::Proposed, + proposer, + value, + fee: 0u32.into(), + curator_deposit: 0u32.into(), + bond, + status: BountyStatus::Proposed, }; Bounties::::insert(index, &bounty); diff --git a/primitives/arithmetic/src/fixed_point.rs b/primitives/arithmetic/src/fixed_point.rs index 970a24156027d..8b882666946d3 100644 --- a/primitives/arithmetic/src/fixed_point.rs +++ b/primitives/arithmetic/src/fixed_point.rs @@ -536,10 +536,10 @@ macro_rules! implement_fixed { } } - impl From

for $name { + impl From

for $name where P::Inner: FixedPointOperand { fn from(p: P) -> Self { - let accuracy = P::ACCURACY.saturated_into(); - let value = p.deconstruct().saturated_into(); + let accuracy = P::ACCURACY; + let value = p.deconstruct(); $name::saturating_from_rational(value, accuracy) } } diff --git a/primitives/npos-elections/src/mock.rs b/primitives/npos-elections/src/mock.rs index 32c9d1223862a..75ff292450df6 100644 --- a/primitives/npos-elections/src/mock.rs +++ b/primitives/npos-elections/src/mock.rs @@ -308,7 +308,7 @@ pub(crate) fn create_stake_of(stakes: &[(AccountId, VoteWeight)]) pub fn check_assignments_sum(assignments: Vec>) { for Assignment { distribution, .. } in assignments { let mut sum: u128 = Zero::zero(); - distribution.iter().for_each(|(_, p)| sum += p.deconstruct().saturated_into()); + distribution.iter().for_each(|(_, p)| sum += p.deconstruct().saturated_into::()); assert_eq!(sum, T::ACCURACY.saturated_into(), "Assignment ratio sum is not 100%"); } } diff --git a/shell.nix b/shell.nix index 79d9e67bde1f2..9d660df4a1ed0 100644 --- a/shell.nix +++ b/shell.nix @@ -5,7 +5,7 @@ let rev = "57c8084c7ef41366993909c20491e359bbb90f54"; }); nixpkgs = import { overlays = [ mozillaOverlay ]; }; - rust-nightly = with nixpkgs; ((rustChannelOf { date = "2020-10-01"; channel = "nightly"; }).rust.override { + rust-nightly = with nixpkgs; ((rustChannelOf { date = "2020-10-23"; channel = "nightly"; }).rust.override { targets = [ "wasm32-unknown-unknown" ]; }); in diff --git a/test-utils/client/src/client_ext.rs b/test-utils/client/src/client_ext.rs index a74bd3258ef0f..43e89c8f10bc1 100644 --- a/test-utils/client/src/client_ext.rs +++ b/test-utils/client/src/client_ext.rs @@ -79,7 +79,7 @@ impl ClientExt for Client } fn genesis_hash(&self) -> ::Hash { - self.block_hash(0.into()).unwrap().unwrap() + self.block_hash(0u32.into()).unwrap().unwrap() } }