feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent 286de54384
commit 1c0e57d984
9084 changed files with 997839 additions and 997557 deletions
+68
View File
@@ -0,0 +1,68 @@
[package]
name = "pezpallet-society"
version = "28.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "FRAME society pallet"
readme = "README.md"
[lints]
workspace = true
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { features = ["derive"], workspace = true }
log = { workspace = true }
rand_chacha = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-arithmetic = { workspace = true }
pezsp-io = { workspace = true }
pezsp-runtime = { workspace = true }
[dev-dependencies]
pezframe-support-test = { workspace = true }
pezpallet-balances = { workspace = true, default-features = true }
pezsp-crypto-hashing = { workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"codec/std",
"pezframe-benchmarking?/std",
"pezframe-support-test/std",
"pezframe-support/std",
"pezframe-system/std",
"log/std",
"pezpallet-balances/std",
"rand_chacha/std",
"scale-info/std",
"pezsp-arithmetic/std",
"pezsp-io/std",
"pezsp-runtime/std",
]
runtime-benchmarks = [
"pezframe-benchmarking",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support-test/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
try-runtime = [
"pezframe-support-test/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-balances/try-runtime",
"pezsp-runtime/try-runtime",
]
+228
View File
@@ -0,0 +1,228 @@
# Society Module
- [`society::Config`](https://docs.rs/pezpallet-society/latest/pallet_society/trait.Config.html)
- [`Call`](https://docs.rs/pezpallet-society/latest/pallet_society/enum.Call.html)
## Overview
The Society module is an economic game which incentivizes users to participate
and maintain a membership society.
### User Types
At any point, a user in the society can be one of a:
- Bidder - A user who has submitted intention of joining the society.
- Candidate - A user who will be voted on to join the society.
- Suspended Candidate - A user who failed to win a vote.
- Member - A user who is a member of the society.
- Suspended Member - A member of the society who has accumulated too many strikes
or failed their membership challenge.
Of the non-suspended members, there is always a:
- Head - A member who is exempt from suspension.
- Defender - A member whose membership is under question and voted on again.
Of the non-suspended members of the society, a random set of them are chosen as
"skeptics". The mechanics of skeptics is explained in the
[member phase](https://docs.rs/pezpallet-society/latest/pallet_society/#member-phase) below.
### Mechanics
#### Rewards
Members are incentivized to participate in the society through rewards paid
by the Society treasury. These payments have a maturity period that the user
must wait before they are able to access the funds.
#### Punishments
Members can be punished by slashing the reward payouts that have not been
collected. Additionally, members can accumulate "strikes", and when they
reach a max strike limit, they become suspended.
#### Skeptics
During the voting period, a random set of members are selected as "skeptics".
These skeptics are expected to vote on the current candidates. If they do not vote,
their skeptic status is treated as a rejection vote, the member is deemed
"lazy", and are given a strike per missing vote.
#### Membership Challenges
Every challenge rotation period, an existing member will be randomly selected
to defend their membership into society. Then, other members can vote whether
this defender should stay in society. A simple majority wins vote will determine
the outcome of the user. Ties are treated as a failure of the challenge, but
assuming no one else votes, the defender always get a free vote on their
own challenge keeping them in the society. The Head member is exempt from the
negative outcome of a membership challenge.
#### Society Treasury
The membership society is independently funded by a treasury managed by this
module. Some subset of this treasury is placed in a Society Pot, which is used
to determine the number of accepted bids.
#### Rate of Growth
The membership society can grow at a rate of 10 accepted candidates per rotation period up
to the max membership threshold. Once this threshold is met, candidate selections
are stalled until there is space for new members to join. This can be resolved by
voting out existing members through the random challenges or by using governance
to increase the maximum membership count.
### User Life Cycle
A user can go through the following phases:
```rust
+-------> User <----------+
| + |
| | |
+----------------------------------------------+
| | | | |
| | v | |
| | Bidder <-----------+ |
| | + | |
| | | + |
| | v Suspended |
| | Candidate +----> Candidate |
| | + + |
| | | | |
| + | | |
| Suspended +------>| | |
| Member | | |
| ^ | | |
| | v | |
| +-------+ Member <----------+ |
| |
| |
+------------------Society---------------------+
```
#### Initialization
The society is initialized with a single member who is automatically chosen as the Head.
#### Bid Phase
New users must have a bid to join the society.
A user can make a bid by reserving a deposit. Alternatively, an already existing member
can create a bid on a user's behalf by "vouching" for them.
A bid includes reward information that the user would like to receive for joining
the society. A vouching bid can additionally request some portion of that reward as a tip
to the voucher for vouching for the prospective candidate.
Every rotation period, Bids are ordered by reward amount, and the module
selects as many bids the Society Pot can support for that period.
These selected bids become candidates and move on to the Candidate phase.
Bids that were not selected stay in the bidder pool until they are selected or
a user chooses to "unbid".
#### Candidate Phase
Once a bidder becomes a candidate, members vote whether to approve or reject
that candidate into society. This voting process also happens during a rotation period.
The approval and rejection criteria for candidates are not set on chain,
and may change for different societies.
At the end of the rotation period, we collect the votes for a candidate
and randomly select a vote as the final outcome.
```rust
[ a-accept, r-reject, s-skeptic ]
+----------------------------------+
| |
| Member |0|1|2|3|4|5|6|7|8|9| |
| ----------------------------- |
| Vote |a|a|a|r|s|r|a|a|s|a| |
| ----------------------------- |
| Selected | | | |x| | | | | | | |
| |
+----------------------------------+
Result: Rejected
```
Each member that voted opposite to this randomly selected vote is punished by
slashing their unclaimed payouts and increasing the number of strikes they have.
These slashed funds are given to a random user who voted the same as the
selected vote as a reward for participating in the vote.
If the candidate wins the vote, they receive their bid reward as a future payout.
If the bid was placed by a voucher, they will receive their portion of the reward,
before the rest is paid to the winning candidate.
One winning candidate is selected as the Head of the members. This is randomly
chosen, weighted by the number of approvals the winning candidates accumulated.
If the candidate loses the vote, they are suspended and it is up to the Suspension
Judgement origin to determine if the candidate should go through the bidding process
again, should be accepted into the membership society, or rejected and their deposit
slashed.
#### Member Phase
Once a candidate becomes a member, their role is to participate in society.
Regular participation involves voting on candidates who want to join the membership
society, and by voting in the right way, a member will accumulate future payouts.
When a payout matures, members are able to claim those payouts.
Members can also vouch for users to join the society, and request a "tip" from
the fees the new member would collect by joining the society. This vouching
process is useful in situations where a user may not have enough balance to
satisfy the bid deposit. A member can only vouch one user at a time.
During rotation periods, a random group of members are selected as "skeptics".
These skeptics are expected to vote on the current candidates. If they do not vote,
their skeptic status is treated as a rejection vote, the member is deemed
"lazy", and are given a strike per missing vote.
There is a challenge period in parallel to the rotation period. During a challenge period,
a random member is selected to defend their membership to the society. Other members
make a traditional majority-wins vote to determine if the member should stay in the society.
Ties are treated as a failure of the challenge.
If a member accumulates too many strikes or fails their membership challenge,
they will become suspended. While a member is suspended, they are unable to
claim matured payouts. It is up to the Suspension Judgement origin to determine
if the member should re-enter society or be removed from society with all their
future payouts slashed.
## Interface
### Dispatchable Functions
#### For General Users
- `bid` - A user can make a bid to join the membership society by reserving a deposit.
- `unbid` - A user can withdraw their bid for entry, the deposit is returned.
#### For Members
- `vouch` - A member can place a bid on behalf of a user to join the membership society.
- `unvouch` - A member can revoke their vouch for a user.
- `vote` - A member can vote to approve or reject a candidate's request to join the society.
- `defender_vote` - A member can vote to approve or reject a defender's continued membership
to the society.
- `payout` - A member can claim their first matured payment.
- `unfound` - Allow the founder to unfound the society when they are the only member.
#### For Super Users
- `found` - The founder origin can initiate this society. Useful for bootstrapping the Society
pallet on an already running chain.
- `judge_suspended_member` - The suspension judgement origin is able to make
judgement on a suspended member.
- `judge_suspended_candidate` - The suspension judgement origin is able to
make judgement on a suspended candidate.
- `set_max_membership` - The ROOT origin can update the maximum member count for the society.
The max membership count must be greater than 1.
License: Apache-2.0
@@ -0,0 +1,569 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Society pallet benchmarking.
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use alloc::vec;
use pezsp_runtime::traits::Bounded;
use crate::Pallet as Society;
fn set_block_number<T: Config<I>, I: 'static>(n: BlockNumberFor<T, I>) {
<T as Config<I>>::BlockNumberProvider::set_block_number(n);
}
fn mock_balance_deposit<T: Config<I>, I: 'static>() -> BalanceOf<T, I> {
T::Currency::minimum_balance().saturating_mul(1_000u32.into())
}
fn make_deposit<T: Config<I>, I: 'static>(who: &T::AccountId) -> BalanceOf<T, I> {
let amount = mock_balance_deposit::<T, I>();
let required = amount.saturating_add(T::Currency::minimum_balance());
if T::Currency::free_balance(who) < required {
T::Currency::make_free_balance_be(who, required);
}
T::Currency::reserve(who, amount).expect("Pre-funded account; qed");
amount
}
fn make_bid<T: Config<I>, I: 'static>(
who: &T::AccountId,
) -> BidKind<T::AccountId, BalanceOf<T, I>> {
BidKind::Deposit(make_deposit::<T, I>(who))
}
fn fund_society<T: Config<I>, I: 'static>() {
T::Currency::make_free_balance_be(
&Society::<T, I>::account_id(),
BalanceOf::<T, I>::max_value(),
);
Pot::<T, I>::put(&BalanceOf::<T, I>::max_value());
}
// Set up Society
fn setup_society<T: Config<I>, I: 'static>() -> Result<T::AccountId, &'static str> {
let origin = T::FounderSetOrigin::try_successful_origin().map_err(|_| "No origin")?;
let founder: T::AccountId = account("founder", 0, 0);
let founder_lookup: <T::Lookup as StaticLookup>::Source = T::Lookup::unlookup(founder.clone());
let max_members = 5u32;
let max_intake = 3u32;
let max_strikes = 3u32;
Society::<T, I>::found_society(
origin,
founder_lookup,
max_members,
max_intake,
max_strikes,
mock_balance_deposit::<T, I>(),
b"benchmarking-society".to_vec(),
)?;
T::Currency::make_free_balance_be(
&Society::<T, I>::account_id(),
T::Currency::minimum_balance(),
);
T::Currency::make_free_balance_be(&Society::<T, I>::payouts(), T::Currency::minimum_balance());
Ok(founder)
}
fn setup_funded_society<T: Config<I>, I: 'static>() -> Result<T::AccountId, &'static str> {
let founder = setup_society::<T, I>()?;
fund_society::<T, I>();
Ok(founder)
}
fn add_candidate<T: Config<I>, I: 'static>(
name: &'static str,
tally: Tally,
skeptic_struck: bool,
) -> T::AccountId {
let candidate: T::AccountId = account(name, 0, 0);
let candidacy = Candidacy {
round: RoundCount::<T, I>::get(),
kind: make_bid::<T, I>(&candidate),
bid: 0u32.into(),
tally,
skeptic_struck,
};
Candidates::<T, I>::insert(&candidate, &candidacy);
candidate
}
fn increment_round<T: Config<I>, I: 'static>() {
let mut round_count = RoundCount::<T, I>::get();
round_count.saturating_inc();
RoundCount::<T, I>::put(round_count);
}
#[instance_benchmarks]
mod benchmarks {
use super::*;
#[benchmark]
fn bid() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), 10u32.into());
let first_bid: Bid<T::AccountId, BalanceOf<T, I>> = Bid {
who: caller.clone(),
kind: BidKind::Deposit(mock_balance_deposit::<T, I>()),
value: 10u32.into(),
};
assert_eq!(Bids::<T, I>::get(), vec![first_bid]);
Ok(())
}
#[benchmark]
fn unbid() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
let mut bids = Bids::<T, I>::get();
Society::<T, I>::insert_bid(&mut bids, &caller, 10u32.into(), make_bid::<T, I>(&caller));
Bids::<T, I>::put(bids);
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()));
assert_eq!(Bids::<T, I>::get(), vec![]);
Ok(())
}
#[benchmark]
fn vouch() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
let vouched: T::AccountId = account("vouched", 0, 0);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
let _ = Society::<T, I>::insert_member(&caller, 1u32.into());
let vouched_lookup: <T::Lookup as StaticLookup>::Source =
T::Lookup::unlookup(vouched.clone());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), vouched_lookup, 0u32.into(), 0u32.into());
let bids = Bids::<T, I>::get();
let vouched_bid: Bid<T::AccountId, BalanceOf<T, I>> = Bid {
who: vouched.clone(),
kind: BidKind::Vouch(caller.clone(), 0u32.into()),
value: 0u32.into(),
};
assert_eq!(bids, vec![vouched_bid]);
Ok(())
}
#[benchmark]
fn unvouch() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
let mut bids = Bids::<T, I>::get();
Society::<T, I>::insert_bid(
&mut bids,
&caller,
10u32.into(),
BidKind::Vouch(caller.clone(), 0u32.into()),
);
Bids::<T, I>::put(bids);
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()));
assert_eq!(Bids::<T, I>::get(), vec![]);
Ok(())
}
#[benchmark]
fn vote() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
let _ = Society::<T, I>::insert_member(&caller, 1u32.into());
let candidate = add_candidate::<T, I>("candidate", Default::default(), false);
let candidate_lookup: <T::Lookup as StaticLookup>::Source =
T::Lookup::unlookup(candidate.clone());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), candidate_lookup, true);
let maybe_vote: Vote = <Votes<T, I>>::get(candidate.clone(), caller).unwrap();
assert_eq!(maybe_vote.approve, true);
Ok(())
}
#[benchmark]
fn defender_vote() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
let _ = Society::<T, I>::insert_member(&caller, 1u32.into());
let defender: T::AccountId = account("defender", 0, 0);
Defending::<T, I>::put((defender, caller.clone(), Tally::default()));
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), false);
let round = RoundCount::<T, I>::get();
let skeptic_vote: Vote = DefenderVotes::<T, I>::get(round, &caller).unwrap();
assert_eq!(skeptic_vote.approve, false);
Ok(())
}
#[benchmark]
fn payout() -> Result<(), BenchmarkError> {
setup_funded_society::<T, I>()?;
// Payee's account already exists and is a member.
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, mock_balance_deposit::<T, I>());
let _ = Society::<T, I>::insert_member(&caller, 0u32.into());
// Introduce payout.
Society::<T, I>::bump_payout(&caller, 0u32.into(), 1u32.into());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()));
let record = Payouts::<T, I>::get(caller);
assert!(record.payouts.is_empty());
Ok(())
}
#[benchmark]
fn waive_repay() -> Result<(), BenchmarkError> {
setup_funded_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
let _ = Society::<T, I>::insert_member(&caller, 0u32.into());
Society::<T, I>::bump_payout(&caller, 0u32.into(), 1u32.into());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), 1u32.into());
let record = Payouts::<T, I>::get(caller);
assert!(record.payouts.is_empty());
Ok(())
}
#[benchmark]
fn found_society() -> Result<(), BenchmarkError> {
let founder: T::AccountId = whitelisted_caller();
let can_found = T::FounderSetOrigin::try_successful_origin().map_err(|_| "No origin")?;
let founder_lookup: <T::Lookup as StaticLookup>::Source =
T::Lookup::unlookup(founder.clone());
#[extrinsic_call]
_(
can_found as T::RuntimeOrigin,
founder_lookup,
5,
3,
3,
mock_balance_deposit::<T, I>(),
b"benchmarking-society".to_vec(),
);
assert_eq!(Founder::<T, I>::get(), Some(founder.clone()));
Ok(())
}
#[benchmark]
fn dissolve() -> Result<(), BenchmarkError> {
let founder = setup_society::<T, I>()?;
let members_and_candidates = vec![("m1", "c1"), ("m2", "c2"), ("m3", "c3"), ("m4", "c4")];
let members_count = members_and_candidates.clone().len() as u32;
for (m, c) in members_and_candidates {
let member: T::AccountId = account(m, 0, 0);
let _ = Society::<T, I>::insert_member(&member, 100u32.into());
let candidate = add_candidate::<T, I>(
c,
Tally { approvals: 1u32.into(), rejections: 1u32.into() },
false,
);
let candidate_lookup: <T::Lookup as StaticLookup>::Source =
T::Lookup::unlookup(candidate);
let _ = Society::<T, I>::vote(RawOrigin::Signed(member).into(), candidate_lookup, true);
}
// Leaving only Founder member.
MemberCount::<T, I>::mutate(|i| i.saturating_reduce(members_count));
#[extrinsic_call]
_(RawOrigin::Signed(founder));
assert_eq!(Founder::<T, I>::get(), None);
Ok(())
}
#[benchmark]
fn judge_suspended_member() -> Result<(), BenchmarkError> {
let founder = setup_society::<T, I>()?;
let caller: T::AccountId = whitelisted_caller();
let caller_lookup: <T::Lookup as StaticLookup>::Source =
T::Lookup::unlookup(caller.clone());
let _ = Society::<T, I>::insert_member(&caller, 0u32.into());
let _ = Society::<T, I>::suspend_member(&caller);
#[extrinsic_call]
_(RawOrigin::Signed(founder), caller_lookup, false);
assert_eq!(SuspendedMembers::<T, I>::contains_key(&caller), false);
Ok(())
}
#[benchmark]
fn set_parameters() -> Result<(), BenchmarkError> {
let founder = setup_society::<T, I>()?;
let max_members = 10u32;
let max_intake = 10u32;
let max_strikes = 10u32;
let candidate_deposit: BalanceOf<T, I> = 10u32.into();
let params = GroupParams { max_members, max_intake, max_strikes, candidate_deposit };
#[extrinsic_call]
_(RawOrigin::Signed(founder), max_members, max_intake, max_strikes, candidate_deposit);
assert_eq!(Parameters::<T, I>::get(), Some(params));
Ok(())
}
#[benchmark]
fn punish_skeptic() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>("candidate", Default::default(), false);
let skeptic: T::AccountId = account("skeptic", 0, 0);
let _ = Society::<T, I>::insert_member(&skeptic, 0u32.into());
Skeptic::<T, I>::put(&skeptic);
if let Period::Voting { more, .. } = Society::<T, I>::period() {
set_block_number::<T, I>(T::BlockNumberProvider::current_block_number() + more)
}
#[extrinsic_call]
_(RawOrigin::Signed(candidate.clone()));
let candidacy = Candidates::<T, I>::get(&candidate).unwrap();
assert_eq!(candidacy.skeptic_struck, true);
Ok(())
}
#[benchmark]
fn claim_membership() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>(
"candidate",
Tally { approvals: 3u32.into(), rejections: 0u32.into() },
false,
);
increment_round::<T, I>();
#[extrinsic_call]
_(RawOrigin::Signed(candidate.clone()));
assert!(!Candidates::<T, I>::contains_key(&candidate));
assert!(Members::<T, I>::contains_key(&candidate));
Ok(())
}
#[benchmark]
fn bestow_membership() -> Result<(), BenchmarkError> {
let founder = setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>(
"candidate",
Tally { approvals: 3u32.into(), rejections: 1u32.into() },
false,
);
increment_round::<T, I>();
#[extrinsic_call]
_(RawOrigin::Signed(founder), candidate.clone());
assert!(!Candidates::<T, I>::contains_key(&candidate));
assert!(Members::<T, I>::contains_key(&candidate));
Ok(())
}
#[benchmark]
fn kick_candidate() -> Result<(), BenchmarkError> {
let founder = setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>(
"candidate",
Tally { approvals: 1u32.into(), rejections: 1u32.into() },
false,
);
increment_round::<T, I>();
#[extrinsic_call]
_(RawOrigin::Signed(founder), candidate.clone());
assert!(!Candidates::<T, I>::contains_key(&candidate));
Ok(())
}
#[benchmark]
fn resign_candidacy() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>(
"candidate",
Tally { approvals: 0u32.into(), rejections: 0u32.into() },
false,
);
#[extrinsic_call]
_(RawOrigin::Signed(candidate.clone()));
assert!(!Candidates::<T, I>::contains_key(&candidate));
Ok(())
}
#[benchmark]
fn drop_candidate() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>(
"candidate",
Tally { approvals: 0u32.into(), rejections: 3u32.into() },
false,
);
let caller: T::AccountId = whitelisted_caller();
let _ = Society::<T, I>::insert_member(&caller, 0u32.into());
let mut round_count = RoundCount::<T, I>::get();
round_count = round_count.saturating_add(2u32);
RoundCount::<T, I>::put(round_count);
#[extrinsic_call]
_(RawOrigin::Signed(caller), candidate.clone());
assert!(!Candidates::<T, I>::contains_key(&candidate));
Ok(())
}
#[benchmark]
fn cleanup_candidacy() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
let candidate = add_candidate::<T, I>(
"candidate",
Tally { approvals: 0u32.into(), rejections: 0u32.into() },
false,
);
let member_one: T::AccountId = account("one", 0, 0);
let member_two: T::AccountId = account("two", 0, 0);
let _ = Society::<T, I>::insert_member(&member_one, 0u32.into());
let _ = Society::<T, I>::insert_member(&member_two, 0u32.into());
let candidate_lookup: <T::Lookup as StaticLookup>::Source =
T::Lookup::unlookup(candidate.clone());
let _ = Society::<T, I>::vote(
RawOrigin::Signed(member_one.clone()).into(),
candidate_lookup.clone(),
true,
);
let _ = Society::<T, I>::vote(
RawOrigin::Signed(member_two.clone()).into(),
candidate_lookup,
true,
);
Candidates::<T, I>::remove(&candidate);
#[extrinsic_call]
_(RawOrigin::Signed(member_one), candidate.clone(), 5);
assert_eq!(Votes::<T, I>::get(&candidate, &member_two), None);
Ok(())
}
#[benchmark]
fn cleanup_challenge() -> Result<(), BenchmarkError> {
setup_society::<T, I>()?;
ChallengeRoundCount::<T, I>::put(1u32);
let member: T::AccountId = whitelisted_caller();
let _ = Society::<T, I>::insert_member(&member, 0u32.into());
let defender: T::AccountId = account("defender", 0, 0);
Defending::<T, I>::put((defender.clone(), member.clone(), Tally::default()));
let _ = Society::<T, I>::defender_vote(RawOrigin::Signed(member.clone()).into(), true);
ChallengeRoundCount::<T, I>::put(2u32);
let mut challenge_round = ChallengeRoundCount::<T, I>::get();
challenge_round = challenge_round.saturating_sub(1u32);
#[extrinsic_call]
_(RawOrigin::Signed(member.clone()), challenge_round, 1u32);
assert_eq!(DefenderVotes::<T, I>::get(challenge_round, &defender), None);
Ok(())
}
#[benchmark]
fn poke_deposit() -> Result<(), BenchmarkError> {
// Set up society
setup_society::<T, I>()?;
let bidder: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&bidder, BalanceOf::<T, I>::max_value());
// Make initial bid
let initial_deposit = mock_balance_deposit::<T, I>();
Society::<T, I>::bid(RawOrigin::Signed(bidder.clone()).into(), 0u32.into())?;
// Verify initial state
assert_eq!(T::Currency::reserved_balance(&bidder), initial_deposit);
let bids = Bids::<T, I>::get();
let existing_bid = bids.iter().find(|b| b.who == bidder).expect("Bid should exist");
assert_eq!(existing_bid.kind, BidKind::Deposit(initial_deposit));
// Artificially increase deposit in storage and reserve extra balance
let extra_amount = 2u32.into();
let increased_deposit = initial_deposit.saturating_add(extra_amount);
Bids::<T, I>::try_mutate(|bids| -> Result<(), BenchmarkError> {
if let Some(existing_bid) = bids.iter_mut().find(|b| b.who == bidder) {
existing_bid.kind = BidKind::Deposit(increased_deposit);
Ok(())
} else {
Err(BenchmarkError::Stop("Bid not found"))
}
})?;
T::Currency::reserve(&bidder, extra_amount)?;
// Verify increased state
assert_eq!(T::Currency::reserved_balance(&bidder), increased_deposit);
let bids = Bids::<T, I>::get();
let existing_bid = bids.iter().find(|b| b.who == bidder).expect("Bid should exist");
assert_eq!(existing_bid.kind, BidKind::Deposit(increased_deposit));
#[extrinsic_call]
_(RawOrigin::Signed(bidder.clone()));
// Verify final state returned to initial deposit
assert_eq!(T::Currency::reserved_balance(&bidder), initial_deposit);
let bids = Bids::<T, I>::get();
let existing_bid = bids.iter().find(|b| b.who == bidder).expect("Bid should exist");
assert_eq!(existing_bid.kind, BidKind::Deposit(initial_deposit));
Ok(())
}
impl_benchmark_test_suite!(
Society,
pezsp_io::TestExternalities::from(
<pezframe_system::GenesisConfig::<crate::mock::Test> as pezsp_runtime::BuildStorage>::build_storage(
&pezframe_system::GenesisConfig::default()).unwrap()
),
crate::mock::Test
);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,356 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! # Migrations for Society Pallet
use super::*;
use alloc::{vec, vec::Vec};
use codec::{Decode, Encode};
use pezframe_support::traits::{Defensive, DefensiveOption, Instance, UncheckedOnRuntimeUpgrade};
#[cfg(feature = "try-runtime")]
use pezsp_runtime::TryRuntimeError;
/// The log target.
const TARGET: &'static str = "runtime::society::migration";
/// This migration moves all the state to v2 of Society.
pub struct VersionUncheckedMigrateToV2<T: Config<I>, I: 'static, PastPayouts>(
core::marker::PhantomData<(T, I, PastPayouts)>,
);
impl<
T: Config<I>,
I: Instance + 'static,
PastPayouts: Get<Vec<(<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>)>>,
> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV2<T, I, PastPayouts>
{
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
let in_code = Pallet::<T, I>::in_code_storage_version();
let on_chain = Pallet::<T, I>::on_chain_storage_version();
ensure!(on_chain == 0 && in_code == 2, "pezpallet_society: invalid version");
Ok((v0::Candidates::<T, I>::get(), v0::Members::<T, I>::get()).encode())
}
fn on_runtime_upgrade() -> Weight {
let onchain = Pallet::<T, I>::on_chain_storage_version();
if onchain < 2 {
log::info!(
target: TARGET,
"Running migration against onchain version {:?}",
onchain
);
from_original::<T, I>(&mut PastPayouts::get()).defensive_unwrap_or(Weight::MAX)
} else {
log::warn!("Unexpected onchain version: {:?} (expected 0)", onchain);
T::DbWeight::get().reads(1)
}
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(data: Vec<u8>) -> Result<(), TryRuntimeError> {
let old: (
Vec<Bid<<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>>>,
Vec<<T as pezframe_system::Config>::AccountId>,
) = Decode::decode(&mut &data[..]).expect("Bad data");
let mut old_candidates =
old.0.into_iter().map(|x| (x.who, x.kind, x.value)).collect::<Vec<_>>();
let mut old_members = old.1;
let mut candidates =
Candidates::<T, I>::iter().map(|(k, v)| (k, v.kind, v.bid)).collect::<Vec<_>>();
let mut members = Members::<T, I>::iter_keys().collect::<Vec<_>>();
old_candidates.sort_by_key(|x| x.0.clone());
candidates.sort_by_key(|x| x.0.clone());
assert_eq!(candidates, old_candidates);
members.sort();
old_members.sort();
assert_eq!(members, old_members);
ensure!(
Pallet::<T, I>::on_chain_storage_version() == 2,
"The onchain version must be updated after the migration."
);
assert_internal_consistency::<T, I>();
Ok(())
}
}
/// [`VersionUncheckedMigrateToV2`] wrapped in a [`pezframe_support::migrations::VersionedMigration`],
/// ensuring the migration is only performed when on-chain version is 0.
pub type MigrateToV2<T, I, PastPayouts> = pezframe_support::migrations::VersionedMigration<
0,
2,
VersionUncheckedMigrateToV2<T, I, PastPayouts>,
crate::pallet::Pallet<T, I>,
<T as pezframe_system::Config>::DbWeight,
>;
pub(crate) mod v0 {
use super::*;
use pezframe_support::storage_alias;
/// A vote by a member on a candidate application.
#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub enum Vote {
/// The member has been chosen to be skeptic and has not yet taken any action.
Skeptic,
/// The member has rejected the candidate's application.
Reject,
/// The member approves of the candidate's application.
Approve,
}
#[storage_alias]
pub type Bids<T: Config<I>, I: 'static> = StorageValue<
Pallet<T, I>,
Vec<Bid<<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>>>,
ValueQuery,
>;
#[storage_alias]
pub type Candidates<T: Config<I>, I: 'static> = StorageValue<
Pallet<T, I>,
Vec<Bid<<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>>>,
ValueQuery,
>;
#[storage_alias]
pub type Votes<T: Config<I>, I: 'static> = StorageDoubleMap<
Pallet<T, I>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
Vote,
>;
#[storage_alias]
pub type SuspendedCandidates<T: Config<I>, I: 'static> = StorageMap<
Pallet<T, I>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
(BalanceOf<T, I>, BidKind<<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>>),
>;
#[storage_alias]
pub type Members<T: Config<I>, I: 'static> =
StorageValue<Pallet<T, I>, Vec<<T as pezframe_system::Config>::AccountId>, ValueQuery>;
#[storage_alias]
pub type Vouching<T: Config<I>, I: 'static> = StorageMap<
Pallet<T, I>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
VouchingStatus,
>;
#[storage_alias]
pub type Strikes<T: Config<I>, I: 'static> = StorageMap<
Pallet<T, I>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
StrikeCount,
ValueQuery,
>;
#[storage_alias]
pub type Payouts<T: Config<I>, I: 'static> = StorageMap<
Pallet<T, I>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
Vec<(BlockNumberFor<T, I>, BalanceOf<T, I>)>,
ValueQuery,
>;
#[storage_alias]
pub type SuspendedMembers<T: Config<I>, I: 'static> = StorageMap<
Pallet<T, I>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
bool,
ValueQuery,
>;
#[storage_alias]
pub type Defender<T: Config<I>, I: 'static> =
StorageValue<Pallet<T, I>, <T as pezframe_system::Config>::AccountId>;
#[storage_alias]
pub type DefenderVotes<T: Config<I>, I: 'static> =
StorageMap<Pallet<T, I>, Twox64Concat, <T as pezframe_system::Config>::AccountId, Vote>;
}
/// Will panic if there are any inconsistencies in the pallet's state or old keys remaining.
pub fn assert_internal_consistency<T: Config<I>, I: Instance + 'static>() {
// Check all members are valid data.
let mut members = vec![];
for m in Members::<T, I>::iter_keys() {
let r = Members::<T, I>::get(&m).expect("Member data must be valid");
members.push((m, r));
}
assert_eq!(MemberCount::<T, I>::get(), members.len() as u32);
for (who, record) in members.iter() {
assert_eq!(MemberByIndex::<T, I>::get(record.index).as_ref(), Some(who));
}
if let Some(founder) = Founder::<T, I>::get() {
assert_eq!(Members::<T, I>::get(founder).expect("founder is member").index, 0);
}
if let Some(head) = Head::<T, I>::get() {
assert!(Members::<T, I>::contains_key(head));
}
// Check all votes are valid data.
for (k1, k2) in Votes::<T, I>::iter_keys() {
assert!(Votes::<T, I>::get(k1, k2).is_some());
}
// Check all defender votes are valid data.
for (k1, k2) in DefenderVotes::<T, I>::iter_keys() {
assert!(DefenderVotes::<T, I>::get(k1, k2).is_some());
}
// Check all candidates are valid data.
for k in Candidates::<T, I>::iter_keys() {
assert!(Candidates::<T, I>::get(k).is_some());
}
// Check all suspended members are valid data.
for m in SuspendedMembers::<T, I>::iter_keys() {
assert!(SuspendedMembers::<T, I>::get(m).is_some());
}
// Check all payouts are valid data.
for p in Payouts::<T, I>::iter_keys() {
let k = Payouts::<T, I>::hashed_key_for(&p);
let v = pezframe_support::storage::unhashed::get_raw(&k[..]).expect("value is in map");
assert!(PayoutRecordFor::<T, I>::decode(&mut &v[..]).is_ok());
}
// We don't use these - make sure they don't exist.
assert_eq!(v0::SuspendedCandidates::<T, I>::iter().count(), 0);
assert_eq!(v0::Strikes::<T, I>::iter().count(), 0);
assert_eq!(v0::Vouching::<T, I>::iter().count(), 0);
assert!(!v0::Defender::<T, I>::exists());
assert!(!v0::Members::<T, I>::exists());
}
pub fn from_original<T: Config<I>, I: Instance + 'static>(
past_payouts: &mut [(<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>)],
) -> Result<Weight, &'static str> {
// Migrate Bids from old::Bids (just a truncation).
Bids::<T, I>::put(BoundedVec::<_, T::MaxBids>::truncate_from(v0::Bids::<T, I>::take()));
// Initialise round counter.
RoundCount::<T, I>::put(0);
// Migrate Candidates from old::Candidates
for Bid { who: candidate, kind, value } in v0::Candidates::<T, I>::take().into_iter() {
let mut tally = Tally::default();
// Migrate Votes from old::Votes
// No need to drain, since we're overwriting values.
for (voter, vote) in v0::Votes::<T, I>::iter_prefix(&candidate) {
Votes::<T, I>::insert(
&candidate,
&voter,
Vote { approve: vote == v0::Vote::Approve, weight: 1 },
);
match vote {
v0::Vote::Approve => tally.approvals.saturating_inc(),
v0::Vote::Reject => tally.rejections.saturating_inc(),
v0::Vote::Skeptic => Skeptic::<T, I>::put(&voter),
}
}
Candidates::<T, I>::insert(
&candidate,
Candidacy { round: 0, kind, tally, skeptic_struck: false, bid: value },
);
}
// Migrate Members from old::Members old::Strikes old::Vouching
let mut member_count = 0;
for member in v0::Members::<T, I>::take() {
let strikes = v0::Strikes::<T, I>::take(&member);
let vouching = v0::Vouching::<T, I>::take(&member);
let record = MemberRecord { index: member_count, rank: 0, strikes, vouching };
Members::<T, I>::insert(&member, record);
MemberByIndex::<T, I>::insert(member_count, &member);
// The founder must be the first member in Society V2. If we find the founder not in index
// zero, we swap it with the first member.
if member == Founder::<T, I>::get().defensive_ok_or("founder must always be set")? &&
member_count > 0
{
let member_to_swap = MemberByIndex::<T, I>::get(0)
.defensive_ok_or("member_count > 0, we must have at least 1 member")?;
// Swap the founder with the first member in MemberByIndex.
MemberByIndex::<T, I>::swap(0, member_count);
// Update the indices of the swapped member MemberRecords.
Members::<T, I>::mutate(&member, |m| {
if let Some(member) = m {
member.index = 0;
} else {
pezframe_support::defensive!(
"Member somehow disappeared from storage after it was inserted"
);
}
});
Members::<T, I>::mutate(&member_to_swap, |m| {
if let Some(member) = m {
member.index = member_count;
} else {
pezframe_support::defensive!(
"Member somehow disappeared from storage after it was queried"
);
}
});
}
member_count.saturating_inc();
}
MemberCount::<T, I>::put(member_count);
// Migrate Payouts from: old::Payouts and raw info (needed since we can't query old chain
// state).
past_payouts.sort();
for (who, mut payouts) in v0::Payouts::<T, I>::iter() {
payouts.truncate(T::MaxPayouts::get() as usize);
// ^^ Safe since we already truncated.
let paid = past_payouts
.binary_search_by_key(&&who, |x| &x.0)
.ok()
.map(|p| past_payouts[p].1)
.unwrap_or(Zero::zero());
match BoundedVec::try_from(payouts) {
Ok(payouts) => Payouts::<T, I>::insert(who, PayoutRecord { paid, payouts }),
Err(_) => debug_assert!(false, "Truncation of Payouts ineffective??"),
}
}
// Migrate SuspendedMembers from old::SuspendedMembers old::Strikes old::Vouching.
for who in v0::SuspendedMembers::<T, I>::iter_keys() {
let strikes = v0::Strikes::<T, I>::take(&who);
let vouching = v0::Vouching::<T, I>::take(&who);
let record = MemberRecord { index: 0, rank: 0, strikes, vouching };
SuspendedMembers::<T, I>::insert(&who, record);
}
// Any suspended candidates remaining are rejected.
let _ = v0::SuspendedCandidates::<T, I>::clear(u32::MAX, None);
// We give the current defender the benefit of the doubt.
v0::Defender::<T, I>::kill();
let _ = v0::DefenderVotes::<T, I>::clear(u32::MAX, None);
Ok(T::BlockWeights::get().max_block)
}
pub fn from_raw_past_payouts<T: Config<I>, I: Instance + 'static>(
past_payouts_raw: impl Iterator<Item = ([u8; 32], u128)>,
) -> Vec<(<T as pezframe_system::Config>::AccountId, BalanceOf<T, I>)> {
past_payouts_raw
.filter_map(|(x, y)| Some((Decode::decode(&mut &x[..]).ok()?, y.try_into().ok()?)))
.collect()
}
+267
View File
@@ -0,0 +1,267 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Test utilities
use super::*;
use crate as pezpallet_society;
use pezframe_support::{
assert_noop, assert_ok, derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU32, ConstU64},
};
use pezframe_support_test::TestRandomness;
use pezframe_system::EnsureSignedBy;
use pezsp_runtime::{traits::IdentityLookup, BuildStorage};
use RuntimeOrigin as Origin;
type Block = pezframe_system::mocking::MockBlock<Test>;
pezframe_support::construct_runtime!(
pub enum Test
{
System: pezframe_system,
Balances: pezpallet_balances,
Society: pezpallet_society,
}
);
parameter_types! {
pub const SocietyPalletId: PalletId = PalletId(*b"py/socie");
}
ord_parameter_types! {
pub const ChallengePeriod: u64 = 8;
pub const ClaimPeriod: u64 = 1;
pub const VotingPeriod: u64 = 3;
pub const FounderSetAccount: u128 = 1;
pub const SuspensionJudgementSetAccount: u128 = 2;
pub const MaxPayouts: u32 = 10;
pub const MaxBids: u32 = 10;
}
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Test {
type AccountId = u128;
type Block = Block;
type AccountData = pezpallet_balances::AccountData<u64>;
type Lookup = IdentityLookup<Self::AccountId>;
}
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type AccountStore = System;
}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type PalletId = SocietyPalletId;
type Currency = pezpallet_balances::Pallet<Self>;
type Randomness = TestRandomness<Self>;
type GraceStrikes = ConstU32<1>;
type PeriodSpend = ConstU64<1000>;
type VotingPeriod = VotingPeriod;
type ClaimPeriod = ClaimPeriod;
type MaxLockDuration = ConstU64<100>;
type FounderSetOrigin = EnsureSignedBy<FounderSetAccount, u128>;
type ChallengePeriod = ChallengePeriod;
type MaxPayouts = MaxPayouts;
type MaxBids = MaxBids;
type WeightInfo = ();
type BlockNumberProvider = System;
}
pub struct EnvBuilder {
balance: u64,
balances: Vec<(u128, u64)>,
pot: u64,
founded: bool,
}
impl EnvBuilder {
pub fn new() -> Self {
Self {
balance: 10_000,
balances: vec![
(10, 50),
(20, 50),
(30, 50),
(40, 50),
(50, 50),
(60, 50),
(70, 50),
(80, 50),
(90, 50),
],
pot: 0,
founded: true,
}
}
pub fn execute<R, F: FnOnce() -> R>(mut self, f: F) -> R {
let mut t = pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
self.balances.push((Society::account_id(), self.balance.max(self.pot)));
pezpallet_balances::GenesisConfig::<Test> { balances: self.balances, ..Default::default() }
.assimilate_storage(&mut t)
.unwrap();
pezpallet_society::GenesisConfig::<Test> { pot: self.pot }
.assimilate_storage(&mut t)
.unwrap();
let mut ext: pezsp_io::TestExternalities = t.into();
ext.execute_with(|| {
// Initialize the block number to 1 for event registration
System::set_block_number(1);
if self.founded {
let r = b"be cool".to_vec();
assert!(Society::found_society(Origin::signed(1), 10, 10, 8, 2, 25, r).is_ok());
}
let r = f();
migrations::assert_internal_consistency::<Test, ()>();
r
})
}
pub fn founded(mut self, f: bool) -> Self {
self.founded = f;
self
}
}
/// Creates a bid struct using input parameters.
pub fn bid<AccountId, Balance>(
who: AccountId,
kind: BidKind<AccountId, Balance>,
value: Balance,
) -> Bid<AccountId, Balance> {
Bid { who, kind, value }
}
/// Creates a candidate struct using input parameters.
pub fn candidacy<AccountId, Balance>(
round: RoundIndex,
bid: Balance,
kind: BidKind<AccountId, Balance>,
approvals: VoteCount,
rejections: VoteCount,
) -> Candidacy<AccountId, Balance> {
Candidacy { round, kind, bid, tally: Tally { approvals, rejections }, skeptic_struck: false }
}
pub fn next_challenge() {
let challenge_period: u64 = <Test as Config>::ChallengePeriod::get();
let now = System::block_number();
System::run_to_block::<AllPalletsWithSystem>(now + challenge_period - now % challenge_period);
}
pub fn next_voting() {
if let Period::Voting { more, .. } = Society::period() {
System::run_to_block::<AllPalletsWithSystem>(System::block_number() + more);
}
}
pub fn conclude_intake(allow_resignation: bool, judge_intake: Option<bool>) {
next_voting();
let round = RoundCount::<Test>::get();
for (who, candidacy) in Candidates::<Test>::iter() {
if candidacy.tally.clear_approval() {
assert_ok!(Society::claim_membership(Origin::signed(who)));
assert_noop!(
Society::claim_membership(Origin::signed(who)),
Error::<Test>::NotCandidate
);
continue;
}
if candidacy.tally.clear_rejection() && allow_resignation {
assert_noop!(
Society::claim_membership(Origin::signed(who)),
Error::<Test>::NotApproved
);
assert_ok!(Society::resign_candidacy(Origin::signed(who)));
continue;
}
if let (Some(founder), Some(approve)) = (Founder::<Test>::get(), judge_intake) {
if !candidacy.tally.clear_approval() && !approve {
// can be rejected by founder
assert_ok!(Society::kick_candidate(Origin::signed(founder), who));
continue;
}
if !candidacy.tally.clear_rejection() && approve {
// can be rejected by founder
assert_ok!(Society::bestow_membership(Origin::signed(founder), who));
continue;
}
}
if candidacy.tally.clear_rejection() && round > candidacy.round + 1 {
assert_noop!(
Society::claim_membership(Origin::signed(who)),
Error::<Test>::NotApproved
);
assert_ok!(Society::drop_candidate(Origin::signed(0), who));
assert_noop!(
Society::drop_candidate(Origin::signed(0), who),
Error::<Test>::NotCandidate
);
continue;
}
if !candidacy.skeptic_struck {
assert_ok!(Society::punish_skeptic(Origin::signed(who)));
}
}
}
pub fn next_intake() {
let claim_period: u64 = <Test as Config>::ClaimPeriod::get();
match Society::period() {
Period::Voting { more, .. } => System::run_to_block::<AllPalletsWithSystem>(
System::block_number() + more + claim_period,
),
Period::Claim { more, .. } =>
System::run_to_block::<AllPalletsWithSystem>(System::block_number() + more),
Period::Intake { .. } => {},
}
}
pub fn place_members(members: impl AsRef<[u128]>) {
for who in members.as_ref() {
assert_ok!(Society::insert_member(who, 0));
}
}
pub fn members() -> Vec<u128> {
let mut r = Members::<Test>::iter_keys().collect::<Vec<_>>();
r.sort();
r
}
pub fn membership() -> Vec<(u128, MemberRecord)> {
let mut r = Members::<Test>::iter().collect::<Vec<_>>();
r.sort_by_key(|x| x.0);
r
}
pub fn candidacies() -> Vec<(u128, Candidacy<u128, u64>)> {
let mut r = Candidates::<Test>::iter().collect::<Vec<_>>();
r.sort_by_key(|x| x.0);
r
}
pub fn candidates() -> Vec<u128> {
let mut r = Candidates::<Test>::iter_keys().collect::<Vec<_>>();
r.sort();
r
}
File diff suppressed because it is too large Load Diff
+858
View File
@@ -0,0 +1,858 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Autogenerated weights for `pezpallet_society`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-03-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `0848bec9fe49`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024`
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --extrinsic=*
// --runtime=target/production/wbuild/kitchensink-runtime/kitchensink_runtime.wasm
// --pallet=pezpallet_society
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/society/src/weights.rs
// --wasm-execution=compiled
// --steps=50
// --repeat=20
// --heap-pages=4096
// --template=bizinikiwi/.maintain/frame-weight-template.hbs
// --no-storage-info
// --no-min-squares
// --no-median-slopes
// --exclude-pallets=pezpallet_xcm,pezpallet_xcm_benchmarks::fungible,pezpallet_xcm_benchmarks::generic,pezpallet_nomination_pools,pezpallet_remark,pezpallet_transaction_storage,pezpallet_election_provider_multi_block,pezpallet_election_provider_multi_block::signed,pezpallet_election_provider_multi_block::unsigned,pezpallet_election_provider_multi_block::verifier
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
#![allow(dead_code)]
use pezframe_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::marker::PhantomData;
/// Weight functions needed for `pezpallet_society`.
pub trait WeightInfo {
fn bid() -> Weight;
fn unbid() -> Weight;
fn vouch() -> Weight;
fn unvouch() -> Weight;
fn vote() -> Weight;
fn defender_vote() -> Weight;
fn payout() -> Weight;
fn waive_repay() -> Weight;
fn found_society() -> Weight;
fn dissolve() -> Weight;
fn judge_suspended_member() -> Weight;
fn set_parameters() -> Weight;
fn punish_skeptic() -> Weight;
fn claim_membership() -> Weight;
fn bestow_membership() -> Weight;
fn kick_candidate() -> Weight;
fn resign_candidacy() -> Weight;
fn drop_candidate() -> Weight;
fn cleanup_candidacy() -> Weight;
fn cleanup_challenge() -> Weight;
fn poke_deposit() -> Weight;
}
/// Weights for `pezpallet_society` using the Bizinikiwi node and recommended hardware.
pub struct BizinikiwiWeight<T>(PhantomData<T>);
impl<T: pezframe_system::Config> WeightInfo for BizinikiwiWeight<T> {
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:0)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::SuspendedMembers` (r:1 w:0)
/// Proof: `Society::SuspendedMembers` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn bid() -> Weight {
// Proof Size summary in bytes:
// Measured: `444`
// Estimated: `3591`
// Minimum execution time: 37_702_000 picoseconds.
Weight::from_parts(38_951_000, 3591)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
fn unbid() -> Weight {
// Proof Size summary in bytes:
// Measured: `461`
// Estimated: `2456`
// Minimum execution time: 28_427_000 picoseconds.
Weight::from_parts(29_573_000, 2456)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:0)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:2 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::SuspendedMembers` (r:1 w:0)
/// Proof: `Society::SuspendedMembers` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn vouch() -> Weight {
// Proof Size summary in bytes:
// Measured: `481`
// Estimated: `6048`
// Minimum execution time: 28_040_000 picoseconds.
Weight::from_parts(29_063_000, 6048)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn unvouch() -> Weight {
// Proof Size summary in bytes:
// Measured: `535`
// Estimated: `3519`
// Minimum execution time: 20_480_000 picoseconds.
Weight::from_parts(23_171_000, 3519)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:1 w:1)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
fn vote() -> Weight {
// Proof Size summary in bytes:
// Measured: `569`
// Estimated: `3591`
// Minimum execution time: 27_478_000 picoseconds.
Weight::from_parts(28_524_000, 3591)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Defending` (r:1 w:1)
/// Proof: `Society::Defending` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::ChallengeRoundCount` (r:1 w:0)
/// Proof: `Society::ChallengeRoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::DefenderVotes` (r:1 w:1)
/// Proof: `Society::DefenderVotes` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn defender_vote() -> Weight {
// Proof Size summary in bytes:
// Measured: `561`
// Estimated: `3522`
// Minimum execution time: 24_458_000 picoseconds.
Weight::from_parts(25_690_000, 3522)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Payouts` (r:1 w:1)
/// Proof: `Society::Payouts` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn payout() -> Weight {
// Proof Size summary in bytes:
// Measured: `687`
// Estimated: `3722`
// Minimum execution time: 56_406_000 picoseconds.
Weight::from_parts(65_030_000, 3722)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Members` (r:1 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Payouts` (r:1 w:1)
/// Proof: `Society::Payouts` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
fn waive_repay() -> Weight {
// Proof Size summary in bytes:
// Measured: `547`
// Estimated: `3722`
// Minimum execution time: 24_846_000 picoseconds.
Weight::from_parts(25_812_000, 3722)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Head` (r:1 w:1)
/// Proof: `Society::Head` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:0 w:1)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Founder` (r:0 w:1)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Rules` (r:0 w:1)
/// Proof: `Society::Rules` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:0 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:0 w:1)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn found_society() -> Weight {
// Proof Size summary in bytes:
// Measured: `180`
// Estimated: `1517`
// Minimum execution time: 15_931_000 picoseconds.
Weight::from_parts(16_622_000, 1517)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
/// Storage: `Society::Founder` (r:1 w:1)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:5 w:5)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:5 w:5)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:4 w:4)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:4 w:4)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Head` (r:0 w:1)
/// Proof: `Society::Head` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Defending` (r:0 w:1)
/// Proof: `Society::Defending` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`)
/// Storage: `Society::ChallengeRoundCount` (r:0 w:1)
/// Proof: `Society::ChallengeRoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Skeptic` (r:0 w:1)
/// Proof: `Society::Skeptic` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Pot` (r:0 w:1)
/// Proof: `Society::Pot` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Society::Rules` (r:0 w:1)
/// Proof: `Society::Rules` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:0 w:1)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Bids` (r:0 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:0 w:1)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
/// Storage: `Society::NextHead` (r:0 w:1)
/// Proof: `Society::NextHead` (`max_values`: Some(1), `max_size`: Some(52), added: 547, mode: `MaxEncodedLen`)
fn dissolve() -> Weight {
// Proof Size summary in bytes:
// Measured: `1654`
// Estimated: `13635`
// Minimum execution time: 65_898_000 picoseconds.
Weight::from_parts(69_842_000, 13635)
.saturating_add(T::DbWeight::get().reads(20_u64))
.saturating_add(T::DbWeight::get().writes(30_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::SuspendedMembers` (r:1 w:1)
/// Proof: `Society::SuspendedMembers` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Payouts` (r:1 w:0)
/// Proof: `Society::Payouts` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
/// Storage: `Society::Pot` (r:1 w:1)
/// Proof: `Society::Pot` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn judge_suspended_member() -> Weight {
// Proof Size summary in bytes:
// Measured: `505`
// Estimated: `3722`
// Minimum execution time: 25_659_000 picoseconds.
Weight::from_parts(26_456_000, 3722)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:0)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:0 w:1)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn set_parameters() -> Weight {
// Proof Size summary in bytes:
// Measured: `387`
// Estimated: `1517`
// Minimum execution time: 12_063_000 picoseconds.
Weight::from_parts(13_035_000, 1517)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Skeptic` (r:1 w:0)
/// Proof: `Society::Skeptic` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:1 w:0)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn punish_skeptic() -> Weight {
// Proof Size summary in bytes:
// Measured: `636`
// Estimated: `3591`
// Minimum execution time: 29_789_000 picoseconds.
Weight::from_parts(30_860_000, 3591)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::NextHead` (r:1 w:1)
/// Proof: `Society::NextHead` (`max_values`: Some(1), `max_size`: Some(52), added: 547, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:0 w:1)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:0 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn claim_membership() -> Weight {
// Proof Size summary in bytes:
// Measured: `632`
// Estimated: `3593`
// Minimum execution time: 43_192_000 picoseconds.
Weight::from_parts(44_463_000, 3593)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::NextHead` (r:1 w:1)
/// Proof: `Society::NextHead` (`max_values`: Some(1), `max_size`: Some(52), added: 547, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:0 w:1)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:0 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn bestow_membership() -> Weight {
// Proof Size summary in bytes:
// Measured: `650`
// Estimated: `3593`
// Minimum execution time: 44_050_000 picoseconds.
Weight::from_parts(46_458_000, 3593)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn kick_candidate() -> Weight {
// Proof Size summary in bytes:
// Measured: `776`
// Estimated: `6196`
// Minimum execution time: 45_018_000 picoseconds.
Weight::from_parts(46_785_000, 6196)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn resign_candidacy() -> Weight {
// Proof Size summary in bytes:
// Measured: `746`
// Estimated: `6196`
// Minimum execution time: 42_297_000 picoseconds.
Weight::from_parts(43_475_000, 6196)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn drop_candidate() -> Weight {
// Proof Size summary in bytes:
// Measured: `758`
// Estimated: `6196`
// Minimum execution time: 42_533_000 picoseconds.
Weight::from_parts(44_355_000, 6196)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `Society::Candidates` (r:1 w:0)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::VoteClearCursor` (r:1 w:0)
/// Proof: `Society::VoteClearCursor` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:2 w:2)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
fn cleanup_candidacy() -> Weight {
// Proof Size summary in bytes:
// Measured: `552`
// Estimated: `6110`
// Minimum execution time: 20_326_000 picoseconds.
Weight::from_parts(21_079_000, 6110)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Society::ChallengeRoundCount` (r:1 w:0)
/// Proof: `Society::ChallengeRoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::DefenderVotes` (r:1 w:1)
/// Proof: `Society::DefenderVotes` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn cleanup_challenge() -> Weight {
// Proof Size summary in bytes:
// Measured: `510`
// Estimated: `3522`
// Minimum execution time: 13_993_000 picoseconds.
Weight::from_parts(14_622_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn poke_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `475`
// Estimated: `2456`
// Minimum execution time: 30_463_000 picoseconds.
Weight::from_parts(31_422_000, 2456)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
// For backwards compatibility and tests.
impl WeightInfo for () {
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:0)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::SuspendedMembers` (r:1 w:0)
/// Proof: `Society::SuspendedMembers` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn bid() -> Weight {
// Proof Size summary in bytes:
// Measured: `444`
// Estimated: `3591`
// Minimum execution time: 37_702_000 picoseconds.
Weight::from_parts(38_951_000, 3591)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
fn unbid() -> Weight {
// Proof Size summary in bytes:
// Measured: `461`
// Estimated: `2456`
// Minimum execution time: 28_427_000 picoseconds.
Weight::from_parts(29_573_000, 2456)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:0)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:2 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::SuspendedMembers` (r:1 w:0)
/// Proof: `Society::SuspendedMembers` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn vouch() -> Weight {
// Proof Size summary in bytes:
// Measured: `481`
// Estimated: `6048`
// Minimum execution time: 28_040_000 picoseconds.
Weight::from_parts(29_063_000, 6048)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn unvouch() -> Weight {
// Proof Size summary in bytes:
// Measured: `535`
// Estimated: `3519`
// Minimum execution time: 20_480_000 picoseconds.
Weight::from_parts(23_171_000, 3519)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:1 w:1)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
fn vote() -> Weight {
// Proof Size summary in bytes:
// Measured: `569`
// Estimated: `3591`
// Minimum execution time: 27_478_000 picoseconds.
Weight::from_parts(28_524_000, 3591)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Defending` (r:1 w:1)
/// Proof: `Society::Defending` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::ChallengeRoundCount` (r:1 w:0)
/// Proof: `Society::ChallengeRoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::DefenderVotes` (r:1 w:1)
/// Proof: `Society::DefenderVotes` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn defender_vote() -> Weight {
// Proof Size summary in bytes:
// Measured: `561`
// Estimated: `3522`
// Minimum execution time: 24_458_000 picoseconds.
Weight::from_parts(25_690_000, 3522)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Members` (r:1 w:0)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Payouts` (r:1 w:1)
/// Proof: `Society::Payouts` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn payout() -> Weight {
// Proof Size summary in bytes:
// Measured: `687`
// Estimated: `3722`
// Minimum execution time: 56_406_000 picoseconds.
Weight::from_parts(65_030_000, 3722)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Members` (r:1 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Payouts` (r:1 w:1)
/// Proof: `Society::Payouts` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
fn waive_repay() -> Weight {
// Proof Size summary in bytes:
// Measured: `547`
// Estimated: `3722`
// Minimum execution time: 24_846_000 picoseconds.
Weight::from_parts(25_812_000, 3722)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Head` (r:1 w:1)
/// Proof: `Society::Head` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:0 w:1)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Founder` (r:0 w:1)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Rules` (r:0 w:1)
/// Proof: `Society::Rules` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:0 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:0 w:1)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn found_society() -> Weight {
// Proof Size summary in bytes:
// Measured: `180`
// Estimated: `1517`
// Minimum execution time: 15_931_000 picoseconds.
Weight::from_parts(16_622_000, 1517)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
/// Storage: `Society::Founder` (r:1 w:1)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:5 w:5)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:5 w:5)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:4 w:4)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:4 w:4)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::Head` (r:0 w:1)
/// Proof: `Society::Head` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Defending` (r:0 w:1)
/// Proof: `Society::Defending` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`)
/// Storage: `Society::ChallengeRoundCount` (r:0 w:1)
/// Proof: `Society::ChallengeRoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Skeptic` (r:0 w:1)
/// Proof: `Society::Skeptic` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Pot` (r:0 w:1)
/// Proof: `Society::Pot` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Society::Rules` (r:0 w:1)
/// Proof: `Society::Rules` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:0 w:1)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Bids` (r:0 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:0 w:1)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
/// Storage: `Society::NextHead` (r:0 w:1)
/// Proof: `Society::NextHead` (`max_values`: Some(1), `max_size`: Some(52), added: 547, mode: `MaxEncodedLen`)
fn dissolve() -> Weight {
// Proof Size summary in bytes:
// Measured: `1654`
// Estimated: `13635`
// Minimum execution time: 65_898_000 picoseconds.
Weight::from_parts(69_842_000, 13635)
.saturating_add(RocksDbWeight::get().reads(20_u64))
.saturating_add(RocksDbWeight::get().writes(30_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::SuspendedMembers` (r:1 w:1)
/// Proof: `Society::SuspendedMembers` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Payouts` (r:1 w:0)
/// Proof: `Society::Payouts` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
/// Storage: `Society::Pot` (r:1 w:1)
/// Proof: `Society::Pot` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn judge_suspended_member() -> Weight {
// Proof Size summary in bytes:
// Measured: `505`
// Estimated: `3722`
// Minimum execution time: 25_659_000 picoseconds.
Weight::from_parts(26_456_000, 3722)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:0)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:0 w:1)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn set_parameters() -> Weight {
// Proof Size summary in bytes:
// Measured: `387`
// Estimated: `1517`
// Minimum execution time: 12_063_000 picoseconds.
Weight::from_parts(13_035_000, 1517)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Skeptic` (r:1 w:0)
/// Proof: `Society::Skeptic` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:1 w:0)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:1 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn punish_skeptic() -> Weight {
// Proof Size summary in bytes:
// Measured: `636`
// Estimated: `3591`
// Minimum execution time: 29_789_000 picoseconds.
Weight::from_parts(30_860_000, 3591)
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::NextHead` (r:1 w:1)
/// Proof: `Society::NextHead` (`max_values`: Some(1), `max_size`: Some(52), added: 547, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:0 w:1)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:0 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn claim_membership() -> Weight {
// Proof Size summary in bytes:
// Measured: `632`
// Estimated: `3593`
// Minimum execution time: 43_192_000 picoseconds.
Weight::from_parts(44_463_000, 3593)
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberCount` (r:1 w:1)
/// Proof: `Society::MemberCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::NextHead` (r:1 w:1)
/// Proof: `Society::NextHead` (`max_values`: Some(1), `max_size`: Some(52), added: 547, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Society::MemberByIndex` (r:0 w:1)
/// Proof: `Society::MemberByIndex` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `Society::Members` (r:0 w:1)
/// Proof: `Society::Members` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn bestow_membership() -> Weight {
// Proof Size summary in bytes:
// Measured: `650`
// Estimated: `3593`
// Minimum execution time: 44_050_000 picoseconds.
Weight::from_parts(46_458_000, 3593)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
/// Storage: `Society::Founder` (r:1 w:0)
/// Proof: `Society::Founder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn kick_candidate() -> Weight {
// Proof Size summary in bytes:
// Measured: `776`
// Estimated: `6196`
// Minimum execution time: 45_018_000 picoseconds.
Weight::from_parts(46_785_000, 6196)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn resign_candidacy() -> Weight {
// Proof Size summary in bytes:
// Measured: `746`
// Estimated: `6196`
// Minimum execution time: 42_297_000 picoseconds.
Weight::from_parts(43_475_000, 6196)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: `Society::Candidates` (r:1 w:1)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::RoundCount` (r:1 w:0)
/// Proof: `Society::RoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn drop_candidate() -> Weight {
// Proof Size summary in bytes:
// Measured: `758`
// Estimated: `6196`
// Minimum execution time: 42_533_000 picoseconds.
Weight::from_parts(44_355_000, 6196)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: `Society::Candidates` (r:1 w:0)
/// Proof: `Society::Candidates` (`max_values`: None, `max_size`: Some(126), added: 2601, mode: `MaxEncodedLen`)
/// Storage: `Society::VoteClearCursor` (r:1 w:0)
/// Proof: `Society::VoteClearCursor` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
/// Storage: `Society::Votes` (r:2 w:2)
/// Proof: `Society::Votes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
fn cleanup_candidacy() -> Weight {
// Proof Size summary in bytes:
// Measured: `552`
// Estimated: `6110`
// Minimum execution time: 20_326_000 picoseconds.
Weight::from_parts(21_079_000, 6110)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Society::ChallengeRoundCount` (r:1 w:0)
/// Proof: `Society::ChallengeRoundCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Society::DefenderVotes` (r:1 w:1)
/// Proof: `Society::DefenderVotes` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn cleanup_challenge() -> Weight {
// Proof Size summary in bytes:
// Measured: `510`
// Estimated: `3522`
// Minimum execution time: 13_993_000 picoseconds.
Weight::from_parts(14_622_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Society::Bids` (r:1 w:1)
/// Proof: `Society::Bids` (`max_values`: Some(1), `max_size`: Some(971), added: 1466, mode: `MaxEncodedLen`)
/// Storage: `Society::Parameters` (r:1 w:0)
/// Proof: `Society::Parameters` (`max_values`: Some(1), `max_size`: Some(28), added: 523, mode: `MaxEncodedLen`)
fn poke_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `475`
// Estimated: `2456`
// Minimum execution time: 30_463_000 picoseconds.
Weight::from_parts(31_422_000, 2456)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}