diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index 6741d30159..44be9bfac0 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -223,7 +223,7 @@ mod pallet { use frame_support::pallet_prelude::*; use frame_support::traits::fungible::{Inspect, InspectHold, Mutate, MutateHold}; use frame_support::traits::tokens::Preservation; - use frame_support::traits::Randomness as RandomnessT; + use frame_support::traits::{Randomness as RandomnessT, Time}; use frame_support::weights::Weight; use frame_support::{Identity, PalletError}; use frame_system::pallet_prelude::*; @@ -390,6 +390,9 @@ mod pallet { /// Storage fee interface used to deal with bundle storage fee type StorageFee: StorageFee>; + /// The block timestamp + type BlockTimestamp: Time; + /// The block slot type BlockSlot: BlockSlot; @@ -1913,7 +1916,11 @@ mod pallet { Into::::into(Self::extrinsics_shuffling_seed()).to_fixed_bytes(), ); - let timestamp = Moment::default(); + // There is no actual conversion here, but the trait bounds required to prove that + // (and debug-print the error in expect()) are very verbose. + let timestamp = TryInto::::try_into(T::BlockTimestamp::now()) + .map_err(|_| ()) + .expect("Moment is the same type in both pallets; qed"); let invalid_inherent_extrinsic_data = InvalidInherentExtrinsicData { extrinsics_shuffling_seed, diff --git a/crates/pallet-domains/src/tests.rs b/crates/pallet-domains/src/tests.rs index 2459685bd7..20f937a669 100644 --- a/crates/pallet-domains/src/tests.rs +++ b/crates/pallet-domains/src/tests.rs @@ -263,6 +263,7 @@ impl pallet_domains::Config for Test { type Randomness = MockRandomness; type PalletId = DomainsPalletId; type StorageFee = DummyStorageFee; + type BlockTimestamp = pallet_timestamp::Pallet; type BlockSlot = DummyBlockSlot; type DomainsTransfersTracker = MockDomainsTransfersTracker; type MaxInitialDomainAccounts = MaxInitialDomainAccounts; diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index 4908890a6b..c29579b8ca 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -836,6 +836,7 @@ impl pallet_domains::Config for Runtime { type Randomness = Subspace; type PalletId = DomainsPalletId; type StorageFee = TransactionFees; + type BlockTimestamp = pallet_timestamp::Pallet; type BlockSlot = BlockSlot; type BundleLongevity = BundleLongevity; type DomainsTransfersTracker = Transporter; diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index af728ac5a1..8e966f99d0 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -766,6 +766,7 @@ impl pallet_domains::Config for Runtime { type MinNominatorStake = MinNominatorStake; type PalletId = DomainsPalletId; type StorageFee = TransactionFees; + type BlockTimestamp = pallet_timestamp::Pallet; type BlockSlot = BlockSlot; type BundleLongevity = BundleLongevity; type DomainsTransfersTracker = Transporter;