diff --git a/substrate/frame/broker/src/benchmarking.rs b/substrate/frame/broker/src/benchmarking.rs index 7ec8ec6422fa..7f87e76baa94 100644 --- a/substrate/frame/broker/src/benchmarking.rs +++ b/substrate/frame/broker/src/benchmarking.rs @@ -840,23 +840,19 @@ mod benches { Ok(()) })?; - // Advance to the block before the rotate_sale in which the auto-renewals will take place. - advance_to::( - timeslice_period.saturating_mul(config.region_length).saturating_mul(2) - 1, - ); + // Advance to the block before `rotate_sale`. + advance_to::(timeslice_period.saturating_mul(config.region_length) - 1); // Advance one block and manually tick so we can isolate the `rotate_sale` call. - System::::set_block_number( - timeslice_period.saturating_mul(config.region_length.saturating_mul(2)).into(), - ); + System::::set_block_number(timeslice_period.saturating_mul(config.region_length).into()); RCBlockNumberProviderOf::::set_block_number( - timeslice_period.saturating_mul(config.region_length.saturating_mul(2)).into(), + timeslice_period.saturating_mul(config.region_length).into(), ); let mut status = Status::::get().expect("Sale has started."); let sale = SaleInfo::::get().expect("Sale has started."); Broker::::process_core_count(&mut status); Broker::::process_revenue(); - status.last_committed_timeslice = config.region_length.saturating_mul(2); + status.last_committed_timeslice = config.region_length; #[block] { @@ -868,9 +864,9 @@ mod benches { let new_sale = SaleInfo::::get().expect("Sale has started."); let now = RCBlockNumberProviderOf::::current_block_number(); - assert_has_event::( + assert_last_event::( Event::SaleInitialized { - sale_start: new_sale.region_end.into(), + sale_start: new_sale.region_begin.into(), leadin_length: 1u32.into(), start_price: Broker::::sale_price(&new_sale, now), end_price: new_prices.end_price, @@ -896,7 +892,7 @@ mod benches { who, old_core: n_reservations as u16 + n_leases as u16 + indx as u16, core: n_reservations as u16 + n_leases as u16 + indx as u16, - price: 11_000_000u32.into(), // Renewal bump from config. + price: 10_000_000u32.into(), begin: new_sale.region_begin, duration: config.region_length, workload: Schedule::truncate_from(vec![ScheduleItem {