Manual Para Lock (#5451)

* remove para lock check for now

* fmt

* manual para lock

* expose schedule_code_upgrade and set_current_head

* extrinsics and benchmarks

* use zero

* add weights

* fix variable name

* add and fix comments

* fix weights

* add back default lock

Co-authored-by: parity-processbot <>
This commit is contained in:
Shawn Tabrizi
2022-10-11 15:22:38 -04:00
committed by GitHub
parent dc555b9510
commit bccffcad12
7 changed files with 236 additions and 31 deletions
+19 -1
View File
@@ -50,7 +50,8 @@ mod mock;
pub use origin::{ensure_parachain, Origin};
pub use paras::ParaLifecycle;
use primitives::v2::Id as ParaId;
use primitives::v2::{HeadData, Id as ParaId, ValidationCode};
use sp_runtime::DispatchResult;
/// Schedule a para to be initialized at the start of the next session with the given genesis data.
///
@@ -78,3 +79,20 @@ pub fn schedule_parathread_upgrade<T: paras::Config>(id: ParaId) -> Result<(), (
pub fn schedule_parachain_downgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
paras::Pallet::<T>::schedule_parachain_downgrade(id).map_err(|_| ())
}
/// Schedules a validation code upgrade to a parachain with the given id.
///
/// This simply calls [`crate::paras::Pallet::schedule_code_upgrade_external`].
pub fn schedule_code_upgrade<T: paras::Config>(
id: ParaId,
new_code: ValidationCode,
) -> DispatchResult {
paras::Pallet::<T>::schedule_code_upgrade_external(id, new_code)
}
/// Sets the current parachain head with the given id.
///
/// This simply calls [`crate::paras::Pallet::set_current_head`].
pub fn set_current_head<T: paras::Config>(id: ParaId, new_head: HeadData) {
paras::Pallet::<T>::set_current_head(id, new_head)
}