chore: regenerate umbrella crate, fix feature propagation
This commit is contained in:
@@ -27,8 +27,8 @@
|
||||
//! More information about `honggfuzz` can be found
|
||||
//! [here](https://docs.rs/honggfuzz/).
|
||||
|
||||
use pezframe_election_provider_support::{SortedListProvider, VoteWeight};
|
||||
use honggfuzz::fuzz;
|
||||
use pezframe_election_provider_support::{SortedListProvider, VoteWeight};
|
||||
use pezpallet_bags_list::mock::{AccountId, BagsList, ExtBuilder};
|
||||
|
||||
const ID_RANGE: AccountId = 25_000;
|
||||
|
||||
@@ -63,7 +63,8 @@ pub fn display_and_check_bags<Runtime: RuntimeT<Instance1>>(
|
||||
let mut seen_in_bags = 0;
|
||||
let mut rebaggable = 0;
|
||||
let mut active_bags = 0;
|
||||
for vote_weight_thresh in <Runtime as pezpallet_bags_list::Config<Instance1>>::BagThresholds::get()
|
||||
for vote_weight_thresh in
|
||||
<Runtime as pezpallet_bags_list::Config<Instance1>>::BagThresholds::get()
|
||||
{
|
||||
let vote_weight_thresh_u64: u64 = (*vote_weight_thresh)
|
||||
.try_into()
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
use crate::{RuntimeT, LOG_TARGET};
|
||||
use pezframe_support::traits::PalletInfoAccess;
|
||||
use pezpallet_staking::Nominators;
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
use pezsp_runtime::{traits::Block as BlockT, DeserializeOwned};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
|
||||
/// Test voter bags migration. `currency_unit` is the number of planks per the the runtimes `UNITS`
|
||||
/// (i.e. number of decimal places per HEZ, KSM etc)
|
||||
@@ -56,7 +56,8 @@ pub async fn execute<Runtime, Block>(
|
||||
);
|
||||
log::info!(target: LOG_TARGET, "Moved {} nominators", moved);
|
||||
|
||||
let voter_list_len = <Runtime as pezpallet_staking::Config>::VoterList::iter().count() as u32;
|
||||
let voter_list_len =
|
||||
<Runtime as pezpallet_staking::Config>::VoterList::iter().count() as u32;
|
||||
let voter_list_count = <Runtime as pezpallet_staking::Config>::VoterList::count();
|
||||
// and confirm it is equal to the length of the `VoterList`.
|
||||
assert_eq!(pre_migrate_nominator_count, voter_list_len);
|
||||
|
||||
@@ -21,11 +21,11 @@ use pezframe_election_provider_support::{
|
||||
SortedListProvider,
|
||||
};
|
||||
use pezframe_support::traits::PalletInfoAccess;
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
use pezsp_runtime::{
|
||||
traits::{Block as BlockT, Zero},
|
||||
DeserializeOwned,
|
||||
};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
|
||||
/// Execute create a snapshot from pezpallet-staking.
|
||||
pub async fn execute<Runtime, Block>(voter_limit: Option<usize>, currency_unit: u64, ws_url: String)
|
||||
@@ -39,10 +39,12 @@ where
|
||||
let mut ext = Builder::<Block>::new()
|
||||
.mode(Mode::Online(OnlineConfig {
|
||||
transport: ws_url.to_string().into(),
|
||||
// NOTE: we don't scrape pezpallet-staking, this kinda ensures that the source of the data
|
||||
// is bags-list.
|
||||
pallets: vec![pezpallet_bags_list::Pezpallet::<Runtime, pezpallet_bags_list::Instance1>::name()
|
||||
.to_string()],
|
||||
// NOTE: we don't scrape pezpallet-staking, this kinda ensures that the source of the
|
||||
// data is bags-list.
|
||||
pallets: vec![
|
||||
pezpallet_bags_list::Pezpallet::<Runtime, pezpallet_bags_list::Instance1>::name()
|
||||
.to_string(),
|
||||
],
|
||||
at: None,
|
||||
hashed_prefixes: vec![
|
||||
<pezpallet_staking::Bonded<Runtime>>::prefix_hash().to_vec(),
|
||||
|
||||
@@ -20,8 +20,8 @@ use pezframe_support::{
|
||||
storage::generator::StorageMap,
|
||||
traits::{Get, PalletInfoAccess},
|
||||
};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
use pezsp_runtime::{traits::Block as BlockT, DeserializeOwned};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
|
||||
/// Execute the sanity check of the bags-list.
|
||||
pub async fn execute<Runtime, Block>(
|
||||
@@ -36,8 +36,10 @@ pub async fn execute<Runtime, Block>(
|
||||
let mut ext = Builder::<Block>::new()
|
||||
.mode(Mode::Online(OnlineConfig {
|
||||
transport: ws_url.to_string().into(),
|
||||
pallets: vec![pezpallet_bags_list::Pezpallet::<Runtime, pezpallet_bags_list::Instance1>::name()
|
||||
.to_string()],
|
||||
pallets: vec![
|
||||
pezpallet_bags_list::Pezpallet::<Runtime, pezpallet_bags_list::Instance1>::name()
|
||||
.to_string(),
|
||||
],
|
||||
hashed_prefixes: vec![
|
||||
<pezpallet_staking::Bonded<Runtime>>::prefix_hash().to_vec(),
|
||||
<pezpallet_staking::Ledger<Runtime>>::prefix_hash().to_vec(),
|
||||
@@ -49,9 +51,12 @@ pub async fn execute<Runtime, Block>(
|
||||
.unwrap();
|
||||
|
||||
ext.execute_with(|| {
|
||||
pezsp_core::crypto::set_default_ss58_version(Runtime::SS58Prefix::get().try_into().unwrap());
|
||||
pezsp_core::crypto::set_default_ss58_version(
|
||||
Runtime::SS58Prefix::get().try_into().unwrap(),
|
||||
);
|
||||
|
||||
pezpallet_bags_list::Pezpallet::<Runtime, pezpallet_bags_list::Instance1>::do_try_state().unwrap();
|
||||
pezpallet_bags_list::Pezpallet::<Runtime, pezpallet_bags_list::Instance1>::do_try_state()
|
||||
.unwrap();
|
||||
|
||||
log::info!(target: crate::LOG_TARGET, "executed bags-list sanity check with no errors.");
|
||||
|
||||
|
||||
@@ -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