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:
@@ -0,0 +1,369 @@
|
||||
// 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.
|
||||
|
||||
//! Treasury pallet benchmarking.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use super::{Pallet as Treasury, *};
|
||||
|
||||
use pezframe_benchmarking::{
|
||||
v1::{account, BenchmarkError},
|
||||
v2::*,
|
||||
};
|
||||
use pezframe_support::{
|
||||
assert_err, assert_ok, ensure,
|
||||
traits::{
|
||||
tokens::{ConversionFromAssetBalance, PaymentStatus},
|
||||
EnsureOrigin, OnInitialize,
|
||||
},
|
||||
};
|
||||
use pezframe_system::RawOrigin;
|
||||
use pezsp_core::crypto::FromEntropy;
|
||||
|
||||
/// Trait describing factory functions for dispatchables' parameters.
|
||||
pub trait ArgumentsFactory<AssetKind, Beneficiary> {
|
||||
/// Factory function for an asset kind.
|
||||
fn create_asset_kind(seed: u32) -> AssetKind;
|
||||
/// Factory function for a beneficiary.
|
||||
fn create_beneficiary(seed: [u8; 32]) -> Beneficiary;
|
||||
}
|
||||
|
||||
/// Implementation that expects the parameters implement the [`FromEntropy`] trait.
|
||||
impl<AssetKind, Beneficiary> ArgumentsFactory<AssetKind, Beneficiary> for ()
|
||||
where
|
||||
AssetKind: FromEntropy,
|
||||
Beneficiary: FromEntropy,
|
||||
{
|
||||
fn create_asset_kind(seed: u32) -> AssetKind {
|
||||
AssetKind::from_entropy(&mut seed.encode().as_slice()).unwrap()
|
||||
}
|
||||
fn create_beneficiary(seed: [u8; 32]) -> Beneficiary {
|
||||
Beneficiary::from_entropy(&mut seed.as_slice()).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
const SEED: u32 = 0;
|
||||
|
||||
// Create the pre-requisite information needed to create a treasury `spend_local`.
|
||||
fn setup_proposal<T: Config<I>, I: 'static>(
|
||||
u: u32,
|
||||
) -> (T::AccountId, BalanceOf<T, I>, AccountIdLookupOf<T>) {
|
||||
let caller = account("caller", u, SEED);
|
||||
let value: BalanceOf<T, I> = T::Currency::minimum_balance() * 100u32.into();
|
||||
let _ = T::Currency::make_free_balance_be(&caller, value);
|
||||
let beneficiary = account("beneficiary", u, SEED);
|
||||
let beneficiary_lookup = T::Lookup::unlookup(beneficiary);
|
||||
(caller, value, beneficiary_lookup)
|
||||
}
|
||||
|
||||
// Create proposals that are approved for use in `on_initialize`.
|
||||
fn create_approved_proposals<T: Config<I>, I: 'static>(n: u32) -> Result<(), &'static str> {
|
||||
let spender = T::SpendOrigin::try_successful_origin();
|
||||
|
||||
for i in 0..n {
|
||||
let (_, value, lookup) = setup_proposal::<T, I>(i);
|
||||
|
||||
#[allow(deprecated)]
|
||||
if let Ok(origin) = &spender {
|
||||
Treasury::<T, I>::spend_local(origin.clone(), value, lookup)?;
|
||||
}
|
||||
}
|
||||
|
||||
if spender.is_ok() {
|
||||
ensure!(Approvals::<T, I>::get().len() == n as usize, "Not all approved");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn setup_pot_account<T: Config<I>, I: 'static>() {
|
||||
let pot_account = Treasury::<T, I>::account_id();
|
||||
let value = T::Currency::minimum_balance().saturating_mul(1_000_000_000u32.into());
|
||||
let _ = T::Currency::make_free_balance_be(&pot_account, value);
|
||||
}
|
||||
|
||||
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
|
||||
pezframe_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
// Create the arguments for the `spend` dispatchable.
|
||||
fn create_spend_arguments<T: Config<I>, I: 'static>(
|
||||
seed: u32,
|
||||
) -> (T::AssetKind, AssetBalanceOf<T, I>, T::Beneficiary, BeneficiaryLookupOf<T, I>) {
|
||||
let asset_kind = T::BenchmarkHelper::create_asset_kind(seed);
|
||||
let beneficiary = T::BenchmarkHelper::create_beneficiary([seed.try_into().unwrap(); 32]);
|
||||
let beneficiary_lookup = T::BeneficiaryLookup::unlookup(beneficiary.clone());
|
||||
(asset_kind, 100u32.into(), beneficiary, beneficiary_lookup)
|
||||
}
|
||||
|
||||
#[instance_benchmarks]
|
||||
mod benchmarks {
|
||||
use super::*;
|
||||
|
||||
/// This benchmark is short-circuited if `SpendOrigin` cannot provide
|
||||
/// a successful origin, in which case `spend` is un-callable and can use weight=0.
|
||||
#[benchmark]
|
||||
fn spend_local() -> Result<(), BenchmarkError> {
|
||||
let (_, value, beneficiary_lookup) = setup_proposal::<T, _>(SEED);
|
||||
let origin =
|
||||
T::SpendOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let beneficiary = T::Lookup::lookup(beneficiary_lookup.clone()).unwrap();
|
||||
|
||||
#[extrinsic_call]
|
||||
_(origin as T::RuntimeOrigin, value, beneficiary_lookup);
|
||||
|
||||
assert_last_event::<T, I>(
|
||||
Event::SpendApproved { proposal_index: 0, amount: value, beneficiary }.into(),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn remove_approval() -> Result<(), BenchmarkError> {
|
||||
let (spend_exists, proposal_id) =
|
||||
if let Ok(origin) = T::SpendOrigin::try_successful_origin() {
|
||||
let (_, value, beneficiary_lookup) = setup_proposal::<T, _>(SEED);
|
||||
#[allow(deprecated)]
|
||||
Treasury::<T, _>::spend_local(origin, value, beneficiary_lookup)?;
|
||||
let proposal_id = ProposalCount::<T, _>::get() - 1;
|
||||
|
||||
(true, proposal_id)
|
||||
} else {
|
||||
(false, 0)
|
||||
};
|
||||
|
||||
let reject_origin =
|
||||
T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
|
||||
#[block]
|
||||
{
|
||||
#[allow(deprecated)]
|
||||
let res = Treasury::<T, _>::remove_approval(reject_origin as T::RuntimeOrigin, proposal_id);
|
||||
|
||||
if spend_exists {
|
||||
assert_ok!(res);
|
||||
} else {
|
||||
assert_err!(res, Error::<T, _>::ProposalNotApproved);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn on_initialize_proposals(
|
||||
p: Linear<0, { T::MaxApprovals::get() - 1 }>,
|
||||
) -> Result<(), BenchmarkError> {
|
||||
setup_pot_account::<T, _>();
|
||||
create_approved_proposals::<T, _>(p)?;
|
||||
|
||||
#[block]
|
||||
{
|
||||
Treasury::<T, _>::on_initialize(0u32.into());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// This benchmark is short-circuited if `SpendOrigin` cannot provide
|
||||
/// a successful origin, in which case `spend` is un-callable and can use weight=0.
|
||||
#[benchmark]
|
||||
fn spend() -> Result<(), BenchmarkError> {
|
||||
let origin =
|
||||
T::SpendOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let (asset_kind, amount, beneficiary, beneficiary_lookup) =
|
||||
create_spend_arguments::<T, _>(SEED);
|
||||
T::BalanceConverter::ensure_successful(asset_kind.clone());
|
||||
|
||||
#[extrinsic_call]
|
||||
_(
|
||||
origin as T::RuntimeOrigin,
|
||||
Box::new(asset_kind.clone()),
|
||||
amount,
|
||||
Box::new(beneficiary_lookup),
|
||||
None,
|
||||
);
|
||||
|
||||
let valid_from = T::BlockNumberProvider::current_block_number();
|
||||
let expire_at = valid_from.saturating_add(T::PayoutPeriod::get());
|
||||
assert_last_event::<T, I>(
|
||||
Event::AssetSpendApproved {
|
||||
index: 0,
|
||||
asset_kind,
|
||||
amount,
|
||||
beneficiary,
|
||||
valid_from,
|
||||
expire_at,
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn payout() -> Result<(), BenchmarkError> {
|
||||
let (asset_kind, amount, beneficiary, beneficiary_lookup) =
|
||||
create_spend_arguments::<T, _>(SEED);
|
||||
T::BalanceConverter::ensure_successful(asset_kind.clone());
|
||||
|
||||
let spend_exists = if let Ok(origin) = T::SpendOrigin::try_successful_origin() {
|
||||
Treasury::<T, _>::spend(
|
||||
origin,
|
||||
Box::new(asset_kind.clone()),
|
||||
amount,
|
||||
Box::new(beneficiary_lookup),
|
||||
None,
|
||||
)?;
|
||||
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
T::Paymaster::ensure_successful(&beneficiary, asset_kind, amount);
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
|
||||
#[block]
|
||||
{
|
||||
let res = Treasury::<T, _>::payout(RawOrigin::Signed(caller.clone()).into(), 0u32);
|
||||
|
||||
if spend_exists {
|
||||
assert_ok!(res);
|
||||
} else {
|
||||
assert_err!(res, crate::Error::<T, _>::InvalidIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if spend_exists {
|
||||
let id = match Spends::<T, I>::get(0).unwrap().status {
|
||||
PaymentState::Attempted { id, .. } => {
|
||||
assert_ne!(T::Paymaster::check_payment(id), PaymentStatus::Failure);
|
||||
id
|
||||
},
|
||||
_ => panic!("No payout attempt made"),
|
||||
};
|
||||
assert_last_event::<T, I>(Event::Paid { index: 0, payment_id: id }.into());
|
||||
assert!(Treasury::<T, _>::payout(RawOrigin::Signed(caller).into(), 0u32).is_err());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn check_status() -> Result<(), BenchmarkError> {
|
||||
let (asset_kind, amount, beneficiary, beneficiary_lookup) =
|
||||
create_spend_arguments::<T, _>(SEED);
|
||||
|
||||
T::BalanceConverter::ensure_successful(asset_kind.clone());
|
||||
T::Paymaster::ensure_successful(&beneficiary, asset_kind.clone(), amount);
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
|
||||
let spend_exists = if let Ok(origin) = T::SpendOrigin::try_successful_origin() {
|
||||
Treasury::<T, _>::spend(
|
||||
origin,
|
||||
Box::new(asset_kind),
|
||||
amount,
|
||||
Box::new(beneficiary_lookup),
|
||||
None,
|
||||
)?;
|
||||
|
||||
Treasury::<T, _>::payout(RawOrigin::Signed(caller.clone()).into(), 0u32)?;
|
||||
match Spends::<T, I>::get(0).unwrap().status {
|
||||
PaymentState::Attempted { id, .. } => {
|
||||
T::Paymaster::ensure_concluded(id);
|
||||
},
|
||||
_ => panic!("No payout attempt made"),
|
||||
};
|
||||
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
#[block]
|
||||
{
|
||||
let res =
|
||||
Treasury::<T, _>::check_status(RawOrigin::Signed(caller.clone()).into(), 0u32);
|
||||
|
||||
if spend_exists {
|
||||
assert_ok!(res);
|
||||
} else {
|
||||
assert_err!(res, crate::Error::<T, _>::InvalidIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(s) = Spends::<T, I>::get(0) {
|
||||
assert!(!matches!(s.status, PaymentState::Attempted { .. }));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn void_spend() -> Result<(), BenchmarkError> {
|
||||
let (asset_kind, amount, _, beneficiary_lookup) = create_spend_arguments::<T, _>(SEED);
|
||||
T::BalanceConverter::ensure_successful(asset_kind.clone());
|
||||
let spend_exists = if let Ok(origin) = T::SpendOrigin::try_successful_origin() {
|
||||
Treasury::<T, _>::spend(
|
||||
origin,
|
||||
Box::new(asset_kind.clone()),
|
||||
amount,
|
||||
Box::new(beneficiary_lookup),
|
||||
None,
|
||||
)?;
|
||||
assert!(Spends::<T, I>::get(0).is_some());
|
||||
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
let origin =
|
||||
T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
|
||||
#[block]
|
||||
{
|
||||
let res = Treasury::<T, _>::void_spend(origin as T::RuntimeOrigin, 0u32);
|
||||
|
||||
if spend_exists {
|
||||
assert_ok!(res);
|
||||
} else {
|
||||
assert_err!(res, crate::Error::<T, _>::InvalidIndex);
|
||||
}
|
||||
}
|
||||
|
||||
assert!(Spends::<T, I>::get(0).is_none());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Treasury,
|
||||
crate::tests::ExtBuilder::default().build(),
|
||||
crate::tests::Test
|
||||
);
|
||||
|
||||
mod no_spend_origin_tests {
|
||||
use super::*;
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Treasury,
|
||||
crate::tests::ExtBuilder::default().spend_origin_succesful_origin_err().build(),
|
||||
crate::tests::Test,
|
||||
benchmarks_path = benchmarking
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,135 @@
|
||||
// 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.
|
||||
|
||||
//! Treasury pallet migrations.
|
||||
|
||||
use super::*;
|
||||
use alloc::collections::BTreeSet;
|
||||
#[cfg(feature = "try-runtime")]
|
||||
use alloc::vec::Vec;
|
||||
use core::marker::PhantomData;
|
||||
use pezframe_support::{defensive, traits::OnRuntimeUpgrade};
|
||||
|
||||
/// The log target for this pallet.
|
||||
const LOG_TARGET: &str = "runtime::treasury";
|
||||
|
||||
pub mod cleanup_proposals {
|
||||
use super::*;
|
||||
|
||||
/// Migration to cleanup unapproved proposals to return the bonds back to the proposers.
|
||||
/// Proposals can no longer be created and the `Proposal` storage item will be removed in the
|
||||
/// future.
|
||||
///
|
||||
/// `UnreserveWeight` returns `Weight` of `unreserve_balance` operation which is perfomed during
|
||||
/// this migration.
|
||||
pub struct Migration<T, I, UnreserveWeight>(PhantomData<(T, I, UnreserveWeight)>);
|
||||
|
||||
impl<T: Config<I>, I: 'static, UnreserveWeight: Get<Weight>> OnRuntimeUpgrade
|
||||
for Migration<T, I, UnreserveWeight>
|
||||
{
|
||||
fn on_runtime_upgrade() -> pezframe_support::weights::Weight {
|
||||
let mut approval_index = BTreeSet::new();
|
||||
#[allow(deprecated)]
|
||||
for approval in Approvals::<T, I>::get().iter() {
|
||||
approval_index.insert(*approval);
|
||||
}
|
||||
|
||||
let mut proposals_processed = 0;
|
||||
#[allow(deprecated)]
|
||||
for (proposal_index, p) in Proposals::<T, I>::iter() {
|
||||
if !approval_index.contains(&proposal_index) {
|
||||
let err_amount = T::Currency::unreserve(&p.proposer, p.bond);
|
||||
if err_amount.is_zero() {
|
||||
Proposals::<T, I>::remove(proposal_index);
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"Released bond amount of {:?} to proposer {:?}",
|
||||
p.bond,
|
||||
p.proposer,
|
||||
);
|
||||
} else {
|
||||
defensive!(
|
||||
"err_amount is non zero for proposal {:?}",
|
||||
(proposal_index, err_amount)
|
||||
);
|
||||
Proposals::<T, I>::mutate_extant(proposal_index, |proposal| {
|
||||
proposal.value = err_amount;
|
||||
});
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"Released partial bond amount of {:?} to proposer {:?}",
|
||||
p.bond - err_amount,
|
||||
p.proposer,
|
||||
);
|
||||
}
|
||||
proposals_processed += 1;
|
||||
}
|
||||
}
|
||||
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"Migration for pezpallet-treasury finished, released {} proposal bonds.",
|
||||
proposals_processed,
|
||||
);
|
||||
|
||||
// calculate and return migration weights
|
||||
let approvals_read = 1;
|
||||
T::DbWeight::get().reads_writes(
|
||||
proposals_processed as u64 + approvals_read,
|
||||
proposals_processed as u64,
|
||||
) + UnreserveWeight::get() * proposals_processed
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
|
||||
let value = (
|
||||
Proposals::<T, I>::iter_values().count() as u32,
|
||||
Approvals::<T, I>::get().len() as u32,
|
||||
);
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"Proposals and Approvals count {:?}",
|
||||
value,
|
||||
);
|
||||
Ok(value.encode())
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
|
||||
let (old_proposals_count, old_approvals_count) =
|
||||
<(u32, u32)>::decode(&mut &state[..]).expect("Known good");
|
||||
let new_proposals_count = Proposals::<T, I>::iter_values().count() as u32;
|
||||
let new_approvals_count = Approvals::<T, I>::get().len() as u32;
|
||||
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"Proposals and Approvals count {:?}",
|
||||
(new_proposals_count, new_approvals_count),
|
||||
);
|
||||
|
||||
ensure!(
|
||||
new_proposals_count <= old_proposals_count,
|
||||
"Proposals after migration should be less or equal to old proposals"
|
||||
);
|
||||
ensure!(
|
||||
new_approvals_count == old_approvals_count,
|
||||
"Approvals after migration should remain the same"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,283 @@
|
||||
// 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_treasury`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `4563561839a5`, 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_treasury
|
||||
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
|
||||
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/treasury/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
|
||||
// --genesis-builder-policy=none
|
||||
// --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_treasury`.
|
||||
pub trait WeightInfo {
|
||||
fn spend_local() -> Weight;
|
||||
fn remove_approval() -> Weight;
|
||||
fn on_initialize_proposals(p: u32, ) -> Weight;
|
||||
fn spend() -> Weight;
|
||||
fn payout() -> Weight;
|
||||
fn check_status() -> Weight;
|
||||
fn void_spend() -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for `pezpallet_treasury` using the Bizinikiwi node and recommended hardware.
|
||||
pub struct BizinikiwiWeight<T>(PhantomData<T>);
|
||||
impl<T: pezframe_system::Config> WeightInfo for BizinikiwiWeight<T> {
|
||||
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
|
||||
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Approvals` (r:1 w:1)
|
||||
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Proposals` (r:0 w:1)
|
||||
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
|
||||
fn spend_local() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `1887`
|
||||
// Minimum execution time: 9_084_000 picoseconds.
|
||||
Weight::from_parts(9_260_000, 1887)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Approvals` (r:1 w:1)
|
||||
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
|
||||
fn remove_approval() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `69`
|
||||
// Estimated: `1887`
|
||||
// Minimum execution time: 5_149_000 picoseconds.
|
||||
Weight::from_parts(5_358_000, 1887)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Deactivated` (r:1 w:1)
|
||||
/// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::LastSpendPeriod` (r:1 w:1)
|
||||
/// Proof: `Treasury::LastSpendPeriod` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// The range of component `p` is `[0, 99]`.
|
||||
fn on_initialize_proposals(p: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `78`
|
||||
// Estimated: `1501`
|
||||
// Minimum execution time: 8_211_000 picoseconds.
|
||||
Weight::from_parts(11_324_784, 1501)
|
||||
// Standard Error: 806
|
||||
.saturating_add(Weight::from_parts(45_246, 0).saturating_mul(p.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0)
|
||||
/// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(37), added: 2512, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::SpendCount` (r:1 w:1)
|
||||
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Spends` (r:0 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
fn spend() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `42`
|
||||
// Estimated: `3502`
|
||||
// Minimum execution time: 11_348_000 picoseconds.
|
||||
Weight::from_parts(11_874_000, 3502)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Spends` (r:1 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, 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: `473`
|
||||
// Estimated: `6208`
|
||||
// Minimum execution time: 55_665_000 picoseconds.
|
||||
Weight::from_parts(57_099_000, 6208)
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Spends` (r:1 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
fn check_status() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `143`
|
||||
// Estimated: `3539`
|
||||
// Minimum execution time: 12_058_000 picoseconds.
|
||||
Weight::from_parts(12_297_000, 3539)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Spends` (r:1 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
fn void_spend() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `144`
|
||||
// Estimated: `3539`
|
||||
// Minimum execution time: 10_730_000 picoseconds.
|
||||
Weight::from_parts(10_908_000, 3539)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility and tests.
|
||||
impl WeightInfo for () {
|
||||
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
|
||||
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Approvals` (r:1 w:1)
|
||||
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Proposals` (r:0 w:1)
|
||||
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
|
||||
fn spend_local() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `1887`
|
||||
// Minimum execution time: 9_084_000 picoseconds.
|
||||
Weight::from_parts(9_260_000, 1887)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Approvals` (r:1 w:1)
|
||||
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
|
||||
fn remove_approval() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `69`
|
||||
// Estimated: `1887`
|
||||
// Minimum execution time: 5_149_000 picoseconds.
|
||||
Weight::from_parts(5_358_000, 1887)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Deactivated` (r:1 w:1)
|
||||
/// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::LastSpendPeriod` (r:1 w:1)
|
||||
/// Proof: `Treasury::LastSpendPeriod` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// The range of component `p` is `[0, 99]`.
|
||||
fn on_initialize_proposals(p: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `78`
|
||||
// Estimated: `1501`
|
||||
// Minimum execution time: 8_211_000 picoseconds.
|
||||
Weight::from_parts(11_324_784, 1501)
|
||||
// Standard Error: 806
|
||||
.saturating_add(Weight::from_parts(45_246, 0).saturating_mul(p.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0)
|
||||
/// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(37), added: 2512, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::SpendCount` (r:1 w:1)
|
||||
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Spends` (r:0 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
fn spend() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `42`
|
||||
// Estimated: `3502`
|
||||
// Minimum execution time: 11_348_000 picoseconds.
|
||||
Weight::from_parts(11_874_000, 3502)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Spends` (r:1 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, 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: `473`
|
||||
// Estimated: `6208`
|
||||
// Minimum execution time: 55_665_000 picoseconds.
|
||||
Weight::from_parts(57_099_000, 6208)
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Spends` (r:1 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
fn check_status() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `143`
|
||||
// Estimated: `3539`
|
||||
// Minimum execution time: 12_058_000 picoseconds.
|
||||
Weight::from_parts(12_297_000, 3539)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Treasury::Spends` (r:1 w:1)
|
||||
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
|
||||
fn void_spend() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `144`
|
||||
// Estimated: `3539`
|
||||
// Minimum execution time: 10_730_000 picoseconds.
|
||||
Weight::from_parts(10_908_000, 3539)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user