difftreelog
refactor(collator-selection) rename revoke to release + update tx + cargo fmt
in: master
13 files changed
pallets/collator-selection/src/lib.rsdiffbeforeafterboth--- a/pallets/collator-selection/src/lib.rs
+++ b/pallets/collator-selection/src/lib.rs
@@ -217,7 +217,7 @@
let bounded_invulnerables =
BoundedVec::<_, T::MaxCollators>::try_from(self.invulnerables.clone())
.expect("genesis invulnerables are more than T::MaxCollators");
-
+
<Invulnerables<T>>::put(bounded_invulnerables);
}
}
@@ -284,6 +284,7 @@
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Add a collator to the list of invulnerable (fixed) collators.
+ #[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::set_invulnerables(1u32))] // todo:collator weight
pub fn add_invulnerable(
origin: OriginFor<T>,
@@ -313,6 +314,7 @@
}
/// Remove a collator from the list of invulnerable (fixed) collators.
+ #[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::set_invulnerables(1))] // todo:collator weight
pub fn remove_invulnerable(
origin: OriginFor<T>,
@@ -341,6 +343,7 @@
/// (a) already have registered session keys and (b) be able to reserve the `LicenseBond`.
///
/// This call is not available to `Invulnerable` collators.
+ #[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::register_as_candidate(T::MaxCollators::get()))] // todo:collator weight
pub fn get_license(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// register_as_candidate
@@ -373,6 +376,7 @@
/// The account must already hold a license, and cannot offboard immediately during a session.
///
/// This call is not available to `Invulnerable` collators.
+ #[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::register_as_candidate(T::MaxCollators::get()))] // todo:collator weight
pub fn onboard(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// register_as_candidate
@@ -418,6 +422,7 @@
/// Deregister `origin` as a collator candidate. Note that the collator can only leave on
/// session change. The license to `onboard` later at any other time will remain.
+ #[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::leave_intent(T::MaxCollators::get()))] // todo:collator weight
pub fn offboard(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// leave_intent
@@ -430,6 +435,7 @@
/// Forfeit `origin`'s own license. The `LicenseBond` will be unreserved immediately.
///
/// This call is not available to `Invulnerable` collators.
+ #[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::leave_intent(T::MaxCollators::get()))] // todo:collator weight
pub fn release_license(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// leave_intent
@@ -445,8 +451,9 @@
/// The `LicenseBond` will be unreserved and returned immediately.
///
/// This call is, of course, not applicable to `Invulnerable` collators.
+ #[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::leave_intent(T::MaxCollators::get()))] // todo:collator weight
- pub fn force_revoke_license(
+ pub fn force_release_license(
origin: OriginFor<T>,
who: T::AccountId,
) -> DispatchResultWithPostInfo {
pallets/collator-selection/src/mock.rsdiffbeforeafterboth--- a/pallets/collator-selection/src/mock.rs
+++ b/pallets/collator-selection/src/mock.rs
@@ -281,9 +281,7 @@
)
})
.collect::<Vec<_>>();
- let collator_selection = collator_selection::GenesisConfig::<Test> {
- invulnerables,
- };
+ let collator_selection = collator_selection::GenesisConfig::<Test> { invulnerables };
let session = pallet_session::GenesisConfig::<Test> { keys };
pallet_balances::GenesisConfig::<Test> { balances }
.assimilate_storage(&mut t)
pallets/collator-selection/src/tests.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// Copyright (C) 2021 Parity Technologies (UK) Ltd.19// SPDX-License-Identifier: Apache-2.02021// Licensed under the Apache License, Version 2.0 (the "License");22// you may not use this file except in compliance with the License.23// You may obtain a copy of the License at24//25// http://www.apache.org/licenses/LICENSE-2.026//27// Unless required by applicable law or agreed to in writing, software28// distributed under the License is distributed on an "AS IS" BASIS,29// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.30// See the License for the specific language governing permissions and31// limitations under the License.3233use crate as collator_selection;34use crate::{mock::*, Error};35use frame_support::{36 assert_noop, assert_ok,37 traits::{Currency, GenesisBuild, OnInitialize},38};39use frame_system::RawOrigin;40use pallet_balances::Error as BalancesError;41use sp_runtime::traits::BadOrigin;42use pallet_configuration::{43 CollatorSelectionDesiredCollatorsOverride as DesiredCollators,44 CollatorSelectionKickThresholdOverride as KickThreshold,45 CollatorSelectionLicenseBondOverride as LicenseBond,46};4748fn get_license_and_onboard(account_id: <Test as frame_system::Config>::AccountId) {49 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(50 account_id51 )));52 assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(53 account_id54 )));55}5657#[test]58fn basic_setup_works() {59 new_test_ext().execute_with(|| {60 assert_eq!(<DesiredCollators<Test>>::get(), 5);61 assert_eq!(<LicenseBond<Test>>::get(), 10);6263 assert!(CollatorSelection::candidates().is_empty());64 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);65 });66}6768#[test]69fn it_should_add_invulnerables() {70 new_test_ext().execute_with(|| {71 assert_ok!(CollatorSelection::add_invulnerable(72 RuntimeOrigin::signed(RootAccount::get()),73 174 ));75 assert_ok!(CollatorSelection::add_invulnerable(76 RuntimeOrigin::signed(RootAccount::get()),77 278 ));79 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);8081 // cannot set with non-root.82 assert_noop!(83 CollatorSelection::add_invulnerable(RuntimeOrigin::signed(1), 3),84 BadOrigin85 );8687 // cannot set invulnerables without associated validator keys88 assert_noop!(89 CollatorSelection::add_invulnerable(RuntimeOrigin::signed(RootAccount::get()), 7),90 Error::<Test>::ValidatorNotRegistered91 );92 });93}9495#[test]96fn it_should_remove_invulnerables() {97 new_test_ext().execute_with(|| {98 assert_ok!(CollatorSelection::add_invulnerable(99 RuntimeOrigin::signed(RootAccount::get()),100 1101 ));102 assert_ok!(CollatorSelection::add_invulnerable(103 RuntimeOrigin::signed(RootAccount::get()),104 2105 ));106107 // cannot remove with non-root.108 assert_noop!(109 CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(1), 3),110 BadOrigin111 );112113 assert_ok!(CollatorSelection::remove_invulnerable(114 RuntimeOrigin::signed(RootAccount::get()),115 2116 ));117 assert_eq!(CollatorSelection::invulnerables(), vec![1]);118119 // cannot remove an invulnerable if there would be 0 invulnerables.120 assert_noop!(121 CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(RootAccount::get()), 1),122 Error::<Test>::TooFewInvulnerables123 );124 });125}126127#[test]128fn set_desired_collators_works() {129 new_test_ext().execute_with(|| {130 // given131 assert_eq!(<DesiredCollators<Test>>::get(), 5);132133 // can set134 assert_ok!(Configuration::set_collator_selection_desired_collators(135 RawOrigin::Root.into(),136 Some(7)137 ));138 assert_eq!(<DesiredCollators<Test>>::get(), 7);139140 // rejects bad origin141 assert_noop!(142 Configuration::set_collator_selection_desired_collators(143 RuntimeOrigin::signed(1),144 Some(8)145 ),146 BadOrigin147 );148 });149}150151#[test]152fn set_license_bond() {153 new_test_ext().execute_with(|| {154 // given155 assert_eq!(<LicenseBond<Test>>::get(), 10);156157 // can set158 assert_ok!(Configuration::set_collator_selection_license_bond(159 RawOrigin::Root.into(),160 Some(7)161 ));162 assert_eq!(<LicenseBond<Test>>::get(), 7);163164 // rejects bad origin.165 assert_noop!(166 Configuration::set_collator_selection_license_bond(RuntimeOrigin::signed(1), Some(8)),167 BadOrigin168 );169 });170}171172#[test]173fn cannot_onboard_candidate_with_no_license() {174 new_test_ext().execute_with(|| {175 // can't onboard a candidate who did not get a license.176 assert_noop!(177 CollatorSelection::onboard(RuntimeOrigin::signed(3)),178 Error::<Test>::NoLicense,179 );180181 // but give it a license and welcome aboard.182 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));183 assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(3)));184 })185}186187#[test]188fn cannot_onboard_candidate_if_too_many() {189 new_test_ext().execute_with(|| {190 // reset desired candidates191 <pallet_configuration::CollatorSelectionDesiredCollatorsOverride<Test>>::put(0);192193 // can still get a license.194 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(4)));195196 // can't accept anyone anymore.197 assert_noop!(198 CollatorSelection::onboard(RuntimeOrigin::signed(4)),199 Error::<Test>::TooManyCandidates,200 );201202 // reset desired candidates to invulnerables + 1203 <pallet_configuration::CollatorSelectionDesiredCollatorsOverride<Test>>::put(3);204 assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(4)));205206 // but no more.207 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(5)));208 assert_noop!(209 CollatorSelection::onboard(RuntimeOrigin::signed(5)),210 Error::<Test>::TooManyCandidates,211 );212 })213}214215#[test]216fn cannot_obtain_license_if_keys_not_registered() {217 new_test_ext().execute_with(|| {218 // can't 7 because keys not registered.219 assert_noop!(220 CollatorSelection::get_license(RuntimeOrigin::signed(7)),221 Error::<Test>::ValidatorNotRegistered222 );223 })224}225226#[test]227fn cannot_obtain_license_if_poor() {228 new_test_ext().execute_with(|| {229 assert_eq!(Balances::free_balance(&3), 100);230 assert_eq!(Balances::free_balance(&33), 0);231232 // works233 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));234235 // poor236 assert_noop!(237 CollatorSelection::get_license(RuntimeOrigin::signed(33)),238 BalancesError::<Test>::InsufficientBalance,239 );240 });241}242243#[test]244fn cannot_onboard_dupe_candidate() {245 new_test_ext().execute_with(|| {246 // can add 3 as candidate247 get_license_and_onboard(3);248 assert_eq!(CollatorSelection::license_deposit_of(3), 10);249 assert_eq!(CollatorSelection::candidates(), vec![3]);250 assert_eq!(CollatorSelection::last_authored_block(3), 10);251 assert_eq!(Balances::free_balance(3), 90);252253 // but no more254 assert_noop!(255 CollatorSelection::get_license(RuntimeOrigin::signed(3)),256 Error::<Test>::AlreadyHoldingLicense,257 );258 assert_noop!(259 CollatorSelection::onboard(RuntimeOrigin::signed(3)),260 Error::<Test>::AlreadyCandidate,261 );262 })263}264265#[test]266fn becoming_candidate_works() {267 new_test_ext().execute_with(|| {268 // given269 assert_eq!(<DesiredCollators<Test>>::get(), 5);270 assert_eq!(<LicenseBond<Test>>::get(), 10);271 assert_eq!(CollatorSelection::candidates(), Vec::new());272 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);273274 // take two endowed, non-invulnerables accounts.275 assert_eq!(Balances::free_balance(&3), 100);276 assert_eq!(Balances::free_balance(&4), 100);277278 get_license_and_onboard(3);279 get_license_and_onboard(4);280281 assert_eq!(Balances::free_balance(&3), 90);282 assert_eq!(Balances::free_balance(&4), 90);283284 assert_eq!(CollatorSelection::candidates().len(), 2);285 });286}287288#[test]289fn cannot_become_candidate_if_invulnerable() {290 new_test_ext().execute_with(|| {291 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);292293 // can obtain a license even if is invulnerable.294 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(1)));295 // but cannot onboard296 assert_noop!(297 CollatorSelection::onboard(RuntimeOrigin::signed(1)),298 Error::<Test>::AlreadyInvulnerable,299 );300301 // get a license and then become invulnerable.302 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));303 assert_ok!(CollatorSelection::add_invulnerable(304 RuntimeOrigin::signed(RootAccount::get()),305 3306 ));307 assert_noop!(308 CollatorSelection::onboard(RuntimeOrigin::signed(3)),309 Error::<Test>::AlreadyInvulnerable,310 );311 })312}313314#[test]315fn can_become_invulnerable_if_candidate() {316 new_test_ext().execute_with(|| {317 // become a candidate and then become invulnerable.318 get_license_and_onboard(3);319 assert_eq!(CollatorSelection::candidates(), vec![3]);320321 assert_ok!(CollatorSelection::add_invulnerable(322 RuntimeOrigin::signed(RootAccount::get()),323 3324 ));325 // should exclude from candidates, but not revoke the license326 assert_eq!(CollatorSelection::candidates(), vec![]);327 assert_eq!(CollatorSelection::license_deposit_of(3), 10);328 assert_eq!(Balances::free_balance(3), 90);329 });330}331332#[test]333fn offboard() {334 new_test_ext().execute_with(|| {335 // register a candidate.336 get_license_and_onboard(3);337 assert_eq!(Balances::free_balance(3), 90);338339 // cannot leave if holds license but not yet candidate.340 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(4)));341 assert_noop!(342 CollatorSelection::offboard(RuntimeOrigin::signed(4)),343 Error::<Test>::NotCandidate344 );345 // cannot leave if does not hold license.346 assert_noop!(347 CollatorSelection::offboard(RuntimeOrigin::signed(5)),348 Error::<Test>::NotCandidate349 );350351 // bond is returned - only after releasing the license352 assert_ok!(CollatorSelection::offboard(RuntimeOrigin::signed(3)));353 assert_eq!(Balances::free_balance(3), 90);354 assert_eq!(CollatorSelection::last_authored_block(3), 0);355 assert_ok!(CollatorSelection::release_license(RuntimeOrigin::signed(3)));356 assert_eq!(Balances::free_balance(3), 100);357 });358}359360#[test]361fn release_license() {362 new_test_ext().execute_with(|| {363 // obtain a license to collate and reserve the bond.364 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));365 assert_eq!(Balances::free_balance(3), 90);366367 // release the license and get the bond back.368 assert_ok!(CollatorSelection::release_license(RuntimeOrigin::signed(3)));369 assert_eq!(Balances::free_balance(3), 100);370371 // register a candidate.372 get_license_and_onboard(3);373 assert_eq!(Balances::free_balance(3), 90);374375 // can release license even if onboarded.376 assert_ok!(CollatorSelection::release_license(RuntimeOrigin::signed(3)));377 assert_eq!(Balances::free_balance(3), 100);378 assert_eq!(CollatorSelection::candidates(), vec![]);379 });380}381382#[test]383fn force_revoke_license() {384 new_test_ext().execute_with(|| {385 // obtain a license to collate and reserve the bond.386 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));387 assert_eq!(Balances::free_balance(3), 90);388389 // cannot execute the operation as non-root390 assert_noop!(391 CollatorSelection::force_revoke_license(RuntimeOrigin::signed(3), 3),392 BadOrigin393 );394395 // release the license and get the bond back.396 assert_ok!(CollatorSelection::force_revoke_license(397 RuntimeOrigin::signed(RootAccount::get()),398 3399 ));400 assert_eq!(Balances::free_balance(3), 100);401402 // register a candidate.403 get_license_and_onboard(3);404 assert_eq!(Balances::free_balance(3), 90);405406 // can release license even if onboarded.407 assert_ok!(CollatorSelection::force_revoke_license(408 RuntimeOrigin::signed(RootAccount::get()),409 3410 ));411 assert_eq!(Balances::free_balance(3), 100);412 assert_eq!(CollatorSelection::candidates(), vec![]);413 });414}415416#[test]417fn authorship_event_handler() {418 new_test_ext().execute_with(|| {419 // put 100 in the pot + 5 for ED420 Balances::make_free_balance_be(&CollatorSelection::account_id(), 105);421422 // 4 is the default author.423 assert_eq!(Balances::free_balance(4), 100);424 get_license_and_onboard(4);425 // triggers `note_author`426 Authorship::on_initialize(1);427428 assert_eq!(CollatorSelection::candidates(), vec![4]);429 assert_eq!(CollatorSelection::last_authored_block(4), 0);430431 // half of the pot goes to the collator who's the author (4 in tests).432 assert_eq!(Balances::free_balance(4), 140);433 // half + ED stays.434 assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 55);435 });436}437438#[test]439fn fees_edgecases() {440 new_test_ext().execute_with(|| {441 // Nothing panics, no reward when no ED in balance442 Authorship::on_initialize(1);443 // put some money into the pot at ED444 Balances::make_free_balance_be(&CollatorSelection::account_id(), 5);445 // 4 is the default author.446 assert_eq!(Balances::free_balance(4), 100);447 get_license_and_onboard(4);448 // triggers `note_author`449 Authorship::on_initialize(1);450451 assert_eq!(CollatorSelection::candidates(), vec![4]);452 assert_eq!(CollatorSelection::last_authored_block(4), 0);453 // Nothing received454 assert_eq!(Balances::free_balance(4), 90);455 // all fee stays456 assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 5);457 });458}459460#[test]461fn session_management_works() {462 new_test_ext().execute_with(|| {463 initialize_to_block(1);464465 assert_eq!(SessionChangeBlock::get(), 0);466 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);467468 initialize_to_block(4);469470 assert_eq!(SessionChangeBlock::get(), 0);471 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);472473 // add a new collator474 get_license_and_onboard(5);475476 // session won't see this.477 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);478 // but we have a new candidate.479 assert_eq!(CollatorSelection::candidates().len(), 1);480481 initialize_to_block(10);482 assert_eq!(SessionChangeBlock::get(), 10);483 // pallet-session has 1 session delay; current validators are the same.484 assert_eq!(Session::validators(), vec![1, 2]);485 // queued ones are changed, and now we have 3.486 assert_eq!(Session::queued_keys().len(), 3);487 // session handlers (aura, et. al.) cannot see this yet.488 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);489490 initialize_to_block(20);491 assert_eq!(SessionChangeBlock::get(), 20);492 // changed are now reflected to session handlers.493 assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 5]);494 });495}496497#[test]498fn kick_mechanism() {499 new_test_ext().execute_with(|| {500 // add a new collator501 get_license_and_onboard(3);502 get_license_and_onboard(4);503504 initialize_to_block(10);505 assert_eq!(CollatorSelection::candidates().len(), 2);506507 initialize_to_block(20);508 assert_eq!(SessionChangeBlock::get(), 20);509 // 4 authored this block, gets to stay 3 was kicked510 assert_eq!(CollatorSelection::candidates().len(), 1);511 // 3 will be kicked after 1 session delay512 assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 3, 4]);513514 assert_eq!(CollatorSelection::candidates(), vec![4]);515 assert_eq!(<KickThreshold<Test>>::get(), 10);516 assert_eq!(CollatorSelection::last_authored_block(4), 20);517518 initialize_to_block(30);519 // 3 gets kicked after 1 session delay520 assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 4]);521 // kicked collator gets their funds slashed, the deposit going to treasury522 assert_eq!(Balances::free_balance(3), 90);523 });524}525526#[test]527#[should_panic = "duplicate invulnerables in genesis."]528fn cannot_set_genesis_value_twice() {529 sp_tracing::try_init_simple();530 let mut t = frame_system::GenesisConfig::default()531 .build_storage::<Test>()532 .unwrap();533 let invulnerables = vec![1, 1];534535 let collator_selection = collator_selection::GenesisConfig::<Test> {536 invulnerables,537 };538 // collator selection must be initialized before session.539 collator_selection.assimilate_storage(&mut t).unwrap();540}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// Copyright (C) 2021 Parity Technologies (UK) Ltd.19// SPDX-License-Identifier: Apache-2.02021// Licensed under the Apache License, Version 2.0 (the "License");22// you may not use this file except in compliance with the License.23// You may obtain a copy of the License at24//25// http://www.apache.org/licenses/LICENSE-2.026//27// Unless required by applicable law or agreed to in writing, software28// distributed under the License is distributed on an "AS IS" BASIS,29// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.30// See the License for the specific language governing permissions and31// limitations under the License.3233use crate as collator_selection;34use crate::{mock::*, Error};35use frame_support::{36 assert_noop, assert_ok,37 traits::{Currency, GenesisBuild, OnInitialize},38};39use frame_system::RawOrigin;40use pallet_balances::Error as BalancesError;41use sp_runtime::traits::BadOrigin;42use pallet_configuration::{43 CollatorSelectionDesiredCollatorsOverride as DesiredCollators,44 CollatorSelectionKickThresholdOverride as KickThreshold,45 CollatorSelectionLicenseBondOverride as LicenseBond,46};4748fn get_license_and_onboard(account_id: <Test as frame_system::Config>::AccountId) {49 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(50 account_id51 )));52 assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(53 account_id54 )));55}5657#[test]58fn basic_setup_works() {59 new_test_ext().execute_with(|| {60 assert_eq!(<DesiredCollators<Test>>::get(), 5);61 assert_eq!(<LicenseBond<Test>>::get(), 10);6263 assert!(CollatorSelection::candidates().is_empty());64 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);65 });66}6768#[test]69fn it_should_add_invulnerables() {70 new_test_ext().execute_with(|| {71 assert_ok!(CollatorSelection::add_invulnerable(72 RuntimeOrigin::signed(RootAccount::get()),73 174 ));75 assert_ok!(CollatorSelection::add_invulnerable(76 RuntimeOrigin::signed(RootAccount::get()),77 278 ));79 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);8081 // cannot set with non-root.82 assert_noop!(83 CollatorSelection::add_invulnerable(RuntimeOrigin::signed(1), 3),84 BadOrigin85 );8687 // cannot set invulnerables without associated validator keys88 assert_noop!(89 CollatorSelection::add_invulnerable(RuntimeOrigin::signed(RootAccount::get()), 7),90 Error::<Test>::ValidatorNotRegistered91 );92 });93}9495#[test]96fn it_should_remove_invulnerables() {97 new_test_ext().execute_with(|| {98 assert_ok!(CollatorSelection::add_invulnerable(99 RuntimeOrigin::signed(RootAccount::get()),100 1101 ));102 assert_ok!(CollatorSelection::add_invulnerable(103 RuntimeOrigin::signed(RootAccount::get()),104 2105 ));106107 // cannot remove with non-root.108 assert_noop!(109 CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(1), 3),110 BadOrigin111 );112113 assert_ok!(CollatorSelection::remove_invulnerable(114 RuntimeOrigin::signed(RootAccount::get()),115 2116 ));117 assert_eq!(CollatorSelection::invulnerables(), vec![1]);118119 // cannot remove an invulnerable if there would be 0 invulnerables.120 assert_noop!(121 CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(RootAccount::get()), 1),122 Error::<Test>::TooFewInvulnerables123 );124 });125}126127#[test]128fn set_desired_collators_works() {129 new_test_ext().execute_with(|| {130 // given131 assert_eq!(<DesiredCollators<Test>>::get(), 5);132133 // can set134 assert_ok!(Configuration::set_collator_selection_desired_collators(135 RawOrigin::Root.into(),136 Some(7)137 ));138 assert_eq!(<DesiredCollators<Test>>::get(), 7);139140 // rejects bad origin141 assert_noop!(142 Configuration::set_collator_selection_desired_collators(143 RuntimeOrigin::signed(1),144 Some(8)145 ),146 BadOrigin147 );148 });149}150151#[test]152fn set_license_bond() {153 new_test_ext().execute_with(|| {154 // given155 assert_eq!(<LicenseBond<Test>>::get(), 10);156157 // can set158 assert_ok!(Configuration::set_collator_selection_license_bond(159 RawOrigin::Root.into(),160 Some(7)161 ));162 assert_eq!(<LicenseBond<Test>>::get(), 7);163164 // rejects bad origin.165 assert_noop!(166 Configuration::set_collator_selection_license_bond(RuntimeOrigin::signed(1), Some(8)),167 BadOrigin168 );169 });170}171172#[test]173fn cannot_onboard_candidate_with_no_license() {174 new_test_ext().execute_with(|| {175 // can't onboard a candidate who did not get a license.176 assert_noop!(177 CollatorSelection::onboard(RuntimeOrigin::signed(3)),178 Error::<Test>::NoLicense,179 );180181 // but give it a license and welcome aboard.182 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));183 assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(3)));184 })185}186187#[test]188fn cannot_onboard_candidate_if_too_many() {189 new_test_ext().execute_with(|| {190 // reset desired candidates191 <pallet_configuration::CollatorSelectionDesiredCollatorsOverride<Test>>::put(0);192193 // can still get a license.194 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(4)));195196 // can't accept anyone anymore.197 assert_noop!(198 CollatorSelection::onboard(RuntimeOrigin::signed(4)),199 Error::<Test>::TooManyCandidates,200 );201202 // reset desired candidates to invulnerables + 1203 <pallet_configuration::CollatorSelectionDesiredCollatorsOverride<Test>>::put(3);204 assert_ok!(CollatorSelection::onboard(RuntimeOrigin::signed(4)));205206 // but no more.207 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(5)));208 assert_noop!(209 CollatorSelection::onboard(RuntimeOrigin::signed(5)),210 Error::<Test>::TooManyCandidates,211 );212 })213}214215#[test]216fn cannot_obtain_license_if_keys_not_registered() {217 new_test_ext().execute_with(|| {218 // can't 7 because keys not registered.219 assert_noop!(220 CollatorSelection::get_license(RuntimeOrigin::signed(7)),221 Error::<Test>::ValidatorNotRegistered222 );223 })224}225226#[test]227fn cannot_obtain_license_if_poor() {228 new_test_ext().execute_with(|| {229 assert_eq!(Balances::free_balance(&3), 100);230 assert_eq!(Balances::free_balance(&33), 0);231232 // works233 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));234235 // poor236 assert_noop!(237 CollatorSelection::get_license(RuntimeOrigin::signed(33)),238 BalancesError::<Test>::InsufficientBalance,239 );240 });241}242243#[test]244fn cannot_onboard_dupe_candidate() {245 new_test_ext().execute_with(|| {246 // can add 3 as candidate247 get_license_and_onboard(3);248 assert_eq!(CollatorSelection::license_deposit_of(3), 10);249 assert_eq!(CollatorSelection::candidates(), vec![3]);250 assert_eq!(CollatorSelection::last_authored_block(3), 10);251 assert_eq!(Balances::free_balance(3), 90);252253 // but no more254 assert_noop!(255 CollatorSelection::get_license(RuntimeOrigin::signed(3)),256 Error::<Test>::AlreadyHoldingLicense,257 );258 assert_noop!(259 CollatorSelection::onboard(RuntimeOrigin::signed(3)),260 Error::<Test>::AlreadyCandidate,261 );262 })263}264265#[test]266fn becoming_candidate_works() {267 new_test_ext().execute_with(|| {268 // given269 assert_eq!(<DesiredCollators<Test>>::get(), 5);270 assert_eq!(<LicenseBond<Test>>::get(), 10);271 assert_eq!(CollatorSelection::candidates(), Vec::new());272 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);273274 // take two endowed, non-invulnerables accounts.275 assert_eq!(Balances::free_balance(&3), 100);276 assert_eq!(Balances::free_balance(&4), 100);277278 get_license_and_onboard(3);279 get_license_and_onboard(4);280281 assert_eq!(Balances::free_balance(&3), 90);282 assert_eq!(Balances::free_balance(&4), 90);283284 assert_eq!(CollatorSelection::candidates().len(), 2);285 });286}287288#[test]289fn cannot_become_candidate_if_invulnerable() {290 new_test_ext().execute_with(|| {291 assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]);292293 // can obtain a license even if is invulnerable.294 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(1)));295 // but cannot onboard296 assert_noop!(297 CollatorSelection::onboard(RuntimeOrigin::signed(1)),298 Error::<Test>::AlreadyInvulnerable,299 );300301 // get a license and then become invulnerable.302 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));303 assert_ok!(CollatorSelection::add_invulnerable(304 RuntimeOrigin::signed(RootAccount::get()),305 3306 ));307 assert_noop!(308 CollatorSelection::onboard(RuntimeOrigin::signed(3)),309 Error::<Test>::AlreadyInvulnerable,310 );311 })312}313314#[test]315fn can_become_invulnerable_if_candidate() {316 new_test_ext().execute_with(|| {317 // become a candidate and then become invulnerable.318 get_license_and_onboard(3);319 assert_eq!(CollatorSelection::candidates(), vec![3]);320321 assert_ok!(CollatorSelection::add_invulnerable(322 RuntimeOrigin::signed(RootAccount::get()),323 3324 ));325 // should exclude from candidates, but not revoke the license326 assert_eq!(CollatorSelection::candidates(), vec![]);327 assert_eq!(CollatorSelection::license_deposit_of(3), 10);328 assert_eq!(Balances::free_balance(3), 90);329 });330}331332#[test]333fn offboard() {334 new_test_ext().execute_with(|| {335 // register a candidate.336 get_license_and_onboard(3);337 assert_eq!(Balances::free_balance(3), 90);338339 // cannot leave if holds license but not yet candidate.340 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(4)));341 assert_noop!(342 CollatorSelection::offboard(RuntimeOrigin::signed(4)),343 Error::<Test>::NotCandidate344 );345 // cannot leave if does not hold license.346 assert_noop!(347 CollatorSelection::offboard(RuntimeOrigin::signed(5)),348 Error::<Test>::NotCandidate349 );350351 // bond is returned - only after releasing the license352 assert_ok!(CollatorSelection::offboard(RuntimeOrigin::signed(3)));353 assert_eq!(Balances::free_balance(3), 90);354 assert_eq!(CollatorSelection::last_authored_block(3), 0);355 assert_ok!(CollatorSelection::release_license(RuntimeOrigin::signed(3)));356 assert_eq!(Balances::free_balance(3), 100);357 });358}359360#[test]361fn release_license() {362 new_test_ext().execute_with(|| {363 // obtain a license to collate and reserve the bond.364 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));365 assert_eq!(Balances::free_balance(3), 90);366367 // release the license and get the bond back.368 assert_ok!(CollatorSelection::release_license(RuntimeOrigin::signed(3)));369 assert_eq!(Balances::free_balance(3), 100);370371 // register a candidate.372 get_license_and_onboard(3);373 assert_eq!(Balances::free_balance(3), 90);374375 // can release license even if onboarded.376 assert_ok!(CollatorSelection::release_license(RuntimeOrigin::signed(3)));377 assert_eq!(Balances::free_balance(3), 100);378 assert_eq!(CollatorSelection::candidates(), vec![]);379 });380}381382#[test]383fn force_release_license() {384 new_test_ext().execute_with(|| {385 // obtain a license to collate and reserve the bond.386 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(3)));387 assert_eq!(Balances::free_balance(3), 90);388389 // cannot execute the operation as non-root390 assert_noop!(391 CollatorSelection::force_release_license(RuntimeOrigin::signed(3), 3),392 BadOrigin393 );394395 // release the license and get the bond back.396 assert_ok!(CollatorSelection::force_release_license(397 RuntimeOrigin::signed(RootAccount::get()),398 3399 ));400 assert_eq!(Balances::free_balance(3), 100);401402 // register a candidate.403 get_license_and_onboard(3);404 assert_eq!(Balances::free_balance(3), 90);405406 // can release license even if onboarded.407 assert_ok!(CollatorSelection::force_release_license(408 RuntimeOrigin::signed(RootAccount::get()),409 3410 ));411 assert_eq!(Balances::free_balance(3), 100);412 assert_eq!(CollatorSelection::candidates(), vec![]);413 });414}415416#[test]417fn authorship_event_handler() {418 new_test_ext().execute_with(|| {419 // put 100 in the pot + 5 for ED420 Balances::make_free_balance_be(&CollatorSelection::account_id(), 105);421422 // 4 is the default author.423 assert_eq!(Balances::free_balance(4), 100);424 get_license_and_onboard(4);425 // triggers `note_author`426 Authorship::on_initialize(1);427428 assert_eq!(CollatorSelection::candidates(), vec![4]);429 assert_eq!(CollatorSelection::last_authored_block(4), 0);430431 // half of the pot goes to the collator who's the author (4 in tests).432 assert_eq!(Balances::free_balance(4), 140);433 // half + ED stays.434 assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 55);435 });436}437438#[test]439fn fees_edgecases() {440 new_test_ext().execute_with(|| {441 // Nothing panics, no reward when no ED in balance442 Authorship::on_initialize(1);443 // put some money into the pot at ED444 Balances::make_free_balance_be(&CollatorSelection::account_id(), 5);445 // 4 is the default author.446 assert_eq!(Balances::free_balance(4), 100);447 get_license_and_onboard(4);448 // triggers `note_author`449 Authorship::on_initialize(1);450451 assert_eq!(CollatorSelection::candidates(), vec![4]);452 assert_eq!(CollatorSelection::last_authored_block(4), 0);453 // Nothing received454 assert_eq!(Balances::free_balance(4), 90);455 // all fee stays456 assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 5);457 });458}459460#[test]461fn session_management_works() {462 new_test_ext().execute_with(|| {463 initialize_to_block(1);464465 assert_eq!(SessionChangeBlock::get(), 0);466 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);467468 initialize_to_block(4);469470 assert_eq!(SessionChangeBlock::get(), 0);471 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);472473 // add a new collator474 get_license_and_onboard(5);475476 // session won't see this.477 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);478 // but we have a new candidate.479 assert_eq!(CollatorSelection::candidates().len(), 1);480481 initialize_to_block(10);482 assert_eq!(SessionChangeBlock::get(), 10);483 // pallet-session has 1 session delay; current validators are the same.484 assert_eq!(Session::validators(), vec![1, 2]);485 // queued ones are changed, and now we have 3.486 assert_eq!(Session::queued_keys().len(), 3);487 // session handlers (aura, et. al.) cannot see this yet.488 assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);489490 initialize_to_block(20);491 assert_eq!(SessionChangeBlock::get(), 20);492 // changed are now reflected to session handlers.493 assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 5]);494 });495}496497#[test]498fn kick_mechanism() {499 new_test_ext().execute_with(|| {500 // add a new collator501 get_license_and_onboard(3);502 get_license_and_onboard(4);503504 initialize_to_block(10);505 assert_eq!(CollatorSelection::candidates().len(), 2);506507 initialize_to_block(20);508 assert_eq!(SessionChangeBlock::get(), 20);509 // 4 authored this block, gets to stay 3 was kicked510 assert_eq!(CollatorSelection::candidates().len(), 1);511 // 3 will be kicked after 1 session delay512 assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 3, 4]);513514 assert_eq!(CollatorSelection::candidates(), vec![4]);515 assert_eq!(<KickThreshold<Test>>::get(), 10);516 assert_eq!(CollatorSelection::last_authored_block(4), 20);517518 initialize_to_block(30);519 // 3 gets kicked after 1 session delay520 assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 4]);521 // kicked collator gets their funds slashed, the deposit going to treasury522 assert_eq!(Balances::free_balance(3), 90);523 });524}525526#[test]527#[should_panic = "duplicate invulnerables in genesis."]528fn cannot_set_genesis_value_twice() {529 sp_tracing::try_init_simple();530 let mut t = frame_system::GenesisConfig::default()531 .build_storage::<Test>()532 .unwrap();533 let invulnerables = vec![1, 1];534535 let collator_selection = collator_selection::GenesisConfig::<Test> { invulnerables };536 // collator selection must be initialized before session.537 collator_selection.assimilate_storage(&mut t).unwrap();538}pallets/configuration/src/lib.rsdiffbeforeafterboth--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -201,6 +201,7 @@
Ok(())
}
+ #[pallet::call_index(4)]
#[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_collator_selection_desired_collators(
origin: OriginFor<T>,
@@ -216,10 +217,13 @@
} else {
<CollatorSelectionDesiredCollatorsOverride<T>>::kill();
}
- Self::deposit_event(Event::NewDesiredCollators { desired_collators: max });
+ Self::deposit_event(Event::NewDesiredCollators {
+ desired_collators: max,
+ });
Ok(())
}
+ #[pallet::call_index(5)]
#[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_collator_selection_license_bond(
origin: OriginFor<T>,
@@ -235,6 +239,7 @@
Ok(())
}
+ #[pallet::call_index(6)]
#[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_collator_selection_kick_threshold(
origin: OriginFor<T>,
@@ -246,7 +251,9 @@
} else {
<CollatorSelectionKickThresholdOverride<T>>::kill();
}
- Self::deposit_event(Event::NewCollatorKickThreshold { length_in_blocks: threshold });
+ Self::deposit_event(Event::NewCollatorKickThreshold {
+ length_in_blocks: threshold,
+ });
Ok(())
}
}
runtime/common/data_management.rsdiffbeforeafterboth--- a/runtime/common/data_management.rs
+++ b/runtime/common/data_management.rs
@@ -58,10 +58,10 @@
_info: &DispatchInfoOf<Self::Call>,
_len: usize,
) -> TransactionValidity {
- match call {
- #[cfg(feature = "collator-selection")]
- RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
- _ => Ok(ValidTransaction::default()),
- }
+ match call {
+ #[cfg(feature = "collator-selection")]
+ RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
+ _ => Ok(ValidTransaction::default()),
+ }
}
}
runtime/common/mod.rsdiffbeforeafterboth--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -16,11 +16,11 @@
pub mod config;
pub mod construct_runtime;
+pub mod data_management;
pub mod dispatch;
pub mod ethereum;
pub mod instance;
pub mod maintenance;
-pub mod data_management;
pub mod runtime_apis;
pub mod xcm;
runtime/common/tests/mod.rsdiffbeforeafterboth--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -63,9 +63,7 @@
.collect::<Vec<_>>();
let cfg = GenesisConfig {
- collator_selection: CollatorSelectionConfig {
- invulnerables,
- },
+ collator_selection: CollatorSelectionConfig { invulnerables },
session: SessionConfig { keys },
parachain_info: ParachainInfoConfig {
parachain_id: para_id.into(),
tests/src/collatorSelection.seqtest.tsdiffbeforeafterboth--- a/tests/src/collatorSelection.seqtest.ts
+++ b/tests/src/collatorSelection.seqtest.ts
@@ -209,7 +209,7 @@
expect(await helper.collatorSelection.hasLicense(account.address)).to.be.equal(licenseBond);
// force-releasing a license un-reserves the license bond cost as well
- await helper.getSudo().collatorSelection.forceRevokeLicense(superuser, account.address);
+ await helper.getSudo().collatorSelection.forceReleaseLicense(superuser, account.address);
expect(await helper.collatorSelection.hasLicense(account.address)).to.be.equal(previousBalance.reserved);
const balance = await helper.balance.getSubstrateFull(account.address);
@@ -243,7 +243,7 @@
itSub('Cannot force revoke a license as non-sudo', async ({helper}) => {
const account = crowd.pop()!;
await helper.collatorSelection.obtainLicense(account);
- await expect(helper.collatorSelection.forceRevokeLicense(superuser, account.address))
+ await expect(helper.collatorSelection.forceReleaseLicense(superuser, account.address))
.to.be.rejectedWith(/BadOrigin/);
});
});
@@ -459,7 +459,7 @@
const candidates = await helper.collatorSelection.getCandidates();
let nonce = await helper.chain.getNonce(superuser.address);
await Promise.all(candidates.map(candidate =>
- helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.forceRevokeLicense', [candidate], true, {nonce: nonce++})));
+ helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.forceReleaseLicense', [candidate], true, {nonce: nonce++})));
});
});
});
\ No newline at end of file
tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -237,7 +237,7 @@
*
* This call is, of course, not applicable to `Invulnerable` collators.
**/
- forceRevokeLicense: AugmentedSubmittable<(who: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
+ forceReleaseLicense: AugmentedSubmittable<(who: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
* Purchase a license on block collation for this account.
* It does not make it a collator candidate, use `onboard` afterward. The account must
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1243,11 +1243,11 @@
readonly isOnboard: boolean;
readonly isOffboard: boolean;
readonly isReleaseLicense: boolean;
- readonly isForceRevokeLicense: boolean;
- readonly asForceRevokeLicense: {
+ readonly isForceReleaseLicense: boolean;
+ readonly asForceReleaseLicense: {
readonly who: AccountId32;
} & Struct;
- readonly type: 'AddInvulnerable' | 'RemoveInvulnerable' | 'GetLicense' | 'Onboard' | 'Offboard' | 'ReleaseLicense' | 'ForceRevokeLicense';
+ readonly type: 'AddInvulnerable' | 'RemoveInvulnerable' | 'GetLicense' | 'Onboard' | 'Offboard' | 'ReleaseLicense' | 'ForceReleaseLicense';
}
/** @name PalletCollatorSelectionError */
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1692,7 +1692,7 @@
onboard: 'Null',
offboard: 'Null',
release_license: 'Null',
- force_revoke_license: {
+ force_release_license: {
who: 'AccountId32'
}
}
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -1867,11 +1867,11 @@
readonly isOnboard: boolean;
readonly isOffboard: boolean;
readonly isReleaseLicense: boolean;
- readonly isForceRevokeLicense: boolean;
- readonly asForceRevokeLicense: {
+ readonly isForceReleaseLicense: boolean;
+ readonly asForceReleaseLicense: {
readonly who: AccountId32;
} & Struct;
- readonly type: 'AddInvulnerable' | 'RemoveInvulnerable' | 'GetLicense' | 'Onboard' | 'Offboard' | 'ReleaseLicense' | 'ForceRevokeLicense';
+ readonly type: 'AddInvulnerable' | 'RemoveInvulnerable' | 'GetLicense' | 'Onboard' | 'Offboard' | 'ReleaseLicense' | 'ForceReleaseLicense';
}
/** @name PalletCollatorSelectionError (185) */
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2772,8 +2772,8 @@
return this.helper.executeExtrinsic(signer, 'api.tx.collatorSelection.releaseLicense', []);
}
- forceRevokeLicense(signer: TSigner, released: string) {
- return this.helper.executeExtrinsic(signer, 'api.tx.collatorSelection.forceRevokeLicense', [released]);
+ forceReleaseLicense(signer: TSigner, released: string) {
+ return this.helper.executeExtrinsic(signer, 'api.tx.collatorSelection.forceReleaseLicense', [released]);
}
async hasLicense(address: string): Promise<bigint> {