mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 23:51:05 +00:00
Ensure correct variant count in Runtime[Hold/Freeze]Reason (#1900)
closes https://github.com/paritytech/polkadot-sdk/issues/1882 ## Breaking Changes This PR introduces a new item to `pallet_balances::Config`: ```diff trait Config { ++ type RuntimeFreezeReasons; } ``` This value is only used to check it against `type MaxFreeze`. A similar check has been added for `MaxHolds` against `RuntimeHoldReasons`, which is already given to `pallet_balances`. In all contexts, you should pass the real `RuntimeFreezeReasons` generated by `construct_runtime` to `type RuntimeFreezeReasons`. Passing `()` would also work, but it would imply that the runtime uses no freezes at all. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -27,7 +27,7 @@ use frame_support::{
|
||||
parameter_types,
|
||||
traits::{
|
||||
fungible, ConstU32, ConstU64, ConstU8, Imbalance as ImbalanceT, OnUnbalanced,
|
||||
StorageMapShim, StoredMap, WhitelistedStorageKeys,
|
||||
StorageMapShim, StoredMap, VariantCount, WhitelistedStorageKeys,
|
||||
},
|
||||
weights::{IdentityFee, Weight},
|
||||
};
|
||||
@@ -70,6 +70,10 @@ pub enum TestId {
|
||||
Baz,
|
||||
}
|
||||
|
||||
impl VariantCount for TestId {
|
||||
const VARIANT_COUNT: u32 = 3;
|
||||
}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Test
|
||||
{
|
||||
@@ -132,9 +136,10 @@ impl Config for Test {
|
||||
type ReserveIdentifier = TestId;
|
||||
type WeightInfo = ();
|
||||
type RuntimeHoldReason = TestId;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
type FreezeIdentifier = TestId;
|
||||
type MaxFreezes = ConstU32<2>;
|
||||
type MaxHolds = ConstU32<2>;
|
||||
type MaxHolds = ConstU32<3>;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
Reference in New Issue
Block a user