mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 03:25:41 +00:00
pallet_broker: Let start_sales calculate and request the correct core count (#4221)
This commit is contained in:
@@ -559,27 +559,22 @@ pub mod pallet {
|
||||
///
|
||||
/// - `origin`: Must be Root or pass `AdminOrigin`.
|
||||
/// - `initial_price`: The price of Bulk Coretime in the first sale.
|
||||
/// - `total_core_count`: This is the total number of cores the relay chain should have
|
||||
/// after the sale concludes.
|
||||
/// - `extra_cores`: Number of extra cores that should be requested on top of the cores
|
||||
/// required for `Reservations` and `Leases`.
|
||||
///
|
||||
/// NOTE: This function does not actually request that new core count from the relay chain.
|
||||
/// You need to make sure to call `request_core_count` afterwards to bring the relay chain
|
||||
/// in sync.
|
||||
///
|
||||
/// When to call the function depends on the new core count. If it is larger than what it
|
||||
/// was before, you can call it immediately or even before `start_sales` as non allocated
|
||||
/// cores will just be `Idle`. If you are actually reducing the number of cores, you should
|
||||
/// call `request_core_count`, right before the next sale, to avoid shutting down tasks too
|
||||
/// early.
|
||||
/// This will call [`Self::request_core_count`] internally to set the correct core count on
|
||||
/// the relay chain.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::WeightInfo::start_sales((*total_core_count).into()))]
|
||||
#[pallet::weight(T::WeightInfo::start_sales(
|
||||
T::MaxLeasedCores::get() + T::MaxReservedCores::get() + *extra_cores as u32
|
||||
))]
|
||||
pub fn start_sales(
|
||||
origin: OriginFor<T>,
|
||||
initial_price: BalanceOf<T>,
|
||||
total_core_count: CoreIndex,
|
||||
extra_cores: CoreIndex,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
T::AdminOrigin::ensure_origin_or_root(origin)?;
|
||||
Self::do_start_sales(initial_price, total_core_count)?;
|
||||
Self::do_start_sales(initial_price, extra_cores)?;
|
||||
Ok(Pays::No.into())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user