Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit f4774a5

Browse files
authored
Adds deregister_validators call for propose-parachain (#2615)
1 parent a1e36ec commit f4774a5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

runtime/rococo/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
103103
spec_name: create_runtime_str!("rococo"),
104104
impl_name: create_runtime_str!("parity-rococo-v1-1"),
105105
authoring_version: 0,
106-
spec_version: 210,
106+
spec_version: 215,
107107
impl_version: 0,
108108
#[cfg(not(feature = "disable-runtime-api"))]
109109
apis: RUNTIME_API_VERSIONS,

runtime/rococo/src/propose_parachain.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ decl_event! {
107107
ParachainRegistered(ParaId),
108108
/// New validators were added to the set.
109109
ValidatorsRegistered(Vec<ValidatorId>),
110+
/// Validators were removed from the set.
111+
ValidatorsDeregistered(Vec<ValidatorId>),
110112
}
111113
}
112114

@@ -296,6 +298,8 @@ decl_module! {
296298
}
297299

298300
/// Add new validators to the set.
301+
///
302+
/// The new validators will be active from current session + 2.
299303
#[weight = 100_000]
300304
fn register_validators(
301305
origin,
@@ -307,6 +311,21 @@ decl_module! {
307311

308312
Self::deposit_event(RawEvent::ValidatorsRegistered(validators));
309313
}
314+
315+
/// Remove validators from the set.
316+
///
317+
/// The removed validators will be deactivated from current session + 2.
318+
#[weight = 100_000]
319+
fn deregister_validators(
320+
origin,
321+
validators: Vec<T::ValidatorId>,
322+
) {
323+
T::PriviledgedOrigin::ensure_origin(origin)?;
324+
325+
validators.clone().into_iter().for_each(|v| ValidatorsToRetire::<T>::append(v));
326+
327+
Self::deposit_event(RawEvent::ValidatorsDeregistered(validators));
328+
}
310329
}
311330
}
312331

0 commit comments

Comments
 (0)