cumulus: fix test runtimes panic (#2039)

the min slot duration should be 0 only if the `experimental` feature is
enabled. otherwise, the runtime will panic on a division by 0.
This commit is contained in:
Alin Dima
2023-10-26 22:00:51 +03:00
committed by GitHub
parent 21d36b7b42
commit 1b08bdd2dd
5 changed files with 16 additions and 5 deletions
+3 -2
View File
@@ -408,8 +408,9 @@ impl<T: Config> OnTimestampSet<T::Moment> for Pallet<T> {
let timestamp_slot = moment / slot_duration;
let timestamp_slot = Slot::from(timestamp_slot.saturated_into::<u64>());
assert!(
CurrentSlot::<T>::get() == timestamp_slot,
assert_eq!(
CurrentSlot::<T>::get(),
timestamp_slot,
"Timestamp slot must match `CurrentSlot`"
);
}
+3 -2
View File
@@ -900,8 +900,9 @@ impl<T: Config> OnTimestampSet<T::Moment> for Pallet<T> {
let timestamp_slot = moment / slot_duration;
let timestamp_slot = Slot::from(timestamp_slot.saturated_into::<u64>());
assert!(
CurrentSlot::<T>::get() == timestamp_slot,
assert_eq!(
CurrentSlot::<T>::get(),
timestamp_slot,
"Timestamp slot must match `CurrentSlot`"
);
}