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
+1 -1
View File
@@ -101,9 +101,9 @@ impl<T: Config> Pallet<T> {
let last_committed_timeslice = status.last_committed_timeslice;
if region_id.begin <= last_committed_timeslice {
let duration = region.end.saturating_sub(region_id.begin);
region_id.begin = last_committed_timeslice + 1;
if region_id.begin >= region.end {
let duration = region.end.saturating_sub(region_id.begin);
Self::deposit_event(Event::RegionDropped { region_id, duration });
return Ok(None)
}