Co #12928: NIS should retain funds in reserve (#6569)

* Add new weight functions

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Configure NIS pallet ReserveId

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Bump

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Gav <gavin@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2023-01-17 16:24:39 +01:00
committed by GitHub
parent d827f59993
commit 78645cacda
5 changed files with 264 additions and 191 deletions
+2
View File
@@ -1275,6 +1275,7 @@ parameter_types! {
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
pub storage NisTarget: Perquintill = Perquintill::zero();
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
pub const NisReserveId: [u8; 8] = *b"py/nis ";
}
impl pallet_nis::Config for Runtime {
@@ -1298,6 +1299,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle;
type ReserveId = NisReserveId;
}
parameter_types! {
@@ -86,15 +86,49 @@ impl<T: frame_system::Config> pallet_nis::WeightInfo for WeightInfo<T> {
}
// Storage: Nis Receipts (r:1 w:1)
// Storage: Nis Summary (r:1 w:1)
// Storage: NisCounterpartBalances Account (r:1 w:1)
// Storage: NisCounterpartBalances TotalIssuance (r:1 w:1)
// Storage: System Account (r:1 w:0)
// Storage: Balances Reserves (r:1 w:1)
fn thaw_private() -> Weight {
// Minimum execution time: 84_000 nanoseconds.
Weight::from_ref_time(85_000_000)
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: Nis Receipts (r:1 w:1)
// Storage: Nis Summary (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn thaw() -> Weight {
// Minimum execution time: 61_305 nanoseconds.
Weight::from_ref_time(61_909_000)
fn thaw_communal() -> Weight {
// Minimum execution time: 108_000 nanoseconds.
Weight::from_ref_time(115_000_000)
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
// Storage: Nis Receipts (r:1 w:1)
// Storage: Nis Summary (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
// Storage: Balances Reserves (r:1 w:1)
fn privatize() -> Weight {
// Minimum execution time: 107_000 nanoseconds.
Weight::from_ref_time(110_000_000)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Nis Receipts (r:1 w:1)
// Storage: Balances Reserves (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: Nis Summary (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn communify() -> Weight {
// Minimum execution time: 89_000 nanoseconds.
Weight::from_ref_time(89_000_000)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
}
// Storage: Nis Summary (r:1 w:1)
// Storage: System Account (r:1 w:0)
// Storage: Nis QueueTotals (r:1 w:1)