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

Commit e2861b5

Browse files
committed
Backport #7395
1 parent dac9477 commit e2861b5

File tree

12 files changed

+69
-69
lines changed

12 files changed

+69
-69
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frame/balances/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-balances"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"

frame/balances/src/benchmarking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ benchmarks! {
4949
// Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user.
5050
let recipient: T::AccountId = account("recipient", 0, SEED);
5151
let recipient_lookup: <T::Lookup as StaticLookup>::Source = T::Lookup::unlookup(recipient.clone());
52-
let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1.into();
52+
let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into();
5353
}: transfer(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount)
5454
verify {
5555
assert_eq!(Balances::<T>::free_balance(&caller), Zero::zero());
@@ -138,7 +138,7 @@ benchmarks! {
138138
// Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account, and reap this user.
139139
let recipient: T::AccountId = account("recipient", 0, SEED);
140140
let recipient_lookup: <T::Lookup as StaticLookup>::Source = T::Lookup::unlookup(recipient.clone());
141-
let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1.into();
141+
let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into();
142142
}: force_transfer(RawOrigin::Root, source_lookup, recipient_lookup, transfer_amount)
143143
verify {
144144
assert_eq!(Balances::<T>::free_balance(&source), Zero::zero());

frame/contracts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-contracts"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"

frame/contracts/src/benchmarking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn compile_module<T: Trait>(code: &[u8]) -> (Vec<u8>, <T::Hashing as Hash>::Outp
4242
}
4343

4444
fn funding<T: Trait>() -> BalanceOf<T> {
45-
T::Currency::minimum_balance() * 10_000.into()
45+
T::Currency::minimum_balance() * 10_000u32.into()
4646
}
4747

4848
fn create_funded_user<T: Trait>(string: &'static str, n: u32) -> T::AccountId {
@@ -160,7 +160,7 @@ benchmarks! {
160160
call {
161161
let data = vec![0u8; 128];
162162
let endowment = Config::<T>::subsistence_threshold_uncached();
163-
let value = T::Currency::minimum_balance() * 100.into();
163+
let value = T::Currency::minimum_balance() * 100u32.into();
164164
let caller = create_funded_user::<T>("caller", 0);
165165
let (binary, hash) = load_module!("dummy");
166166
let addr = T::DetermineContractAddress::contract_address_for(&hash, &[], &caller);
@@ -195,7 +195,7 @@ benchmarks! {
195195
// the reward for removing them.
196196
claim_surcharge {
197197
let endowment = Config::<T>::subsistence_threshold_uncached();
198-
let value = T::Currency::minimum_balance() * 100.into();
198+
let value = T::Currency::minimum_balance() * 100u32.into();
199199
let caller = create_funded_user::<T>("caller", 0);
200200
let (binary, hash) = load_module!("dummy");
201201
let addr = T::DetermineContractAddress::contract_address_for(&hash, &[], &caller);
@@ -213,7 +213,7 @@ benchmarks! {
213213
ContractInfoOf::<T>::get(addr.clone()).unwrap().get_alive().unwrap();
214214

215215
// generate some rent
216-
advance_block::<T>(<T as Trait>::SignedClaimHandicap::get() + 1.into());
216+
advance_block::<T>(<T as Trait>::SignedClaimHandicap::get() + 1u32.into());
217217

218218
}: _(RawOrigin::Signed(caller.clone()), addr.clone(), None)
219219
verify {

frame/democracy/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-democracy"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"

frame/democracy/src/benchmarking.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ fn add_referendum<T: Trait>(n: u32) -> Result<ReferendumIndex, &'static str> {
7070
T::LaunchPeriod::get(),
7171
proposal_hash,
7272
vote_threshold,
73-
0.into(),
73+
0u32.into(),
7474
);
7575
let referendum_index: ReferendumIndex = ReferendumCount::get() - 1;
7676
T::Scheduler::schedule_named(
7777
(DEMOCRACY_ID, referendum_index).encode(),
78-
DispatchTime::At(1.into()),
78+
DispatchTime::At(1u32.into()),
7979
None,
8080
63,
8181
system::RawOrigin::Root.into(),
@@ -132,7 +132,7 @@ benchmarks! {
132132
let r in 1 .. MAX_REFERENDUMS;
133133

134134
let caller = funded_account::<T>("caller", 0);
135-
let account_vote = account_vote::<T>(100.into());
135+
let account_vote = account_vote::<T>(100u32.into());
136136

137137
// We need to create existing direct votes
138138
for i in 0 .. r {
@@ -160,7 +160,7 @@ benchmarks! {
160160
let r in 1 .. MAX_REFERENDUMS;
161161

162162
let caller = funded_account::<T>("caller", 0);
163-
let account_vote = account_vote::<T>(100.into());
163+
let account_vote = account_vote::<T>(100u32.into());
164164

165165
// We need to create existing direct votes
166166
for i in 0 ..=r {
@@ -175,7 +175,7 @@ benchmarks! {
175175

176176
// Change vote from aye to nay
177177
let nay = Vote { aye: false, conviction: Conviction::Locked1x };
178-
let new_vote = AccountVote::Standard { vote: nay, balance: 1000.into() };
178+
let new_vote = AccountVote::Standard { vote: nay, balance: 1000u32.into() };
179179
let referendum_index = Democracy::<T>::referendum_count() - 1;
180180

181181
// This tests when a user changes a vote
@@ -192,7 +192,7 @@ benchmarks! {
192192
ReferendumInfo::Ongoing(r) => r.tally,
193193
_ => return Err("referendum not ongoing"),
194194
};
195-
assert_eq!(tally.nays, 1000.into(), "changed vote was not recorded");
195+
assert_eq!(tally.nays, 1000u32.into(), "changed vote was not recorded");
196196
}
197197

198198
emergency_cancel {
@@ -253,7 +253,7 @@ benchmarks! {
253253
// NOTE: Instant origin may invoke a little bit more logic, but may not always succeed.
254254
let origin_fast_track = T::FastTrackOrigin::successful_origin();
255255
let voting_period = T::FastTrackVotingPeriod::get();
256-
let delay = 0;
256+
let delay = 0u32;
257257
let call = Call::<T>::fast_track(proposal_hash, voting_period.into(), delay.into());
258258

259259
}: { call.dispatch_bypass_filter(origin_fast_track)? }
@@ -382,15 +382,15 @@ benchmarks! {
382382

383383
for (key, mut info) in ReferendumInfoOf::<T>::iter() {
384384
if let ReferendumInfo::Ongoing(ref mut status) = info {
385-
status.end += 100.into();
385+
status.end += 100u32.into();
386386
}
387387
ReferendumInfoOf::<T>::insert(key, info);
388388
}
389389

390390
assert_eq!(Democracy::<T>::referendum_count(), r, "referenda not created");
391391
assert_eq!(Democracy::<T>::lowest_unbaked(), 0, "invalid referenda init");
392392

393-
}: { Democracy::<T>::on_initialize(0.into()) }
393+
}: { Democracy::<T>::on_initialize(0u32.into()) }
394394
verify {
395395
// All should be on going
396396
for i in 0 .. r {
@@ -406,8 +406,8 @@ benchmarks! {
406406
delegate {
407407
let r in 1 .. MAX_REFERENDUMS;
408408

409-
let initial_balance: BalanceOf<T> = 100.into();
410-
let delegated_balance: BalanceOf<T> = 1000.into();
409+
let initial_balance: BalanceOf<T> = 100u32.into();
410+
let delegated_balance: BalanceOf<T> = 1000u32.into();
411411

412412
let caller = funded_account::<T>("caller", 0);
413413
// Caller will initially delegate to `old_delegate`
@@ -455,8 +455,8 @@ benchmarks! {
455455
undelegate {
456456
let r in 1 .. MAX_REFERENDUMS;
457457

458-
let initial_balance: BalanceOf<T> = 100.into();
459-
let delegated_balance: BalanceOf<T> = 1000.into();
458+
let initial_balance: BalanceOf<T> = 100u32.into();
459+
let delegated_balance: BalanceOf<T> = 1000u32.into();
460460

461461
let caller = funded_account::<T>("caller", 0);
462462
// Caller will delegate
@@ -567,7 +567,7 @@ benchmarks! {
567567

568568
let locker = funded_account::<T>("locker", 0);
569569
// Populate votes so things are locked
570-
let base_balance: BalanceOf<T> = 100.into();
570+
let base_balance: BalanceOf<T> = 100u32.into();
571571
let small_vote = account_vote::<T>(base_balance);
572572
// Vote and immediately unvote
573573
for i in 0 .. r {
@@ -590,15 +590,15 @@ benchmarks! {
590590

591591
let locker = funded_account::<T>("locker", 0);
592592
// Populate votes so things are locked
593-
let base_balance: BalanceOf<T> = 100.into();
593+
let base_balance: BalanceOf<T> = 100u32.into();
594594
let small_vote = account_vote::<T>(base_balance);
595595
for i in 0 .. r {
596596
let ref_idx = add_referendum::<T>(i)?;
597597
Democracy::<T>::vote(RawOrigin::Signed(locker.clone()).into(), ref_idx, small_vote.clone())?;
598598
}
599599

600600
// Create a big vote so lock increases
601-
let big_vote = account_vote::<T>(base_balance * 10.into());
601+
let big_vote = account_vote::<T>(base_balance * 10u32.into());
602602
let referendum_index = add_referendum::<T>(r)?;
603603
Democracy::<T>::vote(RawOrigin::Signed(locker.clone()).into(), referendum_index, big_vote)?;
604604

@@ -609,7 +609,7 @@ benchmarks! {
609609
assert_eq!(votes.len(), (r + 1) as usize, "Votes were not recorded.");
610610

611611
let voting = VotingOf::<T>::get(&locker);
612-
assert_eq!(voting.locked_balance(), base_balance * 10.into());
612+
assert_eq!(voting.locked_balance(), base_balance * 10u32.into());
613613

614614
Democracy::<T>::remove_vote(RawOrigin::Signed(locker.clone()).into(), referendum_index)?;
615615

@@ -631,7 +631,7 @@ benchmarks! {
631631
let r in 1 .. MAX_REFERENDUMS;
632632

633633
let caller = funded_account::<T>("caller", 0);
634-
let account_vote = account_vote::<T>(100.into());
634+
let account_vote = account_vote::<T>(100u32.into());
635635

636636
for i in 0 .. r {
637637
let ref_idx = add_referendum::<T>(i)?;
@@ -660,7 +660,7 @@ benchmarks! {
660660
let r in 1 .. MAX_REFERENDUMS;
661661

662662
let caller = funded_account::<T>("caller", r);
663-
let account_vote = account_vote::<T>(100.into());
663+
let account_vote = account_vote::<T>(100u32.into());
664664

665665
for i in 0 .. r {
666666
let ref_idx = add_referendum::<T>(i)?;

frame/identity/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-identity"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"

frame/identity/src/benchmarking.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn add_registrars<T: Trait>(r: u32) -> Result<(), &'static str> {
4343
let registrar: T::AccountId = account("registrar", i, SEED);
4444
let _ = T::Currency::make_free_balance_be(&registrar, BalanceOf::<T>::max_value());
4545
Identity::<T>::add_registrar(RawOrigin::Root.into(), registrar.clone())?;
46-
Identity::<T>::set_fee(RawOrigin::Signed(registrar.clone()).into(), i.into(), 10.into())?;
46+
Identity::<T>::set_fee(RawOrigin::Signed(registrar.clone()).into(), i.into(), 10u32.into())?;
4747
let fields = IdentityFields(
4848
IdentityField::Display | IdentityField::Legal | IdentityField::Web | IdentityField::Riot
4949
| IdentityField::Email | IdentityField::PgpFingerprint | IdentityField::Image | IdentityField::Twitter
@@ -152,7 +152,7 @@ benchmarks! {
152152

153153
// User requests judgement from all the registrars, and they approve
154154
for i in 0..r {
155-
Identity::<T>::request_judgement(caller_origin.clone(), i, 10.into())?;
155+
Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;
156156
Identity::<T>::provide_judgement(
157157
RawOrigin::Signed(account("registrar", i, SEED)).into(),
158158
i,
@@ -210,7 +210,7 @@ benchmarks! {
210210

211211
// User requests judgement from all the registrars, and they approve
212212
for i in 0..r {
213-
Identity::<T>::request_judgement(caller_origin.clone(), i, 10.into())?;
213+
Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;
214214
Identity::<T>::provide_judgement(
215215
RawOrigin::Signed(account("registrar", i, SEED)).into(),
216216
i,
@@ -230,7 +230,7 @@ benchmarks! {
230230

231231
let r in ...;
232232
let x in ...;
233-
}: _(RawOrigin::Signed(caller.clone()), r - 1, 10.into())
233+
}: _(RawOrigin::Signed(caller.clone()), r - 1, 10u32.into())
234234
verify {
235235
assert_last_event::<T>(Event::<T>::JudgementRequested(caller, r-1).into());
236236
}
@@ -243,7 +243,7 @@ benchmarks! {
243243
let r in ...;
244244
let x in ...;
245245

246-
Identity::<T>::request_judgement(caller_origin, r - 1, 10.into())?;
246+
Identity::<T>::request_judgement(caller_origin, r - 1, 10u32.into())?;
247247
}: _(RawOrigin::Signed(caller.clone()), r - 1)
248248
verify {
249249
assert_last_event::<T>(Event::<T>::JudgementUnrequested(caller, r-1).into());
@@ -256,11 +256,11 @@ benchmarks! {
256256

257257
Identity::<T>::add_registrar(RawOrigin::Root.into(), caller.clone())?;
258258
let registrars = Registrars::<T>::get();
259-
ensure!(registrars[r as usize].as_ref().unwrap().fee == 0.into(), "Fee already set.");
260-
}: _(RawOrigin::Signed(caller), r, 100.into())
259+
ensure!(registrars[r as usize].as_ref().unwrap().fee == 0u32.into(), "Fee already set.");
260+
}: _(RawOrigin::Signed(caller), r, 100u32.into())
261261
verify {
262262
let registrars = Registrars::<T>::get();
263-
ensure!(registrars[r as usize].as_ref().unwrap().fee == 100.into(), "Fee not changed.");
263+
ensure!(registrars[r as usize].as_ref().unwrap().fee == 100u32.into(), "Fee not changed.");
264264
}
265265

266266
set_account_id {
@@ -315,7 +315,7 @@ benchmarks! {
315315
};
316316

317317
Identity::<T>::add_registrar(RawOrigin::Root.into(), caller.clone())?;
318-
Identity::<T>::request_judgement(user_origin.clone(), r, 10.into())?;
318+
Identity::<T>::request_judgement(user_origin.clone(), r, 10u32.into())?;
319319
}: _(RawOrigin::Signed(caller), r, user_lookup, Judgement::Reasonable)
320320
verify {
321321
assert_last_event::<T>(Event::<T>::JudgementGiven(user, r).into())
@@ -338,7 +338,7 @@ benchmarks! {
338338

339339
// User requests judgement from all the registrars, and they approve
340340
for i in 0..r {
341-
Identity::<T>::request_judgement(target_origin.clone(), i, 10.into())?;
341+
Identity::<T>::request_judgement(target_origin.clone(), i, 10u32.into())?;
342342
Identity::<T>::provide_judgement(
343343
RawOrigin::Signed(account("registrar", i, SEED)).into(),
344344
i,

0 commit comments

Comments
 (0)