diff --git a/crates/pallet-domains/src/tests.rs b/crates/pallet-domains/src/tests.rs index f85b6fb2813..fac4c19788a 100644 --- a/crates/pallet-domains/src/tests.rs +++ b/crates/pallet-domains/src/tests.rs @@ -8,7 +8,6 @@ use crate::{ Operators, ReceiptHashFor, }; use codec::{Decode, Encode, MaxEncodedLen}; -use core::mem; use domain_runtime_primitives::opaque::Header as DomainHeader; use domain_runtime_primitives::BlockNumber as DomainBlockNumber; use frame_support::dispatch::{DispatchInfo, RawOrigin}; @@ -133,11 +132,10 @@ impl pallet_domains::HoldIdentifier for HoldIdentifier { } impl VariantCount for HoldIdentifier { - const VARIANT_COUNT: u32 = mem::variant_count::() as u32; + const VARIANT_COUNT: u32 = 10; } parameter_types! { - pub const MaxHolds: u32 = 10; pub const ExistentialDeposit: Balance = 1; } diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index a6df0c47b2e..8b65e3d4632 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -32,7 +32,6 @@ use crate::fees::{OnChargeTransaction, TransactionByteFee}; use crate::object_mapping::extract_block_object_mapping; pub use crate::signed_extensions::{CheckStorageAccess, DisablePallets}; use codec::{Decode, Encode, MaxEncodedLen}; -use core::mem; use core::num::NonZeroU64; use domain_runtime_primitives::opaque::Header as DomainHeader; use domain_runtime_primitives::{ @@ -408,12 +407,11 @@ impl pallet_messenger::HoldIdentifier for HoldIdentifier { } impl VariantCount for HoldIdentifier { - const VARIANT_COUNT: u32 = mem::variant_count::() as u32; -} - -parameter_types! { - // TODO: revisit this - pub const MaxHolds: u32 = 100; + // TODO: revist this value, it is used as the max number of hold an account can + // create. Currently, nomination an operator will create 2 holds and opening an + // XDM channel will create 1 hold, so this value also used as the limit of how + // many operator/channel an account can nominate/open. + const VARIANT_COUNT: u32 = 100; } impl pallet_balances::Config for Runtime { diff --git a/domains/runtime/auto-id/src/lib.rs b/domains/runtime/auto-id/src/lib.rs index 4bec8f66e92..94b598a85b3 100644 --- a/domains/runtime/auto-id/src/lib.rs +++ b/domains/runtime/auto-id/src/lib.rs @@ -13,7 +13,6 @@ extern crate alloc; #[cfg(not(feature = "std"))] use alloc::format; use codec::{Decode, Encode, MaxEncodedLen}; -use core::mem; use domain_runtime_primitives::opaque::Header; pub use domain_runtime_primitives::{ block_weights, maximum_block_length, opaque, Balance, BlockNumber, Hash, Nonce, @@ -201,10 +200,6 @@ impl OnUnbalanced> for DustRemovalHandler { } } -parameter_types! { - pub const MaxHolds: u32 = 100; -} - impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type MaxLocks = MaxLocks; @@ -354,7 +349,10 @@ pub enum HoldIdentifier { } impl VariantCount for HoldIdentifier { - const VARIANT_COUNT: u32 = mem::variant_count::() as u32; + // TODO: revist this value, it is used as the max number of hold an account can + // create. Currently, opening an XDM channel will create 1 hold, so this value + // also used as the limit of how many channel an account can open. + const VARIANT_COUNT: u32 = 100; } impl pallet_messenger::HoldIdentifier for HoldIdentifier { diff --git a/domains/runtime/evm/src/lib.rs b/domains/runtime/evm/src/lib.rs index ae6dd411e84..b4eac50a500 100644 --- a/domains/runtime/evm/src/lib.rs +++ b/domains/runtime/evm/src/lib.rs @@ -15,7 +15,6 @@ extern crate alloc; #[cfg(not(feature = "std"))] use alloc::format; use codec::{Decode, Encode, MaxEncodedLen}; -use core::mem; use domain_runtime_primitives::opaque::Header; pub use domain_runtime_primitives::{ block_weights, maximum_block_length, opaque, Balance, BlockNumber, Hash, Nonce, @@ -318,10 +317,6 @@ impl OnUnbalanced> for DustRemovalHandler { } } -parameter_types! { - pub const MaxHolds: u32 = 100; -} - impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type MaxLocks = MaxLocks; @@ -468,7 +463,10 @@ pub enum HoldIdentifier { } impl VariantCount for HoldIdentifier { - const VARIANT_COUNT: u32 = mem::variant_count::() as u32; + // TODO: revist this value, it is used as the max number of hold an account can + // create. Currently, opening an XDM channel will create 1 hold, so this value + // also used as the limit of how many channel an account can open. + const VARIANT_COUNT: u32 = 100; } impl pallet_messenger::HoldIdentifier for HoldIdentifier { diff --git a/domains/test/runtime/evm/src/lib.rs b/domains/test/runtime/evm/src/lib.rs index b9875f09cbf..1c139664d1f 100644 --- a/domains/test/runtime/evm/src/lib.rs +++ b/domains/test/runtime/evm/src/lib.rs @@ -15,7 +15,6 @@ extern crate alloc; #[cfg(not(feature = "std"))] use alloc::format; use codec::{Decode, Encode, MaxEncodedLen}; -use core::mem; pub use domain_runtime_primitives::opaque::Header; use domain_runtime_primitives::{ block_weights, maximum_block_length, EXISTENTIAL_DEPOSIT, MAXIMUM_BLOCK_WEIGHT, SLOT_DURATION, @@ -306,10 +305,6 @@ parameter_types! { pub const MaxReserves: u32 = 50; } -parameter_types! { - pub const MaxHolds: u32 = 100; -} - impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type MaxLocks = MaxLocks; @@ -432,7 +427,7 @@ pub enum HoldIdentifier { } impl VariantCount for HoldIdentifier { - const VARIANT_COUNT: u32 = mem::variant_count::() as u32; + const VARIANT_COUNT: u32 = 10; } impl pallet_messenger::HoldIdentifier for HoldIdentifier { diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index f4a5ac1c488..6665f889677 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -24,7 +24,6 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); use codec::{Compact, CompactLen, Decode, Encode, MaxEncodedLen}; -use core::mem; use core::num::NonZeroU64; use domain_runtime_primitives::opaque::Header as DomainHeader; use domain_runtime_primitives::{ @@ -344,11 +343,7 @@ impl pallet_messenger::HoldIdentifier for HoldIdentifier { } impl VariantCount for HoldIdentifier { - const VARIANT_COUNT: u32 = mem::variant_count::() as u32; -} - -parameter_types! { - pub const MaxHolds: u32 = 10; + const VARIANT_COUNT: u32 = 10; } impl pallet_balances::Config for Runtime {