git.delta.rocks / unique-network / refs/commits / 30011e53c39d

difftreelog

fix(pallet-collator-selection) benchmarking

Yaroslav Bolyukin2023-04-20parent: #8613e5e.patch.diff
in: master

2 files changed

modifiedMakefilediffbeforeafterboth
before · Makefile
1.PHONY: _help2_help:3	@echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"4	@echo "evm_stubs - recompile contract stubs and ABI"5	@echo "bench - run frame-benchmarking"6	@echo "  bench-evm-migration"7	@echo "  bench-unique"89FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs10FUNGIBLE_EVM_ABI=./tests/src/eth/abi/fungible.json1112NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs13NONFUNGIBLE_EVM_ABI=./tests/src/eth/abi/nonFungible.json1415REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs16REFUNGIBLE_EVM_ABI=./tests/src/eth/abi/reFungible.json17REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/abi/reFungibleToken.json1819CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/20CONTRACT_HELPERS_ABI=./tests/src/eth/abi/contractHelpers.json2122COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/23COLLECTION_HELPER_ABI=./tests/src/eth/abi/collectionHelpers.json2425TESTS_API=./tests/src/eth/api/2627.PHONY: regenerate_solidity28regenerate_solidity: UniqueFungible.sol UniqueNFT.sol UniqueRefungible.sol UniqueRefungibleToken.sol ContractHelpers.sol CollectionHelpers.sol2930UniqueFungible.sol:31	PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh32	PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=$(FUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh3334UniqueNFT.sol:35	PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh36	PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh3738UniqueRefungible.sol:39	PACKAGE=pallet-refungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh40	PACKAGE=pallet-refungible NAME=erc::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4142UniqueRefungibleToken.sol:43	PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh44	PACKAGE=pallet-refungible NAME=erc_token::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4546ContractHelpers.sol:47	PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh48	PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4950CollectionHelpers.sol:51	PACKAGE=pallet-unique NAME=eth::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh52	PACKAGE=pallet-unique NAME=eth::collection_helper_impl OUTPUT=$(COLLECTION_HELPER_STUBS)/$@ ./.maintain/scripts/generate_sol.sh5354UniqueFungible: UniqueFungible.sol55	INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh56	INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh5758UniqueNFT: UniqueNFT.sol59	INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw ./.maintain/scripts/compile_stub.sh60	INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6162UniqueRefungible: UniqueRefungible.sol63	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungible.raw ./.maintain/scripts/compile_stub.sh64	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6566UniqueRefungibleToken: UniqueRefungibleToken.sol67	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungibleToken.raw ./.maintain/scripts/compile_stub.sh68	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_TOKEN_EVM_ABI) ./.maintain/scripts/generate_abi.sh6970ContractHelpers: ContractHelpers.sol71	INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh72	INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh7374CollectionHelpers: CollectionHelpers.sol75	INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelpers.raw ./.maintain/scripts/compile_stub.sh76	INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh7778evm_stubs: UniqueFungible UniqueNFT UniqueRefungible UniqueRefungibleToken ContractHelpers CollectionHelpers7980.PHONY: _bench81_bench:82	cargo run --release --features runtime-benchmarks,$(RUNTIME) -- \83	benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \84	--wasm-execution compiled --extrinsic '*' \85	$(if $(TEMPLATE),$(TEMPLATE),--template=.maintain/frame-weight-template.hbs) --steps=50 --repeat=80 --heap-pages=4096 \86	--output=$(if $(OUTPUT),$(OUTPUT),./pallets/$(if $(PALLET_DIR),$(PALLET_DIR),$(PALLET))/src/weights.rs)8788.PHONY: bench-evm-migration89bench-evm-migration:90	make _bench PALLET=evm-migration9192.PHONY: bench-configuration93bench-configuration:94	make _bench PALLET=configuration9596.PHONY: bench-common97bench-common:98	make _bench PALLET=common99100.PHONY: bench-unique101bench-unique:102	make _bench PALLET=unique103104.PHONY: bench-fungible105bench-fungible:106	make _bench PALLET=fungible107108.PHONY: bench-refungible109bench-refungible:110	make _bench PALLET=refungible111112.PHONY: bench-nonfungible113bench-nonfungible:114	make _bench PALLET=nonfungible115116.PHONY: bench-structure117bench-structure:118	make _bench PALLET=structure119120.PHONY: bench-scheduler121bench-scheduler:122	make _bench PALLET=unique-scheduler-v2 PALLET_DIR=scheduler-v2123124.PHONY: bench-foreign-assets125bench-foreign-assets:126	make _bench PALLET=foreign-assets127128.PHONY: bench-collator-selection129bench-collator-selection:130	make _bench PALLET=collator-selection131132.PHONY: bench-identity133bench-identity:134	make _bench PALLET=identity135136.PHONY: bench-app-promotion137bench-app-promotion:138	make _bench PALLET=app-promotion139140.PHONY: bench-maintenance141bench-maintenance:142	make _bench PALLET=maintenance143144.PHONY: bench-xcm145bench-xcm:146	make _bench PALLET=xcm OUTPUT=./runtime/common/weights/xcm.rs TEMPLATE="--template=.maintain/external-weight-template.hbs"147148.PHONY: bench149# Disabled: bench-scheduler, bench-collator-selection, bench-identity150bench: bench-app-promotion bench-common bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-configuration bench-foreign-assets bench-maintenance bench-xcm151152.PHONY: check153check:154	SKIP_WASM_BUILD=1 cargo check --features=quartz-runtime,unique-runtime,try-runtime,runtime-benchmarks --tests155156.PHONY: clippy157clippy:158	SKIP_WASM_BUILD=1 cargo clippy --features=quartz-runtime,unique-runtime,try-runtime,runtime-benchmarks --tests
after · Makefile
1.PHONY: _help2_help:3	@echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"4	@echo "evm_stubs - recompile contract stubs and ABI"5	@echo "bench - run frame-benchmarking"6	@echo "  bench-evm-migration"7	@echo "  bench-unique"89FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs10FUNGIBLE_EVM_ABI=./tests/src/eth/abi/fungible.json1112NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs13NONFUNGIBLE_EVM_ABI=./tests/src/eth/abi/nonFungible.json1415REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs16REFUNGIBLE_EVM_ABI=./tests/src/eth/abi/reFungible.json17REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/abi/reFungibleToken.json1819CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/20CONTRACT_HELPERS_ABI=./tests/src/eth/abi/contractHelpers.json2122COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/23COLLECTION_HELPER_ABI=./tests/src/eth/abi/collectionHelpers.json2425TESTS_API=./tests/src/eth/api/2627.PHONY: regenerate_solidity28regenerate_solidity: UniqueFungible.sol UniqueNFT.sol UniqueRefungible.sol UniqueRefungibleToken.sol ContractHelpers.sol CollectionHelpers.sol2930UniqueFungible.sol:31	PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh32	PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=$(FUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh3334UniqueNFT.sol:35	PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh36	PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh3738UniqueRefungible.sol:39	PACKAGE=pallet-refungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh40	PACKAGE=pallet-refungible NAME=erc::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4142UniqueRefungibleToken.sol:43	PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh44	PACKAGE=pallet-refungible NAME=erc_token::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4546ContractHelpers.sol:47	PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh48	PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4950CollectionHelpers.sol:51	PACKAGE=pallet-unique NAME=eth::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh52	PACKAGE=pallet-unique NAME=eth::collection_helper_impl OUTPUT=$(COLLECTION_HELPER_STUBS)/$@ ./.maintain/scripts/generate_sol.sh5354UniqueFungible: UniqueFungible.sol55	INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh56	INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh5758UniqueNFT: UniqueNFT.sol59	INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw ./.maintain/scripts/compile_stub.sh60	INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6162UniqueRefungible: UniqueRefungible.sol63	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungible.raw ./.maintain/scripts/compile_stub.sh64	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6566UniqueRefungibleToken: UniqueRefungibleToken.sol67	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungibleToken.raw ./.maintain/scripts/compile_stub.sh68	INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_TOKEN_EVM_ABI) ./.maintain/scripts/generate_abi.sh6970ContractHelpers: ContractHelpers.sol71	INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh72	INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh7374CollectionHelpers: CollectionHelpers.sol75	INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelpers.raw ./.maintain/scripts/compile_stub.sh76	INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh7778evm_stubs: UniqueFungible UniqueNFT UniqueRefungible UniqueRefungibleToken ContractHelpers CollectionHelpers7980.PHONY: _bench81_bench:82	cargo run --release --features runtime-benchmarks,$(RUNTIME) -- \83	benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \84	--wasm-execution compiled --extrinsic '*' \85	$(if $(TEMPLATE),$(TEMPLATE),--template=.maintain/frame-weight-template.hbs) --steps=50 --repeat=80 --heap-pages=4096 \86	--output=$(if $(OUTPUT),$(OUTPUT),./pallets/$(if $(PALLET_DIR),$(PALLET_DIR),$(PALLET))/src/weights.rs)8788.PHONY: bench-evm-migration89bench-evm-migration:90	make _bench PALLET=evm-migration9192.PHONY: bench-configuration93bench-configuration:94	make _bench PALLET=configuration9596.PHONY: bench-common97bench-common:98	make _bench PALLET=common99100.PHONY: bench-unique101bench-unique:102	make _bench PALLET=unique103104.PHONY: bench-fungible105bench-fungible:106	make _bench PALLET=fungible107108.PHONY: bench-refungible109bench-refungible:110	make _bench PALLET=refungible111112.PHONY: bench-nonfungible113bench-nonfungible:114	make _bench PALLET=nonfungible115116.PHONY: bench-structure117bench-structure:118	make _bench PALLET=structure119120.PHONY: bench-scheduler121bench-scheduler:122	make _bench PALLET=unique-scheduler-v2 PALLET_DIR=scheduler-v2123124.PHONY: bench-foreign-assets125bench-foreign-assets:126	make _bench PALLET=foreign-assets127128.PHONY: bench-collator-selection129bench-collator-selection:130	make _bench PALLET=collator-selection131132.PHONY: bench-identity133bench-identity:134	make _bench PALLET=identity135136.PHONY: bench-app-promotion137bench-app-promotion:138	make _bench PALLET=app-promotion139140.PHONY: bench-maintenance141bench-maintenance:142	make _bench PALLET=maintenance143144.PHONY: bench-xcm145bench-xcm:146	make _bench PALLET=xcm OUTPUT=./runtime/common/weights/xcm.rs TEMPLATE="--template=.maintain/external-weight-template.hbs"147148.PHONY: bench149# Disabled: bench-scheduler, bench-identity150bench: bench-app-promotion bench-common bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-configuration bench-foreign-assets bench-maintenance bench-xcm bench-collator-selection151152.PHONY: check153check:154	SKIP_WASM_BUILD=1 cargo check --features=quartz-runtime,unique-runtime,try-runtime,runtime-benchmarks --tests155156.PHONY: clippy157clippy:158	SKIP_WASM_BUILD=1 cargo clippy --features=quartz-runtime,unique-runtime,try-runtime,runtime-benchmarks --tests
modifiedpallets/collator-selection/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/collator-selection/src/benchmarking.rs
+++ b/pallets/collator-selection/src/benchmarking.rs
@@ -77,7 +77,7 @@
 	balance_factor: u32,
 ) -> T::AccountId {
 	let user = account(string, n, SEED);
-	let balance = T::Currency::minimum_balance() * balance_factor.into();
+	let balance = balance_unit::<T>() * balance_factor.into();
 	let _ = T::Currency::make_free_balance_be(&user, balance);
 	user
 }
@@ -158,6 +158,15 @@
 	}
 }
 
+/// `Currency::minimum_balance` was used originally, but in unique-chain, we have
+/// zero existential deposit, thus triggering zero bond assertion.
+fn balance_unit<T: Config>() -> <T::Currency as Currency<T::AccountId>>::Balance {
+	200u32.into()
+}
+
+/// Our benchmarking environment already has invulnerables registered.
+const INITIAL_INVULNERABLES: u32 = 2;
+
 benchmarks! {
 	where_clause { where T: pallet_authorship::Config + session::Config + configuration::Config }
 
@@ -165,14 +174,14 @@
 	// Both invulnerables and candidates count together against MaxCollators.
 	// Maybe try putting it in braces? 1 .. (T::MaxCollators::get() - 2)
 	add_invulnerable {
-		let b in 1 .. T::MaxCollators::get() - 3;
+		let b in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES - 1;
 		register_validators::<T>(b);
 		register_invulnerables::<T>(b);
 
 		// log::info!("{} {}", <Invulnerables<T>>::get().len(), b);
 
 		let new_invulnerable: T::AccountId = whitelisted_caller();
-		let bond: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
+		let bond: BalanceOf<T> = balance_unit::<T>() * 2u32.into();
 		T::Currency::make_free_balance_be(&new_invulnerable, bond.clone());
 
 		<session::Pallet<T>>::set_keys(
@@ -192,7 +201,7 @@
 	}
 
 	remove_invulnerable {
-		let b in 1 .. T::MaxCollators::get();
+		let b in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES - 1;
 		register_validators::<T>(b);
 		register_invulnerables::<T>(b);
 
@@ -209,15 +218,15 @@
 	}
 
 	get_license {
-		let c in 1 .. T::MaxCollators::get();
+		let c in 1 .. T::MaxCollators::get() - 1;
 
-		<LicenseBond<T>>::put(T::Currency::minimum_balance());
+		<LicenseBond<T>>::put(balance_unit::<T>());
 
 		register_validators::<T>(c);
 		get_licenses::<T>(c);
 
 		let caller: T::AccountId = whitelisted_caller();
-		let bond: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
+		let bond: BalanceOf<T> = balance_unit::<T>() * 2u32.into();
 		T::Currency::make_free_balance_be(&caller, bond.clone());
 
 		<session::Pallet<T>>::set_keys(
@@ -234,16 +243,16 @@
 	// worst case is when we have all the max-candidate slots filled except one, and we fill that
 	// one.
 	onboard {
-		let c in 1 .. 5;
+		let c in 1 .. T::MaxCollators::get() - INITIAL_INVULNERABLES - 1;
 
-		<LicenseBond<T>>::put(T::Currency::minimum_balance());
-		<DesiredCollators<T>>::put(c + 2);
+		<LicenseBond<T>>::put(balance_unit::<T>());
+		<DesiredCollators<T>>::put(c + INITIAL_INVULNERABLES + 1);
 
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
 
 		let caller: T::AccountId = whitelisted_caller();
-		let bond: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
+		let bond: BalanceOf<T> = balance_unit::<T>() * 2u32.into();
 		T::Currency::make_free_balance_be(&caller, bond.clone());
 
 		let origin = RawOrigin::Signed(caller.clone());
@@ -265,8 +274,8 @@
 	// worst case is the last candidate leaving.
 	offboard {
 		let c in 1 .. T::MaxCollators::get();
-		<LicenseBond<T>>::put(T::Currency::minimum_balance());
-		<DesiredCollators<T>>::put(c + 2);
+		<LicenseBond<T>>::put(balance_unit::<T>());
+		<DesiredCollators<T>>::put(c + INITIAL_INVULNERABLES);
 
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
@@ -281,9 +290,9 @@
 	// worst case is the last candidate leaving.
 	release_license {
 		let c in 1 .. T::MaxCollators::get();
-		let bond = T::Currency::minimum_balance();
+		let bond = balance_unit::<T>();
 		<LicenseBond<T>>::put(bond);
-		<DesiredCollators<T>>::put(c);
+		<DesiredCollators<T>>::put(c + INITIAL_INVULNERABLES);
 
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
@@ -298,9 +307,9 @@
 	// worst case is the last candidate leaving.
 	force_release_license {
 		let c in 1 .. T::MaxCollators::get();
-		let bond = T::Currency::minimum_balance();
+		let bond = balance_unit::<T>();
 		<LicenseBond<T>>::put(bond);
-		<DesiredCollators<T>>::put(c);
+		<DesiredCollators<T>>::put(c + INITIAL_INVULNERABLES);
 
 		register_validators::<T>(c);
 		register_candidates::<T>(c);
@@ -319,10 +328,10 @@
 
 	// worst case is paying a non-existing candidate account.
 	note_author {
-		<LicenseBond<T>>::put(T::Currency::minimum_balance());
+		<LicenseBond<T>>::put(balance_unit::<T>());
 		T::Currency::make_free_balance_be(
 			&<CollatorSelection<T>>::account_id(),
-			T::Currency::minimum_balance() * 4u32.into(),
+			balance_unit::<T>() * 4u32.into(),
 		);
 		let author = account("author", 0, SEED);
 		let new_block: T::BlockNumber = 10u32.into();
@@ -341,8 +350,8 @@
 		let r in 1 .. T::MaxCollators::get();
 		let c in 1 .. T::MaxCollators::get();
 
-		<LicenseBond<T>>::put(T::Currency::minimum_balance());
-		<DesiredCollators<T>>::put(c);
+		<LicenseBond<T>>::put(balance_unit::<T>());
+		<DesiredCollators<T>>::put(c + INITIAL_INVULNERABLES);
 		frame_system::Pallet::<T>::set_block_number(0u32.into());
 
 		register_validators::<T>(c);