Skip to content

Commit

Permalink
bench update price
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed May 25, 2024
1 parent 866f64e commit 97f4d23
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pallets/market/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,29 @@ mod benchmarks {
Ok(())
}

#[benchmark]
fn update_region_price() -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();

let region_id = RegionId { begin: 0, core: 0, mask: CoreMask::complete() };
let record: RegionRecordOf<T> = RegionRecord { end: 8, owner: caller.clone(), paid: None };
T::BenchmarkHelper::create_region(region_id, record, caller.clone())?;

crate::Pallet::<T>::list_region(
RawOrigin::Signed(caller.clone()).into(),
region_id,
1_000u32.saturated_into(),
None,
)?;

let new_timeslice_price = 2_000u32.saturated_into();
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), region_id, new_timeslice_price);

assert_last_event::<T>(Event::PriceUpdated { region_id, new_timeslice_price }.into());

Ok(())
}

impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
}

0 comments on commit 97f4d23

Please sign in to comment.