mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 18:51:02 +00:00
Use RuntimeHoldReason for the NIS pallet HoldReason (#7017)
* Use RuntimeHoldReason for the NIS pallet HoldReason * Update substrate * Fixes * Fixes * Fixes * Fixes * Move encoding test to tests.rs
This commit is contained in:
Generated
+183
-183
File diff suppressed because it is too large
Load Diff
@@ -303,7 +303,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||||
type FreezeIdentifier = ();
|
type FreezeIdentifier = ();
|
||||||
type MaxFreezes = ();
|
type MaxFreezes = ();
|
||||||
type HoldIdentifier = HoldReason;
|
type HoldIdentifier = RuntimeHoldReason;
|
||||||
type MaxHolds = ConstU32<1>;
|
type MaxHolds = ConstU32<1>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +929,7 @@ parameter_types! {
|
|||||||
Decode,
|
Decode,
|
||||||
RuntimeDebug,
|
RuntimeDebug,
|
||||||
MaxEncodedLen,
|
MaxEncodedLen,
|
||||||
scale_info::TypeInfo,
|
TypeInfo,
|
||||||
)]
|
)]
|
||||||
pub enum ProxyType {
|
pub enum ProxyType {
|
||||||
Any,
|
Any,
|
||||||
@@ -1258,27 +1258,7 @@ parameter_types! {
|
|||||||
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
|
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
|
||||||
pub storage NisTarget: Perquintill = Perquintill::zero();
|
pub storage NisTarget: Perquintill = Perquintill::zero();
|
||||||
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
|
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
|
||||||
pub const NisHoldReason: HoldReason = HoldReason::Nis(HoldReasonNis::NftReceipt);
|
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::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 {
|
impl pallet_nis::Config for Runtime {
|
||||||
@@ -1408,7 +1388,7 @@ construct_runtime! {
|
|||||||
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 37,
|
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 37,
|
||||||
|
|
||||||
// NIS pallet.
|
// NIS pallet.
|
||||||
Nis: pallet_nis::{Pallet, Call, Storage, Event<T>} = 38,
|
Nis: pallet_nis::{Pallet, Call, Storage, Event<T>, HoldReason} = 38,
|
||||||
// pub type NisCounterpartInstance = pallet_balances::Instance2;
|
// pub type NisCounterpartInstance = pallet_balances::Instance2;
|
||||||
NisCounterpartBalances: pallet_balances::<Instance2> = 45,
|
NisCounterpartBalances: pallet_balances::<Instance2> = 45,
|
||||||
|
|
||||||
@@ -2155,7 +2135,7 @@ sp_api::impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests_fess {
|
mod fees_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use sp_runtime::assert_eq_error_rate;
|
use sp_runtime::assert_eq_error_rate;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ use runtime_common::MinimumMultiplier;
|
|||||||
use separator::Separatable;
|
use separator::Separatable;
|
||||||
use sp_runtime::FixedPointNumber;
|
use sp_runtime::FixedPointNumber;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn nis_hold_reason_encoding_is_correct() {
|
||||||
|
assert_eq!(NisHoldReason::get().encode(), [38, 0]);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn remove_keys_weight_is_sensible() {
|
fn remove_keys_weight_is_sensible() {
|
||||||
use runtime_common::crowdloan::WeightInfo;
|
use runtime_common::crowdloan::WeightInfo;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ impl pallet_balances::Config for Runtime {
|
|||||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||||
type FreezeIdentifier = ();
|
type FreezeIdentifier = ();
|
||||||
type MaxFreezes = ConstU32<1>;
|
type MaxFreezes = ConstU32<1>;
|
||||||
type HoldIdentifier = HoldReason;
|
type HoldIdentifier = RuntimeHoldReason;
|
||||||
type MaxHolds = ConstU32<1>;
|
type MaxHolds = ConstU32<1>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,7 +875,7 @@ parameter_types! {
|
|||||||
Decode,
|
Decode,
|
||||||
RuntimeDebug,
|
RuntimeDebug,
|
||||||
MaxEncodedLen,
|
MaxEncodedLen,
|
||||||
scale_info::TypeInfo,
|
TypeInfo,
|
||||||
)]
|
)]
|
||||||
pub enum ProxyType {
|
pub enum ProxyType {
|
||||||
Any,
|
Any,
|
||||||
@@ -1196,27 +1196,7 @@ parameter_types! {
|
|||||||
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
|
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
|
||||||
pub storage NisTarget: Perquintill = Perquintill::zero();
|
pub storage NisTarget: Perquintill = Perquintill::zero();
|
||||||
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
|
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
|
||||||
pub const NisHoldReason: HoldReason = HoldReason::Nis(HoldReasonNis::NftReceipt);
|
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::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 {
|
impl pallet_nis::Config for Runtime {
|
||||||
@@ -1416,7 +1396,7 @@ construct_runtime! {
|
|||||||
Tips: pallet_tips::{Pallet, Call, Storage, Event<T>} = 36,
|
Tips: pallet_tips::{Pallet, Call, Storage, Event<T>} = 36,
|
||||||
|
|
||||||
// NIS pallet.
|
// NIS pallet.
|
||||||
Nis: pallet_nis::{Pallet, Call, Storage, Event<T>} = 38,
|
Nis: pallet_nis::{Pallet, Call, Storage, Event<T>, HoldReason} = 38,
|
||||||
// pub type NisCounterpartInstance = pallet_balances::Instance2;
|
// pub type NisCounterpartInstance = pallet_balances::Instance2;
|
||||||
NisCounterpartBalances: pallet_balances::<Instance2> = 45,
|
NisCounterpartBalances: pallet_balances::<Instance2> = 45,
|
||||||
|
|
||||||
@@ -2152,6 +2132,16 @@ sp_api::impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod encoding_tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn nis_hold_reason_encoding_is_correct() {
|
||||||
|
assert_eq!(NisHoldReason::get().encode(), [38, 0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(all(test, feature = "try-runtime"))]
|
#[cfg(all(test, feature = "try-runtime"))]
|
||||||
mod remote_tests {
|
mod remote_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user