Deprecate Currency: Companion for #12951 (#6780)

* Some renames

* Fix

* Fix build for new APIs

* Remove diener

* Fixes

* Fixes

* Fix integration tests

* Fixes

* fix nis issuance

* Update Cargo.toml

* Polkadot doesn't have freezes/holds yet

* No networks use freezes/holds

* update lockfile for {"substrate"}

* Fix tests

There are more failing tests; just starting with the easy ones.
Reserved balance does not count towards ED anymore, therefore reducing
all the reserves by ED (1).

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

* Fixes for Polkadot pallets

* Fix parachains benchmarks

* Update Substrate

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

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Gavin Wood
2023-03-20 13:20:22 +00:00
committed by GitHub
parent 67035d6436
commit 2e656dcd6e
33 changed files with 481 additions and 305 deletions
+32 -5
View File
@@ -34,6 +34,7 @@ use runtime_common::{
paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, BlockLength,
SlowAdjustingFeeUpdate,
};
use scale_info::TypeInfo;
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
use runtime_parachains::{
@@ -281,6 +282,10 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>;
type HoldIdentifier = HoldReason;
type MaxHolds = ConstU32<1>;
}
parameter_types! {
@@ -1169,7 +1174,6 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type ExistentialDeposit = ConstU128<10_000_000_000>; // One RTC cent
type AccountStore = StorageMapShim<
pallet_balances::Account<Runtime, NisCounterpartInstance>,
frame_system::Provider<Runtime>,
AccountId,
pallet_balances::AccountData<u128>,
>;
@@ -1177,10 +1181,13 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type MaxReserves = ConstU32<4>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_nis_counterpart_balances::WeightInfo<Runtime>;
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
parameter_types! {
pub IgnoredIssuance: Balance = Treasury::pot();
pub const NisBasePeriod: BlockNumber = 30 * DAYS;
pub const MinBid: Balance = 100 * UNITS;
pub MinReceipt: Perquintill = Perquintill::from_rational(1u64, 10_000_000u64);
@@ -1189,7 +1196,27 @@ 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 ";
pub const NisHoldReason: HoldReason = HoldReason::Nis(HoldReasonNis::NftReceipt);
}
/// A reason for placing a hold on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, Debug, TypeInfo,
)]
pub enum HoldReason {
/// Some reason of the NIS pallet.
#[codec(index = 38)]
Nis(HoldReasonNis),
}
/// A reason for the NIS pallet placing a hold on funds.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, Debug, TypeInfo,
)]
pub enum HoldReasonNis {
/// The NIS Pallet has reserved it for a non-fungible receipt.
#[codec(index = 0)]
NftReceipt = 0,
}
impl pallet_nis::Config for Runtime {
@@ -1201,7 +1228,7 @@ impl pallet_nis::Config for Runtime {
type Counterpart = NisCounterpartBalances;
type CounterpartAmount = WithMaximumOf<ConstU128<21_000_000_000_000_000_000u128>>;
type Deficit = (); // Mint
type IgnoredIssuance = IgnoredIssuance;
type IgnoredIssuance = ();
type Target = NisTarget;
type PalletId = NisPalletId;
type QueueCount = ConstU32<300>;
@@ -1213,7 +1240,7 @@ impl pallet_nis::Config for Runtime {
type IntakePeriod = IntakePeriod;
type MaxIntakeWeight = MaxIntakeWeight;
type ThawThrottle = ThawThrottle;
type ReserveId = NisReserveId;
type HoldReason = NisHoldReason;
}
parameter_types! {
@@ -45,7 +45,7 @@ use sp_std::marker::PhantomData;
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
fn transfer_allow_death() -> Weight {
// Minimum execution time: 40_106 nanoseconds.
Weight::from_parts(40_750_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
@@ -59,14 +59,14 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
fn force_set_balance_creating() -> Weight {
// Minimum execution time: 23_902 nanoseconds.
Weight::from_parts(24_338_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
fn force_set_balance_killing() -> Weight {
// Minimum execution time: 26_492 nanoseconds.
Weight::from_parts(26_866_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
@@ -93,4 +93,7 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
fn upgrade_accounts(_: u32) -> Weight {
Weight::from_parts(0, 0)
}
}
@@ -51,7 +51,7 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// Storage: NisCounterpartBalances TotalIssuance (r:1 w:1)
/// Proof: NisCounterpartBalances TotalIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn transfer() -> Weight {
fn transfer_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `219`
// Estimated: `11258`
@@ -79,7 +79,7 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: NisCounterpartBalances Account (max_values: None, max_size: Some(112), added: 2587, mode: MaxEncodedLen)
/// Storage: NisCounterpartBalances TotalIssuance (r:1 w:1)
/// Proof: NisCounterpartBalances TotalIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn set_balance_creating() -> Weight {
fn force_set_balance_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `219`
// Estimated: `5078`
@@ -95,7 +95,7 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// Storage: NisCounterpartBalances TotalIssuance (r:1 w:1)
/// Proof: NisCounterpartBalances TotalIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn set_balance_killing() -> Weight {
fn force_set_balance_killing() -> Weight {
// Proof Size summary in bytes:
// Measured: `393`
// Estimated: `8671`
@@ -147,4 +147,7 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
fn upgrade_accounts(_: u32) -> Weight {
Weight::from_parts(0, 0)
}
}