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:
Doordashcon
2022-08-18 10:30:46 +01:00
committed by GitHub
parent 511e5c9651
commit d46f6f0d34
50 changed files with 465 additions and 309 deletions
+9 -3
View File
@@ -57,6 +57,8 @@ frame_benchmarking::benchmarks_instance_pallet! {
let dest_head: T::AccountId = account("dest_head", 0, 0);
assert_ok!(List::<T, _>::insert(dest_head.clone(), dest_bag_thresh));
let origin_middle_lookup = T::Lookup::unlookup(origin_middle.clone());
// the bags are in the expected state after initial setup.
assert_eq!(
List::<T, _>::get_bags(),
@@ -69,7 +71,7 @@ frame_benchmarking::benchmarks_instance_pallet! {
let caller = whitelisted_caller();
// update the weight of `origin_middle` to guarantee it will be rebagged into the destination.
T::ScoreProvider::set_score_of(&origin_middle, dest_bag_thresh);
}: rebag(SystemOrigin::Signed(caller), origin_middle.clone())
}: rebag(SystemOrigin::Signed(caller), origin_middle_lookup.clone())
verify {
// check the bags have updated as expected.
assert_eq!(
@@ -114,6 +116,8 @@ frame_benchmarking::benchmarks_instance_pallet! {
let dest_head: T::AccountId = account("dest_head", 0, 0);
assert_ok!(List::<T, _>::insert(dest_head.clone(), dest_bag_thresh));
let origin_tail_lookup = T::Lookup::unlookup(origin_tail.clone());
// the bags are in the expected state after initial setup.
assert_eq!(
List::<T, _>::get_bags(),
@@ -126,7 +130,7 @@ frame_benchmarking::benchmarks_instance_pallet! {
let caller = whitelisted_caller();
// update the weight of `origin_tail` to guarantee it will be rebagged into the destination.
T::ScoreProvider::set_score_of(&origin_tail, dest_bag_thresh);
}: rebag(SystemOrigin::Signed(caller), origin_tail.clone())
}: rebag(SystemOrigin::Signed(caller), origin_tail_lookup.clone())
verify {
// check the bags have updated as expected.
assert_eq!(
@@ -166,13 +170,15 @@ frame_benchmarking::benchmarks_instance_pallet! {
T::ScoreProvider::set_score_of(&lighter, bag_thresh - One::one());
T::ScoreProvider::set_score_of(&heavier, bag_thresh);
let lighter_lookup = T::Lookup::unlookup(lighter.clone());
assert_eq!(
List::<T, _>::iter().map(|n| n.id().clone()).collect::<Vec<_>>(),
vec![lighter.clone(), heavier_prev.clone(), heavier.clone(), heavier_next.clone()]
);
whitelist_account!(heavier);
}: _(SystemOrigin::Signed(heavier.clone()), lighter.clone())
}: _(SystemOrigin::Signed(heavier.clone()), lighter_lookup.clone())
verify {
assert_eq!(
List::<T, _>::iter().map(|n| n.id().clone()).collect::<Vec<_>>(),