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
@@ -0,0 +1,463 @@
// 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.
// Benchmarks for Proxy Pallet
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use crate::Pallet as Proxy;
use alloc::{boxed::Box, vec};
use frame::benchmarking::prelude::{
account, benchmarks, impl_test_function, whitelisted_caller, BenchmarkError, RawOrigin,
};
const SEED: u32 = 0;
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
pezframe_system::Pallet::<T>::assert_last_event(generic_event.into());
}
fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
pezframe_system::Pallet::<T>::assert_has_event(generic_event.into());
}
fn add_proxies<T: Config>(n: u32, maybe_who: Option<T::AccountId>) -> Result<(), &'static str> {
let caller = maybe_who.unwrap_or_else(whitelisted_caller);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value() / 2u32.into());
for i in 0..n {
let real = T::Lookup::unlookup(account("target", i, SEED));
Proxy::<T>::add_proxy(
RawOrigin::Signed(caller.clone()).into(),
real,
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
)?;
}
Ok(())
}
fn add_announcements<T: Config>(
n: u32,
maybe_who: Option<T::AccountId>,
maybe_real: Option<T::AccountId>,
) -> Result<(), &'static str> {
let caller = maybe_who.unwrap_or_else(|| account("caller", 0, SEED));
let caller_lookup = T::Lookup::unlookup(caller.clone());
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value() / 2u32.into());
let real = if let Some(real) = maybe_real {
real
} else {
let real = account("real", 0, SEED);
T::Currency::make_free_balance_be(&real, BalanceOf::<T>::max_value() / 2u32.into());
Proxy::<T>::add_proxy(
RawOrigin::Signed(real.clone()).into(),
caller_lookup,
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
)?;
real
};
let real_lookup = T::Lookup::unlookup(real);
for _ in 0..n {
Proxy::<T>::announce(
RawOrigin::Signed(caller.clone()).into(),
real_lookup.clone(),
T::CallHasher::hash_of(&("add_announcement", n)),
)?;
}
Ok(())
}
#[benchmarks]
mod benchmarks {
use super::*;
#[benchmark]
fn proxy(p: Linear<1, { T::MaxProxies::get() - 1 }>) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value() / 2u32.into());
// ... and "real" is the traditional caller. This is not a typo.
let real: T::AccountId = whitelisted_caller();
let real_lookup = T::Lookup::unlookup(real);
let call: <T as Config>::RuntimeCall =
pezframe_system::Call::<T>::remark { remark: vec![] }.into();
#[extrinsic_call]
_(RawOrigin::Signed(caller), real_lookup, Some(T::ProxyType::default()), Box::new(call));
assert_last_event::<T>(Event::ProxyExecuted { result: Ok(()) }.into());
Ok(())
}
#[benchmark]
fn proxy_announced(
a: Linear<0, { T::MaxPending::get() - 1 }>,
p: Linear<1, { T::MaxProxies::get() - 1 }>,
) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("pure", 0, SEED);
let delegate: T::AccountId = account("target", p - 1, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
T::Currency::make_free_balance_be(&delegate, BalanceOf::<T>::max_value() / 2u32.into());
// ... and "real" is the traditional caller. This is not a typo.
let real: T::AccountId = whitelisted_caller();
let real_lookup = T::Lookup::unlookup(real);
let call: <T as Config>::RuntimeCall =
pezframe_system::Call::<T>::remark { remark: vec![] }.into();
Proxy::<T>::announce(
RawOrigin::Signed(delegate.clone()).into(),
real_lookup.clone(),
T::CallHasher::hash_of(&call),
)?;
add_announcements::<T>(a, Some(delegate.clone()), None)?;
#[extrinsic_call]
_(
RawOrigin::Signed(caller),
delegate_lookup,
real_lookup,
Some(T::ProxyType::default()),
Box::new(call),
);
assert_last_event::<T>(Event::ProxyExecuted { result: Ok(()) }.into());
Ok(())
}
#[benchmark]
fn remove_announcement(
a: Linear<0, { T::MaxPending::get() - 1 }>,
p: Linear<1, { T::MaxProxies::get() - 1 }>,
) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value() / 2u32.into());
// ... and "real" is the traditional caller. This is not a typo.
let real: T::AccountId = whitelisted_caller();
let real_lookup = T::Lookup::unlookup(real);
let call: <T as Config>::RuntimeCall =
pezframe_system::Call::<T>::remark { remark: vec![] }.into();
Proxy::<T>::announce(
RawOrigin::Signed(caller.clone()).into(),
real_lookup.clone(),
T::CallHasher::hash_of(&call),
)?;
add_announcements::<T>(a, Some(caller.clone()), None)?;
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), real_lookup, T::CallHasher::hash_of(&call));
let (announcements, _) = Announcements::<T>::get(&caller);
assert_eq!(announcements.len() as u32, a);
Ok(())
}
#[benchmark]
fn reject_announcement(
a: Linear<0, { T::MaxPending::get() - 1 }>,
p: Linear<1, { T::MaxProxies::get() - 1 }>,
) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
let caller_lookup = T::Lookup::unlookup(caller.clone());
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value() / 2u32.into());
// ... and "real" is the traditional caller. This is not a typo.
let real: T::AccountId = whitelisted_caller();
let real_lookup = T::Lookup::unlookup(real.clone());
let call: <T as Config>::RuntimeCall =
pezframe_system::Call::<T>::remark { remark: vec![] }.into();
Proxy::<T>::announce(
RawOrigin::Signed(caller.clone()).into(),
real_lookup,
T::CallHasher::hash_of(&call),
)?;
add_announcements::<T>(a, Some(caller.clone()), None)?;
#[extrinsic_call]
_(RawOrigin::Signed(real), caller_lookup, T::CallHasher::hash_of(&call));
let (announcements, _) = Announcements::<T>::get(&caller);
assert_eq!(announcements.len() as u32, a);
Ok(())
}
#[benchmark]
fn announce(
a: Linear<0, { T::MaxPending::get() - 1 }>,
p: Linear<1, { T::MaxProxies::get() - 1 }>,
) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
// In this case the caller is the "target" proxy
let caller: T::AccountId = account("target", p - 1, SEED);
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value() / 2u32.into());
// ... and "real" is the traditional caller. This is not a typo.
let real: T::AccountId = whitelisted_caller();
let real_lookup = T::Lookup::unlookup(real.clone());
add_announcements::<T>(a, Some(caller.clone()), None)?;
let call: <T as Config>::RuntimeCall =
pezframe_system::Call::<T>::remark { remark: vec![] }.into();
let call_hash = T::CallHasher::hash_of(&call);
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), real_lookup, call_hash);
assert_last_event::<T>(Event::Announced { real, proxy: caller, call_hash }.into());
Ok(())
}
#[benchmark]
fn add_proxy(p: Linear<1, { T::MaxProxies::get() - 1 }>) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
let real = T::Lookup::unlookup(account("target", T::MaxProxies::get(), SEED));
#[extrinsic_call]
_(
RawOrigin::Signed(caller.clone()),
real,
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
);
let (proxies, _) = Proxies::<T>::get(caller);
assert_eq!(proxies.len() as u32, p + 1);
Ok(())
}
#[benchmark]
fn remove_proxy(p: Linear<1, { T::MaxProxies::get() - 1 }>) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
let delegate = T::Lookup::unlookup(account("target", 0, SEED));
#[extrinsic_call]
_(
RawOrigin::Signed(caller.clone()),
delegate,
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
);
let (proxies, _) = Proxies::<T>::get(caller);
assert_eq!(proxies.len() as u32, p - 1);
Ok(())
}
#[benchmark]
fn remove_proxies(p: Linear<1, { T::MaxProxies::get() - 1 }>) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()));
let (proxies, _) = Proxies::<T>::get(caller);
assert_eq!(proxies.len() as u32, 0);
Ok(())
}
#[benchmark]
fn create_pure(p: Linear<1, { T::MaxProxies::get() - 1 }>) -> Result<(), BenchmarkError> {
add_proxies::<T>(p, None)?;
let caller: T::AccountId = whitelisted_caller();
#[extrinsic_call]
_(
RawOrigin::Signed(caller.clone()),
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
0,
);
let pure_account = Pallet::<T>::pure_account(&caller, &T::ProxyType::default(), 0, None);
assert_last_event::<T>(
Event::PureCreated {
pure: pure_account,
who: caller,
proxy_type: T::ProxyType::default(),
disambiguation_index: 0,
at: <T as Config>::BlockNumberProvider::current_block_number(),
extrinsic_index: pezframe_system::Pallet::<T>::extrinsic_index().unwrap_or_default(),
}
.into(),
);
Ok(())
}
#[benchmark]
fn kill_pure(p: Linear<0, { T::MaxProxies::get() - 2 }>) -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();
let caller_lookup = T::Lookup::unlookup(caller.clone());
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
Pallet::<T>::create_pure(
RawOrigin::Signed(whitelisted_caller()).into(),
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
0,
)?;
let height = T::BlockNumberProvider::current_block_number();
let ext_index = pezframe_system::Pallet::<T>::extrinsic_index().unwrap_or(0);
let pure_account = Pallet::<T>::pure_account(&caller, &T::ProxyType::default(), 0, None);
add_proxies::<T>(p, Some(pure_account.clone()))?;
ensure!(Proxies::<T>::contains_key(&pure_account), "pure proxy not created");
#[extrinsic_call]
_(
RawOrigin::Signed(pure_account.clone()),
caller_lookup,
T::ProxyType::default(),
0,
height,
ext_index,
);
assert!(!Proxies::<T>::contains_key(&pure_account));
Ok(())
}
#[benchmark]
fn poke_deposit() -> Result<(), BenchmarkError> {
// Create accounts using the same pattern as other benchmarks
let account_1: T::AccountId = account("account", 1, SEED);
let account_2: T::AccountId = account("account", 2, SEED);
let account_3: T::AccountId = account("account", 3, SEED);
// Fund accounts
T::Currency::make_free_balance_be(&account_1, BalanceOf::<T>::max_value() / 100u8.into());
T::Currency::make_free_balance_be(&account_2, BalanceOf::<T>::max_value() / 100u8.into());
T::Currency::make_free_balance_be(&account_3, BalanceOf::<T>::max_value() / 100u8.into());
// Add proxy relationships
Proxy::<T>::add_proxy(
RawOrigin::Signed(account_1.clone()).into(),
T::Lookup::unlookup(account_2.clone()),
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
)?;
Proxy::<T>::add_proxy(
RawOrigin::Signed(account_2.clone()).into(),
T::Lookup::unlookup(account_3.clone()),
T::ProxyType::default(),
BlockNumberFor::<T>::zero(),
)?;
let (proxies, initial_proxy_deposit) = Proxies::<T>::get(&account_2);
assert!(!initial_proxy_deposit.is_zero());
assert_eq!(initial_proxy_deposit, T::Currency::reserved_balance(&account_2));
// Create announcement
Proxy::<T>::announce(
RawOrigin::Signed(account_2.clone()).into(),
T::Lookup::unlookup(account_1.clone()),
T::CallHasher::hash_of(&("add_announcement", 1)),
)?;
let (announcements, initial_announcement_deposit) = Announcements::<T>::get(&account_2);
assert!(!initial_announcement_deposit.is_zero());
assert_eq!(
initial_announcement_deposit.saturating_add(initial_proxy_deposit),
T::Currency::reserved_balance(&account_2)
);
// Artificially inflate deposits and reserve the extra amount
let extra_proxy_deposit = initial_proxy_deposit; // Double the deposit
let extra_announcement_deposit = initial_announcement_deposit; // Double the deposit
let total = extra_proxy_deposit.saturating_add(extra_announcement_deposit);
T::Currency::reserve(&account_2, total)?;
let initial_reserved = T::Currency::reserved_balance(&account_2);
assert_eq!(initial_reserved, total.saturating_add(total)); // Double
// Update storage with increased deposits
Proxies::<T>::insert(
&account_2,
(proxies, initial_proxy_deposit.saturating_add(extra_proxy_deposit)),
);
Announcements::<T>::insert(
&account_2,
(
announcements,
initial_announcement_deposit.saturating_add(extra_announcement_deposit),
),
);
// Verify artificial state
let (_, inflated_proxy_deposit) = Proxies::<T>::get(&account_2);
let (_, inflated_announcement_deposit) = Announcements::<T>::get(&account_2);
assert_eq!(
inflated_proxy_deposit,
initial_proxy_deposit.saturating_add(extra_proxy_deposit)
);
assert_eq!(
inflated_announcement_deposit,
initial_announcement_deposit.saturating_add(extra_announcement_deposit)
);
#[extrinsic_call]
_(RawOrigin::Signed(account_2.clone()));
// Verify results
let (_, final_proxy_deposit) = Proxies::<T>::get(&account_2);
let (_, final_announcement_deposit) = Announcements::<T>::get(&account_2);
assert_eq!(final_proxy_deposit, initial_proxy_deposit);
assert_eq!(final_announcement_deposit, initial_announcement_deposit);
let final_reserved = T::Currency::reserved_balance(&account_2);
assert_eq!(final_reserved, initial_reserved.saturating_sub(total));
// Verify events
assert_has_event::<T>(
Event::DepositPoked {
who: account_2.clone(),
kind: DepositKind::Proxies,
old_deposit: inflated_proxy_deposit,
new_deposit: final_proxy_deposit,
}
.into(),
);
assert_last_event::<T>(
Event::DepositPoked {
who: account_2,
kind: DepositKind::Announcements,
old_deposit: inflated_announcement_deposit,
new_deposit: final_announcement_deposit,
}
.into(),
);
Ok(())
}
impl_benchmark_test_suite!(Proxy, crate::tests::new_test_ext(), crate::tests::Test);
}
File diff suppressed because it is too large Load Diff
+868
View File
@@ -0,0 +1,868 @@
// 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.
// Tests for Proxy Pallet
#![cfg(test)]
use super::*;
use crate as proxy;
use alloc::{vec, vec::Vec};
use frame::testing_prelude::*;
type Block = pezframe_system::mocking::MockBlock<Test>;
construct_runtime!(
pub struct Test {
System: pezframe_system,
Balances: pezpallet_balances,
Proxy: proxy,
Utility: pezpallet_utility,
}
);
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Test {
type Block = Block;
type BaseCallFilter = BaseFilter;
type AccountData = pezpallet_balances::AccountData<u64>;
}
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type AccountStore = System;
}
impl pezpallet_utility::Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller;
type WeightInfo = ();
}
#[derive(
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
DecodeWithMemTracking,
RuntimeDebug,
MaxEncodedLen,
scale_info::TypeInfo,
)]
pub enum ProxyType {
Any,
JustTransfer,
JustUtility,
}
impl Default for ProxyType {
fn default() -> Self {
Self::Any
}
}
impl frame::traits::InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &RuntimeCall) -> bool {
match self {
ProxyType::Any => true,
ProxyType::JustTransfer => {
matches!(
c,
RuntimeCall::Balances(pezpallet_balances::Call::transfer_allow_death { .. })
)
},
ProxyType::JustUtility => matches!(c, RuntimeCall::Utility { .. }),
}
}
fn is_superset(&self, o: &Self) -> bool {
self == &ProxyType::Any || self == o
}
}
pub struct BaseFilter;
impl Contains<RuntimeCall> for BaseFilter {
fn contains(c: &RuntimeCall) -> bool {
match *c {
// Remark is used as a no-op call in the benchmarking
RuntimeCall::System(SystemCall::remark { .. }) => true,
RuntimeCall::System(_) => false,
_ => true,
}
}
}
parameter_types! {
pub static ProxyDepositBase: u64 = 1;
pub static ProxyDepositFactor: u64 = 1;
pub static AnnouncementDepositBase: u64 = 1;
pub static AnnouncementDepositFactor: u64 = 1;
}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = ConstU32<4>;
type WeightInfo = ();
type CallHasher = BlakeTwo256;
type MaxPending = ConstU32<2>;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
type BlockNumberProvider = pezframe_system::Pallet<Test>;
}
use super::{Call as ProxyCall, Event as ProxyEvent};
use pezframe_system::Call as SystemCall;
use pezpallet_balances::{Call as BalancesCall, Error as BalancesError, Event as BalancesEvent};
use pezpallet_utility::{Call as UtilityCall, Event as UtilityEvent};
type SystemError = pezframe_system::Error<Test>;
pub fn new_test_ext() -> TestState {
let mut t = pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
pezpallet_balances::GenesisConfig::<Test> {
balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 3)],
..Default::default()
}
.assimilate_storage(&mut t)
.unwrap();
let mut ext = TestState::new(t);
ext.execute_with(|| System::set_block_number(1));
ext
}
fn last_events(n: usize) -> Vec<RuntimeEvent> {
pezframe_system::Pallet::<Test>::events()
.into_iter()
.rev()
.take(n)
.rev()
.map(|e| e.event)
.collect()
}
fn expect_events(e: Vec<RuntimeEvent>) {
assert_eq!(last_events(e.len()), e);
}
fn call_transfer(dest: u64, value: u64) -> RuntimeCall {
RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest, value })
}
#[test]
fn announcement_works() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 1));
System::assert_last_event(
ProxyEvent::ProxyAdded {
delegator: 1,
delegatee: 3,
proxy_type: ProxyType::Any,
delay: 1,
}
.into(),
);
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(2), 3, ProxyType::Any, 1));
assert_eq!(Balances::reserved_balance(3), 0);
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 1, [1; 32].into()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(
announcements.0,
vec![Announcement { real: 1, call_hash: [1; 32].into(), height: 1 }]
);
assert_eq!(Balances::reserved_balance(3), announcements.1);
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 2, [2; 32].into()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(
announcements.0,
vec![
Announcement { real: 1, call_hash: [1; 32].into(), height: 1 },
Announcement { real: 2, call_hash: [2; 32].into(), height: 1 },
]
);
assert_eq!(Balances::reserved_balance(3), announcements.1);
assert_noop!(
Proxy::announce(RuntimeOrigin::signed(3), 2, [3; 32].into()),
Error::<Test>::TooMany
);
});
}
#[test]
fn remove_announcement_works() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 1));
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(2), 3, ProxyType::Any, 1));
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 1, [1; 32].into()));
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 2, [2; 32].into()));
let e = Error::<Test>::NotFound;
assert_noop!(Proxy::remove_announcement(RuntimeOrigin::signed(3), 1, [0; 32].into()), e);
assert_ok!(Proxy::remove_announcement(RuntimeOrigin::signed(3), 1, [1; 32].into()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(
announcements.0,
vec![Announcement { real: 2, call_hash: [2; 32].into(), height: 1 }]
);
assert_eq!(Balances::reserved_balance(3), announcements.1);
});
}
#[test]
fn reject_announcement_works() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 1));
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(2), 3, ProxyType::Any, 1));
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 1, [1; 32].into()));
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 2, [2; 32].into()));
let e = Error::<Test>::NotFound;
assert_noop!(Proxy::reject_announcement(RuntimeOrigin::signed(1), 3, [0; 32].into()), e);
let e = Error::<Test>::NotFound;
assert_noop!(Proxy::reject_announcement(RuntimeOrigin::signed(4), 3, [1; 32].into()), e);
assert_ok!(Proxy::reject_announcement(RuntimeOrigin::signed(1), 3, [1; 32].into()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(
announcements.0,
vec![Announcement { real: 2, call_hash: [2; 32].into(), height: 1 }]
);
assert_eq!(Balances::reserved_balance(3), announcements.1);
});
}
#[test]
fn announcer_must_be_proxy() {
new_test_ext().execute_with(|| {
assert_noop!(
Proxy::announce(RuntimeOrigin::signed(2), 1, H256::zero()),
Error::<Test>::NotProxy
);
});
}
#[test]
fn calling_proxy_doesnt_remove_announcement() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0));
let call = Box::new(call_transfer(6, 1));
let call_hash = BlakeTwo256::hash_of(&call);
assert_ok!(Proxy::announce(RuntimeOrigin::signed(2), 1, call_hash));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call));
// The announcement is not removed by calling proxy.
let announcements = Announcements::<Test>::get(2);
assert_eq!(announcements.0, vec![Announcement { real: 1, call_hash, height: 1 }]);
});
}
#[test]
fn delayed_requires_pre_announcement() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 1));
let call = Box::new(call_transfer(6, 1));
let e = Error::<Test>::Unannounced;
assert_noop!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()), e);
let e = Error::<Test>::Unannounced;
assert_noop!(Proxy::proxy_announced(RuntimeOrigin::signed(0), 2, 1, None, call.clone()), e);
let call_hash = BlakeTwo256::hash_of(&call);
assert_ok!(Proxy::announce(RuntimeOrigin::signed(2), 1, call_hash));
pezframe_system::Pallet::<Test>::set_block_number(2);
assert_ok!(Proxy::proxy_announced(RuntimeOrigin::signed(0), 2, 1, None, call.clone()));
});
}
#[test]
fn proxy_announced_removes_announcement_and_returns_deposit() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 1));
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(2), 3, ProxyType::Any, 1));
let call = Box::new(call_transfer(6, 1));
let call_hash = BlakeTwo256::hash_of(&call);
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 1, call_hash));
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 2, call_hash));
// Too early to execute announced call
let e = Error::<Test>::Unannounced;
assert_noop!(Proxy::proxy_announced(RuntimeOrigin::signed(0), 3, 1, None, call.clone()), e);
pezframe_system::Pallet::<Test>::set_block_number(2);
assert_ok!(Proxy::proxy_announced(RuntimeOrigin::signed(0), 3, 1, None, call.clone()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(announcements.0, vec![Announcement { real: 2, call_hash, height: 1 }]);
assert_eq!(Balances::reserved_balance(3), announcements.1);
});
}
#[test]
fn filtering_works() {
new_test_ext().execute_with(|| {
Balances::make_free_balance_be(&1, 1000);
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0));
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::JustTransfer, 0));
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 4, ProxyType::JustUtility, 0));
let call = Box::new(call_transfer(6, 1));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()));
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Ok(()) }.into());
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Ok(()) }.into());
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(4), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
let derivative_id = pezpallet_utility::derivative_account_id(1, 0);
Balances::make_free_balance_be(&derivative_id, 1000);
let inner = Box::new(call_transfer(6, 1));
let call = Box::new(RuntimeCall::Utility(UtilityCall::as_derivative {
index: 0,
call: inner.clone(),
}));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()));
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Ok(()) }.into());
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(4), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
let call = Box::new(RuntimeCall::Utility(UtilityCall::batch { calls: vec![*inner] }));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()));
expect_events(vec![
UtilityEvent::BatchCompleted.into(),
ProxyEvent::ProxyExecuted { result: Ok(()) }.into(),
]);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(4), 1, None, call.clone()));
expect_events(vec![
UtilityEvent::BatchInterrupted { index: 0, error: SystemError::CallFiltered.into() }
.into(),
ProxyEvent::ProxyExecuted { result: Ok(()) }.into(),
]);
let inner = Box::new(RuntimeCall::Proxy(ProxyCall::new_call_variant_add_proxy(
5,
ProxyType::Any,
0,
)));
let call = Box::new(RuntimeCall::Utility(UtilityCall::batch { calls: vec![*inner] }));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()));
expect_events(vec![
UtilityEvent::BatchCompleted.into(),
ProxyEvent::ProxyExecuted { result: Ok(()) }.into(),
]);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(4), 1, None, call.clone()));
expect_events(vec![
UtilityEvent::BatchInterrupted { index: 0, error: SystemError::CallFiltered.into() }
.into(),
ProxyEvent::ProxyExecuted { result: Ok(()) }.into(),
]);
let call = Box::new(RuntimeCall::Proxy(ProxyCall::remove_proxies {}));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(4), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()));
expect_events(vec![
BalancesEvent::<Test>::Unreserved { who: 1, amount: 5 }.into(),
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 2,
proxy_type: ProxyType::Any,
delay: 0,
}
.into(),
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 3,
proxy_type: ProxyType::JustTransfer,
delay: 0,
}
.into(),
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 4,
proxy_type: ProxyType::JustUtility,
delay: 0,
}
.into(),
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 5,
proxy_type: ProxyType::Any,
delay: 0,
}
.into(),
ProxyEvent::ProxyExecuted { result: Ok(()) }.into(),
]);
});
}
#[test]
fn add_remove_proxies_works() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0));
assert_noop!(
Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0),
Error::<Test>::Duplicate
);
assert_eq!(Balances::reserved_balance(1), 2);
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::JustTransfer, 0));
assert_eq!(Balances::reserved_balance(1), 3);
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(1), 4);
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 4, ProxyType::JustUtility, 0));
assert_eq!(Balances::reserved_balance(1), 5);
assert_noop!(
Proxy::add_proxy(RuntimeOrigin::signed(1), 4, ProxyType::Any, 0),
Error::<Test>::TooMany
);
assert_noop!(
Proxy::remove_proxy(RuntimeOrigin::signed(1), 3, ProxyType::JustTransfer, 0),
Error::<Test>::NotFound
);
assert_ok!(Proxy::remove_proxy(RuntimeOrigin::signed(1), 4, ProxyType::JustUtility, 0));
System::assert_last_event(
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 4,
proxy_type: ProxyType::JustUtility,
delay: 0,
}
.into(),
);
assert_eq!(Balances::reserved_balance(1), 4);
assert_ok!(Proxy::remove_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(1), 3);
System::assert_last_event(
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 3,
proxy_type: ProxyType::Any,
delay: 0,
}
.into(),
);
assert_ok!(Proxy::remove_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(1), 2);
System::assert_last_event(
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 2,
proxy_type: ProxyType::Any,
delay: 0,
}
.into(),
);
assert_ok!(Proxy::remove_proxy(RuntimeOrigin::signed(1), 2, ProxyType::JustTransfer, 0));
assert_eq!(Balances::reserved_balance(1), 0);
System::assert_last_event(
ProxyEvent::ProxyRemoved {
delegator: 1,
delegatee: 2,
proxy_type: ProxyType::JustTransfer,
delay: 0,
}
.into(),
);
assert_noop!(
Proxy::add_proxy(RuntimeOrigin::signed(1), 1, ProxyType::Any, 0),
Error::<Test>::NoSelfProxy
);
});
}
#[test]
fn cannot_add_proxy_without_balance() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(5), 3, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(5), 2);
assert_noop!(
Proxy::add_proxy(RuntimeOrigin::signed(5), 4, ProxyType::Any, 0),
DispatchError::ConsumerRemaining,
);
});
}
#[test]
fn proxying_works() {
new_test_ext().execute_with(|| {
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::JustTransfer, 0));
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 0));
let call = Box::new(call_transfer(6, 1));
assert_noop!(
Proxy::proxy(RuntimeOrigin::signed(4), 1, None, call.clone()),
Error::<Test>::NotProxy
);
assert_noop!(
Proxy::proxy(RuntimeOrigin::signed(2), 1, Some(ProxyType::Any), call.clone()),
Error::<Test>::NotProxy
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), 1, None, call.clone()));
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Ok(()) }.into());
assert_eq!(Balances::free_balance(6), 1);
let call = Box::new(RuntimeCall::System(SystemCall::set_code { code: vec![] }));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer_keep_alive {
dest: 6,
value: 1,
}));
assert_ok!(RuntimeCall::Proxy(super::Call::new_call_variant_proxy(1, None, call.clone()))
.dispatch(RuntimeOrigin::signed(2)));
System::assert_last_event(
ProxyEvent::ProxyExecuted { result: Err(SystemError::CallFiltered.into()) }.into(),
);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(3), 1, None, call.clone()));
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Ok(()) }.into());
assert_eq!(Balances::free_balance(6), 2);
});
}
#[test]
fn pure_works() {
new_test_ext().execute_with(|| {
Balances::make_free_balance_be(&1, 11); // An extra one for the ED.
assert_ok!(Proxy::create_pure(RuntimeOrigin::signed(1), ProxyType::Any, 0, 0));
let anon = Proxy::pure_account(&1, &ProxyType::Any, 0, None);
System::assert_last_event(
ProxyEvent::PureCreated {
pure: anon,
who: 1,
proxy_type: ProxyType::Any,
disambiguation_index: 0,
at: <Test as Config>::BlockNumberProvider::current_block_number(),
extrinsic_index: System::extrinsic_index().unwrap(),
}
.into(),
);
// other calls to pure allowed as long as they're not exactly the same.
assert_ok!(Proxy::create_pure(RuntimeOrigin::signed(1), ProxyType::JustTransfer, 0, 0));
assert_ok!(Proxy::create_pure(RuntimeOrigin::signed(1), ProxyType::Any, 0, 1));
let anon2 = Proxy::pure_account(&2, &ProxyType::Any, 0, None);
assert_ok!(Proxy::create_pure(RuntimeOrigin::signed(2), ProxyType::Any, 0, 0));
assert_noop!(
Proxy::create_pure(RuntimeOrigin::signed(1), ProxyType::Any, 0, 0),
Error::<Test>::Duplicate
);
System::set_extrinsic_index(1);
assert_ok!(Proxy::create_pure(RuntimeOrigin::signed(1), ProxyType::Any, 0, 0));
System::set_extrinsic_index(0);
System::set_block_number(2);
assert_ok!(Proxy::create_pure(RuntimeOrigin::signed(1), ProxyType::Any, 0, 0));
let call = Box::new(call_transfer(6, 1));
assert_ok!(Balances::transfer_allow_death(RuntimeOrigin::signed(3), anon, 5));
assert_eq!(Balances::free_balance(6), 0);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(1), anon, None, call));
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Ok(()) }.into());
assert_eq!(Balances::free_balance(6), 1);
let call = Box::new(RuntimeCall::Proxy(ProxyCall::new_call_variant_kill_pure(
1,
ProxyType::Any,
0,
1,
0,
)));
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(2), anon2, None, call.clone()));
let de: DispatchError = DispatchError::from(Error::<Test>::NoPermission).stripped();
System::assert_last_event(ProxyEvent::ProxyExecuted { result: Err(de) }.into());
assert_noop!(
Proxy::kill_pure(RuntimeOrigin::signed(1), 1, ProxyType::Any, 0, 1, 0),
Error::<Test>::NoPermission
);
assert_eq!(Balances::free_balance(1), 1);
assert_ok!(Proxy::proxy(RuntimeOrigin::signed(1), anon, None, call.clone()));
assert_eq!(Balances::free_balance(1), 3);
assert_noop!(
Proxy::proxy(RuntimeOrigin::signed(1), anon, None, call.clone()),
Error::<Test>::NotProxy
);
// Actually kill the pure proxy.
assert_ok!(Proxy::kill_pure(RuntimeOrigin::signed(anon), 1, ProxyType::Any, 0, 1, 0));
System::assert_last_event(
ProxyEvent::PureKilled {
pure: anon,
spawner: 1,
proxy_type: ProxyType::Any,
disambiguation_index: 0,
}
.into(),
);
});
}
#[test]
fn poke_deposit_works_for_proxy_deposits() {
new_test_ext().execute_with(|| {
// Add a proxy and check initial deposit
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(1), 2); // Base(1) + Factor(1) * 1
// Change the proxy deposit base to trigger deposit update
ProxyDepositBase::set(2);
let result = Proxy::poke_deposit(RuntimeOrigin::signed(1));
assert_ok!(result.as_ref());
assert_eq!(result.unwrap().pays_fee, Pays::No);
assert_eq!(Balances::reserved_balance(1), 3); // New Base(2) + Factor(1) * 1
System::assert_last_event(
ProxyEvent::DepositPoked {
who: 1,
kind: DepositKind::Proxies,
old_deposit: 2,
new_deposit: 3,
}
.into(),
);
assert!(System::events()
.iter()
.any(|record| matches!(record.event, RuntimeEvent::Proxy(Event::DepositPoked { .. }))));
});
}
#[test]
fn poke_deposit_works_for_announcement_deposits() {
new_test_ext().execute_with(|| {
// Setup proxy and make announcement
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 1));
assert_eq!(Balances::reserved_balance(1), 2); // Base(1) + Factor(1) * 1
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 1, [1; 32].into()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(
announcements.0,
vec![Announcement { real: 1, call_hash: [1; 32].into(), height: 1 }]
);
assert_eq!(Balances::reserved_balance(3), announcements.1);
let initial_deposit = Balances::reserved_balance(3);
// Change announcement deposit base to trigger update
AnnouncementDepositBase::set(2);
let result = Proxy::poke_deposit(RuntimeOrigin::signed(3));
assert_ok!(result.as_ref());
assert_eq!(result.unwrap().pays_fee, Pays::No);
let new_deposit = initial_deposit.saturating_add(1); // Base increased by 1
assert_eq!(Balances::reserved_balance(3), new_deposit);
System::assert_last_event(
ProxyEvent::DepositPoked {
who: 3,
kind: DepositKind::Announcements,
old_deposit: initial_deposit,
new_deposit,
}
.into(),
);
assert!(System::events()
.iter()
.any(|record| matches!(record.event, RuntimeEvent::Proxy(Event::DepositPoked { .. }))));
});
}
#[test]
fn poke_deposit_charges_fee_when_deposit_unchanged() {
new_test_ext().execute_with(|| {
// Add a proxy and check initial deposit
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 3, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(1), 2); // Base(1) + Factor(1) * 1
// Poke the deposit without changing deposit required and check fee
let result = Proxy::poke_deposit(RuntimeOrigin::signed(1));
assert_ok!(result.as_ref());
assert_eq!(result.unwrap().pays_fee, Pays::Yes); // Pays fee
assert_eq!(Balances::reserved_balance(1), 2); // No change
// No event emitted
assert!(!System::events()
.iter()
.any(|record| matches!(record.event, RuntimeEvent::Proxy(Event::DepositPoked { .. }))));
// Add an announcement and check initial deposit
assert_ok!(Proxy::announce(RuntimeOrigin::signed(3), 1, [1; 32].into()));
let announcements = Announcements::<Test>::get(3);
assert_eq!(
announcements.0,
vec![Announcement { real: 1, call_hash: [1; 32].into(), height: 1 }]
);
assert_eq!(Balances::reserved_balance(3), announcements.1);
let initial_deposit = Balances::reserved_balance(3);
// Poke the deposit without changing deposit required and check fee
let result = Proxy::poke_deposit(RuntimeOrigin::signed(3));
assert_ok!(result.as_ref());
assert_eq!(result.unwrap().pays_fee, Pays::Yes); // Pays fee
assert_eq!(Balances::reserved_balance(3), initial_deposit); // No change
// No event emitted
assert!(!System::events()
.iter()
.any(|record| matches!(record.event, RuntimeEvent::Proxy(Event::DepositPoked { .. }))));
});
}
#[test]
fn poke_deposit_handles_insufficient_balance() {
new_test_ext().execute_with(|| {
// Setup with account that has minimal balance
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(5), 3, ProxyType::Any, 0));
let initial_deposit = Balances::reserved_balance(5);
// Change deposit base to require more than available balance
ProxyDepositBase::set(10);
// Poking should fail due to insufficient balance
assert_noop!(
Proxy::poke_deposit(RuntimeOrigin::signed(5)),
BalancesError::<Test, _>::InsufficientBalance,
);
// Original deposit should remain unchanged
assert_eq!(Balances::reserved_balance(5), initial_deposit);
});
}
#[test]
fn poke_deposit_updates_both_proxy_and_announcement_deposits() {
new_test_ext().execute_with(|| {
// Setup both proxy and announcement for the same account
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(1), 2, ProxyType::Any, 0));
assert_eq!(Balances::reserved_balance(1), 2); // Base(1) + Factor(1) * 1
assert_ok!(Proxy::add_proxy(RuntimeOrigin::signed(2), 3, ProxyType::Any, 1));
assert_eq!(Balances::reserved_balance(2), 2); // Base(1) + Factor(1) * 1
assert_ok!(Proxy::announce(RuntimeOrigin::signed(2), 1, [1; 32].into()));
let announcements = Announcements::<Test>::get(2);
assert_eq!(
announcements.0,
vec![Announcement { real: 1, call_hash: [1; 32].into(), height: 1 }]
);
assert_eq!(announcements.1, 2); // Base(1) + Factor(1) * 1
// Record initial deposits
let initial_proxy_deposit = Proxies::<Test>::get(2).1;
let initial_announcement_deposit = Announcements::<Test>::get(2).1;
// Total reserved = deposit for proxy + deposit for announcement
assert_eq!(
Balances::reserved_balance(2),
initial_proxy_deposit.saturating_add(initial_announcement_deposit)
);
// Change both deposit requirements
ProxyDepositBase::set(2);
AnnouncementDepositBase::set(2);
// Poke deposits - should update both deposits and emit two events
let result = Proxy::poke_deposit(RuntimeOrigin::signed(2));
assert_ok!(result.as_ref());
assert_eq!(result.unwrap().pays_fee, Pays::No);
// Check both deposits were updated
let (_, new_proxy_deposit) = Proxies::<Test>::get(2);
let (_, new_announcement_deposit) = Announcements::<Test>::get(2);
assert_eq!(new_proxy_deposit, 3); // Base(2) + Factor(1) * 1
assert_eq!(new_announcement_deposit, 3); // Base(2) + Factor(1) * 1
assert_eq!(
Balances::reserved_balance(2),
new_proxy_deposit.saturating_add(new_announcement_deposit)
);
// Verify both events were emitted in the correct order
let events = System::events();
let relevant_events: Vec<_> = events
.iter()
.filter(|record| {
matches!(record.event, RuntimeEvent::Proxy(ProxyEvent::DepositPoked { .. }))
})
.collect();
assert_eq!(relevant_events.len(), 2);
// First event should be for Proxies
assert_eq!(
relevant_events[0].event,
ProxyEvent::DepositPoked {
who: 2,
kind: DepositKind::Proxies,
old_deposit: initial_proxy_deposit,
new_deposit: new_proxy_deposit,
}
.into()
);
// Second event should be for Announcements
assert_eq!(
relevant_events[1].event,
ProxyEvent::DepositPoked {
who: 2,
kind: DepositKind::Announcements,
old_deposit: initial_announcement_deposit,
new_deposit: new_announcement_deposit,
}
.into()
);
// Poking again should charge fee as nothing changes
let result = Proxy::poke_deposit(RuntimeOrigin::signed(2));
assert_ok!(result.as_ref());
assert_eq!(result.unwrap().pays_fee, Pays::Yes);
// Verify deposits remained the same
assert_eq!(Proxies::<Test>::get(2).1, new_proxy_deposit);
assert_eq!(Announcements::<Test>::get(2).1, new_announcement_deposit);
assert_eq!(
Balances::reserved_balance(2),
new_proxy_deposit.saturating_add(new_announcement_deposit)
);
});
}
#[test]
fn poke_deposit_fails_for_unsigned_origin() {
new_test_ext().execute_with(|| {
assert_noop!(Proxy::poke_deposit(RuntimeOrigin::none()), DispatchError::BadOrigin,);
});
}
+465
View File
@@ -0,0 +1,465 @@
// 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_proxy`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-03-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `99fc4dfa9c86`, 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_proxy
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/proxy/src/weights.rs
// --wasm-execution=compiled
// --steps=50
// --repeat=20
// --heap-pages=4096
// --template=bizinikiwi/.maintain/frame-umbrella-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 frame::weights_prelude::*;
/// Weight functions needed for `pezpallet_proxy`.
pub trait WeightInfo {
fn proxy(p: u32, ) -> Weight;
fn proxy_announced(a: u32, p: u32, ) -> Weight;
fn remove_announcement(a: u32, p: u32, ) -> Weight;
fn reject_announcement(a: u32, p: u32, ) -> Weight;
fn announce(a: u32, p: u32, ) -> Weight;
fn add_proxy(p: u32, ) -> Weight;
fn remove_proxy(p: u32, ) -> Weight;
fn remove_proxies(p: u32, ) -> Weight;
fn create_pure(p: u32, ) -> Weight;
fn kill_pure(p: u32, ) -> Weight;
fn poke_deposit() -> Weight;
}
/// Weights for `pezpallet_proxy` using the Bizinikiwi node and recommended hardware.
pub struct BizinikiwiWeight<T>(PhantomData<T>);
impl<T: pezframe_system::Config> WeightInfo for BizinikiwiWeight<T> {
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `SafeMode::EnteredUntil` (r:1 w:0)
/// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TxPause::PausedCalls` (r:1 w:0)
/// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 23_353_000 picoseconds.
Weight::from_parts(25_084_085, 4706)
// Standard Error: 2_569
.saturating_add(Weight::from_parts(33_574, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `SafeMode::EnteredUntil` (r:1 w:0)
/// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TxPause::PausedCalls` (r:1 w:0)
/// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn proxy_announced(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `666 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 47_196_000 picoseconds.
Weight::from_parts(48_686_812, 5698)
// Standard Error: 3_711
.saturating_add(Weight::from_parts(171_107, 0).saturating_mul(a.into()))
// Standard Error: 3_834
.saturating_add(Weight::from_parts(34_523, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn remove_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `436 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 29_341_000 picoseconds.
Weight::from_parts(30_320_504, 5698)
// Standard Error: 1_821
.saturating_add(Weight::from_parts(158_572, 0).saturating_mul(a.into()))
// Standard Error: 1_881
.saturating_add(Weight::from_parts(8_433, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn reject_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `436 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 28_422_000 picoseconds.
Weight::from_parts(29_754_384, 5698)
// Standard Error: 1_840
.saturating_add(Weight::from_parts(176_827, 0).saturating_mul(a.into()))
// Standard Error: 1_901
.saturating_add(Weight::from_parts(9_607, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn announce(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `453 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 36_885_000 picoseconds.
Weight::from_parts(38_080_636, 5698)
// Standard Error: 2_642
.saturating_add(Weight::from_parts(157_335, 0).saturating_mul(a.into()))
// Standard Error: 2_730
.saturating_add(Weight::from_parts(28_872, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn add_proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `194 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 27_016_000 picoseconds.
Weight::from_parts(28_296_216, 4706)
// Standard Error: 1_643
.saturating_add(Weight::from_parts(50_271, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn remove_proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `194 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 26_955_000 picoseconds.
Weight::from_parts(28_379_566, 4706)
// Standard Error: 1_547
.saturating_add(Weight::from_parts(45_784, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn remove_proxies(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `194 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 24_656_000 picoseconds.
Weight::from_parts(25_821_878, 4706)
// Standard Error: 2_300
.saturating_add(Weight::from_parts(33_972, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn create_pure(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `206`
// Estimated: `4706`
// Minimum execution time: 28_416_000 picoseconds.
Weight::from_parts(29_662_728, 4706)
// Standard Error: 1_851
.saturating_add(Weight::from_parts(29_928, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[0, 30]`.
fn kill_pure(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `231 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 25_505_000 picoseconds.
Weight::from_parts(26_780_627, 4706)
// Standard Error: 1_581
.saturating_add(Weight::from_parts(33_085, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
fn poke_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `519`
// Estimated: `5698`
// Minimum execution time: 46_733_000 picoseconds.
Weight::from_parts(47_972_000, 5698)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
}
// For backwards compatibility and tests.
impl WeightInfo for () {
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `SafeMode::EnteredUntil` (r:1 w:0)
/// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TxPause::PausedCalls` (r:1 w:0)
/// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 23_353_000 picoseconds.
Weight::from_parts(25_084_085, 4706)
// Standard Error: 2_569
.saturating_add(Weight::from_parts(33_574, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `SafeMode::EnteredUntil` (r:1 w:0)
/// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TxPause::PausedCalls` (r:1 w:0)
/// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn proxy_announced(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `666 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 47_196_000 picoseconds.
Weight::from_parts(48_686_812, 5698)
// Standard Error: 3_711
.saturating_add(Weight::from_parts(171_107, 0).saturating_mul(a.into()))
// Standard Error: 3_834
.saturating_add(Weight::from_parts(34_523, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn remove_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `436 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 29_341_000 picoseconds.
Weight::from_parts(30_320_504, 5698)
// Standard Error: 1_821
.saturating_add(Weight::from_parts(158_572, 0).saturating_mul(a.into()))
// Standard Error: 1_881
.saturating_add(Weight::from_parts(8_433, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn reject_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `436 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 28_422_000 picoseconds.
Weight::from_parts(29_754_384, 5698)
// Standard Error: 1_840
.saturating_add(Weight::from_parts(176_827, 0).saturating_mul(a.into()))
// Standard Error: 1_901
.saturating_add(Weight::from_parts(9_607, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn announce(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `453 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 36_885_000 picoseconds.
Weight::from_parts(38_080_636, 5698)
// Standard Error: 2_642
.saturating_add(Weight::from_parts(157_335, 0).saturating_mul(a.into()))
// Standard Error: 2_730
.saturating_add(Weight::from_parts(28_872, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn add_proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `194 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 27_016_000 picoseconds.
Weight::from_parts(28_296_216, 4706)
// Standard Error: 1_643
.saturating_add(Weight::from_parts(50_271, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn remove_proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `194 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 26_955_000 picoseconds.
Weight::from_parts(28_379_566, 4706)
// Standard Error: 1_547
.saturating_add(Weight::from_parts(45_784, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn remove_proxies(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `194 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 24_656_000 picoseconds.
Weight::from_parts(25_821_878, 4706)
// Standard Error: 2_300
.saturating_add(Weight::from_parts(33_972, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn create_pure(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `206`
// Estimated: `4706`
// Minimum execution time: 28_416_000 picoseconds.
Weight::from_parts(29_662_728, 4706)
// Standard Error: 1_851
.saturating_add(Weight::from_parts(29_928, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[0, 30]`.
fn kill_pure(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `231 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 25_505_000 picoseconds.
Weight::from_parts(26_780_627, 4706)
// Standard Error: 1_581
.saturating_add(Weight::from_parts(33_085, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
fn poke_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `519`
// Estimated: `5698`
// Minimum execution time: 46_733_000 picoseconds.
Weight::from_parts(47_972_000, 5698)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
}