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,35 @@
|
||||
[package]
|
||||
name = "pezpallet-nis"
|
||||
version = "28.0.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
description = "FRAME pallet for rewarding account freezing."
|
||||
readme = "README.md"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
frame = { workspace = true, features = ["runtime"] }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
pezpallet-balances = { workspace = true, default-features = true }
|
||||
pezsp-io = { workspace = true, default-features = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["codec/std", "frame/std", "scale-info/std"]
|
||||
runtime-benchmarks = [
|
||||
"frame/runtime-benchmarks",
|
||||
"pezpallet-balances/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = ["frame/try-runtime", "pezpallet-balances/try-runtime"]
|
||||
@@ -0,0 +1,5 @@
|
||||
# NIS Module
|
||||
|
||||
Provides a non-interactive variant of staking.
|
||||
|
||||
License: Apache-2.0
|
||||
@@ -0,0 +1,314 @@
|
||||
// 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 NIS Pallet
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use frame::benchmarking::prelude::*;
|
||||
|
||||
use crate::*;
|
||||
|
||||
const SEED: u32 = 0;
|
||||
|
||||
type BalanceOf<T> =
|
||||
<<T as Config>::Currency as FunInspect<<T as pezframe_system::Config>::AccountId>>::Balance;
|
||||
|
||||
fn fill_queues<T: Config>() -> Result<(), DispatchError> {
|
||||
// filling queues involves filling the first queue entirely and placing a single item in all
|
||||
// other queues.
|
||||
|
||||
let queues = T::QueueCount::get();
|
||||
let bids = T::MaxQueueLen::get();
|
||||
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::set_balance(&caller, T::MinBid::get() * BalanceOf::<T>::from(queues + bids));
|
||||
|
||||
for _ in 0..bids {
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), T::MinBid::get(), 1)?;
|
||||
}
|
||||
for d in 1..queues {
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), T::MinBid::get(), 1 + d)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmarks]
|
||||
mod benchmarks {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn place_bid(l: Linear<0, { T::MaxQueueLen::get() - 1 }>) -> Result<(), BenchmarkError> {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let ed = T::Currency::minimum_balance();
|
||||
let bid = T::MinBid::get();
|
||||
T::Currency::set_balance(&caller, (ed + bid) * BalanceOf::<T>::from(l + 1) + bid);
|
||||
for _ in 0..l {
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), T::MinBid::get(), 1)?;
|
||||
}
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), T::MinBid::get() * BalanceOf::<T>::from(2_u32), 1);
|
||||
|
||||
assert_eq!(
|
||||
QueueTotals::<T>::get()[0],
|
||||
(l + 1, T::MinBid::get() * BalanceOf::<T>::from(l + 2))
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn place_bid_max() -> Result<(), BenchmarkError> {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let origin = RawOrigin::Signed(caller.clone());
|
||||
let ed = T::Currency::minimum_balance();
|
||||
let bid = T::MinBid::get();
|
||||
let ql = T::MaxQueueLen::get();
|
||||
T::Currency::set_balance(&caller, (ed + bid) * BalanceOf::<T>::from(ql + 1) + bid);
|
||||
for _ in 0..T::MaxQueueLen::get() {
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), T::MinBid::get(), 1)?;
|
||||
}
|
||||
|
||||
#[extrinsic_call]
|
||||
place_bid(origin, T::MinBid::get() * BalanceOf::<T>::from(2_u32), 1);
|
||||
|
||||
assert_eq!(
|
||||
QueueTotals::<T>::get()[0],
|
||||
(
|
||||
T::MaxQueueLen::get(),
|
||||
T::MinBid::get() * BalanceOf::<T>::from(T::MaxQueueLen::get() + 1),
|
||||
)
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn retract_bid(l: Linear<1, { T::MaxQueueLen::get() }>) -> Result<(), BenchmarkError> {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let ed = T::Currency::minimum_balance();
|
||||
let bid = T::MinBid::get();
|
||||
T::Currency::set_balance(&caller, (ed + bid) * BalanceOf::<T>::from(l + 1) + bid);
|
||||
for _ in 0..l {
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), T::MinBid::get(), 1)?;
|
||||
}
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), T::MinBid::get(), 1);
|
||||
|
||||
assert_eq!(
|
||||
QueueTotals::<T>::get()[0],
|
||||
(l - 1, T::MinBid::get() * BalanceOf::<T>::from(l - 1))
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn fund_deficit() -> Result<(), BenchmarkError> {
|
||||
T::BenchmarkSetup::create_counterpart_asset();
|
||||
let origin =
|
||||
T::FundOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bid = T::MinBid::get().max(One::one());
|
||||
let ed = T::Currency::minimum_balance();
|
||||
T::Currency::set_balance(&caller, ed + bid);
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::process_queues(Perquintill::one(), 1, 1, &mut WeightCounter::unlimited());
|
||||
Pallet::<T>::communify(RawOrigin::Signed(caller.clone()).into(), 0)?;
|
||||
let original = T::Currency::balance(&Pallet::<T>::account_id());
|
||||
T::Currency::set_balance(&Pallet::<T>::account_id(), BalanceOf::<T>::min_value());
|
||||
|
||||
#[extrinsic_call]
|
||||
_(origin as T::RuntimeOrigin);
|
||||
|
||||
// Must fund at least 99.999% of the required amount.
|
||||
let missing =
|
||||
Perquintill::from_rational(T::Currency::balance(&Pallet::<T>::account_id()), original)
|
||||
.left_from_one();
|
||||
assert!(missing <= Perquintill::one() / 100_000);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn communify() -> Result<(), BenchmarkError> {
|
||||
T::BenchmarkSetup::create_counterpart_asset();
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bid = T::MinBid::get().max(One::one()) * 100u32.into();
|
||||
let ed = T::Currency::minimum_balance();
|
||||
T::Currency::set_balance(&caller, ed + bid + bid);
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited());
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), 0);
|
||||
|
||||
assert_eq!(Pallet::<T>::owner(&0), None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn privatize() -> Result<(), BenchmarkError> {
|
||||
T::BenchmarkSetup::create_counterpart_asset();
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bid = T::MinBid::get().max(One::one());
|
||||
let ed = T::Currency::minimum_balance();
|
||||
T::Currency::set_balance(&caller, ed + bid + bid);
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited());
|
||||
Pallet::<T>::communify(RawOrigin::Signed(caller.clone()).into(), 0)?;
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), 0);
|
||||
|
||||
assert_eq!(Pallet::<T>::owner(&0), Some(caller));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn thaw_private() -> Result<(), BenchmarkError> {
|
||||
T::BenchmarkSetup::create_counterpart_asset();
|
||||
let whale: T::AccountId = account("whale", 0, SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bid = T::MinBid::get().max(One::one());
|
||||
let ed = T::Currency::minimum_balance();
|
||||
T::Currency::set_balance(&caller, ed + bid + bid);
|
||||
// Ensure we don't get throttled.
|
||||
T::Currency::set_balance(
|
||||
&whale,
|
||||
T::ThawThrottle::get()
|
||||
.0
|
||||
.saturating_reciprocal_mul_ceil(T::Currency::balance(&caller)),
|
||||
);
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited());
|
||||
pezframe_system::Pallet::<T>::set_block_number(Receipts::<T>::get(0).unwrap().expiry);
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), 0, None);
|
||||
|
||||
assert!(Receipts::<T>::get(0).is_none());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn thaw_communal() -> Result<(), BenchmarkError> {
|
||||
T::BenchmarkSetup::create_counterpart_asset();
|
||||
let whale: T::AccountId = account("whale", 0, SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bid = T::MinBid::get().max(One::one());
|
||||
let ed = T::Currency::minimum_balance();
|
||||
T::Currency::set_balance(&caller, ed + bid + bid);
|
||||
// Ensure we don't get throttled.
|
||||
T::Currency::set_balance(
|
||||
&whale,
|
||||
T::ThawThrottle::get()
|
||||
.0
|
||||
.saturating_reciprocal_mul_ceil(T::Currency::balance(&caller)),
|
||||
);
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
|
||||
Pallet::<T>::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited());
|
||||
pezframe_system::Pallet::<T>::set_block_number(Receipts::<T>::get(0).unwrap().expiry);
|
||||
Pallet::<T>::communify(RawOrigin::Signed(caller.clone()).into(), 0)?;
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), 0);
|
||||
|
||||
assert!(Receipts::<T>::get(0).is_none());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn process_queues() -> Result<(), BenchmarkError> {
|
||||
fill_queues::<T>()?;
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::process_queues(
|
||||
Perquintill::one(),
|
||||
Zero::zero(),
|
||||
u32::max_value(),
|
||||
&mut WeightCounter::unlimited(),
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn process_queue() {
|
||||
let our_account = Pallet::<T>::account_id();
|
||||
let issuance = Pallet::<T>::issuance();
|
||||
let mut summary = Summary::<T>::get();
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::process_queue(
|
||||
1_u32,
|
||||
1_u32.into(),
|
||||
&our_account,
|
||||
&issuance,
|
||||
0,
|
||||
&mut Bounded::max_value(),
|
||||
&mut (T::MaxQueueLen::get(), Bounded::max_value()),
|
||||
&mut summary,
|
||||
&mut WeightCounter::unlimited(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[benchmark]
|
||||
fn process_bid() {
|
||||
let who = account::<T::AccountId>("bidder", 0, SEED);
|
||||
let min_bid = T::MinBid::get().max(One::one());
|
||||
let ed = T::Currency::minimum_balance();
|
||||
T::Currency::set_balance(&who, ed + min_bid);
|
||||
let bid = Bid { amount: T::MinBid::get(), who };
|
||||
let our_account = Pallet::<T>::account_id();
|
||||
let issuance = Pallet::<T>::issuance();
|
||||
let mut summary = Summary::<T>::get();
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::process_bid(
|
||||
bid,
|
||||
2_u32.into(),
|
||||
&our_account,
|
||||
&issuance,
|
||||
&mut Bounded::max_value(),
|
||||
&mut Bounded::max_value(),
|
||||
&mut summary,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite! {
|
||||
Pallet,
|
||||
mock::new_test_ext_empty(),
|
||||
mock::Test
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,154 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Test environment for NIS pallet.
|
||||
|
||||
use frame::{runtime::prelude::*, testing_prelude::*, traits::StorageMapShim};
|
||||
|
||||
use crate::{self as pezpallet_nis, *};
|
||||
|
||||
pub type Balance = u64;
|
||||
|
||||
type Block = pezframe_system::mocking::MockBlock<Test>;
|
||||
|
||||
// Configure a mock runtime to test the pallet.
|
||||
#[frame_construct_runtime]
|
||||
mod runtime {
|
||||
#[runtime::runtime]
|
||||
#[runtime::derive(
|
||||
RuntimeCall,
|
||||
RuntimeError,
|
||||
RuntimeEvent,
|
||||
RuntimeFreezeReason,
|
||||
RuntimeHoldReason,
|
||||
RuntimeOrigin,
|
||||
RuntimeTask
|
||||
)]
|
||||
pub struct Test;
|
||||
|
||||
#[runtime::pezpallet_index(0)]
|
||||
pub type System = pezframe_system;
|
||||
#[runtime::pezpallet_index(1)]
|
||||
pub type Balances = pezpallet_balances<Instance1>;
|
||||
#[runtime::pezpallet_index(2)]
|
||||
pub type NisBalances = pezpallet_balances<Instance2>;
|
||||
#[runtime::pezpallet_index(3)]
|
||||
pub type Nis = pezpallet_nis;
|
||||
}
|
||||
|
||||
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
|
||||
impl pezframe_system::Config for Test {
|
||||
type Block = Block;
|
||||
type AccountData = pezpallet_balances::AccountData<Balance>;
|
||||
}
|
||||
|
||||
impl pezpallet_balances::Config<pezpallet_balances::Instance1> for Test {
|
||||
type Balance = Balance;
|
||||
type DustRemoval = ();
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ExistentialDeposit = ConstU64<1>;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
type MaxLocks = ();
|
||||
type MaxReserves = ConstU32<1>;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type FreezeIdentifier = ();
|
||||
type MaxFreezes = ();
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
type DoneSlashHandler = ();
|
||||
}
|
||||
|
||||
impl pezpallet_balances::Config<pezpallet_balances::Instance2> for Test {
|
||||
type Balance = u128;
|
||||
type DustRemoval = ();
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ExistentialDeposit = ConstU128<1>;
|
||||
type AccountStore = StorageMapShim<
|
||||
pezpallet_balances::Account<Test, pezpallet_balances::Instance2>,
|
||||
u64,
|
||||
pezpallet_balances::AccountData<u128>,
|
||||
>;
|
||||
type WeightInfo = ();
|
||||
type MaxLocks = ();
|
||||
type MaxReserves = ();
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type FreezeIdentifier = ();
|
||||
type MaxFreezes = ();
|
||||
type RuntimeHoldReason = ();
|
||||
type RuntimeFreezeReason = ();
|
||||
type DoneSlashHandler = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub IgnoredIssuance: Balance = Balances::total_balance(&0); // Account zero is ignored.
|
||||
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
|
||||
pub static Target: Perquintill = Perquintill::zero();
|
||||
pub const MinReceipt: Perquintill = Perquintill::from_percent(1);
|
||||
pub const ThawThrottle: (Perquintill, u64) = (Perquintill::from_percent(25), 5);
|
||||
pub static MaxIntakeWeight: Weight = Weight::from_parts(2_000_000_000_000, 0);
|
||||
}
|
||||
|
||||
ord_parameter_types! {
|
||||
pub const One: u64 = 1;
|
||||
}
|
||||
|
||||
impl pezpallet_nis::Config for Test {
|
||||
type WeightInfo = ();
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletId = NisPalletId;
|
||||
type Currency = Balances;
|
||||
type CurrencyBalance = <Self as pezpallet_balances::Config<pezpallet_balances::Instance1>>::Balance;
|
||||
type FundOrigin = pezframe_system::EnsureSigned<Self::AccountId>;
|
||||
type Deficit = ();
|
||||
type IgnoredIssuance = IgnoredIssuance;
|
||||
type Counterpart = NisBalances;
|
||||
type CounterpartAmount = WithMaximumOf<ConstU128<21_000_000u128>>;
|
||||
type Target = Target;
|
||||
type QueueCount = ConstU32<3>;
|
||||
type MaxQueueLen = ConstU32<3>;
|
||||
type FifoQueueLen = ConstU32<1>;
|
||||
type BasePeriod = ConstU64<3>;
|
||||
type MinBid = ConstU64<2>;
|
||||
type IntakePeriod = ConstU64<2>;
|
||||
type MaxIntakeWeight = MaxIntakeWeight;
|
||||
type MinReceipt = MinReceipt;
|
||||
type ThawThrottle = ThawThrottle;
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type BenchmarkSetup = ();
|
||||
}
|
||||
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup.
|
||||
pub fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
let mut t = pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
pezpallet_balances::GenesisConfig::<Test, pezpallet_balances::Instance1> {
|
||||
balances: vec![(1, 100), (2, 100), (3, 100), (4, 100)],
|
||||
..Default::default()
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
// This function basically just builds a genesis storage key/value store according to
|
||||
// our desired mockup, but without any balances.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub fn new_test_ext_empty() -> pezsp_io::TestExternalities {
|
||||
pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
|
||||
}
|
||||
@@ -0,0 +1,853 @@
|
||||
// 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 NIS pallet.
|
||||
|
||||
use frame::testing_prelude::*;
|
||||
|
||||
use crate::{
|
||||
mock::{Balance, *},
|
||||
*,
|
||||
};
|
||||
use fungible::InspectHold;
|
||||
|
||||
fn pot() -> Balance {
|
||||
Balances::free_balance(&Nis::account_id())
|
||||
}
|
||||
|
||||
fn holdings() -> Balance {
|
||||
Nis::issuance().holdings
|
||||
}
|
||||
|
||||
fn signed(who: u64) -> RuntimeOrigin {
|
||||
RuntimeOrigin::signed(who)
|
||||
}
|
||||
|
||||
fn enlarge(amount: Balance, max_bids: u32) {
|
||||
let summary: SummaryRecord<u64, Balance> = Summary::<Test>::get();
|
||||
let increase_in_proportion_owed = Perquintill::from_rational(amount, Nis::issuance().effective);
|
||||
let target = summary.proportion_owed.saturating_add(increase_in_proportion_owed);
|
||||
Nis::process_queues(target, u32::max_value(), max_bids, &mut WeightCounter::unlimited());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_setup_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
|
||||
for q in 0..3 {
|
||||
assert!(Queues::<Test>::get(q).is_empty());
|
||||
}
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::zero(),
|
||||
index: 0,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 0,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn place_bid_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_noop!(Nis::place_bid(signed(1), 1, 2), Error::<Test>::AmountTooSmall);
|
||||
assert_noop!(Nis::place_bid(signed(1), 101, 2), TokenError::FundsUnavailable);
|
||||
assert_noop!(Nis::place_bid(signed(1), 10, 4), Error::<Test>::DurationTooBig);
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_eq!(Balances::reserved_balance(1), 10);
|
||||
assert_eq!(Queues::<Test>::get(2), vec![Bid { amount: 10, who: 1 }]);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(0, 0), (1, 10), (0, 0)]);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn place_bid_queuing_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 20, 2));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(1), 5, 2));
|
||||
assert_noop!(Nis::place_bid(signed(1), 5, 2), Error::<Test>::BidTooLow);
|
||||
assert_ok!(Nis::place_bid(signed(1), 15, 2));
|
||||
assert_eq!(Balances::reserved_balance(1), 45);
|
||||
|
||||
assert_ok!(Nis::place_bid(signed(1), 25, 2));
|
||||
assert_eq!(Balances::reserved_balance(1), 60);
|
||||
assert_noop!(Nis::place_bid(signed(1), 10, 2), Error::<Test>::BidTooLow);
|
||||
assert_eq!(
|
||||
Queues::<Test>::get(2),
|
||||
vec![
|
||||
Bid { amount: 15, who: 1 },
|
||||
Bid { amount: 25, who: 1 },
|
||||
Bid { amount: 20, who: 1 },
|
||||
]
|
||||
);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(0, 0), (3, 60), (0, 0)]);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn place_bid_fails_when_queue_full() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(2), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(3), 10, 2));
|
||||
assert_noop!(Nis::place_bid(signed(4), 10, 2), Error::<Test>::BidTooLow);
|
||||
assert_ok!(Nis::place_bid(signed(4), 10, 3));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_place_bids_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 3));
|
||||
assert_ok!(Nis::place_bid(signed(2), 10, 2));
|
||||
|
||||
assert_eq!(Balances::reserved_balance(1), 40);
|
||||
assert_eq!(Balances::reserved_balance(2), 10);
|
||||
assert_eq!(Queues::<Test>::get(1), vec![Bid { amount: 10, who: 1 },]);
|
||||
assert_eq!(
|
||||
Queues::<Test>::get(2),
|
||||
vec![
|
||||
Bid { amount: 10, who: 2 },
|
||||
Bid { amount: 10, who: 1 },
|
||||
Bid { amount: 10, who: 1 },
|
||||
]
|
||||
);
|
||||
assert_eq!(Queues::<Test>::get(3), vec![Bid { amount: 10, who: 1 },]);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(1, 10), (3, 30), (1, 10)]);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn retract_single_item_queue_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::retract_bid(signed(1), 10, 1));
|
||||
|
||||
assert_eq!(Balances::reserved_balance(1), 10);
|
||||
assert_eq!(Queues::<Test>::get(1), vec![]);
|
||||
assert_eq!(Queues::<Test>::get(2), vec![Bid { amount: 10, who: 1 }]);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(0, 0), (1, 10), (0, 0)]);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn retract_with_other_and_duplicate_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 2));
|
||||
assert_ok!(Nis::place_bid(signed(2), 10, 2));
|
||||
|
||||
assert_ok!(Nis::retract_bid(signed(1), 10, 2));
|
||||
assert_eq!(Balances::reserved_balance(1), 20);
|
||||
assert_eq!(Balances::reserved_balance(2), 10);
|
||||
assert_eq!(Queues::<Test>::get(1), vec![Bid { amount: 10, who: 1 },]);
|
||||
assert_eq!(
|
||||
Queues::<Test>::get(2),
|
||||
vec![Bid { amount: 10, who: 2 }, Bid { amount: 10, who: 1 },]
|
||||
);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(1, 10), (2, 20), (0, 0)]);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn retract_non_existent_item_fails() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_noop!(Nis::retract_bid(signed(1), 10, 1), Error::<Test>::UnknownBid);
|
||||
assert_ok!(Nis::place_bid(signed(1), 10, 1));
|
||||
assert_noop!(Nis::retract_bid(signed(1), 20, 1), Error::<Test>::UnknownBid);
|
||||
assert_noop!(Nis::retract_bid(signed(1), 10, 2), Error::<Test>::UnknownBid);
|
||||
assert_noop!(Nis::retract_bid(signed(2), 10, 1), Error::<Test>::UnknownBid);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_enlarge_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_ok!(Nis::place_bid(signed(2), 40, 2));
|
||||
enlarge(40, 2);
|
||||
|
||||
// Takes 2/2, then stopped because it reaches its max amount
|
||||
assert_eq!(Balances::reserved_balance(1), 40);
|
||||
assert_eq!(Balances::reserved_balance(2), 40);
|
||||
assert_eq!(holdings(), 40);
|
||||
|
||||
assert_eq!(Queues::<Test>::get(1), vec![Bid { amount: 40, who: 1 }]);
|
||||
assert_eq!(Queues::<Test>::get(2), vec![]);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(1, 40), (0, 0), (0, 0)]);
|
||||
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(10),
|
||||
index: 1,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 40,
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(0).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((2, 40)),
|
||||
expiry: 7
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enlarge_respects_bids_limit() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_ok!(Nis::place_bid(signed(2), 40, 2));
|
||||
assert_ok!(Nis::place_bid(signed(3), 40, 2));
|
||||
assert_ok!(Nis::place_bid(signed(4), 40, 3));
|
||||
enlarge(100, 2);
|
||||
|
||||
// Should have taken 4/3 and 2/2, then stopped because it's only allowed 2.
|
||||
assert_eq!(Queues::<Test>::get(1), vec![Bid { amount: 40, who: 1 }]);
|
||||
assert_eq!(Queues::<Test>::get(2), vec![Bid { amount: 40, who: 3 }]);
|
||||
assert_eq!(Queues::<Test>::get(3), vec![]);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(1, 40), (1, 40), (0, 0)]);
|
||||
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(0).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((4, 40)),
|
||||
expiry: 10
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(1).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((2, 40)),
|
||||
expiry: 7
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(20),
|
||||
index: 2,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 80,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enlarge_respects_amount_limit_and_will_split() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 80, 1));
|
||||
enlarge(40, 2);
|
||||
|
||||
// Takes 2/2, then stopped because it reaches its max amount
|
||||
assert_eq!(Queues::<Test>::get(1), vec![Bid { amount: 40, who: 1 }]);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(1, 40), (0, 0), (0, 0)]);
|
||||
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(0).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((1, 40)),
|
||||
expiry: 4
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(10),
|
||||
index: 1,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 40,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_thaw_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_eq!(Nis::issuance().effective, 400);
|
||||
assert_eq!(Balances::free_balance(1), 60);
|
||||
assert_eq!(Balances::reserved_balance(1), 40);
|
||||
assert_eq!(holdings(), 0);
|
||||
|
||||
enlarge(40, 1);
|
||||
assert_eq!(Nis::issuance().effective, 400);
|
||||
assert_eq!(Balances::free_balance(1), 60);
|
||||
assert_eq!(Balances::reserved_balance(1), 40);
|
||||
assert_eq!(holdings(), 40);
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(3);
|
||||
assert_noop!(Nis::thaw_private(signed(1), 0, None), Error::<Test>::NotExpired);
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
assert_noop!(Nis::thaw_private(signed(1), 1, None), Error::<Test>::UnknownReceipt);
|
||||
assert_noop!(Nis::thaw_private(signed(2), 0, None), Error::<Test>::NotOwner);
|
||||
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
assert_eq!(NisBalances::free_balance(1), 0);
|
||||
assert_eq!(Nis::typed_attribute::<_, Perquintill>(&0, b"proportion"), None);
|
||||
assert_eq!(Nis::issuance().effective, 400);
|
||||
assert_eq!(Balances::free_balance(1), 100);
|
||||
assert_eq!(pot(), 0);
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::zero(),
|
||||
index: 1,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::from_percent(10),
|
||||
receipts_on_hold: 0,
|
||||
}
|
||||
);
|
||||
assert_eq!(Receipts::<Test>::get(0), None);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_thaw_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 80, 1));
|
||||
enlarge(80, 1);
|
||||
assert_eq!(holdings(), 80);
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
let prop = Perquintill::from_rational(4_100_000, 21_000_000u64);
|
||||
assert_noop!(Nis::thaw_private(signed(1), 0, Some(prop)), Error::<Test>::MakesDust);
|
||||
let prop = Perquintill::from_rational(1_050_000, 21_000_000u64);
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, Some(prop)));
|
||||
|
||||
assert_eq!(
|
||||
Nis::typed_attribute::<_, Perquintill>(&0, b"proportion"),
|
||||
Some(Perquintill::from_rational(3_150_000u64, 21_000_000u64)),
|
||||
);
|
||||
|
||||
assert_eq!(Nis::issuance().effective, 400);
|
||||
assert_eq!(Balances::free_balance(1), 40);
|
||||
assert_eq!(holdings(), 60);
|
||||
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
|
||||
assert_eq!(Nis::issuance().effective, 400);
|
||||
assert_eq!(Balances::free_balance(1), 100);
|
||||
assert_eq!(pot(), 0);
|
||||
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::zero(),
|
||||
index: 1,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::from_percent(20),
|
||||
receipts_on_hold: 0,
|
||||
}
|
||||
);
|
||||
assert_eq!(Receipts::<Test>::get(0), None);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thaw_respects_transfers() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
enlarge(40, 1);
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
|
||||
assert_eq!(Nis::owner(&0), Some(1));
|
||||
assert_eq!(Balances::reserved_balance(&1), 40);
|
||||
assert_eq!(Balances::reserved_balance(&2), 0);
|
||||
assert_ok!(Nis::transfer(&0, &2));
|
||||
assert_eq!(Balances::reserved_balance(&1), 0);
|
||||
assert_eq!(Balances::reserved_balance(&2), 40);
|
||||
|
||||
// Transferring the receipt...
|
||||
assert_noop!(Nis::thaw_private(signed(1), 0, None), Error::<Test>::NotOwner);
|
||||
|
||||
// ...and thawing is possible.
|
||||
assert_ok!(Nis::thaw_private(signed(2), 0, None));
|
||||
|
||||
assert_eq!(Balances::total_balance(&2), 140);
|
||||
assert_eq!(Balances::total_balance(&1), 60);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn communify_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
enlarge(40, 1);
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
|
||||
assert_eq!(Nis::owner(&0), Some(1));
|
||||
assert_eq!(Balances::reserved_balance(&1), 40);
|
||||
assert_eq!(pot(), 0);
|
||||
assert_eq!(NisBalances::free_balance(&1), 0);
|
||||
assert_ok!(Nis::communify(signed(1), 0));
|
||||
assert_eq!(Nis::owner(&0), None);
|
||||
assert_eq!(Balances::reserved_balance(&1), 0);
|
||||
assert_eq!(pot(), 40);
|
||||
// We now have fungibles.
|
||||
assert_eq!(NisBalances::free_balance(&1), 2_100_000);
|
||||
|
||||
// Can't transfer the NFT or thaw it as a private.
|
||||
assert_noop!(Nis::thaw_private(signed(1), 0, None), Error::<Test>::AlreadyCommunal);
|
||||
assert_noop!(Nis::transfer(&0, &2), Error::<Test>::AlreadyCommunal);
|
||||
// Communal thawing would be possible, except it's the wrong receipt.
|
||||
assert_noop!(Nis::thaw_communal(signed(1), 1), Error::<Test>::UnknownReceipt);
|
||||
|
||||
// Transfer some of the fungibles away.
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(1), 2, 100_000));
|
||||
assert_eq!(NisBalances::free_balance(&1), 2_000_000);
|
||||
assert_eq!(NisBalances::free_balance(&2), 100_000);
|
||||
|
||||
// Communal thawing with the correct index is not possible now.
|
||||
assert_noop!(Nis::thaw_communal(signed(1), 0), TokenError::FundsUnavailable);
|
||||
assert_noop!(Nis::thaw_communal(signed(2), 0), TokenError::FundsUnavailable);
|
||||
|
||||
// Transfer the rest to 2...
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(1), 2, 2_000_000));
|
||||
assert_eq!(NisBalances::free_balance(&1), 0);
|
||||
assert_eq!(NisBalances::free_balance(&2), 2_100_000);
|
||||
|
||||
// ...and thawing becomes possible.
|
||||
assert_ok!(Nis::thaw_communal(signed(2), 0));
|
||||
assert_eq!(NisBalances::free_balance(&1), 0);
|
||||
assert_eq!(NisBalances::free_balance(&2), 0);
|
||||
assert_eq!(pot(), 0);
|
||||
assert_eq!(Balances::total_balance(&1), 60);
|
||||
assert_eq!(Balances::total_balance(&2), 140);
|
||||
|
||||
assert_noop!(Nis::thaw_communal(signed(2), 0), Error::<Test>::UnknownReceipt);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn privatize_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
enlarge(40, 1);
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
assert_noop!(Nis::privatize(signed(2), 0), Error::<Test>::AlreadyPrivate);
|
||||
assert_ok!(Nis::communify(signed(1), 0));
|
||||
|
||||
// Transfer the fungibles to #2
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(1), 2, 2_100_000));
|
||||
assert_noop!(Nis::privatize(signed(1), 0), TokenError::FundsUnavailable);
|
||||
|
||||
// Privatize
|
||||
assert_ok!(Nis::privatize(signed(2), 0));
|
||||
assert_noop!(Nis::privatize(signed(2), 0), Error::<Test>::AlreadyPrivate);
|
||||
assert_eq!(NisBalances::free_balance(&2), 0);
|
||||
assert_eq!(Nis::owner(&0), Some(2));
|
||||
assert_eq!(Balances::reserved_balance(&2), 40);
|
||||
assert_eq!(pot(), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn privatize_and_thaw_with_another_receipt_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_ok!(Nis::place_bid(signed(2), 40, 1));
|
||||
enlarge(80, 2);
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
|
||||
assert_ok!(Nis::communify(signed(1), 0));
|
||||
assert_ok!(Nis::communify(signed(2), 1));
|
||||
|
||||
// Transfer half of fungibles to #3 from each of #1 and #2, and the other half from #2 to #4
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(1), 3, 1_050_000));
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(2), 3, 1_050_000));
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(2), 4, 1_050_000));
|
||||
|
||||
// #3 privatizes, partially thaws, then re-communifies with #0, then transfers the fungibles
|
||||
// to #2
|
||||
assert_ok!(Nis::privatize(signed(3), 0));
|
||||
assert_ok!(Nis::thaw_private(signed(3), 0, Some(Perquintill::from_percent(5))));
|
||||
assert_ok!(Nis::communify(signed(3), 0));
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(3), 1, 1_050_000));
|
||||
|
||||
// #1 now has enough to thaw using receipt 1
|
||||
assert_ok!(Nis::thaw_communal(signed(1), 1));
|
||||
|
||||
// #4 now has enough to thaw using receipt 0
|
||||
assert_ok!(Nis::thaw_communal(signed(4), 0));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn communal_thaw_when_issuance_higher_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Balances::transfer_allow_death(signed(2), 1, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 100, 1));
|
||||
enlarge(100, 1);
|
||||
assert_eq!(Balances::total_balance(&1), 101);
|
||||
|
||||
assert_ok!(Nis::communify(signed(1), 0));
|
||||
assert_eq!(Balances::total_balance_on_hold(&1), 0);
|
||||
assert_eq!(Balances::total_balance(&1), 1);
|
||||
|
||||
assert_eq!(NisBalances::free_balance(1), 5_250_000); // (12.5% of 21m)
|
||||
|
||||
// Everybody else's balances goes up by 50%
|
||||
assert_ok!(Balances::mint_into(&2, 50));
|
||||
assert_ok!(Balances::mint_into(&3, 50));
|
||||
assert_ok!(Balances::mint_into(&4, 50));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
|
||||
// Unfunded initially...
|
||||
assert_noop!(Nis::thaw_communal(signed(1), 0), Error::<Test>::Unfunded);
|
||||
// ...so we fund.
|
||||
assert_ok!(Nis::fund_deficit(signed(1)));
|
||||
|
||||
// Transfer counterparts away...
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(1), 2, 125_000));
|
||||
// ...and it's not thawable.
|
||||
assert_noop!(Nis::thaw_communal(signed(1), 0), TokenError::FundsUnavailable);
|
||||
|
||||
// Transfer counterparts back...
|
||||
assert_ok!(NisBalances::transfer_allow_death(signed(2), 1, 125_000));
|
||||
// ...and it is.
|
||||
assert_ok!(Nis::thaw_communal(signed(1), 0));
|
||||
assert_eq!(Balances::total_balance(&1), 151);
|
||||
|
||||
assert_ok!(Balances::transfer_allow_death(signed(1), 2, 1));
|
||||
assert_eq!(Balances::total_balance(&1), 150);
|
||||
assert_eq!(Balances::free_balance(1), 150);
|
||||
assert_eq!(Balances::total_balance_on_hold(&1), 0);
|
||||
assert_eq!(Balances::reserved_balance(1), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn private_thaw_when_issuance_higher_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Balances::transfer_allow_death(signed(2), 1, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 100, 1));
|
||||
enlarge(100, 1);
|
||||
|
||||
// Everybody else's balances goes up by 50%
|
||||
assert_ok!(Balances::mint_into(&2, 50));
|
||||
assert_ok!(Balances::mint_into(&3, 50));
|
||||
assert_ok!(Balances::mint_into(&4, 50));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
|
||||
// Unfunded initially...
|
||||
assert_noop!(Nis::thaw_private(signed(1), 0, None), Error::<Test>::Unfunded);
|
||||
// ...so we fund.
|
||||
assert_ok!(Nis::fund_deficit(signed(1)));
|
||||
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
|
||||
assert_ok!(Balances::transfer_allow_death(signed(1), 2, 1));
|
||||
assert_eq!(Balances::free_balance(1), 150);
|
||||
assert_eq!(Balances::reserved_balance(1), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thaw_with_ignored_issuance_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
// Give account zero some balance.
|
||||
assert_ok!(Balances::mint_into(&0, 200));
|
||||
|
||||
assert_ok!(Balances::transfer_allow_death(signed(2), 1, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 100, 1));
|
||||
enlarge(100, 1);
|
||||
|
||||
// Account zero transfers 50 into everyone else's accounts.
|
||||
assert_ok!(Balances::transfer_allow_death(signed(0), 2, 50));
|
||||
assert_ok!(Balances::transfer_allow_death(signed(0), 3, 50));
|
||||
assert_ok!(Balances::transfer_allow_death(signed(0), 4, 50));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
// Unfunded initially...
|
||||
assert_noop!(Nis::thaw_private(signed(1), 0, None), Error::<Test>::Unfunded);
|
||||
// ...so we fund...
|
||||
assert_ok!(Nis::fund_deficit(signed(1)));
|
||||
// ...and then it's ok.
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
|
||||
// Account zero changes have been ignored.
|
||||
assert_ok!(Balances::transfer_allow_death(signed(1), 2, 1));
|
||||
assert_eq!(Balances::free_balance(1), 150);
|
||||
assert_eq!(Balances::reserved_balance(1), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thaw_when_issuance_lower_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Balances::transfer_allow_death(signed(2), 1, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 100, 1));
|
||||
enlarge(100, 1);
|
||||
|
||||
// Everybody else's balances goes down by 25%
|
||||
assert_ok!(Balances::burn_from(&2, 25, Expendable, Exact, Force));
|
||||
assert_ok!(Balances::burn_from(&3, 25, Expendable, Exact, Force));
|
||||
assert_ok!(Balances::burn_from(&4, 25, Expendable, Exact, Force));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
|
||||
assert_ok!(Balances::transfer_allow_death(signed(1), 2, 1));
|
||||
assert_eq!(Balances::free_balance(1), 75);
|
||||
assert_eq!(Balances::reserved_balance(1), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_thaws_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Balances::transfer_allow_death(signed(3), 1, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 60, 1));
|
||||
assert_ok!(Nis::place_bid(signed(2), 50, 1));
|
||||
enlarge(200, 3);
|
||||
|
||||
// Double everyone's free balances.
|
||||
assert_ok!(Balances::mint_into(&2, 50));
|
||||
assert_ok!(Balances::mint_into(&3, 100));
|
||||
assert_ok!(Balances::mint_into(&4, 100));
|
||||
assert_ok!(Nis::fund_deficit(signed(1)));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
assert_ok!(Nis::thaw_private(signed(1), 1, None));
|
||||
assert_noop!(Nis::thaw_private(signed(2), 2, None), Error::<Test>::Throttled);
|
||||
System::run_to_block::<AllPalletsWithSystem>(5);
|
||||
assert_ok!(Nis::thaw_private(signed(2), 2, None));
|
||||
|
||||
assert_ok!(Balances::transfer_allow_death(signed(1), 3, 1));
|
||||
assert_eq!(Balances::free_balance(1), 200);
|
||||
assert_eq!(Balances::free_balance(2), 200);
|
||||
assert_eq!(Balances::total_balance(&1), 200);
|
||||
assert_eq!(Balances::total_balance(&2), 200);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_thaws_works_in_alternative_thaw_order() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(1);
|
||||
assert_ok!(Balances::transfer_allow_death(signed(3), 1, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 60, 1));
|
||||
assert_ok!(Nis::place_bid(signed(2), 50, 1));
|
||||
enlarge(200, 3);
|
||||
|
||||
// Double everyone's free balances.
|
||||
assert_ok!(Balances::mint_into(&2, 50));
|
||||
assert_ok!(Balances::mint_into(&3, 100));
|
||||
assert_ok!(Balances::mint_into(&4, 100));
|
||||
assert_ok!(Nis::fund_deficit(signed(1)));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
assert_ok!(Nis::thaw_private(signed(2), 2, None));
|
||||
assert_noop!(Nis::thaw_private(signed(1), 1, None), Error::<Test>::Throttled);
|
||||
assert_ok!(Nis::thaw_private(signed(1), 0, None));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(5);
|
||||
assert_ok!(Nis::thaw_private(signed(1), 1, None));
|
||||
|
||||
assert_ok!(Balances::transfer_allow_death(signed(1), 3, 1));
|
||||
assert_eq!(Balances::free_balance(1), 200);
|
||||
assert_eq!(Balances::free_balance(2), 200);
|
||||
assert_eq!(Balances::total_balance(&1), 200);
|
||||
assert_eq!(Balances::total_balance(&2), 200);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enlargement_to_target_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::run_to_block::<AllPalletsWithSystem>(2);
|
||||
let w = <() as WeightInfo>::process_queues() +
|
||||
<() as WeightInfo>::process_queue() +
|
||||
(<() as WeightInfo>::process_bid() * 2);
|
||||
super::mock::MaxIntakeWeight::set(w);
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 1));
|
||||
assert_ok!(Nis::place_bid(signed(1), 40, 2));
|
||||
assert_ok!(Nis::place_bid(signed(2), 40, 2));
|
||||
assert_ok!(Nis::place_bid(signed(2), 40, 3));
|
||||
assert_ok!(Nis::place_bid(signed(3), 40, 3));
|
||||
Target::set(Perquintill::from_percent(40));
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(3);
|
||||
assert_eq!(Queues::<Test>::get(1), vec![Bid { amount: 40, who: 1 },]);
|
||||
assert_eq!(
|
||||
Queues::<Test>::get(2),
|
||||
vec![Bid { amount: 40, who: 2 }, Bid { amount: 40, who: 1 },]
|
||||
);
|
||||
assert_eq!(
|
||||
Queues::<Test>::get(3),
|
||||
vec![Bid { amount: 40, who: 3 }, Bid { amount: 40, who: 2 },]
|
||||
);
|
||||
assert_eq!(QueueTotals::<Test>::get(), vec![(1, 40), (2, 80), (2, 80)]);
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(4);
|
||||
// Two new items should have been issued to 2 & 3 for 40 each & duration of 3.
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(0).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((2, 40)),
|
||||
expiry: 13
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(1).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((3, 40)),
|
||||
expiry: 13
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(20),
|
||||
index: 2,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 80,
|
||||
}
|
||||
);
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(5);
|
||||
// No change
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(20),
|
||||
index: 2,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 80,
|
||||
}
|
||||
);
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(6);
|
||||
// Two new items should have been issued to 1 & 2 for 40 each & duration of 2.
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(2).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((1, 40)),
|
||||
expiry: 12
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(3).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((2, 40)),
|
||||
expiry: 12
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(40),
|
||||
index: 4,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 160,
|
||||
}
|
||||
);
|
||||
|
||||
System::run_to_block::<AllPalletsWithSystem>(8);
|
||||
// No change now.
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(40),
|
||||
index: 4,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 160,
|
||||
}
|
||||
);
|
||||
|
||||
// Set target a bit higher to use up the remaining bid.
|
||||
Target::set(Perquintill::from_percent(60));
|
||||
System::run_to_block::<AllPalletsWithSystem>(10);
|
||||
|
||||
// One new item should have been issued to 1 for 40 each & duration of 2.
|
||||
assert_eq!(
|
||||
Receipts::<Test>::get(4).unwrap(),
|
||||
ReceiptRecord {
|
||||
proportion: Perquintill::from_percent(10),
|
||||
owner: Some((1, 40)),
|
||||
expiry: 13
|
||||
}
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Summary::<Test>::get(),
|
||||
SummaryRecord {
|
||||
proportion_owed: Perquintill::from_percent(50),
|
||||
index: 5,
|
||||
last_period: 0,
|
||||
thawed: Perquintill::zero(),
|
||||
receipts_on_hold: 200,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
// 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_nis`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2025-03-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bd5e4dfa0790`, 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_nis
|
||||
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
|
||||
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/nis/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
|
||||
// --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 frame::weights_prelude::*;
|
||||
|
||||
/// Weight functions needed for `pezpallet_nis`.
|
||||
pub trait WeightInfo {
|
||||
fn place_bid(l: u32, ) -> Weight;
|
||||
fn place_bid_max() -> Weight;
|
||||
fn retract_bid(l: u32, ) -> Weight;
|
||||
fn fund_deficit() -> Weight;
|
||||
fn communify() -> Weight;
|
||||
fn privatize() -> Weight;
|
||||
fn thaw_private() -> Weight;
|
||||
fn thaw_communal() -> Weight;
|
||||
fn process_queues() -> Weight;
|
||||
fn process_queue() -> Weight;
|
||||
fn process_bid() -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for `pezpallet_nis` using the Bizinikiwi node and recommended hardware.
|
||||
pub struct BizinikiwiWeight<T>(PhantomData<T>);
|
||||
impl<T: pezframe_system::Config> WeightInfo for BizinikiwiWeight<T> {
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
/// The range of component `l` is `[0, 999]`.
|
||||
fn place_bid(l: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6115 + l * (48 ±0)`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 43_703_000 picoseconds.
|
||||
Weight::from_parts(42_231_449, 51487)
|
||||
// Standard Error: 1_303
|
||||
.saturating_add(Weight::from_parts(92_036, 0).saturating_mul(l.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
fn place_bid_max() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `54117`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 146_230_000 picoseconds.
|
||||
Weight::from_parts(154_165_000, 51487)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
/// The range of component `l` is `[1, 1000]`.
|
||||
fn retract_bid(l: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6115 + l * (48 ±0)`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 43_614_000 picoseconds.
|
||||
Weight::from_parts(37_201_688, 51487)
|
||||
// Standard Error: 1_241
|
||||
.saturating_add(Weight::from_parts(79_738, 0).saturating_mul(l.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Summary` (r:1 w:0)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
fn fund_deficit() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `153`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 29_920_000 picoseconds.
|
||||
Weight::from_parts(30_761_000, 3593)
|
||||
.saturating_add(T::DbWeight::get().reads(2_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, 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:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn communify() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `533`
|
||||
// Estimated: `3892`
|
||||
// Minimum execution time: 71_257_000 picoseconds.
|
||||
Weight::from_parts(72_559_000, 3892)
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(6_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, 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:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
fn privatize() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `699`
|
||||
// Estimated: `3892`
|
||||
// Minimum execution time: 92_578_000 picoseconds.
|
||||
Weight::from_parts(94_495_000, 3892)
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(6_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:0)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
fn thaw_private() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `316`
|
||||
// Estimated: `3892`
|
||||
// Minimum execution time: 48_478_000 picoseconds.
|
||||
Weight::from_parts(49_690_000, 3892)
|
||||
.saturating_add(T::DbWeight::get().reads(4_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, 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:1 w:1)
|
||||
/// 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 thaw_communal() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `642`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 89_681_000 picoseconds.
|
||||
Weight::from_parts(92_693_000, 3675)
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:0)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
fn process_queues() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6563`
|
||||
// Estimated: `7487`
|
||||
// Minimum execution time: 19_670_000 picoseconds.
|
||||
Weight::from_parts(22_353_000, 7487)
|
||||
.saturating_add(T::DbWeight::get().reads(3_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
fn process_queue() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 2_755_000 picoseconds.
|
||||
Weight::from_parts(2_944_000, 51487)
|
||||
.saturating_add(T::DbWeight::get().reads(1_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:0 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
fn process_bid() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_919_000 picoseconds.
|
||||
Weight::from_parts(4_114_000, 0)
|
||||
.saturating_add(T::DbWeight::get().writes(1_u64))
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility and tests.
|
||||
impl WeightInfo for () {
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
/// The range of component `l` is `[0, 999]`.
|
||||
fn place_bid(l: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6115 + l * (48 ±0)`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 43_703_000 picoseconds.
|
||||
Weight::from_parts(42_231_449, 51487)
|
||||
// Standard Error: 1_303
|
||||
.saturating_add(Weight::from_parts(92_036, 0).saturating_mul(l.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
fn place_bid_max() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `54117`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 146_230_000 picoseconds.
|
||||
Weight::from_parts(154_165_000, 51487)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
/// The range of component `l` is `[1, 1000]`.
|
||||
fn retract_bid(l: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6115 + l * (48 ±0)`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 43_614_000 picoseconds.
|
||||
Weight::from_parts(37_201_688, 51487)
|
||||
// Standard Error: 1_241
|
||||
.saturating_add(Weight::from_parts(79_738, 0).saturating_mul(l.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Summary` (r:1 w:0)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
fn fund_deficit() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `153`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 29_920_000 picoseconds.
|
||||
Weight::from_parts(30_761_000, 3593)
|
||||
.saturating_add(RocksDbWeight::get().reads(2_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, 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:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn communify() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `533`
|
||||
// Estimated: `3892`
|
||||
// Minimum execution time: 71_257_000 picoseconds.
|
||||
Weight::from_parts(72_559_000, 3892)
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(6_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, 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:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
fn privatize() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `699`
|
||||
// Estimated: `3892`
|
||||
// Minimum execution time: 92_578_000 picoseconds.
|
||||
Weight::from_parts(94_495_000, 3892)
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(6_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:0)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::Holds` (r:1 w:1)
|
||||
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(427), added: 2902, mode: `MaxEncodedLen`)
|
||||
fn thaw_private() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `316`
|
||||
// Estimated: `3892`
|
||||
// Minimum execution time: 48_478_000 picoseconds.
|
||||
Weight::from_parts(49_690_000, 3892)
|
||||
.saturating_add(RocksDbWeight::get().reads(4_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:1 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, 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:1 w:1)
|
||||
/// 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 thaw_communal() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `642`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 89_681_000 picoseconds.
|
||||
Weight::from_parts(92_693_000, 3675)
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `Nis::Summary` (r:1 w:1)
|
||||
/// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:0)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Nis::QueueTotals` (r:1 w:1)
|
||||
/// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(6002), added: 6497, mode: `MaxEncodedLen`)
|
||||
fn process_queues() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6563`
|
||||
// Estimated: `7487`
|
||||
// Minimum execution time: 19_670_000 picoseconds.
|
||||
Weight::from_parts(22_353_000, 7487)
|
||||
.saturating_add(RocksDbWeight::get().reads(3_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `Nis::Queues` (r:1 w:1)
|
||||
/// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`)
|
||||
fn process_queue() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `51487`
|
||||
// Minimum execution time: 2_755_000 picoseconds.
|
||||
Weight::from_parts(2_944_000, 51487)
|
||||
.saturating_add(RocksDbWeight::get().reads(1_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
/// Storage: `Nis::Receipts` (r:0 w:1)
|
||||
/// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`)
|
||||
fn process_bid() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_919_000 picoseconds.
|
||||
Weight::from_parts(4_114_000, 0)
|
||||
.saturating_add(RocksDbWeight::get().writes(1_u64))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user