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:
Muharem Ismailov
2022-08-29 18:02:23 +02:00
committed by GitHub
parent b922a25ccd
commit b74fba5dac
8 changed files with 561 additions and 292 deletions
+9 -7
View File
@@ -37,8 +37,10 @@ pub use crate as pallet_alliance;
use super::*;
type BlockNumber = u64;
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const BlockHashCount: BlockNumber = 250;
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
@@ -47,7 +49,7 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Call = Call;
type Index = u64;
type BlockNumber = u64;
type BlockNumber = BlockNumber;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
@@ -83,8 +85,10 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
}
const MOTION_DURATION_IN_BLOCKS: BlockNumber = 3;
parameter_types! {
pub const MotionDuration: u64 = 3;
pub const MotionDuration: BlockNumber = MOTION_DURATION_IN_BLOCKS;
pub const MaxProposals: u32 = 100;
pub const MaxMembers: u32 = 100;
}
@@ -199,6 +203,7 @@ parameter_types! {
pub const MaxFellows: u32 = MaxMembers::get() - MaxFounders::get();
pub const MaxAllies: u32 = 100;
pub const AllyDeposit: u64 = 25;
pub const RetirementPeriod: BlockNumber = MOTION_DURATION_IN_BLOCKS + 1;
}
impl Config for Test {
type Event = Event;
@@ -225,6 +230,7 @@ impl Config for Test {
type MaxMembersCount = MaxMembers;
type AllyDeposit = AllyDeposit;
type WeightInfo = ();
type RetirementPeriod = RetirementPeriod;
}
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
@@ -324,7 +330,3 @@ pub fn make_proposal(value: u64) -> Call {
pub fn make_set_rule_proposal(rule: Cid) -> Call {
Call::Alliance(pallet_alliance::Call::set_rule { rule })
}
pub fn make_kick_member_proposal(who: u64) -> Call {
Call::Alliance(pallet_alliance::Call::kick_member { who })
}