mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 08:31:14 +00:00
Alliance pallet: retirement notice call (#11970)
* Alliance pallet: retirement notice * add alliance pallet to benchmark list for dev chain * fix type * ".git/.scripts/bench-bot.sh" pallet dev pallet_alliance * ".git/.scripts/bench-bot.sh" pallet dev pallet_alliance * link weight generated by bench for retirement_notice method * migration to clear UpForKicking storage prefix * rename migration from v1 to v0_to_v1 * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * rename `retirement-notice to give-retirement-notice * Apply suggestions from code review Co-authored-by: Squirrel <gilescope@gmail.com> * review fixes: update doc, saturating add, BlockNumber type alias * add suffix to duratin consts *_IN_BLOCKS * ".git/.scripts/bench-bot.sh" pallet dev pallet_alliance * add negative tests (#11995) * add negative tests * remove tests powerless asserts checking against announcment origin * assert bad origin from announcement origin checks Co-authored-by: muharem <ismailov.m.h@gmail.com> Co-authored-by: command-bot <> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Squirrel <gilescope@gmail.com>
This commit is contained in:
@@ -691,12 +691,37 @@ benchmarks_instance_pallet! {
|
||||
assert_last_event::<T, I>(Event::AllyElevated { ally: ally1 }.into());
|
||||
}
|
||||
|
||||
give_retirement_notice {
|
||||
set_members::<T, I>();
|
||||
let fellow2 = fellow::<T, I>(2);
|
||||
|
||||
assert!(Alliance::<T, I>::is_fellow(&fellow2));
|
||||
}: _(SystemOrigin::Signed(fellow2.clone()))
|
||||
verify {
|
||||
assert!(Alliance::<T, I>::is_member_of(&fellow2, MemberRole::Retiring));
|
||||
|
||||
assert_eq!(
|
||||
RetiringMembers::<T, I>::get(&fellow2),
|
||||
Some(System::<T>::block_number() + T::RetirementPeriod::get())
|
||||
);
|
||||
assert_last_event::<T, I>(
|
||||
Event::MemberRetirementPeriodStarted {member: fellow2}.into()
|
||||
);
|
||||
}
|
||||
|
||||
retire {
|
||||
set_members::<T, I>();
|
||||
|
||||
let fellow2 = fellow::<T, I>(2);
|
||||
assert!(Alliance::<T, I>::is_fellow(&fellow2));
|
||||
assert!(!Alliance::<T, I>::is_up_for_kicking(&fellow2));
|
||||
|
||||
assert_eq!(
|
||||
Alliance::<T, I>::give_retirement_notice(
|
||||
SystemOrigin::Signed(fellow2.clone()).into()
|
||||
),
|
||||
Ok(())
|
||||
);
|
||||
System::<T>::set_block_number(System::<T>::block_number() + T::RetirementPeriod::get());
|
||||
|
||||
assert_eq!(DepositOf::<T, I>::get(&fellow2), Some(T::AllyDeposit::get()));
|
||||
}: _(SystemOrigin::Signed(fellow2.clone()))
|
||||
@@ -713,11 +738,7 @@ benchmarks_instance_pallet! {
|
||||
set_members::<T, I>();
|
||||
|
||||
let fellow2 = fellow::<T, I>(2);
|
||||
UpForKicking::<T, I>::insert(&fellow2, true);
|
||||
|
||||
assert!(Alliance::<T, I>::is_member_of(&fellow2, MemberRole::Fellow));
|
||||
assert!(Alliance::<T, I>::is_up_for_kicking(&fellow2));
|
||||
|
||||
assert_eq!(DepositOf::<T, I>::get(&fellow2), Some(T::AllyDeposit::get()));
|
||||
|
||||
let fellow2_lookup = T::Lookup::unlookup(fellow2.clone());
|
||||
|
||||
Reference in New Issue
Block a user