* Basic weights builder. * Fixing WiP * Make the tests work. * Fix weights in node/runtime. * WiP. * Update pallets with new weights parameters. * Validate returns a Result now. * Count mandatory weight separately. * DRY * BREAKING: Updating state root, because of the left-over weight-tracking stuff * Update tests affected by Mandatory tracking. * Fixing tests. * Fix defaults for simple_max * Update frame/system/src/weights.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Rework the API a bit. * Fix compilation & tests. * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Add extra docs & rename few things. * Fix whitespace in ASCII art. * Update frame/system/src/limits.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fix max_extrinsic calculations. * Fix conflicts. * Fix compilation. * Fix new code. * re-remove generic asset * Fix usage. * Update state root. * Update proxy. * Fix tests. * Move weights validity to integrity_test * Remove redundant BlockWeights. * Add all/non_mandatory comment * Add test. * Remove fn block_weights * Make the macro prettier. * Fix some docs. * Make max_total behave more predictabily. * Add BlockWeights to metadata. * fix balances test * Fix utility test. Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Scored Pool Module
The module maintains a scored membership pool. Each entity in the
pool can be attributed a Score. From this pool a set Members
is constructed. This set contains the MemberCount highest
scoring entities. Unscored entities are never part of Members.
If an entity wants to be part of the pool a deposit is required. The deposit is returned when the entity withdraws or when it is removed by an entity with the appropriate authority.
Every Period blocks the set of Members is refreshed from the
highest scoring members in the pool and, no matter if changes
occurred, T::MembershipChanged::set_members_sorted is invoked.
On first load T::MembershipInitialized::initialize_members is
invoked with the initial Members set.
It is possible to withdraw candidacy/resign your membership at any
time. If an entity is currently a member, this results in removal
from the Pool and Members; the entity is immediately replaced
by the next highest scoring candidate in the pool, if available.
Interface
Public Functions
submit_candidacy- Submit candidacy to become a member. Requires a deposit.withdraw_candidacy- Withdraw candidacy. Deposit is returned.score- Attribute a quantitative score to an entity.kick- Remove an entity from the pool and members. Deposit is returned.change_member_count- Changes the amount of candidates taken intoMembers.
Usage
use frame_support::{decl_module, dispatch};
use frame_system::ensure_signed;
use pallet_scored_pool::{self as scored_pool};
pub trait Config: scored_pool::Config {}
decl_module! {
pub struct Module<T: Config> for enum Call where origin: T::Origin {
#[weight = 0]
pub fn candidate(origin) -> dispatch::DispatchResult {
let who = ensure_signed(origin)?;
let _ = <scored_pool::Module<T>>::submit_candidacy(
T::Origin::from(Some(who.clone()).into())
);
Ok(())
}
}
}
Dependencies
This module depends on the System module.
License: Apache-2.0