Skip to content

Commit a993513

Browse files
authored
Add docs to request_core_count (#4423)
The fact that this takes two sessions to come into effect is not obvious. Just added some docs to explain that. Also tidied up uses of "broker chain" -> "coretime chain"
1 parent 0044077 commit a993513

File tree

1 file changed

+13
-7
lines changed
  • polkadot/runtime/parachains/src/coretime

1 file changed

+13
-7
lines changed

polkadot/runtime/parachains/src/coretime/mod.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub mod pallet {
106106
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
107107
/// The runtime's definition of a Currency.
108108
type Currency: Currency<Self::AccountId>;
109-
/// The ParaId of the broker system parachain.
109+
/// The ParaId of the coretime chain.
110110
#[pallet::constant]
111111
type BrokerId: Get<u32>;
112112
/// Something that provides the weight of this pallet.
@@ -139,10 +139,16 @@ pub mod pallet {
139139

140140
#[pallet::call]
141141
impl<T: Config> Pallet<T> {
142+
/// Request the configuration to be updated with the specified number of cores. Warning:
143+
/// Since this only schedules a configuration update, it takes two sessions to come into
144+
/// effect.
145+
///
146+
/// - `origin`: Root or the Coretime Chain
147+
/// - `count`: total number of cores
142148
#[pallet::weight(<T as Config>::WeightInfo::request_core_count())]
143149
#[pallet::call_index(1)]
144150
pub fn request_core_count(origin: OriginFor<T>, count: u16) -> DispatchResult {
145-
// Ignore requests not coming from the broker parachain or root.
151+
// Ignore requests not coming from the coretime chain or root.
146152
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
147153

148154
configuration::Pallet::<T>::set_coretime_cores_unchecked(u32::from(count))
@@ -155,7 +161,7 @@ pub mod pallet {
155161
// origin: OriginFor<T>,
156162
// _when: BlockNumberFor<T>,
157163
//) -> DispatchResult {
158-
// // Ignore requests not coming from the broker parachain or root.
164+
// // Ignore requests not coming from the coretime chain or root.
159165
// Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
160166
// Ok(())
161167
//}
@@ -168,7 +174,7 @@ pub mod pallet {
168174
// _who: T::AccountId,
169175
// _amount: BalanceOf<T>,
170176
//) -> DispatchResult {
171-
// // Ignore requests not coming from the broker parachain or root.
177+
// // Ignore requests not coming from the coretime chain or root.
172178
// Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
173179
// Ok(())
174180
//}
@@ -177,7 +183,7 @@ pub mod pallet {
177183
/// to be used.
178184
///
179185
/// Parameters:
180-
/// -`origin`: The `ExternalBrokerOrigin`, assumed to be the Broker system parachain.
186+
/// -`origin`: The `ExternalBrokerOrigin`, assumed to be the coretime chain.
181187
/// -`core`: The core that should be scheduled.
182188
/// -`begin`: The starting blockheight of the instruction.
183189
/// -`assignment`: How the blockspace should be utilised.
@@ -193,7 +199,7 @@ pub mod pallet {
193199
assignment: Vec<(CoreAssignment, PartsOf57600)>,
194200
end_hint: Option<BlockNumberFor<T>>,
195201
) -> DispatchResult {
196-
// Ignore requests not coming from the broker parachain or root.
202+
// Ignore requests not coming from the coretime chain or root.
197203
Self::ensure_root_or_para(origin, T::BrokerId::get().into())?;
198204

199205
let core = u32::from(core).into();
@@ -243,7 +249,7 @@ impl<T: Config> Pallet<T> {
243249
}
244250
}
245251

246-
// Handle legacy swaps in coretime. Notifies broker parachain that a lease swap has occurred via
252+
// Handle legacy swaps in coretime. Notifies coretime chain that a lease swap has occurred via
247253
// XCM message. This function is meant to be used in an implementation of `OnSwap` trait.
248254
pub fn on_legacy_lease_swap(one: ParaId, other: ParaId) {
249255
let message = Xcm(vec![

0 commit comments

Comments
 (0)