Broker pallet: RegionDropped event fix & additional tests (#1609)

This PR includes the following fix:
- [x] The `duration` is always set to zero in the `RegionDropped` event.
This is fixed in this PR.

Also added some additional tests to cover some cases that aren't covered
:
- [x] Selling a partitioned region to the instantaneous coretime pool.
- [x] Partitioning a region after assigning it to a particular task.
- [x] Interlacing a region after assigning it to a particular task.
This commit is contained in:
Sergej Sakac
2023-09-18 12:02:15 +02:00
committed by GitHub
parent 519a0f0688
commit f14bf347e8
3 changed files with 119 additions and 6 deletions
@@ -76,7 +76,7 @@ impl<T: Config> Pallet<T> {
last_timeslice: Self::current_timeslice(),
};
let now = frame_system::Pallet::<T>::block_number();
let dummy_sale = SaleInfoRecord {
let new_sale = SaleInfoRecord {
sale_start: now,
leadin_length: Zero::zero(),
price,
@@ -89,7 +89,7 @@ impl<T: Config> Pallet<T> {
cores_sold: 0,
};
Self::deposit_event(Event::<T>::SalesStarted { price, core_count });
Self::rotate_sale(dummy_sale, &config, &status);
Self::rotate_sale(new_sale, &config, &status);
Status::<T>::put(&status);
Ok(())
}