mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Alliance pallet: split force_set_members call (#12179)
* Alliance pallet: split force_set_members call * use counts for event * ".git/.scripts/bench-bot.sh" pallet dev pallet_alliance Co-authored-by: command-bot <>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
use sp_runtime::traits::{Bounded, Hash, StaticLookup};
|
||||
use sp_std::{
|
||||
cmp,
|
||||
convert::{TryFrom, TryInto},
|
||||
mem::size_of,
|
||||
prelude::*,
|
||||
@@ -38,11 +39,6 @@ fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::
|
||||
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
fn assert_prev_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
|
||||
let events = frame_system::Pallet::<T>::events();
|
||||
assert_eq!(events.get(events.len() - 2).expect("events expected").event, generic_event.into());
|
||||
}
|
||||
|
||||
fn cid(input: impl AsRef<[u8]>) -> Cid {
|
||||
use sha2::{Digest, Sha256};
|
||||
let mut hasher = Sha256::new();
|
||||
@@ -126,12 +122,11 @@ benchmarks_instance_pallet! {
|
||||
let proposer = founders[0].clone();
|
||||
let fellows = (0 .. y).map(fellow::<T, I>).collect::<Vec<_>>();
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
fellows,
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
let threshold = m;
|
||||
@@ -178,12 +173,11 @@ benchmarks_instance_pallet! {
|
||||
members.extend(founders.clone());
|
||||
members.extend(fellows.clone());
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
fellows,
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
// Threshold is 1 less than the number of members so that one person can vote nay
|
||||
@@ -247,12 +241,11 @@ benchmarks_instance_pallet! {
|
||||
let founders = (0 .. m).map(founder::<T, I>).collect::<Vec<_>>();
|
||||
let vetor = founders[0].clone();
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
vec![],
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
// Threshold is one less than total members so that two nays will disapprove the vote
|
||||
@@ -299,12 +292,11 @@ benchmarks_instance_pallet! {
|
||||
members.extend(founders.clone());
|
||||
members.extend(fellows.clone());
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
fellows,
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
let proposer = members[0].clone();
|
||||
@@ -385,12 +377,11 @@ benchmarks_instance_pallet! {
|
||||
members.extend(founders.clone());
|
||||
members.extend(fellows.clone());
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
fellows,
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
let proposer = members[0].clone();
|
||||
@@ -477,12 +468,11 @@ benchmarks_instance_pallet! {
|
||||
members.extend(founders.clone());
|
||||
members.extend(fellows.clone());
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
fellows,
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
let proposer = members[0].clone();
|
||||
@@ -554,12 +544,11 @@ benchmarks_instance_pallet! {
|
||||
members.extend(founders.clone());
|
||||
members.extend(fellows.clone());
|
||||
|
||||
Alliance::<T, I>::force_set_members(
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
founders,
|
||||
fellows,
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
let proposer = members[0].clone();
|
||||
@@ -615,124 +604,21 @@ benchmarks_instance_pallet! {
|
||||
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
|
||||
}
|
||||
|
||||
force_set_members {
|
||||
init_members {
|
||||
// at least 1 founders
|
||||
let x in 1 .. T::MaxFounders::get();
|
||||
let y in 0 .. T::MaxFellows::get();
|
||||
let z in 0 .. T::MaxAllies::get();
|
||||
let p in 0 .. T::MaxProposals::get();
|
||||
let c in 0 .. T::MaxFounders::get() + T::MaxFellows::get();
|
||||
let m in 0 .. T::MaxAllies::get();
|
||||
|
||||
let mut founders = (0 .. x).map(founder::<T, I>).collect::<Vec<_>>();
|
||||
let mut proposer = founders[0].clone();
|
||||
let mut fellows = (0 .. y).map(fellow::<T, I>).collect::<Vec<_>>();
|
||||
let mut allies = (0 .. z).map(ally::<T, I>).collect::<Vec<_>>();
|
||||
let witness = ForceSetWitness{
|
||||
proposals: p,
|
||||
voting_members: c,
|
||||
ally_members: m,
|
||||
};
|
||||
let mut old_fellows: Vec<T::AccountId> = Vec::new();
|
||||
let mut old_allies: Vec<T::AccountId> = Vec::new();
|
||||
|
||||
let mut cc = c;
|
||||
if (m > 0 && c == 0) || (p > 0 && c == 0) {
|
||||
// if total member count `m` greater than zero,
|
||||
// one voting member required to set non voting members.
|
||||
// OR
|
||||
// if some proposals,
|
||||
// one voting member required to create proposal.
|
||||
cc = 1;
|
||||
}
|
||||
|
||||
// setting the Alliance to disband on the benchmark call
|
||||
if cc > 0 {
|
||||
old_fellows = (0..cc).map(fellow::<T, I>).collect::<Vec<_>>();
|
||||
old_allies = (0..m).map(ally::<T, I>).collect::<Vec<_>>();
|
||||
|
||||
// used later for proposal creation.
|
||||
proposer = old_fellows[0].clone();
|
||||
|
||||
// set alliance before benchmarked call to include alliance disband.
|
||||
Alliance::<T, I>::force_set_members(
|
||||
SystemOrigin::Root.into(),
|
||||
vec![old_fellows[0].clone()],
|
||||
vec![],
|
||||
vec![],
|
||||
Default::default(),
|
||||
)?;
|
||||
|
||||
// using `join_alliance` instead `force_set_members` to join alliance
|
||||
// to have deposit reserved and bench the worst case scenario.
|
||||
for fellow in old_fellows.iter().skip(1) {
|
||||
Alliance::<T, I>::join_alliance(
|
||||
SystemOrigin::Signed(fellow.clone()).into()
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
// elevating allies to have desired voting members count.
|
||||
for fellow in old_fellows.iter().skip(1) {
|
||||
Alliance::<T, I>::elevate_ally(
|
||||
T::MembershipManager::successful_origin(),
|
||||
T::Lookup::unlookup(fellow.clone())
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
for ally in old_allies.iter() {
|
||||
Alliance::<T, I>::join_alliance(
|
||||
SystemOrigin::Signed(ally.clone()).into()
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(Alliance::<T, I>::voting_members_count(), cc);
|
||||
assert_eq!(Alliance::<T, I>::ally_members_count(), m);
|
||||
}
|
||||
|
||||
// adding proposals to veto on the Alliance reset
|
||||
for i in 0..p {
|
||||
let threshold = cc;
|
||||
let bytes_in_storage = i + size_of::<Cid>() as u32 + 32;
|
||||
// proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal =
|
||||
AllianceCall::<T, I>::set_rule { rule: rule(vec![i as u8; i as usize]) }.into();
|
||||
Alliance::<T, I>::propose(
|
||||
SystemOrigin::Signed(proposer.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal),
|
||||
bytes_in_storage,
|
||||
)?;
|
||||
}
|
||||
let mut proposals = T::ProposalProvider::proposals();
|
||||
if c != cc {
|
||||
// removing a helper founder from the alliance which should not be
|
||||
// included in the actual benchmark call.
|
||||
Alliance::<T, I>::give_retirement_notice(
|
||||
SystemOrigin::Signed(proposer.clone()).into()
|
||||
)?;
|
||||
System::<T>::set_block_number(
|
||||
System::<T>::block_number() + T::RetirementPeriod::get()
|
||||
);
|
||||
Alliance::<T, I>::retire(
|
||||
SystemOrigin::Signed(proposer.clone()).into()
|
||||
)?;
|
||||
// remove a helper founder from fellows list.
|
||||
old_fellows.remove(0);
|
||||
}
|
||||
}: _(SystemOrigin::Root, founders.clone(), fellows.clone(), allies.clone(), witness)
|
||||
}: _(SystemOrigin::Root, founders.clone(), fellows.clone(), allies.clone())
|
||||
verify {
|
||||
founders.sort();
|
||||
fellows.sort();
|
||||
allies.sort();
|
||||
if !witness.is_zero() {
|
||||
old_fellows.append(&mut old_allies);
|
||||
old_fellows.sort();
|
||||
proposals.sort();
|
||||
assert_prev_event::<T, I>(Event::AllianceDisbanded {
|
||||
members: old_fellows,
|
||||
proposals: proposals,
|
||||
}.into());
|
||||
}
|
||||
assert_last_event::<T, I>(Event::MembersInitialized {
|
||||
founders: founders.clone(),
|
||||
fellows: fellows.clone(),
|
||||
@@ -743,6 +629,47 @@ benchmarks_instance_pallet! {
|
||||
assert_eq!(Alliance::<T, I>::members(MemberRole::Ally), allies);
|
||||
}
|
||||
|
||||
disband {
|
||||
// at least 1 founders
|
||||
let x in 1 .. T::MaxFounders::get() + T::MaxFellows::get();
|
||||
let y in 0 .. T::MaxAllies::get();
|
||||
let z in 0 .. T::MaxMembersCount::get() / 2;
|
||||
|
||||
let voting_members = (0 .. x).map(founder::<T, I>).collect::<Vec<_>>();
|
||||
let allies = (0 .. y).map(ally::<T, I>).collect::<Vec<_>>();
|
||||
let witness = DisbandWitness{
|
||||
voting_members: x,
|
||||
ally_members: y,
|
||||
};
|
||||
|
||||
// setting the Alliance to disband on the benchmark call
|
||||
Alliance::<T, I>::init_members(
|
||||
SystemOrigin::Root.into(),
|
||||
voting_members.clone(),
|
||||
vec![],
|
||||
allies.clone(),
|
||||
)?;
|
||||
|
||||
// reserve deposits
|
||||
let deposit = T::AllyDeposit::get();
|
||||
for member in voting_members.iter().chain(allies.iter()).take(z as usize) {
|
||||
T::Currency::reserve(&member, deposit)?;
|
||||
<DepositOf<T, I>>::insert(&member, deposit);
|
||||
}
|
||||
|
||||
assert_eq!(Alliance::<T, I>::voting_members_count(), x);
|
||||
assert_eq!(Alliance::<T, I>::ally_members_count(), y);
|
||||
}: _(SystemOrigin::Root, witness)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::AllianceDisbanded {
|
||||
voting_members: x,
|
||||
ally_members: y,
|
||||
unreserved: cmp::min(z, x + y),
|
||||
}.into());
|
||||
|
||||
assert!(!Alliance::<T, I>::is_initialized());
|
||||
}
|
||||
|
||||
set_rule {
|
||||
set_members::<T, I>();
|
||||
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
//!
|
||||
//! #### Root Calls
|
||||
//!
|
||||
//! - `force_set_members` - Set the members via chain governance.
|
||||
//! - `init_members` - Initialize the Alliance, onboard founders, fellows, and allies.
|
||||
//! - `disband` - Disband the Alliance, remove all active members and unreserve deposits.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
@@ -204,14 +205,6 @@ pub trait ProposalProvider<AccountId, Hash, Proposal> {
|
||||
|
||||
/// Return a proposal of the given hash.
|
||||
fn proposal_of(proposal_hash: Hash) -> Option<Proposal>;
|
||||
|
||||
/// Return hashes of all active proposals.
|
||||
fn proposals() -> Vec<Hash>;
|
||||
|
||||
// Return count of all active proposals.
|
||||
//
|
||||
// Used to check witness data for an extrinsic.
|
||||
fn proposals_count() -> u32;
|
||||
}
|
||||
|
||||
/// The various roles that a member can hold.
|
||||
@@ -428,8 +421,8 @@ pub mod pallet {
|
||||
UnscrupulousItemAdded { items: Vec<UnscrupulousItemOf<T, I>> },
|
||||
/// Accounts or websites have been removed from the list of unscrupulous items.
|
||||
UnscrupulousItemRemoved { items: Vec<UnscrupulousItemOf<T, I>> },
|
||||
/// Alliance disbanded.
|
||||
AllianceDisbanded { members: Vec<T::AccountId>, proposals: Vec<T::Hash> },
|
||||
/// Alliance disbanded. Includes number deleted members and unreserved deposits.
|
||||
AllianceDisbanded { voting_members: u32, ally_members: u32, unreserved: u32 },
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
@@ -647,81 +640,25 @@ pub mod pallet {
|
||||
Ok(info.into())
|
||||
}
|
||||
|
||||
/// Initialize the founders, fellows, and allies.
|
||||
/// Founders must be provided to initialize the Alliance.
|
||||
///
|
||||
/// Provide witness data to disband current Alliance before initializing new.
|
||||
/// Alliance must be empty or disband first to initialize new.
|
||||
///
|
||||
/// Alliance is only disbanded if new member set is not provided.
|
||||
/// Initialize the Alliance, onboard founders, fellows, and allies.
|
||||
///
|
||||
/// Founders must be not empty.
|
||||
/// The Alliance must be empty.
|
||||
/// Must be called by the Root origin.
|
||||
#[pallet::weight(T::WeightInfo::force_set_members(
|
||||
T::MaxFounders::get(),
|
||||
T::MaxFellows::get(),
|
||||
T::MaxAllies::get(),
|
||||
witness.proposals,
|
||||
witness.voting_members,
|
||||
witness.ally_members,
|
||||
#[pallet::weight(T::WeightInfo::init_members(
|
||||
founders.len() as u32,
|
||||
fellows.len() as u32,
|
||||
allies.len() as u32,
|
||||
))]
|
||||
pub fn force_set_members(
|
||||
pub fn init_members(
|
||||
origin: OriginFor<T>,
|
||||
founders: Vec<T::AccountId>,
|
||||
fellows: Vec<T::AccountId>,
|
||||
allies: Vec<T::AccountId>,
|
||||
witness: ForceSetWitness,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
if !witness.is_zero() {
|
||||
// Disband Alliance by removing all members and returning deposits.
|
||||
// Veto and remove all active proposals to avoid any unexpected behavior from
|
||||
// actionable items managed outside of the pallet. Items managed within the pallet,
|
||||
// like `UnscrupulousWebsites`, are left for the new Alliance to clean up or keep.
|
||||
|
||||
ensure!(
|
||||
T::ProposalProvider::proposals_count() <= witness.proposals,
|
||||
Error::<T, I>::BadWitness
|
||||
);
|
||||
ensure!(
|
||||
Self::voting_members_count() <= witness.voting_members,
|
||||
Error::<T, I>::BadWitness
|
||||
);
|
||||
ensure!(
|
||||
Self::ally_members_count() <= witness.ally_members,
|
||||
Error::<T, I>::BadWitness
|
||||
);
|
||||
|
||||
let mut proposals = T::ProposalProvider::proposals();
|
||||
for hash in proposals.iter() {
|
||||
T::ProposalProvider::veto_proposal(*hash);
|
||||
}
|
||||
|
||||
let mut members = Self::voting_members();
|
||||
T::MembershipChanged::change_members_sorted(&[], &members, &[]);
|
||||
|
||||
members.append(&mut Self::members_of(MemberRole::Ally));
|
||||
for member in members.iter() {
|
||||
if let Some(deposit) = DepositOf::<T, I>::take(&member) {
|
||||
let err_amount = T::Currency::unreserve(&member, deposit);
|
||||
debug_assert!(err_amount.is_zero());
|
||||
}
|
||||
}
|
||||
|
||||
Members::<T, I>::remove(&MemberRole::Founder);
|
||||
Members::<T, I>::remove(&MemberRole::Fellow);
|
||||
Members::<T, I>::remove(&MemberRole::Ally);
|
||||
|
||||
members.sort();
|
||||
proposals.sort();
|
||||
Self::deposit_event(Event::AllianceDisbanded { members, proposals });
|
||||
}
|
||||
|
||||
if founders.is_empty() {
|
||||
ensure!(fellows.is_empty() && allies.is_empty(), Error::<T, I>::FoundersMissing);
|
||||
// new members set not provided.
|
||||
return Ok(())
|
||||
}
|
||||
ensure!(!founders.is_empty(), Error::<T, I>::FoundersMissing);
|
||||
ensure!(!Self::is_initialized(), Error::<T, I>::AllianceAlreadyInitialized);
|
||||
|
||||
let mut founders: BoundedVec<T::AccountId, T::MaxMembersCount> =
|
||||
@@ -765,6 +702,59 @@ pub mod pallet {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Disband the Alliance, remove all active members and unreserve deposits.
|
||||
///
|
||||
/// Witness data must be set.
|
||||
#[pallet::weight(T::WeightInfo::disband(
|
||||
witness.voting_members,
|
||||
witness.ally_members,
|
||||
witness.voting_members + witness.ally_members,
|
||||
))]
|
||||
pub fn disband(
|
||||
origin: OriginFor<T>,
|
||||
witness: DisbandWitness,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_root(origin)?;
|
||||
|
||||
ensure!(!witness.is_zero(), Error::<T, I>::BadWitness);
|
||||
ensure!(
|
||||
Self::voting_members_count() <= witness.voting_members,
|
||||
Error::<T, I>::BadWitness
|
||||
);
|
||||
ensure!(Self::ally_members_count() <= witness.ally_members, Error::<T, I>::BadWitness);
|
||||
ensure!(Self::is_initialized(), Error::<T, I>::AllianceNotYetInitialized);
|
||||
|
||||
let voting_members = Self::voting_members();
|
||||
T::MembershipChanged::change_members_sorted(&[], &voting_members, &[]);
|
||||
|
||||
let ally_members = Self::members_of(MemberRole::Ally);
|
||||
let mut unreserve_count: u32 = 0;
|
||||
for member in voting_members.iter().chain(ally_members.iter()) {
|
||||
if let Some(deposit) = DepositOf::<T, I>::take(&member) {
|
||||
let err_amount = T::Currency::unreserve(&member, deposit);
|
||||
debug_assert!(err_amount.is_zero());
|
||||
unreserve_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Members::<T, I>::remove(&MemberRole::Founder);
|
||||
Members::<T, I>::remove(&MemberRole::Fellow);
|
||||
Members::<T, I>::remove(&MemberRole::Ally);
|
||||
|
||||
Self::deposit_event(Event::AllianceDisbanded {
|
||||
voting_members: voting_members.len() as u32,
|
||||
ally_members: ally_members.len() as u32,
|
||||
unreserved: unreserve_count,
|
||||
});
|
||||
|
||||
Ok(Some(T::WeightInfo::disband(
|
||||
voting_members.len() as u32,
|
||||
ally_members.len() as u32,
|
||||
unreserve_count,
|
||||
))
|
||||
.into())
|
||||
}
|
||||
|
||||
/// Set a new IPFS CID to the alliance rule.
|
||||
#[pallet::weight(T::WeightInfo::set_rule())]
|
||||
pub fn set_rule(origin: OriginFor<T>, rule: Cid) -> DispatchResult {
|
||||
|
||||
@@ -197,14 +197,6 @@ impl ProposalProvider<u64, H256, Call> for AllianceProposalProvider {
|
||||
fn proposal_of(proposal_hash: H256) -> Option<Call> {
|
||||
AllianceMotion::proposal_of(proposal_hash)
|
||||
}
|
||||
|
||||
fn proposals() -> Vec<H256> {
|
||||
AllianceMotion::proposals().into_inner()
|
||||
}
|
||||
|
||||
fn proposals_count() -> u32 {
|
||||
pallet_collective::Proposals::<Test, AllianceCollective>::decode_len().unwrap_or(0) as u32
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -326,13 +318,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
Error::<Test, ()>::AllianceNotYetInitialized
|
||||
);
|
||||
|
||||
assert_ok!(Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![1, 2],
|
||||
vec![3],
|
||||
vec![],
|
||||
Default::default()
|
||||
));
|
||||
assert_ok!(Alliance::init_members(Origin::root(), vec![1, 2], vec![3], vec![]));
|
||||
|
||||
System::set_block_number(1);
|
||||
});
|
||||
@@ -369,8 +355,3 @@ pub fn make_proposal(proposal: Call) -> (Call, u32, H256) {
|
||||
let hash = BlakeTwo256::hash_of(&proposal);
|
||||
(proposal, len, hash)
|
||||
}
|
||||
|
||||
pub fn assert_prev_event(event: Event) {
|
||||
let events = System::events();
|
||||
assert_eq!(events.get(events.len() - 2).expect("events expected").event, event);
|
||||
}
|
||||
|
||||
@@ -26,19 +26,57 @@ use crate::mock::*;
|
||||
type AllianceMotionEvent = pallet_collective::Event<Test, pallet_collective::Instance1>;
|
||||
|
||||
#[test]
|
||||
fn force_set_members_works() {
|
||||
fn init_members_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// alliance must be reset first, no witness data
|
||||
assert_noop!(
|
||||
Alliance::init_members(Origin::root(), vec![8], vec![], vec![],),
|
||||
Error::<Test, ()>::AllianceAlreadyInitialized,
|
||||
);
|
||||
|
||||
// give a retirement notice to check later a retiring member not removed
|
||||
assert_ok!(Alliance::give_retirement_notice(Origin::signed(2)));
|
||||
assert!(Alliance::is_member_of(&2, MemberRole::Retiring));
|
||||
|
||||
// disband the Alliance to init new
|
||||
assert_ok!(Alliance::disband(Origin::root(), DisbandWitness::new(2, 0)));
|
||||
|
||||
// fails without root
|
||||
assert_noop!(Alliance::init_members(Origin::signed(1), vec![], vec![], vec![]), BadOrigin);
|
||||
|
||||
// founders missing, other members given
|
||||
assert_noop!(
|
||||
Alliance::init_members(Origin::root(), vec![], vec![4], vec![2],),
|
||||
Error::<Test, ()>::FoundersMissing,
|
||||
);
|
||||
|
||||
// success call
|
||||
assert_ok!(Alliance::init_members(Origin::root(), vec![8, 5], vec![4], vec![2],));
|
||||
|
||||
// assert new set of voting members
|
||||
assert_eq!(Alliance::voting_members_sorted(), vec![4, 5, 8]);
|
||||
// assert new members member
|
||||
assert!(Alliance::is_founder(&8));
|
||||
assert!(Alliance::is_founder(&5));
|
||||
assert!(Alliance::is_fellow(&4));
|
||||
assert!(Alliance::is_ally(&2));
|
||||
// assert a retiring member from previous Alliance not removed
|
||||
assert!(Alliance::is_member_of(&2, MemberRole::Retiring));
|
||||
|
||||
System::assert_last_event(mock::Event::Alliance(crate::Event::MembersInitialized {
|
||||
founders: vec![5, 8],
|
||||
fellows: vec![4],
|
||||
allies: vec![2],
|
||||
}));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disband_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// ensure alliance is set
|
||||
assert_eq!(Alliance::voting_members_sorted(), vec![1, 2, 3]);
|
||||
|
||||
// creating and proposing proposals
|
||||
let (proposal, proposal_len, hash) = make_remark_proposal(42);
|
||||
assert_ok!(Alliance::propose(Origin::signed(1), 3, Box::new(proposal), proposal_len));
|
||||
|
||||
let (k_proposal, k_proposal_len, k_hash) = make_kick_member_proposal(2);
|
||||
assert_ok!(Alliance::propose(Origin::signed(1), 3, Box::new(k_proposal), k_proposal_len));
|
||||
let mut proposals = vec![hash, k_hash];
|
||||
|
||||
// give a retirement notice to check later a retiring member not removed
|
||||
assert_ok!(Alliance::give_retirement_notice(Origin::signed(2)));
|
||||
assert!(Alliance::is_member_of(&2, MemberRole::Retiring));
|
||||
@@ -50,124 +88,46 @@ fn force_set_members_works() {
|
||||
assert_eq!(Balances::free_balance(9), 15);
|
||||
assert!(Alliance::is_member_of(&9, MemberRole::Ally));
|
||||
|
||||
// ensure proposal is listed as active proposal
|
||||
assert_eq!(<Test as Config>::ProposalProvider::proposals(), proposals);
|
||||
assert_eq!(<Test as Config>::ProposalProvider::proposals_count(), 2);
|
||||
|
||||
// fails without root
|
||||
assert_noop!(Alliance::disband(Origin::signed(1), Default::default()), BadOrigin);
|
||||
|
||||
// bad witness data checks
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
Origin::signed(1),
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
Default::default()
|
||||
),
|
||||
BadOrigin
|
||||
Alliance::disband(Origin::root(), Default::default(),),
|
||||
Error::<Test, ()>::BadWitness
|
||||
);
|
||||
|
||||
// nothing to do, witness data is default, new members not provided.
|
||||
assert_ok!(Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
Default::default()
|
||||
));
|
||||
|
||||
// alliance must be reset first, no witness data.
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![8],
|
||||
vec![],
|
||||
vec![],
|
||||
Default::default()
|
||||
),
|
||||
Error::<Test, ()>::AllianceAlreadyInitialized,
|
||||
);
|
||||
|
||||
// wrong witness data checks
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
ForceSetWitness::new(1, 3, 1)
|
||||
),
|
||||
Alliance::disband(Origin::root(), DisbandWitness::new(1, 1)),
|
||||
Error::<Test, ()>::BadWitness,
|
||||
);
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
ForceSetWitness::new(2, 1, 1)
|
||||
),
|
||||
Alliance::disband(Origin::root(), DisbandWitness::new(2, 0)),
|
||||
Error::<Test, ()>::BadWitness,
|
||||
);
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
ForceSetWitness::new(1, 3, 0)
|
||||
),
|
||||
Error::<Test, ()>::BadWitness,
|
||||
);
|
||||
|
||||
// founders missing, other members given
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![],
|
||||
vec![4],
|
||||
vec![2],
|
||||
ForceSetWitness::new(2, 3, 1)
|
||||
),
|
||||
Error::<Test, ()>::FoundersMissing,
|
||||
);
|
||||
|
||||
// success call
|
||||
assert_ok!(Alliance::force_set_members(
|
||||
Origin::root(),
|
||||
vec![8, 5],
|
||||
vec![4],
|
||||
vec![2],
|
||||
ForceSetWitness::new(2, 3, 1)
|
||||
));
|
||||
assert_ok!(Alliance::disband(Origin::root(), DisbandWitness::new(2, 1)));
|
||||
|
||||
// assert new set of voting members
|
||||
assert_eq!(Alliance::voting_members_sorted(), vec![4, 5, 8]);
|
||||
// assert new ally member
|
||||
assert!(Alliance::is_ally(&2));
|
||||
// assert a retiring member from previous Alliance not removed
|
||||
assert!(Alliance::is_member_of(&2, MemberRole::Retiring));
|
||||
// assert old alliance disband.
|
||||
// assert members disband
|
||||
assert!(!Alliance::is_member(&1));
|
||||
assert!(!Alliance::is_member(&3));
|
||||
assert!(!Alliance::is_member(&9));
|
||||
assert!(!Alliance::is_initialized());
|
||||
// assert a retiring member from the previous Alliance not removed
|
||||
assert!(Alliance::is_member_of(&2, MemberRole::Retiring));
|
||||
// deposit unreserved
|
||||
assert_eq!(Balances::free_balance(9), 40);
|
||||
// all proposals are removed
|
||||
assert_eq!(<Test as Config>::ProposalProvider::proposals(), vec![]);
|
||||
assert_eq!(<Test as Config>::ProposalProvider::proposals_count(), 0);
|
||||
|
||||
// assert events
|
||||
proposals.sort();
|
||||
assert_prev_event(mock::Event::Alliance(crate::Event::AllianceDisbanded {
|
||||
members: vec![1, 3, 9],
|
||||
proposals,
|
||||
System::assert_last_event(mock::Event::Alliance(crate::Event::AllianceDisbanded {
|
||||
voting_members: 2,
|
||||
ally_members: 1,
|
||||
unreserved: 1,
|
||||
}));
|
||||
|
||||
System::assert_last_event(mock::Event::Alliance(crate::Event::MembersInitialized {
|
||||
founders: vec![5, 8],
|
||||
fellows: vec![4],
|
||||
allies: vec![2],
|
||||
}));
|
||||
// the Alliance must be set first
|
||||
assert_noop!(
|
||||
Alliance::disband(Origin::root(), DisbandWitness::new(100, 100)),
|
||||
Error::<Test, ()>::AllianceNotYetInitialized,
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -588,14 +548,10 @@ fn assert_powerless(user: Origin) {
|
||||
let cid = test_cid();
|
||||
let (proposal, _, _) = make_kick_member_proposal(42);
|
||||
|
||||
assert_noop!(Alliance::init_members(user.clone(), vec![], vec![], vec![],), BadOrigin);
|
||||
|
||||
assert_noop!(
|
||||
Alliance::force_set_members(
|
||||
user.clone(),
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
ForceSetWitness { voting_members: 3, ..Default::default() }
|
||||
),
|
||||
Alliance::disband(user.clone(), DisbandWitness { voting_members: 3, ..Default::default() }),
|
||||
BadOrigin
|
||||
);
|
||||
|
||||
|
||||
@@ -94,32 +94,28 @@ impl Cid {
|
||||
}
|
||||
}
|
||||
|
||||
/// Witness data for the `force_set_members` call.
|
||||
/// Relevant only if executed on an initialized alliance to reset it.
|
||||
/// Witness data for the `disband` call.
|
||||
#[derive(
|
||||
Copy, Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo, Default,
|
||||
)]
|
||||
pub struct ForceSetWitness {
|
||||
/// Number of active proposals which will be vetoed and removed.
|
||||
#[codec(compact)]
|
||||
pub(super) proposals: u32,
|
||||
/// Total number of voting members in the current alliance.
|
||||
pub struct DisbandWitness {
|
||||
/// Total number of voting members in the current Alliance.
|
||||
#[codec(compact)]
|
||||
pub(super) voting_members: u32,
|
||||
/// Total number of ally members in the current alliance.
|
||||
/// Total number of ally members in the current Alliance.
|
||||
#[codec(compact)]
|
||||
pub(super) ally_members: u32,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl ForceSetWitness {
|
||||
// Creates new ForceSetWitness.
|
||||
pub(super) fn new(proposals: u32, voting_members: u32, ally_members: u32) -> Self {
|
||||
Self { proposals, voting_members, ally_members }
|
||||
impl DisbandWitness {
|
||||
// Creates new DisbandWitness.
|
||||
pub(super) fn new(voting_members: u32, ally_members: u32) -> Self {
|
||||
Self { voting_members, ally_members }
|
||||
}
|
||||
}
|
||||
|
||||
impl ForceSetWitness {
|
||||
impl DisbandWitness {
|
||||
pub(super) fn is_zero(self) -> bool {
|
||||
self == Self::default()
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//! Autogenerated weights for pallet_alliance
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-09-01, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2022-09-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
|
||||
@@ -53,7 +53,8 @@ pub trait WeightInfo {
|
||||
fn close_early_approved(b: u32, x: u32, y: u32, p: u32, ) -> Weight;
|
||||
fn close_disapproved(x: u32, y: u32, p: u32, ) -> Weight;
|
||||
fn close_approved(b: u32, x: u32, y: u32, p: u32, ) -> Weight;
|
||||
fn force_set_members(x: u32, y: u32, z: u32, p: u32, c: u32, m: u32, ) -> Weight;
|
||||
fn init_members(x: u32, y: u32, z: u32, ) -> Weight;
|
||||
fn disband(x: u32, y: u32, z: u32, ) -> Weight;
|
||||
fn set_rule() -> Weight;
|
||||
fn announce() -> Weight;
|
||||
fn remove_announcement() -> Weight;
|
||||
@@ -80,13 +81,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `y` is `[0, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn propose_proposed(_b: u32, x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(37_864_000 as u64)
|
||||
// Standard Error: 28_000
|
||||
.saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(x as u64))
|
||||
Weight::from_ref_time(34_420_000 as u64)
|
||||
// Standard Error: 25_000
|
||||
.saturating_add(Weight::from_ref_time(145_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(66_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(80_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(192_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(197_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
}
|
||||
@@ -95,9 +96,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `x` is `[3, 10]`.
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
fn vote(_x: u32, y: u32, ) -> Weight {
|
||||
Weight::from_ref_time(46_813_000 as u64)
|
||||
Weight::from_ref_time(48_443_000 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(125_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
@@ -107,9 +108,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: AllianceMotion Voting (r:0 w:1)
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn veto(p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(35_316_000 as u64)
|
||||
Weight::from_ref_time(35_056_000 as u64)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(172_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(171_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -122,13 +123,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_early_disapproved(x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(36_245_000 as u64)
|
||||
// Standard Error: 18_000
|
||||
.saturating_add(Weight::from_ref_time(336_000 as u64).saturating_mul(x as u64))
|
||||
Weight::from_ref_time(36_929_000 as u64)
|
||||
// Standard Error: 19_000
|
||||
.saturating_add(Weight::from_ref_time(287_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(105_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(178_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(180_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -141,16 +142,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `x` is `[2, 10]`.
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_early_approved(b: u32, x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(48_088_000 as u64)
|
||||
fn close_early_approved(b: u32, _x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(48_085_000 as u64)
|
||||
// Standard Error: 0
|
||||
.saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(b as u64))
|
||||
// Standard Error: 16_000
|
||||
.saturating_add(Weight::from_ref_time(194_000 as u64).saturating_mul(x as u64))
|
||||
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(93_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(100_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(201_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(210_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -164,11 +163,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_disapproved(_x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(43_374_000 as u64)
|
||||
Weight::from_ref_time(43_377_000 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(101_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(99_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(182_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(190_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -182,65 +181,69 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `x` is `[2, 10]`.
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_approved(_b: u32, _x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(42_798_000 as u64)
|
||||
fn close_approved(_b: u32, x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(41_417_000 as u64)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add(Weight::from_ref_time(67_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(87_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(88_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(192_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(196_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: AllianceMotion Proposals (r:1 w:1)
|
||||
// Storage: Alliance Members (r:3 w:3)
|
||||
// Storage: Alliance DepositOf (r:200 w:199)
|
||||
// Storage: System Account (r:199 w:199)
|
||||
// Storage: AllianceMotion Voting (r:0 w:100)
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
// Storage: AllianceMotion ProposalOf (r:0 w:100)
|
||||
// Storage: AllianceMotion Members (r:1 w:1)
|
||||
/// The range of component `x` is `[1, 10]`.
|
||||
/// The range of component `y` is `[0, 90]`.
|
||||
/// The range of component `z` is `[0, 100]`.
|
||||
/// The range of component `p` is `[0, 100]`.
|
||||
/// The range of component `c` is `[0, 100]`.
|
||||
/// The range of component `m` is `[0, 100]`.
|
||||
fn force_set_members(x: u32, y: u32, z: u32, p: u32, c: u32, m: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 221_000
|
||||
.saturating_add(Weight::from_ref_time(1_294_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 23_000
|
||||
.saturating_add(Weight::from_ref_time(231_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(z as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(9_371_000 as u64).saturating_mul(p as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(11_673_000 as u64).saturating_mul(c as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(11_581_000 as u64).saturating_mul(m as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as u64))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(m as u64)))
|
||||
fn init_members(_x: u32, y: u32, z: u32, ) -> Weight {
|
||||
Weight::from_ref_time(37_202_000 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(149_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(120_000 as u64).saturating_mul(z as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(p as u64)))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(m as u64)))
|
||||
}
|
||||
// Storage: Alliance Members (r:3 w:3)
|
||||
// Storage: AllianceMotion Proposals (r:1 w:0)
|
||||
// Storage: Alliance DepositOf (r:101 w:50)
|
||||
// Storage: System Account (r:50 w:50)
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
/// The range of component `x` is `[1, 100]`.
|
||||
/// The range of component `y` is `[0, 100]`.
|
||||
/// The range of component `z` is `[0, 50]`.
|
||||
fn disband(x: u32, y: u32, z: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 9_000
|
||||
.saturating_add(Weight::from_ref_time(1_447_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 9_000
|
||||
.saturating_add(Weight::from_ref_time(1_512_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 19_000
|
||||
.saturating_add(Weight::from_ref_time(10_760_000 as u64).saturating_mul(z as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(x as u64)))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(y as u64)))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(z as u64)))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(z as u64)))
|
||||
}
|
||||
// Storage: Alliance Rule (r:0 w:1)
|
||||
fn set_rule() -> Weight {
|
||||
Weight::from_ref_time(18_721_000 as u64)
|
||||
Weight::from_ref_time(18_101_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: Alliance Announcements (r:1 w:1)
|
||||
fn announce() -> Weight {
|
||||
Weight::from_ref_time(21_887_000 as u64)
|
||||
Weight::from_ref_time(21_090_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: Alliance Announcements (r:1 w:1)
|
||||
fn remove_announcement() -> Weight {
|
||||
Weight::from_ref_time(23_052_000 as u64)
|
||||
Weight::from_ref_time(22_118_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
@@ -249,14 +252,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: Alliance DepositOf (r:0 w:1)
|
||||
fn join_alliance() -> Weight {
|
||||
Weight::from_ref_time(54_504_000 as u64)
|
||||
Weight::from_ref_time(53_446_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: Alliance Members (r:4 w:1)
|
||||
// Storage: Alliance UnscrupulousAccounts (r:1 w:0)
|
||||
fn nominate_ally() -> Weight {
|
||||
Weight::from_ref_time(42_601_000 as u64)
|
||||
Weight::from_ref_time(42_690_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
@@ -265,7 +268,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
fn elevate_ally() -> Weight {
|
||||
Weight::from_ref_time(37_704_000 as u64)
|
||||
Weight::from_ref_time(37_396_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
}
|
||||
@@ -275,7 +278,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
// Storage: Alliance RetiringMembers (r:0 w:1)
|
||||
fn give_retirement_notice() -> Weight {
|
||||
Weight::from_ref_time(40_859_000 as u64)
|
||||
Weight::from_ref_time(40_644_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as u64))
|
||||
}
|
||||
@@ -284,7 +287,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Alliance DepositOf (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn retire() -> Weight {
|
||||
Weight::from_ref_time(43_447_000 as u64)
|
||||
Weight::from_ref_time(43_440_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
}
|
||||
@@ -295,7 +298,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
fn kick_member() -> Weight {
|
||||
Weight::from_ref_time(61_718_000 as u64)
|
||||
Weight::from_ref_time(61_060_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as u64))
|
||||
}
|
||||
@@ -304,11 +307,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `n` is `[1, 100]`.
|
||||
/// The range of component `l` is `[1, 255]`.
|
||||
fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight {
|
||||
Weight::from_ref_time(359_000 as u64)
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(1_376_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(112_000 as u64).saturating_mul(l as u64))
|
||||
.saturating_add(Weight::from_ref_time(1_362_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 0
|
||||
.saturating_add(Weight::from_ref_time(113_000 as u64).saturating_mul(l as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
@@ -318,10 +321,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `l` is `[1, 255]`.
|
||||
fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 145_000
|
||||
.saturating_add(Weight::from_ref_time(20_932_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 56_000
|
||||
.saturating_add(Weight::from_ref_time(3_649_000 as u64).saturating_mul(l as u64))
|
||||
// Standard Error: 147_000
|
||||
.saturating_add(Weight::from_ref_time(21_060_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 57_000
|
||||
.saturating_add(Weight::from_ref_time(3_683_000 as u64).saturating_mul(l as u64))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
@@ -339,13 +342,13 @@ impl WeightInfo for () {
|
||||
/// The range of component `y` is `[0, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn propose_proposed(_b: u32, x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(37_864_000 as u64)
|
||||
// Standard Error: 28_000
|
||||
.saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(x as u64))
|
||||
Weight::from_ref_time(34_420_000 as u64)
|
||||
// Standard Error: 25_000
|
||||
.saturating_add(Weight::from_ref_time(145_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(66_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(80_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(192_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(197_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
||||
}
|
||||
@@ -354,9 +357,9 @@ impl WeightInfo for () {
|
||||
/// The range of component `x` is `[3, 10]`.
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
fn vote(_x: u32, y: u32, ) -> Weight {
|
||||
Weight::from_ref_time(46_813_000 as u64)
|
||||
Weight::from_ref_time(48_443_000 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(125_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
||||
}
|
||||
@@ -366,9 +369,9 @@ impl WeightInfo for () {
|
||||
// Storage: AllianceMotion Voting (r:0 w:1)
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn veto(p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(35_316_000 as u64)
|
||||
Weight::from_ref_time(35_056_000 as u64)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(172_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(171_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -381,13 +384,13 @@ impl WeightInfo for () {
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_early_disapproved(x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(36_245_000 as u64)
|
||||
// Standard Error: 18_000
|
||||
.saturating_add(Weight::from_ref_time(336_000 as u64).saturating_mul(x as u64))
|
||||
Weight::from_ref_time(36_929_000 as u64)
|
||||
// Standard Error: 19_000
|
||||
.saturating_add(Weight::from_ref_time(287_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(105_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(178_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(180_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -400,16 +403,14 @@ impl WeightInfo for () {
|
||||
/// The range of component `x` is `[2, 10]`.
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_early_approved(b: u32, x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(48_088_000 as u64)
|
||||
fn close_early_approved(b: u32, _x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(48_085_000 as u64)
|
||||
// Standard Error: 0
|
||||
.saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(b as u64))
|
||||
// Standard Error: 16_000
|
||||
.saturating_add(Weight::from_ref_time(194_000 as u64).saturating_mul(x as u64))
|
||||
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(93_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(100_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(201_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(210_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -423,11 +424,11 @@ impl WeightInfo for () {
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_disapproved(_x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(43_374_000 as u64)
|
||||
Weight::from_ref_time(43_377_000 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(101_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(99_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(182_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(190_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
||||
}
|
||||
@@ -441,65 +442,69 @@ impl WeightInfo for () {
|
||||
/// The range of component `x` is `[2, 10]`.
|
||||
/// The range of component `y` is `[2, 90]`.
|
||||
/// The range of component `p` is `[1, 100]`.
|
||||
fn close_approved(_b: u32, _x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(42_798_000 as u64)
|
||||
fn close_approved(_b: u32, x: u32, y: u32, p: u32, ) -> Weight {
|
||||
Weight::from_ref_time(41_417_000 as u64)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add(Weight::from_ref_time(67_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(87_000 as u64).saturating_mul(y as u64))
|
||||
.saturating_add(Weight::from_ref_time(88_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(192_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(Weight::from_ref_time(196_000 as u64).saturating_mul(p as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: AllianceMotion Proposals (r:1 w:1)
|
||||
// Storage: Alliance Members (r:3 w:3)
|
||||
// Storage: Alliance DepositOf (r:200 w:199)
|
||||
// Storage: System Account (r:199 w:199)
|
||||
// Storage: AllianceMotion Voting (r:0 w:100)
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
// Storage: AllianceMotion ProposalOf (r:0 w:100)
|
||||
// Storage: AllianceMotion Members (r:1 w:1)
|
||||
/// The range of component `x` is `[1, 10]`.
|
||||
/// The range of component `y` is `[0, 90]`.
|
||||
/// The range of component `z` is `[0, 100]`.
|
||||
/// The range of component `p` is `[0, 100]`.
|
||||
/// The range of component `c` is `[0, 100]`.
|
||||
/// The range of component `m` is `[0, 100]`.
|
||||
fn force_set_members(x: u32, y: u32, z: u32, p: u32, c: u32, m: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 221_000
|
||||
.saturating_add(Weight::from_ref_time(1_294_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 23_000
|
||||
.saturating_add(Weight::from_ref_time(231_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(z as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(9_371_000 as u64).saturating_mul(p as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(11_673_000 as u64).saturating_mul(c as u64))
|
||||
// Standard Error: 21_000
|
||||
.saturating_add(Weight::from_ref_time(11_581_000 as u64).saturating_mul(m as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
|
||||
.saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(m as u64)))
|
||||
fn init_members(_x: u32, y: u32, z: u32, ) -> Weight {
|
||||
Weight::from_ref_time(37_202_000 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(149_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(120_000 as u64).saturating_mul(z as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(p as u64)))
|
||||
.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
|
||||
.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(m as u64)))
|
||||
}
|
||||
// Storage: Alliance Members (r:3 w:3)
|
||||
// Storage: AllianceMotion Proposals (r:1 w:0)
|
||||
// Storage: Alliance DepositOf (r:101 w:50)
|
||||
// Storage: System Account (r:50 w:50)
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
/// The range of component `x` is `[1, 100]`.
|
||||
/// The range of component `y` is `[0, 100]`.
|
||||
/// The range of component `z` is `[0, 50]`.
|
||||
fn disband(x: u32, y: u32, z: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 9_000
|
||||
.saturating_add(Weight::from_ref_time(1_447_000 as u64).saturating_mul(x as u64))
|
||||
// Standard Error: 9_000
|
||||
.saturating_add(Weight::from_ref_time(1_512_000 as u64).saturating_mul(y as u64))
|
||||
// Standard Error: 19_000
|
||||
.saturating_add(Weight::from_ref_time(10_760_000 as u64).saturating_mul(z as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(x as u64)))
|
||||
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(y as u64)))
|
||||
.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(z as u64)))
|
||||
.saturating_add(RocksDbWeight::get().writes(5 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(z as u64)))
|
||||
}
|
||||
// Storage: Alliance Rule (r:0 w:1)
|
||||
fn set_rule() -> Weight {
|
||||
Weight::from_ref_time(18_721_000 as u64)
|
||||
Weight::from_ref_time(18_101_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: Alliance Announcements (r:1 w:1)
|
||||
fn announce() -> Weight {
|
||||
Weight::from_ref_time(21_887_000 as u64)
|
||||
Weight::from_ref_time(21_090_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: Alliance Announcements (r:1 w:1)
|
||||
fn remove_announcement() -> Weight {
|
||||
Weight::from_ref_time(23_052_000 as u64)
|
||||
Weight::from_ref_time(22_118_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
||||
}
|
||||
@@ -508,14 +513,14 @@ impl WeightInfo for () {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: Alliance DepositOf (r:0 w:1)
|
||||
fn join_alliance() -> Weight {
|
||||
Weight::from_ref_time(54_504_000 as u64)
|
||||
Weight::from_ref_time(53_446_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(6 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: Alliance Members (r:4 w:1)
|
||||
// Storage: Alliance UnscrupulousAccounts (r:1 w:0)
|
||||
fn nominate_ally() -> Weight {
|
||||
Weight::from_ref_time(42_601_000 as u64)
|
||||
Weight::from_ref_time(42_690_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
||||
}
|
||||
@@ -524,7 +529,7 @@ impl WeightInfo for () {
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
fn elevate_ally() -> Weight {
|
||||
Weight::from_ref_time(37_704_000 as u64)
|
||||
Weight::from_ref_time(37_396_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
||||
}
|
||||
@@ -534,7 +539,7 @@ impl WeightInfo for () {
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
// Storage: Alliance RetiringMembers (r:0 w:1)
|
||||
fn give_retirement_notice() -> Weight {
|
||||
Weight::from_ref_time(40_859_000 as u64)
|
||||
Weight::from_ref_time(40_644_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5 as u64))
|
||||
}
|
||||
@@ -543,7 +548,7 @@ impl WeightInfo for () {
|
||||
// Storage: Alliance DepositOf (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn retire() -> Weight {
|
||||
Weight::from_ref_time(43_447_000 as u64)
|
||||
Weight::from_ref_time(43_440_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
||||
}
|
||||
@@ -554,7 +559,7 @@ impl WeightInfo for () {
|
||||
// Storage: AllianceMotion Members (r:0 w:1)
|
||||
// Storage: AllianceMotion Prime (r:0 w:1)
|
||||
fn kick_member() -> Weight {
|
||||
Weight::from_ref_time(61_718_000 as u64)
|
||||
Weight::from_ref_time(61_060_000 as u64)
|
||||
.saturating_add(RocksDbWeight::get().reads(6 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5 as u64))
|
||||
}
|
||||
@@ -563,11 +568,11 @@ impl WeightInfo for () {
|
||||
/// The range of component `n` is `[1, 100]`.
|
||||
/// The range of component `l` is `[1, 255]`.
|
||||
fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight {
|
||||
Weight::from_ref_time(359_000 as u64)
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add(Weight::from_ref_time(1_376_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add(Weight::from_ref_time(112_000 as u64).saturating_mul(l as u64))
|
||||
.saturating_add(Weight::from_ref_time(1_362_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 0
|
||||
.saturating_add(Weight::from_ref_time(113_000 as u64).saturating_mul(l as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
||||
}
|
||||
@@ -577,10 +582,10 @@ impl WeightInfo for () {
|
||||
/// The range of component `l` is `[1, 255]`.
|
||||
fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 145_000
|
||||
.saturating_add(Weight::from_ref_time(20_932_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 56_000
|
||||
.saturating_add(Weight::from_ref_time(3_649_000 as u64).saturating_mul(l as u64))
|
||||
// Standard Error: 147_000
|
||||
.saturating_add(Weight::from_ref_time(21_060_000 as u64).saturating_mul(n as u64))
|
||||
// Standard Error: 57_000
|
||||
.saturating_add(Weight::from_ref_time(3_683_000 as u64).saturating_mul(l as u64))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user