chore: regenerate umbrella crate, fix feature propagation
This commit is contained in:
@@ -36,22 +36,22 @@
|
||||
//! including its configuration trait, dispatchables, storage items, events and errors.
|
||||
//!
|
||||
//! This pezpallet provides an implementation of
|
||||
//! [`pezframe_election_provider_support::SortedListProvider`] and it can typically be used by another
|
||||
//! pezpallet via this API.
|
||||
//! [`pezframe_election_provider_support::SortedListProvider`] and it can typically be used by
|
||||
//! another pezpallet via this API.
|
||||
//!
|
||||
//! ## Overview
|
||||
//!
|
||||
//! This pezpallet splits `AccountId`s into different bags. Within a bag, these `AccountId`s are stored
|
||||
//! as nodes in a linked-list manner. This pezpallet then provides iteration over all bags, which
|
||||
//! basically allows an infinitely large list of items to be kept in a sorted manner.
|
||||
//! This pezpallet splits `AccountId`s into different bags. Within a bag, these `AccountId`s are
|
||||
//! stored as nodes in a linked-list manner. This pezpallet then provides iteration over all bags,
|
||||
//! which basically allows an infinitely large list of items to be kept in a sorted manner.
|
||||
//!
|
||||
//! Each bags has a upper and lower range of scores, denoted by [`Config::BagThresholds`]. All nodes
|
||||
//! within a bag must be within the range of the bag. If not, the permissionless [`Pezpallet::rebag`]
|
||||
//! can be used to move any node to the right bag.
|
||||
//! within a bag must be within the range of the bag. If not, the permissionless
|
||||
//! [`Pezpallet::rebag`] can be used to move any node to the right bag.
|
||||
//!
|
||||
//! Once a `rebag` happens, the order within a node is still not enforced. To move a node to the
|
||||
//! optimal position in a bag, the [`Pezpallet::put_in_front_of`] or [`Pezpallet::put_in_front_of_other`]
|
||||
//! can be used.
|
||||
//! optimal position in a bag, the [`Pezpallet::put_in_front_of`] or
|
||||
//! [`Pezpallet::put_in_front_of_other`] can be used.
|
||||
//!
|
||||
//! Additional reading, about how this pezpallet is used in the context of Pezkuwi's staking system:
|
||||
//! <https://pezkuwichain.io/blog/staking-update-september-2021/#bags-list-in-depth>
|
||||
@@ -217,7 +217,8 @@ pub mod pezpallet {
|
||||
/// there exists some constant ratio such that `threshold[k + 1] == (threshold[k] *
|
||||
/// constant_ratio).max(threshold[k] + 1)` for all `k`.
|
||||
///
|
||||
/// The helpers in the `/utils/pezframe/pez-generate-bags` module can simplify this calculation.
|
||||
/// The helpers in the `/utils/pezframe/pez-generate-bags` module can simplify this
|
||||
/// calculation.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@@ -332,9 +333,9 @@ pub mod pezpallet {
|
||||
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
|
||||
/// Get the current `score` of a given account.
|
||||
///
|
||||
/// Returns `(current, real_score)`, the former being the current score that this pezpallet is
|
||||
/// aware of, which may or may not be up to date, and the latter being the real score, as
|
||||
/// provided by
|
||||
/// Returns `(current, real_score)`, the former being the current score that this pezpallet
|
||||
/// is aware of, which may or may not be up to date, and the latter being the real score,
|
||||
/// as provided by
|
||||
// [`Config::ScoreProvider`].
|
||||
///
|
||||
/// If the two differ, it means this node is eligible for [`Call::rebag`].
|
||||
|
||||
@@ -37,8 +37,8 @@ use pezframe_support::{
|
||||
traits::{Defensive, DefensiveOption, Get},
|
||||
CloneNoBound, DefaultNoBound, EqNoBound, PalletError, PartialEqNoBound, RuntimeDebugNoBound,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::traits::{Bounded, Zero};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
#[cfg(any(
|
||||
test,
|
||||
@@ -595,7 +595,10 @@ impl<T: Config<I>, I: 'static> List<T, I> {
|
||||
let expected_bag = bags_map
|
||||
.get(&node.bag_upper)
|
||||
.ok_or("bag not found for the node in active bags")?;
|
||||
pezframe_support::ensure!(expected_bag.contains(node.id()), "node not found in the bag");
|
||||
pezframe_support::ensure!(
|
||||
expected_bag.contains(node.id()),
|
||||
"node not found in the bag"
|
||||
);
|
||||
|
||||
// verify node state
|
||||
node.do_try_state()?
|
||||
|
||||
@@ -372,8 +372,11 @@ mod list {
|
||||
// we do some wacky stuff here to get access to the counter, since it is (reasonably)
|
||||
// not exposed as mutable in any sense.
|
||||
#[pezframe_support::storage_alias]
|
||||
type CounterForListNodes<T: Config> =
|
||||
StorageValue<crate::Pezpallet<T>, u32, pezframe_support::pezpallet_prelude::ValueQuery>;
|
||||
type CounterForListNodes<T: Config> = StorageValue<
|
||||
crate::Pezpallet<T>,
|
||||
u32,
|
||||
pezframe_support::pezpallet_prelude::ValueQuery,
|
||||
>;
|
||||
CounterForListNodes::<Runtime>::mutate(|counter| *counter += 1);
|
||||
assert_eq!(crate::ListNodes::<Runtime>::count(), 5);
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
use pezframe_support::{assert_noop, assert_ok, assert_storage_noop, traits::IntegrityTest};
|
||||
|
||||
use super::*;
|
||||
use pezframe_election_provider_support::{SortedListProvider, VoteWeight};
|
||||
use bizinikiwi_test_utils::assert_eq_uvec;
|
||||
use list::Bag;
|
||||
use mock::{test_utils::*, *};
|
||||
use bizinikiwi_test_utils::assert_eq_uvec;
|
||||
use pezframe_election_provider_support::{SortedListProvider, VoteWeight};
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user