diff --git a/Cargo.lock b/Cargo.lock index a46ba82d88a74..e1324fa393e17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4305,7 +4305,7 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0" +version = "2.0.1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4338,7 +4338,7 @@ dependencies = [ [[package]] name = "pallet-contracts" -version = "2.0.0" +version = "2.0.1" dependencies = [ "assert_matches", "bitflags", @@ -4405,7 +4405,7 @@ dependencies = [ [[package]] name = "pallet-democracy" -version = "2.0.0" +version = "2.0.1" dependencies = [ "frame-benchmarking", "frame-support", diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index 21c8abbc24a6c..004e631d48719 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-balances" -version = "2.0.0" +version = "2.0.1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/balances/src/benchmarking.rs b/frame/balances/src/benchmarking.rs index 21f43c7c63640..078d74006ba2f 100644 --- a/frame/balances/src/benchmarking.rs +++ b/frame/balances/src/benchmarking.rs @@ -49,7 +49,7 @@ benchmarks! { // Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user. let recipient: T::AccountId = account("recipient", 0, SEED); let recipient_lookup: ::Source = T::Lookup::unlookup(recipient.clone()); - let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1.into(); + let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into(); }: transfer(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount) verify { assert_eq!(Balances::::free_balance(&caller), Zero::zero()); @@ -138,7 +138,7 @@ benchmarks! { // Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user. let recipient: T::AccountId = account("recipient", 0, SEED); let recipient_lookup: ::Source = T::Lookup::unlookup(recipient.clone()); - let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1.into(); + let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into(); }: force_transfer(RawOrigin::Root, source_lookup, recipient_lookup, transfer_amount) verify { assert_eq!(Balances::::free_balance(&source), Zero::zero()); diff --git a/frame/contracts/Cargo.toml b/frame/contracts/Cargo.toml index d18fed1bc8a3e..fe378bc008cd9 100644 --- a/frame/contracts/Cargo.toml +++ b/frame/contracts/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-contracts" -version = "2.0.0" +version = "2.0.1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/contracts/src/benchmarking.rs b/frame/contracts/src/benchmarking.rs index 1a04db4defdb6..ecb2fda135909 100644 --- a/frame/contracts/src/benchmarking.rs +++ b/frame/contracts/src/benchmarking.rs @@ -42,7 +42,7 @@ fn compile_module(code: &[u8]) -> (Vec, ::Outp } fn funding() -> BalanceOf { - T::Currency::minimum_balance() * 10_000.into() + T::Currency::minimum_balance() * 10_000u32.into() } fn create_funded_user(string: &'static str, n: u32) -> T::AccountId { @@ -160,7 +160,7 @@ benchmarks! { call { let data = vec![0u8; 128]; let endowment = Config::::subsistence_threshold_uncached(); - let value = T::Currency::minimum_balance() * 100.into(); + let value = T::Currency::minimum_balance() * 100u32.into(); let caller = create_funded_user::("caller", 0); let (binary, hash) = load_module!("dummy"); let addr = T::DetermineContractAddress::contract_address_for(&hash, &[], &caller); @@ -195,7 +195,7 @@ benchmarks! { // the reward for removing them. claim_surcharge { let endowment = Config::::subsistence_threshold_uncached(); - let value = T::Currency::minimum_balance() * 100.into(); + let value = T::Currency::minimum_balance() * 100u32.into(); let caller = create_funded_user::("caller", 0); let (binary, hash) = load_module!("dummy"); let addr = T::DetermineContractAddress::contract_address_for(&hash, &[], &caller); @@ -213,7 +213,7 @@ benchmarks! { ContractInfoOf::::get(addr.clone()).unwrap().get_alive().unwrap(); // generate some rent - advance_block::(::SignedClaimHandicap::get() + 1.into()); + advance_block::(::SignedClaimHandicap::get() + 1u32.into()); }: _(RawOrigin::Signed(caller.clone()), addr.clone(), None) verify { diff --git a/frame/democracy/Cargo.toml b/frame/democracy/Cargo.toml index 44639a2275644..8f331385fe4b9 100644 --- a/frame/democracy/Cargo.toml +++ b/frame/democracy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-democracy" -version = "2.0.0" +version = "2.0.1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/democracy/src/benchmarking.rs b/frame/democracy/src/benchmarking.rs index 1fa0988fbbd4d..93e0e1df7c438 100644 --- a/frame/democracy/src/benchmarking.rs +++ b/frame/democracy/src/benchmarking.rs @@ -70,12 +70,12 @@ fn add_referendum(n: u32) -> Result { T::LaunchPeriod::get(), proposal_hash, vote_threshold, - 0.into(), + 0u32.into(), ); let referendum_index: ReferendumIndex = ReferendumCount::get() - 1; T::Scheduler::schedule_named( (DEMOCRACY_ID, referendum_index).encode(), - DispatchTime::At(1.into()), + DispatchTime::At(1u32.into()), None, 63, system::RawOrigin::Root.into(), @@ -132,7 +132,7 @@ benchmarks! { let r in 1 .. MAX_REFERENDUMS; let caller = funded_account::("caller", 0); - let account_vote = account_vote::(100.into()); + let account_vote = account_vote::(100u32.into()); // We need to create existing direct votes for i in 0 .. r { @@ -160,7 +160,7 @@ benchmarks! { let r in 1 .. MAX_REFERENDUMS; let caller = funded_account::("caller", 0); - let account_vote = account_vote::(100.into()); + let account_vote = account_vote::(100u32.into()); // We need to create existing direct votes for i in 0 ..=r { @@ -175,7 +175,7 @@ benchmarks! { // Change vote from aye to nay let nay = Vote { aye: false, conviction: Conviction::Locked1x }; - let new_vote = AccountVote::Standard { vote: nay, balance: 1000.into() }; + let new_vote = AccountVote::Standard { vote: nay, balance: 1000u32.into() }; let referendum_index = Democracy::::referendum_count() - 1; // This tests when a user changes a vote @@ -192,7 +192,7 @@ benchmarks! { ReferendumInfo::Ongoing(r) => r.tally, _ => return Err("referendum not ongoing"), }; - assert_eq!(tally.nays, 1000.into(), "changed vote was not recorded"); + assert_eq!(tally.nays, 1000u32.into(), "changed vote was not recorded"); } emergency_cancel { @@ -253,7 +253,7 @@ benchmarks! { // NOTE: Instant origin may invoke a little bit more logic, but may not always succeed. let origin_fast_track = T::FastTrackOrigin::successful_origin(); let voting_period = T::FastTrackVotingPeriod::get(); - let delay = 0; + let delay = 0u32; let call = Call::::fast_track(proposal_hash, voting_period.into(), delay.into()); }: { call.dispatch_bypass_filter(origin_fast_track)? } @@ -382,7 +382,7 @@ benchmarks! { for (key, mut info) in ReferendumInfoOf::::iter() { if let ReferendumInfo::Ongoing(ref mut status) = info { - status.end += 100.into(); + status.end += 100u32.into(); } ReferendumInfoOf::::insert(key, info); } @@ -390,7 +390,7 @@ benchmarks! { assert_eq!(Democracy::::referendum_count(), r, "referenda not created"); assert_eq!(Democracy::::lowest_unbaked(), 0, "invalid referenda init"); - }: { Democracy::::on_initialize(0.into()) } + }: { Democracy::::on_initialize(0u32.into()) } verify { // All should be on going for i in 0 .. r { @@ -406,8 +406,8 @@ benchmarks! { delegate { let r in 1 .. MAX_REFERENDUMS; - let initial_balance: BalanceOf = 100.into(); - let delegated_balance: BalanceOf = 1000.into(); + let initial_balance: BalanceOf = 100u32.into(); + let delegated_balance: BalanceOf = 1000u32.into(); let caller = funded_account::("caller", 0); // Caller will initially delegate to `old_delegate` @@ -455,8 +455,8 @@ benchmarks! { undelegate { let r in 1 .. MAX_REFERENDUMS; - let initial_balance: BalanceOf = 100.into(); - let delegated_balance: BalanceOf = 1000.into(); + let initial_balance: BalanceOf = 100u32.into(); + let delegated_balance: BalanceOf = 1000u32.into(); let caller = funded_account::("caller", 0); // Caller will delegate @@ -567,7 +567,7 @@ benchmarks! { let locker = funded_account::("locker", 0); // Populate votes so things are locked - let base_balance: BalanceOf = 100.into(); + let base_balance: BalanceOf = 100u32.into(); let small_vote = account_vote::(base_balance); // Vote and immediately unvote for i in 0 .. r { @@ -590,7 +590,7 @@ benchmarks! { let locker = funded_account::("locker", 0); // Populate votes so things are locked - let base_balance: BalanceOf = 100.into(); + let base_balance: BalanceOf = 100u32.into(); let small_vote = account_vote::(base_balance); for i in 0 .. r { let ref_idx = add_referendum::(i)?; @@ -598,7 +598,7 @@ benchmarks! { } // Create a big vote so lock increases - let big_vote = account_vote::(base_balance * 10.into()); + let big_vote = account_vote::(base_balance * 10u32.into()); let referendum_index = add_referendum::(r)?; Democracy::::vote(RawOrigin::Signed(locker.clone()).into(), referendum_index, big_vote)?; @@ -609,7 +609,7 @@ benchmarks! { assert_eq!(votes.len(), (r + 1) as usize, "Votes were not recorded."); let voting = VotingOf::::get(&locker); - assert_eq!(voting.locked_balance(), base_balance * 10.into()); + assert_eq!(voting.locked_balance(), base_balance * 10u32.into()); Democracy::::remove_vote(RawOrigin::Signed(locker.clone()).into(), referendum_index)?; @@ -631,7 +631,7 @@ benchmarks! { let r in 1 .. MAX_REFERENDUMS; let caller = funded_account::("caller", 0); - let account_vote = account_vote::(100.into()); + let account_vote = account_vote::(100u32.into()); for i in 0 .. r { let ref_idx = add_referendum::(i)?; @@ -660,7 +660,7 @@ benchmarks! { let r in 1 .. MAX_REFERENDUMS; let caller = funded_account::("caller", r); - let account_vote = account_vote::(100.into()); + let account_vote = account_vote::(100u32.into()); for i in 0 .. r { let ref_idx = add_referendum::(i)?; diff --git a/frame/identity/Cargo.toml b/frame/identity/Cargo.toml index 08777c44ad2b1..b39ce1c944e4d 100644 --- a/frame/identity/Cargo.toml +++ b/frame/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-identity" -version = "2.0.0" +version = "2.0.1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/identity/src/benchmarking.rs b/frame/identity/src/benchmarking.rs index d39df27017b71..d7876514452e2 100644 --- a/frame/identity/src/benchmarking.rs +++ b/frame/identity/src/benchmarking.rs @@ -43,7 +43,7 @@ fn add_registrars(r: u32) -> Result<(), &'static str> { let registrar: T::AccountId = account("registrar", i, SEED); let _ = T::Currency::make_free_balance_be(®istrar, BalanceOf::::max_value()); Identity::::add_registrar(RawOrigin::Root.into(), registrar.clone())?; - Identity::::set_fee(RawOrigin::Signed(registrar.clone()).into(), i.into(), 10.into())?; + Identity::::set_fee(RawOrigin::Signed(registrar.clone()).into(), i.into(), 10u32.into())?; let fields = IdentityFields( IdentityField::Display | IdentityField::Legal | IdentityField::Web | IdentityField::Riot | IdentityField::Email | IdentityField::PgpFingerprint | IdentityField::Image | IdentityField::Twitter @@ -152,7 +152,7 @@ benchmarks! { // User requests judgement from all the registrars, and they approve for i in 0..r { - Identity::::request_judgement(caller_origin.clone(), i, 10.into())?; + Identity::::request_judgement(caller_origin.clone(), i, 10u32.into())?; Identity::::provide_judgement( RawOrigin::Signed(account("registrar", i, SEED)).into(), i, @@ -210,7 +210,7 @@ benchmarks! { // User requests judgement from all the registrars, and they approve for i in 0..r { - Identity::::request_judgement(caller_origin.clone(), i, 10.into())?; + Identity::::request_judgement(caller_origin.clone(), i, 10u32.into())?; Identity::::provide_judgement( RawOrigin::Signed(account("registrar", i, SEED)).into(), i, @@ -230,7 +230,7 @@ benchmarks! { let r in ...; let x in ...; - }: _(RawOrigin::Signed(caller.clone()), r - 1, 10.into()) + }: _(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into()) verify { assert_last_event::(Event::::JudgementRequested(caller, r-1).into()); } @@ -243,7 +243,7 @@ benchmarks! { let r in ...; let x in ...; - Identity::::request_judgement(caller_origin, r - 1, 10.into())?; + Identity::::request_judgement(caller_origin, r - 1, 10u32.into())?; }: _(RawOrigin::Signed(caller.clone()), r - 1) verify { assert_last_event::(Event::::JudgementUnrequested(caller, r-1).into()); @@ -256,11 +256,11 @@ benchmarks! { Identity::::add_registrar(RawOrigin::Root.into(), caller.clone())?; let registrars = Registrars::::get(); - ensure!(registrars[r as usize].as_ref().unwrap().fee == 0.into(), "Fee already set."); - }: _(RawOrigin::Signed(caller), r, 100.into()) + ensure!(registrars[r as usize].as_ref().unwrap().fee == 0u32.into(), "Fee already set."); + }: _(RawOrigin::Signed(caller), r, 100u32.into()) verify { let registrars = Registrars::::get(); - ensure!(registrars[r as usize].as_ref().unwrap().fee == 100.into(), "Fee not changed."); + ensure!(registrars[r as usize].as_ref().unwrap().fee == 100u32.into(), "Fee not changed."); } set_account_id { @@ -315,7 +315,7 @@ benchmarks! { }; Identity::::add_registrar(RawOrigin::Root.into(), caller.clone())?; - Identity::::request_judgement(user_origin.clone(), r, 10.into())?; + Identity::::request_judgement(user_origin.clone(), r, 10u32.into())?; }: _(RawOrigin::Signed(caller), r, user_lookup, Judgement::Reasonable) verify { assert_last_event::(Event::::JudgementGiven(user, r).into()) @@ -338,7 +338,7 @@ benchmarks! { // User requests judgement from all the registrars, and they approve for i in 0..r { - Identity::::request_judgement(target_origin.clone(), i, 10.into())?; + Identity::::request_judgement(target_origin.clone(), i, 10u32.into())?; Identity::::provide_judgement( RawOrigin::Signed(account("registrar", i, SEED)).into(), i, diff --git a/frame/treasury/src/benchmarking.rs b/frame/treasury/src/benchmarking.rs index 5224c1446f452..fa3e7a22ea3d8 100644 --- a/frame/treasury/src/benchmarking.rs +++ b/frame/treasury/src/benchmarking.rs @@ -36,7 +36,7 @@ fn setup_proposal, I: Instance>(u: u32) -> ( ::Source, ) { let caller = account("caller", u, SEED); - let value: BalanceOf = T::ProposalBondMinimum::get().saturating_mul(100.into()); + let value: BalanceOf = T::ProposalBondMinimum::get().saturating_mul(100u32.into()); let _ = T::Currency::make_free_balance_be(&caller, value); let beneficiary = account("beneficiary", u, SEED); let beneficiary_lookup = T::Lookup::unlookup(beneficiary); @@ -71,7 +71,7 @@ fn setup_tip, I: Instance>(r: u32, t: u32) -> let caller = account("member", t - 1, SEED); let reason = vec![0; r as usize]; let beneficiary = account("beneficiary", t, SEED); - let value = T::Currency::minimum_balance().saturating_mul(100.into()); + let value = T::Currency::minimum_balance().saturating_mul(100u32.into()); Ok((caller, reason, beneficiary, value)) } @@ -130,12 +130,12 @@ fn setup_bounty, I: Instance>(u: u32, d: u32) -> ( Vec, ) { let caller = account("caller", u, SEED); - let value: BalanceOf = T::Currency::minimum_balance().saturating_mul(100.into()); - let fee = T::Currency::minimum_balance().saturating_mul(2.into()); + let value: BalanceOf = T::Currency::minimum_balance().saturating_mul(100u32.into()); + let fee = T::Currency::minimum_balance().saturating_mul(2u32.into()); let deposit = T::BountyDepositBase::get() + T::DataDepositPerByte::get() * MAX_BYTES.into(); let _ = T::Currency::make_free_balance_be(&caller, deposit); let curator = account("curator", u, SEED); - let _ = T::Currency::make_free_balance_be(&curator, fee / 2.into()); + let _ = T::Currency::make_free_balance_be(&curator, fee / 2u32.into()); let reason = vec![0; d as usize]; (caller, curator, fee, value, reason) } @@ -157,7 +157,7 @@ fn create_bounty, I: Instance>() -> Result<( fn setup_pod_account, I: Instance>() { let pot_account = Treasury::::account_id(); - let value = T::Currency::minimum_balance().saturating_mul(1_000_000_000.into()); + let value = T::Currency::minimum_balance().saturating_mul(1_000_000_000u32.into()); let _ = T::Currency::make_free_balance_be(&pot_account, value); } @@ -230,7 +230,7 @@ benchmarks_instance! { tip { let t in 1 .. MAX_TIPPERS; let (member, reason, beneficiary, value) = setup_tip::(0, t)?; - let value = T::Currency::minimum_balance().saturating_mul(100.into()); + let value = T::Currency::minimum_balance().saturating_mul(100u32.into()); Treasury::::tip_new( RawOrigin::Signed(member).into(), reason.clone(), @@ -255,7 +255,7 @@ benchmarks_instance! { // Set up a new tip proposal let (member, reason, beneficiary, value) = setup_tip::(0, t)?; - let value = T::Currency::minimum_balance().saturating_mul(100.into()); + let value = T::Currency::minimum_balance().saturating_mul(100u32.into()); Treasury::::tip_new( RawOrigin::Signed(member).into(), reason.clone(), @@ -303,7 +303,7 @@ benchmarks_instance! { let (curator_lookup, bounty_id) = create_bounty::()?; Treasury::::on_initialize(T::BlockNumber::zero()); let bounty_id = BountyCount::::get() - 1; - frame_system::Module::::set_block_number(T::BountyUpdatePeriod::get() + 1.into()); + frame_system::Module::::set_block_number(T::BountyUpdatePeriod::get() + 1u32.into()); let caller = whitelisted_caller(); }: _(RawOrigin::Signed(caller), bounty_id) diff --git a/frame/vesting/Cargo.toml b/frame/vesting/Cargo.toml index bea64c2b4f94d..eda21dc8bbc78 100644 --- a/frame/vesting/Cargo.toml +++ b/frame/vesting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-vesting" -version = "2.0.0" +version = "2.0.1" authors = ["Parity Technologies "] edition = "2018" license = "Apache-2.0" diff --git a/frame/vesting/src/benchmarking.rs b/frame/vesting/src/benchmarking.rs index 7c5478472f8ab..69dc7abaa7038 100644 --- a/frame/vesting/src/benchmarking.rs +++ b/frame/vesting/src/benchmarking.rs @@ -34,18 +34,18 @@ type BalanceOf = <::Currency as Currency<(who: &T::AccountId, n: u8) { for id in 0..n { let lock_id = [id; 8]; - let locked = 100; + let locked = 100u32; let reasons = WithdrawReason::Transfer | WithdrawReason::Reserve; T::Currency::set_lock(lock_id, who, locked.into(), reasons); } } fn add_vesting_schedule(who: &T::AccountId) -> Result<(), &'static str> { - let locked = 100; - let per_block = 10; - let starting_block = 1; + let locked = 100u32; + let per_block = 10u32; + let starting_block = 1u32; - System::::set_block_number(0.into()); + System::::set_block_number(0u32.into()); // Add schedule to avoid `NotVesting` error. Vesting::::add_vesting_schedule( @@ -71,7 +71,7 @@ benchmarks! { System::::set_block_number(T::BlockNumber::zero()); assert_eq!( Vesting::::vesting_balance(&caller), - Some(100.into()), + Some(100u32.into()), "Vesting schedule not added", ); }: vest(RawOrigin::Signed(caller.clone())) @@ -79,7 +79,7 @@ benchmarks! { // Nothing happened since everything is still vested. assert_eq!( Vesting::::vesting_balance(&caller), - Some(100.into()), + Some(100u32.into()), "Vesting schedule was removed", ); } @@ -92,7 +92,7 @@ benchmarks! { add_locks::(&caller, l as u8); add_vesting_schedule::(&caller)?; // At block 20, everything is unvested. - System::::set_block_number(20.into()); + System::::set_block_number(20u32.into()); assert_eq!( Vesting::::vesting_balance(&caller), Some(BalanceOf::::zero()), @@ -120,7 +120,7 @@ benchmarks! { System::::set_block_number(T::BlockNumber::zero()); assert_eq!( Vesting::::vesting_balance(&other), - Some(100.into()), + Some(100u32.into()), "Vesting schedule not added", ); @@ -130,7 +130,7 @@ benchmarks! { // Nothing happened since everything is still vested. assert_eq!( Vesting::::vesting_balance(&other), - Some(100.into()), + Some(100u32.into()), "Vesting schedule was removed", ); } @@ -144,7 +144,7 @@ benchmarks! { add_locks::(&other, l as u8); add_vesting_schedule::(&other)?; // At block 20, everything is unvested. - System::::set_block_number(20.into()); + System::::set_block_number(20u32.into()); assert_eq!( Vesting::::vesting_balance(&other), Some(BalanceOf::::zero()), @@ -176,8 +176,8 @@ benchmarks! { let vesting_schedule = VestingInfo { locked: transfer_amount, - per_block: 10.into(), - starting_block: 1.into(), + per_block: 10u32.into(), + starting_block: 1u32.into(), }; }: _(RawOrigin::Signed(caller), target_lookup, vesting_schedule) verify { @@ -208,8 +208,8 @@ benchmarks! { let vesting_schedule = VestingInfo { locked: transfer_amount, - per_block: 10.into(), - starting_block: 1.into(), + per_block: 10u32.into(), + starting_block: 1u32.into(), }; }: _(RawOrigin::Root, source_lookup, target_lookup, vesting_schedule) verify {