mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 20:21:03 +00:00
Replace T::AccountId with <T::Lookup as StaticLookup>::Source (#11670)
* initial * update * update * update * cargo fmt * update * update benchmarks * AccountIdLookupOf<T> * cargo fmt * fix conflits * cargo fmt * update Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -483,9 +483,10 @@ benchmarks! {
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
// Caller will initially delegate to `old_delegate`
|
||||
let old_delegate: T::AccountId = funded_account::<T>("old_delegate", r);
|
||||
let old_delegate_lookup = T::Lookup::unlookup(old_delegate.clone());
|
||||
Democracy::<T>::delegate(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
old_delegate.clone(),
|
||||
old_delegate_lookup,
|
||||
Conviction::Locked1x,
|
||||
delegated_balance,
|
||||
)?;
|
||||
@@ -497,6 +498,7 @@ benchmarks! {
|
||||
assert_eq!(balance, delegated_balance, "delegation balance didn't work");
|
||||
// Caller will now switch to `new_delegate`
|
||||
let new_delegate: T::AccountId = funded_account::<T>("new_delegate", r);
|
||||
let new_delegate_lookup = T::Lookup::unlookup(new_delegate.clone());
|
||||
let account_vote = account_vote::<T>(initial_balance);
|
||||
// We need to create existing direct votes for the `new_delegate`
|
||||
for i in 0..r {
|
||||
@@ -509,7 +511,7 @@ benchmarks! {
|
||||
};
|
||||
assert_eq!(votes.len(), r as usize, "Votes were not recorded.");
|
||||
whitelist_account!(caller);
|
||||
}: _(RawOrigin::Signed(caller.clone()), new_delegate.clone(), Conviction::Locked1x, delegated_balance)
|
||||
}: _(RawOrigin::Signed(caller.clone()), new_delegate_lookup, Conviction::Locked1x, delegated_balance)
|
||||
verify {
|
||||
let (target, balance) = match VotingOf::<T>::get(&caller) {
|
||||
Voting::Delegating { target, balance, .. } => (target, balance),
|
||||
@@ -533,9 +535,10 @@ benchmarks! {
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
// Caller will delegate
|
||||
let the_delegate: T::AccountId = funded_account::<T>("delegate", r);
|
||||
let the_delegate_lookup = T::Lookup::unlookup(the_delegate.clone());
|
||||
Democracy::<T>::delegate(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
the_delegate.clone(),
|
||||
the_delegate_lookup,
|
||||
Conviction::Locked1x,
|
||||
delegated_balance,
|
||||
)?;
|
||||
@@ -642,6 +645,7 @@ benchmarks! {
|
||||
let r in 1 .. MAX_REFERENDUMS;
|
||||
|
||||
let locker = funded_account::<T>("locker", 0);
|
||||
let locker_lookup = T::Lookup::unlookup(locker.clone());
|
||||
// Populate votes so things are locked
|
||||
let base_balance: BalanceOf<T> = 100u32.into();
|
||||
let small_vote = account_vote::<T>(base_balance);
|
||||
@@ -654,7 +658,7 @@ benchmarks! {
|
||||
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
whitelist_account!(caller);
|
||||
}: unlock(RawOrigin::Signed(caller), locker.clone())
|
||||
}: unlock(RawOrigin::Signed(caller), locker_lookup)
|
||||
verify {
|
||||
// Note that we may want to add a `get_lock` api to actually verify
|
||||
let voting = VotingOf::<T>::get(&locker);
|
||||
@@ -666,6 +670,7 @@ benchmarks! {
|
||||
let r in 1 .. MAX_REFERENDUMS;
|
||||
|
||||
let locker = funded_account::<T>("locker", 0);
|
||||
let locker_lookup = T::Lookup::unlookup(locker.clone());
|
||||
// Populate votes so things are locked
|
||||
let base_balance: BalanceOf<T> = 100u32.into();
|
||||
let small_vote = account_vote::<T>(base_balance);
|
||||
@@ -692,7 +697,7 @@ benchmarks! {
|
||||
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
whitelist_account!(caller);
|
||||
}: unlock(RawOrigin::Signed(caller), locker.clone())
|
||||
}: unlock(RawOrigin::Signed(caller), locker_lookup)
|
||||
verify {
|
||||
let votes = match VotingOf::<T>::get(&locker) {
|
||||
Voting::Direct { votes, .. } => votes,
|
||||
@@ -738,6 +743,7 @@ benchmarks! {
|
||||
let r in 1 .. MAX_REFERENDUMS;
|
||||
|
||||
let caller = funded_account::<T>("caller", r);
|
||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||
let account_vote = account_vote::<T>(100u32.into());
|
||||
|
||||
for i in 0 .. r {
|
||||
@@ -753,7 +759,7 @@ benchmarks! {
|
||||
|
||||
let referendum_index = r - 1;
|
||||
whitelist_account!(caller);
|
||||
}: _(RawOrigin::Signed(caller.clone()), caller.clone(), referendum_index)
|
||||
}: _(RawOrigin::Signed(caller.clone()), caller_lookup, referendum_index)
|
||||
verify {
|
||||
let votes = match VotingOf::<T>::get(&caller) {
|
||||
Voting::Direct { votes, .. } => votes,
|
||||
|
||||
Reference in New Issue
Block a user