mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
min collator check (#498)
* min collator check * change statemint/mine min candidates * Ci pass * Update pallets/collator-selection/src/lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Update pallets/collator-selection/src/lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Apply suggestions from code review * build fixes * add error messages to errors * added validator register check Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -18,7 +18,7 @@ use crate as collator_selection;
|
||||
use sp_core::H256;
|
||||
use frame_support::{
|
||||
parameter_types, ord_parameter_types,
|
||||
traits::{FindAuthor, GenesisBuild},
|
||||
traits::{FindAuthor, GenesisBuild, ValidatorRegistration},
|
||||
PalletId
|
||||
};
|
||||
use sp_runtime::{
|
||||
@@ -188,6 +188,18 @@ parameter_types! {
|
||||
pub const PotId: PalletId = PalletId(*b"PotStake");
|
||||
pub const MaxCandidates: u32 = 20;
|
||||
pub const MaxInvulnerables: u32 = 20;
|
||||
pub const MinCandidates: u32 = 1;
|
||||
}
|
||||
|
||||
pub struct IsRegistered;
|
||||
impl ValidatorRegistration<u64> for IsRegistered {
|
||||
fn is_registered(id: &u64) -> bool {
|
||||
if *id == 7u64 {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config for Test {
|
||||
@@ -196,8 +208,12 @@ impl Config for Test {
|
||||
type UpdateOrigin = EnsureSignedBy<RootAccount, u64>;
|
||||
type PotId = PotId;
|
||||
type MaxCandidates = MaxCandidates;
|
||||
type MinCandidates = MinCandidates;
|
||||
type MaxInvulnerables = MaxInvulnerables;
|
||||
type KickThreshold = Period;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
type ValidatorIdOf = IdentityCollator;
|
||||
type ValidatorRegistration = IsRegistered;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user