Browse Source

runtime: working group: Start renaming working team.

Shamil Gadelshin 4 years ago
parent
commit
07b231e662

+ 1 - 24
Cargo.lock

@@ -4406,30 +4406,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-working-group"
-version = "3.1.0"
-dependencies = [
- "frame-support",
- "frame-system",
- "pallet-balances",
- "pallet-common",
- "pallet-hiring",
- "pallet-membership",
- "pallet-recurring-reward",
- "pallet-stake",
- "pallet-timestamp",
- "pallet-token-mint",
- "parity-scale-codec",
- "serde",
- "sp-arithmetic",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "pallet-working-team"
-version = "1.0.1"
+version = "4.0.0"
 dependencies = [
  "frame-benchmarking",
  "frame-support",

+ 0 - 1
Cargo.toml

@@ -19,7 +19,6 @@ members = [
 	"runtime-modules/versioned-store",
 	"runtime-modules/versioned-store-permissions",
 	"runtime-modules/working-group",
-	"runtime-modules/working-team",
 	"runtime-modules/content-directory",
 	"runtime-modules/constitution",
 	"node",

+ 5 - 3
runtime-modules/service-discovery/src/lib.rs

@@ -30,6 +30,8 @@ use frame_support::{decl_event, decl_module, decl_storage, ensure};
 use frame_system::ensure_root;
 use sp_std::vec::Vec;
 
+use working_group::ensure_worker_signed;
+
 /*
   Although there is support for ed25519 keys as the IPNS identity key and we could potentially
   reuse the same key for the role account and ipns (and make this discovery module obselete)
@@ -56,7 +58,7 @@ pub(crate) type StorageWorkingGroupInstance = working_group::Instance2;
 pub(crate) type StorageWorkingGroup<T> = working_group::Module<T, StorageWorkingGroupInstance>;
 
 /// Storage provider is a worker from the  working_group module.
-pub type StorageProviderId<T> = working_group::WorkerId<T>;
+pub type StorageProviderId<T> = working_group::GroupWorkerId<T>;
 
 pub(crate) const MINIMUM_LIFETIME: u32 = 600; // 1hr assuming 6s block times
 pub(crate) const DEFAULT_LIFETIME: u32 = MINIMUM_LIFETIME * 24; // 24hr
@@ -124,7 +126,7 @@ decl_module! {
             storage_provider_id: StorageProviderId<T>,
             id: Vec<u8>,
         ) {
-            <StorageWorkingGroup<T>>::ensure_worker_signed(origin, &storage_provider_id)?;
+            ensure_worker_signed::<T, StorageWorkingGroupInstance>(origin, &storage_provider_id)?;
 
             // TODO: ensure id is a valid base58 encoded IPNS identity
 
@@ -144,7 +146,7 @@ decl_module! {
         /// Requires signed storage provider credentials.
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn unset_ipns_id(origin, storage_provider_id: StorageProviderId<T>) {
-            <StorageWorkingGroup<T>>::ensure_worker_signed(origin, &storage_provider_id)?;
+            ensure_worker_signed::<T, StorageWorkingGroupInstance>(origin, &storage_provider_id)?;
 
             // == MUTATION SAFE ==
 

+ 1 - 1
runtime-modules/storage/src/lib.rs

@@ -17,4 +17,4 @@ pub(crate) type StorageWorkingGroup<T> = working_group::Module<T, StorageWorking
 pub(crate) type MemberId<T> = <T as membership::Trait>::MemberId;
 
 /// Storage provider is a worker from the working group module.
-pub type StorageProviderId<T> = working_group::WorkerId<T>;
+pub type StorageProviderId<T> = working_group::GroupWorkerId<T>;

+ 2 - 2
runtime-modules/working-team/Cargo.toml → runtime-modules/working-group/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
-name = "pallet-working-team"
-version = "1.0.1"
+name = "pallet-working-group"
+version = "4.0.0"
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 51 - 51
runtime-modules/working-team/src/benchmarking.rs → runtime-modules/working-group/src/benchmarking.rs

@@ -12,7 +12,7 @@ use sp_std::prelude::*;
 use system as frame_system;
 
 use crate::types::StakeParameters;
-use crate::Module as WorkingTeam;
+use crate::Module as WorkingGroup;
 use membership::Module as Membership;
 
 const SEED: u32 = 0;
@@ -49,7 +49,7 @@ fn add_opening_helper<T: Trait<I>, I: Instance>(
         StakingRole::WithoutStakes => None,
     };
 
-    WorkingTeam::<T, _>::add_opening(
+    WorkingGroup::<T, _>::add_opening(
         add_opening_origin.clone(),
         vec![],
         *job_opening_type,
@@ -89,7 +89,7 @@ fn apply_on_opening_helper<T: Trait<I>, I: Instance>(
         StakingRole::WithoutStakes => None,
     };
 
-    WorkingTeam::<T, _>::apply_on_opening(
+    WorkingGroup::<T, _>::apply_on_opening(
         RawOrigin::Signed(applicant_id.clone()).into(),
         ApplyOnOpeningParameters::<T, I> {
             member_id: *member_id,
@@ -209,8 +209,8 @@ fn force_missed_reward<T: Trait<I>, I: Instance>() {
     let curr_block_number =
         System::<T>::block_number().saturating_add(T::RewardPeriod::get().into());
     System::<T>::set_block_number(curr_block_number);
-    WorkingTeam::<T, _>::set_budget(RawOrigin::Root.into(), Zero::zero()).unwrap();
-    WorkingTeam::<T, _>::on_initialize(curr_block_number);
+    WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), Zero::zero()).unwrap();
+    WorkingGroup::<T, _>::on_initialize(curr_block_number);
 }
 
 fn insert_a_worker<T: Trait<I>, I: Instance>(
@@ -218,9 +218,9 @@ fn insert_a_worker<T: Trait<I>, I: Instance>(
     job_opening_type: JobOpeningType,
     id: u32,
     lead_id: Option<T::AccountId>,
-) -> (T::AccountId, TeamWorkerId<T>)
+) -> (T::AccountId, GroupWorkerId<T>)
 where
-    WorkingTeam<T, I>: OnInitialize<T::BlockNumber>,
+    WorkingGroup<T, I>: OnInitialize<T::BlockNumber>,
 {
     let add_worker_origin = match job_opening_type {
         JobOpeningType::Leader => RawOrigin::Root,
@@ -240,7 +240,7 @@ where
 
     let mut successful_application_ids = BTreeSet::<T::ApplicationId>::new();
     successful_application_ids.insert(application_id);
-    WorkingTeam::<T, _>::fill_opening(
+    WorkingGroup::<T, _>::fill_opening(
         add_worker_origin.clone().into(),
         opening_id,
         successful_application_ids,
@@ -251,7 +251,7 @@ where
     // remaining reward
     force_missed_reward::<T, I>();
 
-    let worker_id = TeamWorkerId::<T>::from(id.try_into().unwrap());
+    let worker_id = GroupWorkerId::<T>::from(id.try_into().unwrap());
 
     assert!(WorkerById::<T, I>::contains_key(worker_id));
 
@@ -279,7 +279,7 @@ benchmarks_instance! {
                 &JobOpeningType::Regular
             );
 
-        WorkingTeam::<T, _>::fill_opening(
+        WorkingGroup::<T, _>::fill_opening(
             RawOrigin::Signed(lead_id.clone()).into(),
             opening_id,
             successful_application_ids.clone()
@@ -288,25 +288,25 @@ benchmarks_instance! {
         force_missed_reward::<T,I>();
 
         // Force all workers to leave (Including the lead)
-        // We should have every TeamWorkerId from 0 to i-1
+        // We should have every GroupWorkerId from 0 to i-1
         // Corresponding to each account id
         let mut worker_id = Zero::zero();
         for id in application_account_id {
             worker_id += One::one();
-            WorkingTeam::<T, _>::leave_role(RawOrigin::Signed(id).into(), worker_id).unwrap();
+            WorkingGroup::<T, _>::leave_role(RawOrigin::Signed(id).into(), worker_id).unwrap();
         }
 
         // Worst case scenario one of the leaving workers is the lead
-        WorkingTeam::<T, _>::leave_role(
+        WorkingGroup::<T, _>::leave_role(
             RawOrigin::Signed(lead_id).into(),
             lead_worker_id
         ).unwrap();
 
         for i in 1..successful_application_ids.len() {
-            let worker = TeamWorkerId::<T>::from(i.try_into().unwrap());
+            let worker = GroupWorkerId::<T>::from(i.try_into().unwrap());
             assert!(WorkerById::<T, I>::contains_key(worker), "Not all workers added");
             assert_eq!(
-                WorkingTeam::<T, _>::worker_by_id(worker).started_leaving_at,
+                WorkingGroup::<T, _>::worker_by_id(worker).started_leaving_at,
                 Some(System::<T>::block_number()),
                 "Worker hasn't started leaving"
             );
@@ -319,13 +319,13 @@ benchmarks_instance! {
         let curr_block_number =
             System::<T>::block_number().saturating_add(leaving_unstaking_period.into());
         System::<T>::set_block_number(curr_block_number);
-        WorkingTeam::<T, _>::set_budget(
+        WorkingGroup::<T, _>::set_budget(
             RawOrigin::Root.into(),
             BalanceOfCurrency::<T>::max_value()
         ).unwrap();
 
-        assert_eq!(WorkingTeam::<T, _>::budget(), BalanceOfCurrency::<T>::max_value());
-    }: { WorkingTeam::<T, _>::on_initialize(curr_block_number) }
+        assert_eq!(WorkingGroup::<T, _>::budget(), BalanceOfCurrency::<T>::max_value());
+    }: { WorkingGroup::<T, _>::on_initialize(curr_block_number) }
     verify {
         WorkerById::<T, I>::iter().for_each(|(worker_id, _)| {
             assert!(!WorkerById::<T, I>::contains_key(worker_id), "Worker hasn't left");
@@ -334,7 +334,7 @@ benchmarks_instance! {
         let reward_per_worker = BalanceOfCurrency::<T>::from(T::RewardPeriod::get());
 
         assert_eq!(
-            WorkingTeam::<T, I>::budget(),
+            WorkingGroup::<T, I>::budget(),
             BalanceOfCurrency::<T>::max_value()
                 .saturating_sub(BalanceOfCurrency::<T>::from(i) * reward_per_worker)
                 .saturating_sub(reward_per_worker),
@@ -361,12 +361,12 @@ benchmarks_instance! {
                 &JobOpeningType::Regular
             );
 
-        WorkingTeam::<T, _>::fill_opening(RawOrigin::Signed(lead_id.clone()).into(), opening_id,
+        WorkingGroup::<T, _>::fill_opening(RawOrigin::Signed(lead_id.clone()).into(), opening_id,
         successful_application_ids.clone()).unwrap();
 
         for i in 1..successful_application_ids.len() {
             assert!(
-                WorkerById::<T, I>::contains_key(TeamWorkerId::<T>::from(i.try_into().unwrap())),
+                WorkerById::<T, I>::contains_key(GroupWorkerId::<T>::from(i.try_into().unwrap())),
                 "Not all workers added"
             );
         }
@@ -380,13 +380,13 @@ benchmarks_instance! {
         System::<T>::set_block_number(curr_block_number);
 
         // Sets budget so that we can pay it
-        WorkingTeam::<T, _>::set_budget(
+        WorkingGroup::<T, _>::set_budget(
             RawOrigin::Root.into(),
             BalanceOfCurrency::<T>::max_value()
         ).unwrap();
 
-        assert_eq!(WorkingTeam::<T, _>::budget(), BalanceOfCurrency::<T>::max_value());
-    }: { WorkingTeam::<T, _>::on_initialize(curr_block_number) }
+        assert_eq!(WorkingGroup::<T, _>::budget(), BalanceOfCurrency::<T>::max_value());
+    }: { WorkingGroup::<T, _>::on_initialize(curr_block_number) }
     verify {
         let reward_per_worker = BalanceOfCurrency::<T>::from(T::RewardPeriod::get());
 
@@ -394,7 +394,7 @@ benchmarks_instance! {
             BalanceOfCurrency::<T>::from(i) * reward_per_worker * BalanceOfCurrency::<T>::from(2);
 
         assert_eq!(
-            WorkingTeam::<T, _>::budget(),
+            WorkingGroup::<T, _>::budget(),
             // When creating a worker using `insert_a_worker` it gives the lead a number of block
             // equating to reward period as missed reward(and the reward value is 1) therefore the
             // additional discount of balance
@@ -423,12 +423,12 @@ benchmarks_instance! {
                 &JobOpeningType::Regular
             );
 
-        WorkingTeam::<T, _>::fill_opening(RawOrigin::Signed(lead_id.clone()).into(), opening_id,
+        WorkingGroup::<T, _>::fill_opening(RawOrigin::Signed(lead_id.clone()).into(), opening_id,
         successful_application_ids.clone()).unwrap();
 
         for i in 1..successful_application_ids.len() {
             assert!(
-                WorkerById::<T, I>::contains_key(TeamWorkerId::<T>::from(i.try_into().unwrap())),
+                WorkerById::<T, I>::contains_key(GroupWorkerId::<T>::from(i.try_into().unwrap())),
                 "Not all workers added"
             );
         }
@@ -440,11 +440,11 @@ benchmarks_instance! {
         System::<T>::set_block_number(curr_block_number);
 
         // Sets budget so that we can't pay it
-        WorkingTeam::<T, _>::set_budget(RawOrigin::Root.into(), Zero::zero()).unwrap();
+        WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), Zero::zero()).unwrap();
 
-        assert_eq!(WorkingTeam::<T, _>::budget(), Zero::zero());
+        assert_eq!(WorkingGroup::<T, _>::budget(), Zero::zero());
 
-    }: { WorkingTeam::<T, _>::on_initialize(curr_block_number) }
+    }: { WorkingGroup::<T, _>::on_initialize(curr_block_number) }
     verify {
         WorkerById::<T, I>::iter().for_each(|(_, worker)| {
             let missed_reward = worker.missed_reward.expect("There should be some missed reward");
@@ -474,12 +474,12 @@ benchmarks_instance! {
                 &JobOpeningType::Regular
             );
 
-        WorkingTeam::<T, _>::fill_opening(RawOrigin::Signed(lead_id.clone()).into(), opening_id,
+        WorkingGroup::<T, _>::fill_opening(RawOrigin::Signed(lead_id.clone()).into(), opening_id,
         successful_application_ids.clone()).unwrap();
 
         for i in 1..successful_application_ids.len() {
             assert!(
-                WorkerById::<T, I>::contains_key(TeamWorkerId::<T>::from(i.try_into().unwrap())),
+                WorkerById::<T, I>::contains_key(GroupWorkerId::<T>::from(i.try_into().unwrap())),
                 "Not all workers added"
             );
         }
@@ -490,17 +490,17 @@ benchmarks_instance! {
         System::<T>::set_block_number(curr_block_number);
 
         // Sets budget so that we can pay it
-        WorkingTeam::<T, _>::set_budget(
+        WorkingGroup::<T, _>::set_budget(
             RawOrigin::Root.into(), BalanceOfCurrency::<T>::max_value()
         ).unwrap();
-        assert_eq!(WorkingTeam::<T, _>::budget(), BalanceOfCurrency::<T>::max_value());
+        assert_eq!(WorkingGroup::<T, _>::budget(), BalanceOfCurrency::<T>::max_value());
 
-    }: { WorkingTeam::<T, _>::on_initialize(curr_block_number) }
+    }: { WorkingGroup::<T, _>::on_initialize(curr_block_number) }
     verify {
         let reward_per_worker = BalanceOfCurrency::<T>::from(T::RewardPeriod::get());
         let workers_total_reward = BalanceOfCurrency::<T>::from(i) * reward_per_worker;
         assert_eq!(
-            WorkingTeam::<T, _>::budget(),
+            WorkingGroup::<T, _>::budget(),
             // When creating a worker using `insert_a_worker` it gives the lead a number of block
             // equating to reward period as missed reward(and the reward value is 1) therefore the
             // additional discount of balance
@@ -570,7 +570,7 @@ benchmarks_instance! {
         let worker_id = Zero::zero();
 
         assert_eq!(
-            WorkingTeam::<T, I>::current_lead(),
+            WorkingGroup::<T, I>::current_lead(),
             Some(worker_id),
             "Opening for lead not filled"
         );
@@ -609,10 +609,10 @@ benchmarks_instance! {
 
         let mut application_id_to_worker_id = BTreeMap::new();
         for (i, application_id) in successful_application_ids.iter().enumerate() {
-            let worker_id = TeamWorkerId::<T>::from((i + 1).try_into().unwrap());
+            let worker_id = GroupWorkerId::<T>::from((i + 1).try_into().unwrap());
             application_id_to_worker_id.insert(*application_id, worker_id);
             assert!(
-                WorkerById::<T, I>::contains_key(TeamWorkerId::<T>::from(i.try_into().unwrap())),
+                WorkerById::<T, I>::contains_key(GroupWorkerId::<T>::from(i.try_into().unwrap())),
                 "Not all workers added"
             );
         }
@@ -630,7 +630,7 @@ benchmarks_instance! {
     }: _ (RawOrigin::Signed(lead_id), lead_worker_id, new_account_id.clone())
     verify {
         assert_eq!(
-            WorkingTeam::<T, I>::worker_by_id(lead_worker_id).role_account_id,
+            WorkingGroup::<T, I>::worker_by_id(lead_worker_id).role_account_id,
             new_account_id,
             "Role account notupdated"
         );
@@ -712,7 +712,7 @@ benchmarks_instance! {
         );
         // To be able to pay unpaid reward
         let current_budget = BalanceOfCurrency::<T>::max_value();
-        WorkingTeam::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
+        WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
         let penalty = Penalty {
             slashing_text: vec![0u8; i.try_into().unwrap()],
             slashing_amount: One::one(),
@@ -730,7 +730,7 @@ benchmarks_instance! {
             insert_a_worker::<T, I>(StakingRole::WithStakes, JobOpeningType::Leader, 0, None);
         let current_budget = BalanceOfCurrency::<T>::max_value();
         // To be able to pay unpaid reward
-        WorkingTeam::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
+        WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
         let penalty = Penalty {
             slashing_text: vec![0u8; i.try_into().unwrap()],
             slashing_amount: One::one(),
@@ -756,7 +756,7 @@ benchmarks_instance! {
         );
 
         let old_stake = One::one();
-        WorkingTeam::<T, _>::decrease_stake(
+        WorkingGroup::<T, _>::decrease_stake(
             RawOrigin::Signed(lead_id.clone()).into(), worker_id.clone(), old_stake).unwrap();
         let new_stake = old_stake + One::one();
     }: _ (RawOrigin::Signed(caller_id.clone()), worker_id.clone(), new_stake)
@@ -796,10 +796,10 @@ benchmarks_instance! {
         );
 
         let current_budget = BalanceOfCurrency::<T>::max_value();
-        WorkingTeam::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
+        WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
     }: _ (RawOrigin::Signed(lead_id.clone()), lead_id.clone(), current_budget, None)
     verify {
-        assert_eq!(WorkingTeam::<T, I>::budget(), Zero::zero(), "Budget not updated");
+        assert_eq!(WorkingGroup::<T, I>::budget(), Zero::zero(), "Budget not updated");
         assert_last_event::<T, I>(RawEvent::BudgetSpending(lead_id, current_budget).into());
     }
 
@@ -821,7 +821,7 @@ benchmarks_instance! {
     }: _ (RawOrigin::Signed(lead_id.clone()), worker_id, new_reward)
     verify {
         assert_eq!(
-            WorkingTeam::<T, I>::worker_by_id(worker_id).reward_per_block,
+            WorkingGroup::<T, I>::worker_by_id(worker_id).reward_per_block,
             new_reward,
             "Reward not updated"
         );
@@ -843,7 +843,7 @@ benchmarks_instance! {
         let status_text_hash = T::Hashing::hash(&status_text.unwrap()).as_ref().to_vec();
 
         assert_eq!(
-            WorkingTeam::<T, I>::status_text_hash(),
+            WorkingGroup::<T, I>::status_text_hash(),
             status_text_hash,
             "Status text not updated"
         );
@@ -861,7 +861,7 @@ benchmarks_instance! {
     }: _ (RawOrigin::Signed(caller_id), worker_id, new_id.clone())
     verify {
         assert_eq!(
-            WorkingTeam::<T, I>::worker_by_id(worker_id).reward_account_id,
+            WorkingGroup::<T, I>::worker_by_id(worker_id).reward_account_id,
             new_id,
             "Reward account not updated"
         );
@@ -876,7 +876,7 @@ benchmarks_instance! {
 
     }: _(RawOrigin::Root, new_budget)
     verify {
-        assert_eq!(WorkingTeam::<T, I>::budget(), new_budget, "Budget isn't updated");
+        assert_eq!(WorkingGroup::<T, I>::budget(), new_budget, "Budget isn't updated");
         assert_last_event::<T, I>(RawEvent::BudgetSet(new_budget).into());
     }
 
@@ -921,7 +921,7 @@ benchmarks_instance! {
             insert_a_worker::<T, I>(StakingRole::WithoutStakes, JobOpeningType::Leader, 0, None);
 
         // To be able to pay unpaid reward
-        WorkingTeam::<T, _>::set_budget(
+        WorkingGroup::<T, _>::set_budget(
             RawOrigin::Root.into(),
             BalanceOfCurrency::<T>::max_value()
         ).unwrap();
@@ -948,7 +948,7 @@ benchmarks_instance! {
     }: leave_role(RawOrigin::Signed(caller_id), caller_worker_id)
     verify {
         assert_eq!(
-            WorkingTeam::<T, _>::worker_by_id(caller_worker_id).started_leaving_at,
+            WorkingGroup::<T, _>::worker_by_id(caller_worker_id).started_leaving_at,
             Some(System::<T>::block_number()),
             "Worker hasn't started leaving"
         );

+ 11 - 11
runtime-modules/working-team/src/checks.rs → runtime-modules/working-group/src/checks.rs

@@ -1,6 +1,6 @@
 use crate::{
     BalanceOf, Instance, JobOpening, JobOpeningType, MemberId, RewardPolicy, StakePolicy,
-    TeamWorker, TeamWorkerId, Trait,
+    GroupWorker, GroupWorkerId, Trait,
 };
 
 use super::Error;
@@ -96,8 +96,8 @@ pub(crate) fn ensure_succesful_applications_exist<T: Trait<I>, I: Instance>(
     Ok(result_applications_info)
 }
 
-// Check leader: ensures that team leader was hired.
-pub(crate) fn ensure_lead_is_set<T: Trait<I>, I: Instance>() -> Result<TeamWorkerId<T>, Error<T, I>>
+// Check leader: ensures that group leader was hired.
+pub(crate) fn ensure_lead_is_set<T: Trait<I>, I: Instance>() -> Result<GroupWorkerId<T>, Error<T, I>>
 {
     let leader_worker_id = <crate::CurrentLead<T, I>>::get();
 
@@ -135,8 +135,8 @@ pub(crate) fn ensure_origin_is_active_leader<T: Trait<I>, I: Instance>(
 
 // Check worker: ensures the worker was already created.
 pub(crate) fn ensure_worker_exists<T: Trait<I>, I: Instance>(
-    worker_id: &TeamWorkerId<T>,
-) -> Result<TeamWorker<T>, Error<T, I>> {
+    worker_id: &GroupWorkerId<T>,
+) -> Result<GroupWorker<T>, Error<T, I>> {
     ensure!(
         <crate::WorkerById::<T, I>>::contains_key(worker_id),
         Error::<T, I>::WorkerDoesNotExist
@@ -158,11 +158,11 @@ pub(crate) fn ensure_origin_signed_by_member<T: Trait<I>, I: Instance>(
     Ok(())
 }
 
-// Check worker: ensures the origin contains signed account that belongs to existing worker.
-pub(crate) fn ensure_worker_signed<T: Trait<I>, I: Instance>(
+/// Check worker: ensures the origin contains signed account that belongs to existing worker.
+pub fn ensure_worker_signed<T: Trait<I>, I: Instance>(
     origin: T::Origin,
-    worker_id: &TeamWorkerId<T>,
-) -> Result<TeamWorker<T>, DispatchError> {
+    worker_id: &GroupWorkerId<T>,
+) -> Result<GroupWorker<T>, DispatchError> {
     // Ensure that it is signed
     let signer_account = ensure_signed(origin)?;
 
@@ -181,7 +181,7 @@ pub(crate) fn ensure_worker_signed<T: Trait<I>, I: Instance>(
 // Check worker: verifies proper origin for the worker operation. Returns whether the origin is sudo.
 pub(crate) fn ensure_origin_for_worker_operation<T: Trait<I>, I: Instance>(
     origin: T::Origin,
-    worker_id: TeamWorkerId<T>,
+    worker_id: GroupWorkerId<T>,
 ) -> Result<bool, DispatchError> {
     let leader_worker_id = ensure_lead_is_set::<T, I>()?;
 
@@ -251,7 +251,7 @@ pub(crate) fn ensure_application_stake_match_opening<T: Trait<I>, I: Instance>(
 
 // Check worker: verifies that worker has recurring rewards.
 pub(crate) fn ensure_worker_has_recurring_reward<T: Trait<I>, I: Instance>(
-    worker: &TeamWorker<T>,
+    worker: &GroupWorker<T>,
 ) -> DispatchResult {
     worker
         .reward_per_block

+ 2 - 2
runtime-modules/working-team/src/errors.rs → runtime-modules/working-group/src/errors.rs

@@ -18,7 +18,7 @@ decl_error! {
         /// Worker application does not exist.
         WorkerApplicationDoesNotExist,
 
-        /// Working team size limit exceeded.
+        /// Working group size limit exceeded.
         MaxActiveWorkerNumberExceeded,
 
         /// Successful worker application does not exist.
@@ -69,7 +69,7 @@ decl_error! {
         /// Worker has no recurring reward.
         WorkerHasNoReward,
 
-        /// Specified unstaking period is less then minimum set for the team.
+        /// Specified unstaking period is less then minimum set for the group.
         UnstakingPeriodLessThanMinimum,
 
         /// Requested operation with stake is impossible because of stake was not defined for the role.

+ 64 - 62
runtime-modules/working-team/src/lib.rs → runtime-modules/working-group/src/lib.rs

@@ -1,6 +1,6 @@
-//! # Working team pallet
-//! Working team pallet for the Joystream platform.
-//! Contains abstract working team workflow.
+//! # Working group pallet
+//! Working group pallet for the Joystream platform.
+//! Contains abstract working group workflow.
 //!
 //! Exact working group (eg.: forum working group) should create an instance of the Working group module.
 //!
@@ -17,11 +17,11 @@
 //! - [increase_stake](./struct.Module.html#method.increase_stake) - Increases the regular worker/lead stake.
 //! - [cancel_opening](./struct.Module.html#method.cancel_opening) - Cancel opening for a regular worker/lead.
 //! - [withdraw_application](./struct.Module.html#method.withdraw_application) - Withdraw the regular worker/lead application.
-//! - [set_budget](./struct.Module.html#method.set_budget) - Sets the working team budget.
+//! - [set_budget](./struct.Module.html#method.set_budget) - Sets the working group budget.
 //! - [update_reward_account](./struct.Module.html#method.update_reward_account) -  Update the reward account of the regular worker/lead.
 //! - [update_reward_amount](./struct.Module.html#method.update_reward_amount) -  Update the reward amount of the regular worker/lead.
-//! - [set_status_text](./struct.Module.html#method.set_status_text) - Sets the working team status.
-//! - [spend_from_budget](./struct.Module.html#method.spend_from_budget) - Spend tokens from the team budget.
+//! - [set_status_text](./struct.Module.html#method.set_status_text) - Sets the working group status.
+//! - [spend_from_budget](./struct.Module.html#method.spend_from_budget) - Spend tokens from the group budget.
 
 // Ensure we're `no_std` when compiling for Wasm.
 #![cfg_attr(not(feature = "std"), no_std)]
@@ -48,16 +48,18 @@ use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet};
 use sp_std::vec::Vec;
 
 pub use errors::Error;
-use types::{ApplicationInfo, BalanceOf, MemberId, TeamWorker, TeamWorkerId, WorkerInfo};
+use types::{ApplicationInfo, BalanceOf, MemberId, GroupWorker, WorkerInfo};
 pub use types::{
     ApplyOnOpeningParameters, JobApplication, JobOpening, JobOpeningType, Penalty, RewardPolicy,
-    StakePolicy,
+    StakePolicy, GroupWorkerId
 };
 
+pub use checks::ensure_worker_signed;
+
 use common::origin::ActorOriginValidator;
 use membership::staking_handler::StakingHandler;
 
-/// The _Team_ main _Trait_
+/// The _Group_ main _Trait_
 pub trait Trait<I: Instance = DefaultInstance>:
     frame_system::Trait + membership::Trait + balances::Trait
 {
@@ -84,7 +86,7 @@ pub trait Trait<I: Instance = DefaultInstance>:
     /// _Administration_ event type.
     type Event: From<Event<Self, I>> + Into<<Self as frame_system::Trait>::Event>;
 
-    /// Defines max workers number in the team.
+    /// Defines max workers number in the group.
     type MaxWorkerNumberLimit: Get<u32>;
 
     /// Stakes and balance locks handler.
@@ -93,7 +95,7 @@ pub trait Trait<I: Instance = DefaultInstance>:
     /// Validates member id and origin combination
     type MemberOriginValidator: ActorOriginValidator<Self::Origin, MemberId<Self>, Self::AccountId>;
 
-    /// Defines min unstaking period in the team.
+    /// Defines min unstaking period in the group.
     type MinUnstakingPeriodLimit: Get<Self::BlockNumber>;
 
     /// Defines the period every worker gets paid in blocks.
@@ -101,13 +103,13 @@ pub trait Trait<I: Instance = DefaultInstance>:
 }
 
 decl_event!(
-    /// _Team_ events
+    /// _Group_ events
     pub enum Event<T, I = DefaultInstance>
     where
        <T as Trait<I>>::OpeningId,
        <T as Trait<I>>::ApplicationId,
-       ApplicationIdToWorkerIdMap = BTreeMap<<T as Trait<I>>::ApplicationId, TeamWorkerId<T>>,
-       TeamWorkerId = TeamWorkerId<T>,
+       ApplicationIdToWorkerIdMap = BTreeMap<<T as Trait<I>>::ApplicationId, GroupWorkerId<T>>,
+       GroupWorkerId = GroupWorkerId<T>,
        <T as frame_system::Trait>::AccountId,
        Balance = BalanceOf<T>,
     {
@@ -128,16 +130,16 @@ decl_event!(
         /// - Worker application id to the worker id dictionary
         OpeningFilled(OpeningId, ApplicationIdToWorkerIdMap),
 
-        /// Emits on setting the team leader.
+        /// Emits on setting the group leader.
         /// Params:
-        /// - Team worker id.
-        LeaderSet(TeamWorkerId),
+        /// - Group worker id.
+        LeaderSet(GroupWorkerId),
 
         /// Emits on updating the role account of the worker.
         /// Params:
         /// - Id of the worker.
         /// - Role account id of the worker.
-        WorkerRoleAccountUpdated(TeamWorkerId, AccountId),
+        WorkerRoleAccountUpdated(GroupWorkerId, AccountId),
 
         /// Emits on un-setting the leader.
         LeaderUnset(),
@@ -145,35 +147,35 @@ decl_event!(
         /// Emits on exiting the worker.
         /// Params:
         /// - worker id.
-        WorkerExited(TeamWorkerId),
+        WorkerExited(GroupWorkerId),
 
         /// Emits on terminating the worker.
         /// Params:
         /// - worker id.
-        TerminatedWorker(TeamWorkerId),
+        TerminatedWorker(GroupWorkerId),
 
         /// Emits on terminating the leader.
         /// Params:
         /// - leader worker id.
-        TerminatedLeader(TeamWorkerId),
+        TerminatedLeader(GroupWorkerId),
 
         /// Emits on slashing the regular worker/lead stake.
         /// Params:
         /// - regular worker/lead id.
         /// - actual slashed balance.
-        StakeSlashed(TeamWorkerId, Balance),
+        StakeSlashed(GroupWorkerId, Balance),
 
         /// Emits on decreasing the regular worker/lead stake.
         /// Params:
         /// - regular worker/lead id.
         /// - stake delta amount
-        StakeDecreased(TeamWorkerId, Balance),
+        StakeDecreased(GroupWorkerId, Balance),
 
         /// Emits on increasing the regular worker/lead stake.
         /// Params:
         /// - regular worker/lead id.
         /// - stake delta amount
-        StakeIncreased(TeamWorkerId, Balance),
+        StakeIncreased(GroupWorkerId, Balance),
 
         /// Emits on withdrawing the application for the regular worker/lead opening.
         /// Params:
@@ -185,7 +187,7 @@ decl_event!(
         /// - Opening id
         OpeningCanceled(OpeningId),
 
-        /// Emits on setting the budget for the working team.
+        /// Emits on setting the budget for the working group.
         /// Params:
         /// - new budget
         BudgetSet(Balance),
@@ -194,20 +196,20 @@ decl_event!(
         /// Params:
         /// - Id of the worker.
         /// - Reward account id of the worker.
-        WorkerRewardAccountUpdated(TeamWorkerId, AccountId),
+        WorkerRewardAccountUpdated(GroupWorkerId, AccountId),
 
         /// Emits on updating the reward amount of the worker.
         /// Params:
         /// - Id of the worker.
         /// - Reward per block
-        WorkerRewardAmountUpdated(TeamWorkerId, Option<Balance>),
+        WorkerRewardAmountUpdated(GroupWorkerId, Option<Balance>),
 
-        /// Emits on updating the status text of the working team.
+        /// Emits on updating the status text of the working group.
         /// Params:
         /// - status text hash
         StatusTextChanged(Vec<u8>),
 
-        /// Emits on updating the status text of the working team.
+        /// Emits on updating the status text of the working group.
         /// Params:
         /// - status text hash
         BudgetSpending(AccountId, Balance),
@@ -215,7 +217,7 @@ decl_event!(
 );
 
 decl_storage! {
-    trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as WorkingTeam {
+    trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as WorkingGroup {
         /// Next identifier value for new job opening.
         pub NextOpeningId get(fn next_opening_id): T::OpeningId;
 
@@ -234,16 +236,16 @@ decl_storage! {
         pub NextApplicationId get(fn next_application_id) : T::ApplicationId;
 
         /// Next identifier for a new worker.
-        pub NextWorkerId get(fn next_worker_id) : TeamWorkerId<T>;
+        pub NextWorkerId get(fn next_worker_id) : GroupWorkerId<T>;
 
         /// Maps identifier to corresponding worker.
         pub WorkerById get(fn worker_by_id) : map hasher(blake2_128_concat)
-            TeamWorkerId<T> => TeamWorker<T>;
+            GroupWorkerId<T> => GroupWorker<T>;
 
-        /// Current team lead.
-        pub CurrentLead get(fn current_lead) : Option<TeamWorkerId<T>>;
+        /// Current group lead.
+        pub CurrentLead get(fn current_lead) : Option<GroupWorkerId<T>>;
 
-        /// Budget for the working team.
+        /// Budget for the working group.
         pub Budget get(fn budget) : BalanceOf<T>;
 
         /// Status text hash.
@@ -436,7 +438,7 @@ decl_module! {
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn update_role_account(
             origin,
-            worker_id: TeamWorkerId<T>,
+            worker_id: GroupWorkerId<T>,
             new_role_account_id: T::AccountId
         ) {
             // Ensuring worker actually exists
@@ -465,7 +467,7 @@ decl_module! {
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn leave_role(
             origin,
-            worker_id: TeamWorkerId<T>,
+            worker_id: GroupWorkerId<T>,
         ) {
             // Ensure there is a signer which matches role account of worker corresponding to provided id.
             let worker = checks::ensure_worker_signed::<T, I>(origin, &worker_id)?;
@@ -491,7 +493,7 @@ decl_module! {
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn terminate_role(
             origin,
-            worker_id: TeamWorkerId<T>,
+            worker_id: GroupWorkerId<T>,
             penalty: Option<Penalty<BalanceOf<T>>>,
         ) {
             // Ensure lead is set or it is the council terminating the leader.
@@ -532,7 +534,7 @@ decl_module! {
         /// If slashing balance greater than the existing stake - stake is slashed to zero.
         /// Requires signed leader origin or the root (to slash the leader stake).
         #[weight = 10_000_000] // TODO: adjust weight
-        pub fn slash_stake(origin, worker_id: TeamWorkerId<T>, penalty: Penalty<BalanceOf<T>>) {
+        pub fn slash_stake(origin, worker_id: GroupWorkerId<T>, penalty: Penalty<BalanceOf<T>>) {
             // Ensure lead is set or it is the council slashing the leader.
             checks::ensure_origin_for_worker_operation::<T,I>(origin, worker_id)?;
 
@@ -564,7 +566,7 @@ decl_module! {
         /// Accepts the stake amount to decrease.
         /// Requires signed leader origin or the root (to decrease the leader stake).
         #[weight = 10_000_000] // TODO: adjust weight
-        pub fn decrease_stake(origin, worker_id: TeamWorkerId<T>, stake_balance_delta: BalanceOf<T>) {
+        pub fn decrease_stake(origin, worker_id: GroupWorkerId<T>, stake_balance_delta: BalanceOf<T>) {
             // Ensure lead is set or it is the council decreasing the leader's stake.
             checks::ensure_origin_for_worker_operation::<T,I>(origin, worker_id)?;
 
@@ -615,7 +617,7 @@ decl_module! {
         /// Increases the regular worker/lead stake, demands a worker origin.
         /// Locks tokens from the worker staking_account_id equal to new stake. No limits on the stake.
         #[weight = 10_000_000] // TODO: adjust weight
-        pub fn increase_stake(origin, worker_id: TeamWorkerId<T>, stake_balance_delta: BalanceOf<T>) {
+        pub fn increase_stake(origin, worker_id: GroupWorkerId<T>, stake_balance_delta: BalanceOf<T>) {
             // Checks worker origin and worker existence.
             let worker = checks::ensure_worker_signed::<T, I>(origin, &worker_id)?;
 
@@ -711,7 +713,7 @@ decl_module! {
             Self::deposit_event(RawEvent::OpeningCanceled(opening_id));
         }
 
-        /// Sets a new budget for the working team.
+        /// Sets a new budget for the working group.
         /// Requires root origin.
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn set_budget(
@@ -735,7 +737,7 @@ decl_module! {
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn update_reward_account(
             origin,
-            worker_id: TeamWorkerId<T>,
+            worker_id: GroupWorkerId<T>,
             new_reward_account_id: T::AccountId
         ) {
             // Ensure there is a signer which matches role account of worker corresponding to provided id.
@@ -762,7 +764,7 @@ decl_module! {
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn update_reward_amount(
             origin,
-            worker_id: TeamWorkerId<T>,
+            worker_id: GroupWorkerId<T>,
             reward_per_block: Option<BalanceOf<T>>
         ) {
             // Ensure lead is set or it is the council setting the leader's reward.
@@ -784,14 +786,14 @@ decl_module! {
             Self::deposit_event(RawEvent::WorkerRewardAmountUpdated(worker_id, reward_per_block));
         }
 
-        /// Sets a new status text for the working team.
+        /// Sets a new status text for the working group.
         /// Requires root origin.
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn set_status_text(
             origin,
             status_text: Option<Vec<u8>>,
         ) {
-            // Ensure team leader privilege.
+            // Ensure group leader privilege.
             checks::ensure_origin_is_active_leader::<T,I>(origin)?;
 
             //
@@ -822,7 +824,7 @@ decl_module! {
             amount: BalanceOf<T>,
             rationale: Option<Vec<u8>>,
         ) {
-            // Ensure team leader privilege.
+            // Ensure group leader privilege.
             checks::ensure_origin_is_active_leader::<T,I>(origin)?;
 
             ensure!(amount > Zero::zero(), Error::<T, I>::CannotSpendZero);
@@ -868,7 +870,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
     fn fulfill_successful_applications(
         opening: &JobOpening<T::BlockNumber, BalanceOf<T>>,
         successful_applications_info: Vec<ApplicationInfo<T, I>>,
-    ) -> BTreeMap<T::ApplicationId, TeamWorkerId<T>> {
+    ) -> BTreeMap<T::ApplicationId, GroupWorkerId<T>> {
         let mut application_id_to_worker_id = BTreeMap::new();
 
         successful_applications_info
@@ -891,12 +893,12 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
     fn create_worker_by_application(
         opening: &JobOpening<T::BlockNumber, BalanceOf<T>>,
         application_info: &ApplicationInfo<T, I>,
-    ) -> TeamWorkerId<T> {
+    ) -> GroupWorkerId<T> {
         // Get worker id.
         let new_worker_id = <NextWorkerId<T, I>>::get();
 
         // Construct a worker.
-        let worker = TeamWorker::<T>::new(
+        let worker = GroupWorker::<T>::new(
             &application_info.application.member_id,
             &application_info.application.role_account_id,
             &application_info.application.reward_account_id,
@@ -914,7 +916,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         Self::increase_active_worker_counter();
 
         // Update the next worker id.
-        <NextWorkerId<T, I>>::mutate(|id| *id += <TeamWorkerId<T> as One>::one());
+        <NextWorkerId<T, I>>::mutate(|id| *id += <GroupWorkerId<T> as One>::one());
 
         // Remove an application.
         <ApplicationById<T, I>>::remove(application_info.application_id);
@@ -923,7 +925,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
     }
 
     // Set worker id as a leader id.
-    pub(crate) fn set_lead(worker_id: TeamWorkerId<T>) {
+    pub(crate) fn set_lead(worker_id: GroupWorkerId<T>) {
         // Update current lead
         <CurrentLead<T, I>>::put(worker_id);
 
@@ -943,7 +945,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
 
     // Fires the worker. Unsets the leader if necessary. Decreases active worker counter.
     // Deposits an event.
-    fn remove_worker(worker_id: &TeamWorkerId<T>, worker: &TeamWorker<T>, event: Event<T, I>) {
+    fn remove_worker(worker_id: &GroupWorkerId<T>, worker: &GroupWorker<T>, event: Event<T, I>) {
         // Unset lead if the leader is leaving.
         let leader_worker_id = <CurrentLead<T, I>>::get();
         if let Some(leader_worker_id) = leader_worker_id {
@@ -967,7 +969,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
 
     // Slash the stake.
     fn slash(
-        worker_id: TeamWorkerId<T>,
+        worker_id: GroupWorkerId<T>,
         staking_account_id: &T::AccountId,
         balance: Option<BalanceOf<T>>,
     ) {
@@ -975,8 +977,8 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         Self::deposit_event(RawEvent::StakeSlashed(worker_id, slashed_balance));
     }
 
-    // Reward a worker using reward presets and working team budget.
-    fn reward_worker(worker_id: &TeamWorkerId<T>, worker: &TeamWorker<T>) {
+    // Reward a worker using reward presets and working group budget.
+    fn reward_worker(worker_id: &GroupWorkerId<T>, worker: &GroupWorker<T>) {
         // If reward period is not set.
         let mut rewarding_period: u32 = T::RewardPeriod::get();
         if rewarding_period == 0u32 {
@@ -1020,8 +1022,8 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         let _ = <balances::Module<T>>::deposit_creating(account_id, amount);
     }
 
-    // Tries to pay missed reward if the reward is enabled for worker and there is enough of team budget.
-    fn try_to_pay_missed_reward(worker_id: &TeamWorkerId<T>, worker: &TeamWorker<T>) {
+    // Tries to pay missed reward if the reward is enabled for worker and there is enough of group budget.
+    fn try_to_pay_missed_reward(worker_id: &GroupWorkerId<T>, worker: &GroupWorker<T>) {
         if let Some(missed_reward) = worker.missed_reward {
             let (could_be_paid_reward, insufficient_amount) =
                 Self::calculate_possible_payment(missed_reward);
@@ -1046,8 +1048,8 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
 
     // Saves missed reward for a worker.
     fn save_missed_reward(
-        worker_id: &TeamWorkerId<T>,
-        worker: &TeamWorker<T>,
+        worker_id: &GroupWorkerId<T>,
+        worker: &GroupWorker<T>,
         reward: BalanceOf<T>,
     ) {
         // Save unpaid reward.
@@ -1061,7 +1063,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         });
     }
 
-    // Returns allowed payment by the team budget and possible missed payment
+    // Returns allowed payment by the group budget and possible missed payment
     fn calculate_possible_payment(amount: BalanceOf<T>) -> (BalanceOf<T>, BalanceOf<T>) {
         let budget = Self::budget();
 
@@ -1108,7 +1110,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
     }
 
     // Defines whether the worker staking parameters allow to leave without unstaking period.
-    fn can_leave_immediately(worker: &TeamWorker<T>) -> bool {
+    fn can_leave_immediately(worker: &GroupWorker<T>) -> bool {
         if worker.job_unstaking_period == Zero::zero() {
             return true;
         }

+ 45 - 45
runtime-modules/working-team/src/tests/fixtures.rs → runtime-modules/working-group/src/tests/fixtures.rs

@@ -6,11 +6,11 @@ use sp_runtime::traits::Hash;
 use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet};
 
 use super::hiring_workflow::HiringWorkflow;
-use super::mock::{Balances, LockId, Membership, System, Test, TestEvent, TestWorkingTeam};
+use super::mock::{Balances, LockId, Membership, System, Test, TestEvent, TestWorkingGroup};
 use crate::types::StakeParameters;
 use crate::{
     ApplyOnOpeningParameters, DefaultInstance, JobApplication, JobOpening, JobOpeningType, Penalty,
-    RawEvent, RewardPolicy, StakePolicy, TeamWorker,
+    RawEvent, RewardPolicy, StakePolicy, GroupWorker,
 };
 
 pub struct EventFixture;
@@ -58,19 +58,19 @@ impl Default for AddOpeningFixture {
 
 impl AddOpeningFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) -> u64 {
-        let saved_opening_next_id = TestWorkingTeam::next_opening_id();
+        let saved_opening_next_id = TestWorkingGroup::next_opening_id();
         let actual_result = self.call().map(|_| ());
 
         assert_eq!(actual_result.clone(), expected_result);
 
         if actual_result.is_ok() {
             assert_eq!(
-                TestWorkingTeam::next_opening_id(),
+                TestWorkingGroup::next_opening_id(),
                 saved_opening_next_id + 1
             );
             let opening_id = saved_opening_next_id;
 
-            let actual_opening = TestWorkingTeam::opening_by_id(opening_id);
+            let actual_opening = TestWorkingGroup::opening_by_id(opening_id);
 
             let expected_hash = <Test as frame_system::Trait>::Hashing::hash(&self.description);
             let expected_opening = JobOpening {
@@ -88,8 +88,8 @@ impl AddOpeningFixture {
     }
 
     pub fn call(&self) -> Result<u64, DispatchError> {
-        let saved_opening_next_id = TestWorkingTeam::next_opening_id();
-        TestWorkingTeam::add_opening(
+        let saved_opening_next_id = TestWorkingGroup::next_opening_id();
+        TestWorkingGroup::add_opening(
             self.origin.clone().into(),
             self.description.clone(),
             self.opening_type,
@@ -182,8 +182,8 @@ impl ApplyOnOpeningFixture {
     }
 
     pub fn call(&self) -> Result<u64, DispatchError> {
-        let saved_application_next_id = TestWorkingTeam::next_application_id();
-        TestWorkingTeam::apply_on_opening(
+        let saved_application_next_id = TestWorkingGroup::next_application_id();
+        TestWorkingGroup::apply_on_opening(
             self.origin.clone().into(),
             ApplyOnOpeningParameters::<Test, DefaultInstance> {
                 member_id: self.member_id,
@@ -198,19 +198,19 @@ impl ApplyOnOpeningFixture {
         Ok(saved_application_next_id)
     }
     pub fn call_and_assert(&self, expected_result: DispatchResult) -> u64 {
-        let saved_application_next_id = TestWorkingTeam::next_application_id();
+        let saved_application_next_id = TestWorkingGroup::next_application_id();
 
         let actual_result = self.call().map(|_| ());
         assert_eq!(actual_result.clone(), expected_result);
 
         if actual_result.is_ok() {
             assert_eq!(
-                TestWorkingTeam::next_application_id(),
+                TestWorkingGroup::next_application_id(),
                 saved_application_next_id + 1
             );
             let application_id = saved_application_next_id;
 
-            let actual_application = TestWorkingTeam::application_by_id(application_id);
+            let actual_application = TestWorkingGroup::application_by_id(application_id);
 
             let expected_hash = <Test as frame_system::Trait>::Hashing::hash(&self.description);
             let expected_application = JobApplication::<Test> {
@@ -308,8 +308,8 @@ impl FillOpeningFixture {
     }
 
     pub fn call(&self) -> Result<u64, DispatchError> {
-        let saved_worker_next_id = TestWorkingTeam::next_worker_id();
-        TestWorkingTeam::fill_opening(
+        let saved_worker_next_id = TestWorkingGroup::next_worker_id();
+        TestWorkingGroup::fill_opening(
             self.origin.clone().into(),
             self.opening_id,
             self.successful_application_ids.clone(),
@@ -319,13 +319,13 @@ impl FillOpeningFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) -> u64 {
-        let saved_worker_count = TestWorkingTeam::active_worker_count();
-        let saved_worker_next_id = TestWorkingTeam::next_worker_id();
+        let saved_worker_count = TestWorkingGroup::active_worker_count();
+        let saved_worker_next_id = TestWorkingGroup::next_worker_id();
         let actual_result = self.call().map(|_| ());
         assert_eq!(actual_result.clone(), expected_result);
 
         if actual_result.is_ok() {
-            assert_eq!(TestWorkingTeam::next_worker_id(), saved_worker_next_id + 1);
+            assert_eq!(TestWorkingGroup::next_worker_id(), saved_worker_next_id + 1);
             let worker_id = saved_worker_next_id;
 
             assert!(!<crate::OpeningById<Test, DefaultInstance>>::contains_key(
@@ -338,7 +338,7 @@ impl FillOpeningFixture {
                 );
             }
 
-            let expected_worker = TeamWorker::<Test> {
+            let expected_worker = GroupWorker::<Test> {
                 member_id: 1,
                 role_account_id: self.role_account_id,
                 reward_account_id: self.reward_account_id,
@@ -353,7 +353,7 @@ impl FillOpeningFixture {
                 created_at: self.created_at,
             };
 
-            let actual_worker = TestWorkingTeam::worker_by_id(worker_id);
+            let actual_worker = TestWorkingGroup::worker_by_id(worker_id);
 
             assert_eq!(actual_worker, expected_worker);
 
@@ -361,7 +361,7 @@ impl FillOpeningFixture {
                 saved_worker_count + (self.successful_application_ids.len() as u32);
 
             assert_eq!(
-                TestWorkingTeam::active_worker_count(),
+                TestWorkingGroup::active_worker_count(),
                 expected_worker_count
             );
         }
@@ -491,7 +491,7 @@ impl UpdateWorkerRoleAccountFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let actual_result = TestWorkingTeam::update_role_account(
+        let actual_result = TestWorkingGroup::update_role_account(
             self.origin.clone().into(),
             self.worker_id,
             self.new_role_account_id,
@@ -499,7 +499,7 @@ impl UpdateWorkerRoleAccountFixture {
         assert_eq!(actual_result, expected_result);
 
         if actual_result.is_ok() {
-            let worker = TestWorkingTeam::worker_by_id(self.worker_id);
+            let worker = TestWorkingGroup::worker_by_id(self.worker_id);
 
             assert_eq!(worker.role_account_id, self.new_role_account_id);
         }
@@ -532,12 +532,12 @@ impl LeaveWorkerRoleFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let actual_result = TestWorkingTeam::leave_role(self.origin.clone().into(), self.worker_id);
+        let actual_result = TestWorkingGroup::leave_role(self.origin.clone().into(), self.worker_id);
         assert_eq!(actual_result, expected_result);
 
         if actual_result.is_ok() {
             if self.stake_policy.is_some() {
-                let worker = TestWorkingTeam::worker_by_id(self.worker_id);
+                let worker = TestWorkingGroup::worker_by_id(self.worker_id);
 
                 if worker.job_unstaking_period > 0 {
                     assert_eq!(
@@ -578,7 +578,7 @@ impl TerminateWorkerRoleFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let actual_result = TestWorkingTeam::terminate_role(
+        let actual_result = TestWorkingGroup::terminate_role(
             self.origin.clone().into(),
             self.worker_id,
             self.penalty.clone(),
@@ -634,7 +634,7 @@ impl SlashWorkerStakeFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let old_balance = Balances::usable_balance(&self.account_id);
         let old_stake = get_stake_balance(&self.account_id);
-        let actual_result = TestWorkingTeam::slash_stake(
+        let actual_result = TestWorkingGroup::slash_stake(
             self.origin.clone().into(),
             self.worker_id,
             self.penalty.clone(),
@@ -666,10 +666,10 @@ pub(crate) fn get_stake_balance(account_id: &u64) -> u64 {
 }
 
 fn get_current_lead_account_id() -> u64 {
-    let leader_worker_id = TestWorkingTeam::current_lead();
+    let leader_worker_id = TestWorkingGroup::current_lead();
 
     if let Some(leader_worker_id) = leader_worker_id {
-        let leader = TestWorkingTeam::worker_by_id(leader_worker_id);
+        let leader = TestWorkingGroup::worker_by_id(leader_worker_id);
         leader.role_account_id
     } else {
         0 // return invalid lead_account_id for testing
@@ -707,7 +707,7 @@ impl DecreaseWorkerStakeFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let old_balance = Balances::usable_balance(&self.account_id);
         let old_stake = get_stake_balance(&self.account_id);
-        let actual_result = TestWorkingTeam::decrease_stake(
+        let actual_result = TestWorkingGroup::decrease_stake(
             self.origin.clone().into(),
             self.worker_id,
             self.balance,
@@ -755,7 +755,7 @@ impl IncreaseWorkerStakeFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let old_balance = Balances::usable_balance(&self.account_id);
         let old_stake = get_stake_balance(&self.account_id);
-        let actual_result = TestWorkingTeam::increase_stake(
+        let actual_result = TestWorkingGroup::increase_stake(
             self.origin.clone().into(),
             self.worker_id,
             self.balance,
@@ -819,7 +819,7 @@ impl WithdrawApplicationFixture {
         let old_stake = get_stake_balance(&self.account_id);
 
         let actual_result =
-            TestWorkingTeam::withdraw_application(self.origin.clone().into(), self.application_id);
+            TestWorkingGroup::withdraw_application(self.origin.clone().into(), self.application_id);
         assert_eq!(actual_result.clone(), expected_result);
 
         if actual_result.is_ok() {
@@ -854,7 +854,7 @@ impl CancelOpeningFixture {
     }
 
     pub fn call(&self) -> DispatchResult {
-        TestWorkingTeam::cancel_opening(self.origin.clone().into(), self.opening_id)
+        TestWorkingGroup::cancel_opening(self.origin.clone().into(), self.opening_id)
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
@@ -904,17 +904,17 @@ impl SetBudgetFixture {
     }
 
     pub fn call(&self) -> DispatchResult {
-        TestWorkingTeam::set_budget(self.origin.clone().into(), self.new_budget)
+        TestWorkingGroup::set_budget(self.origin.clone().into(), self.new_budget)
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let old_budget = TestWorkingTeam::budget();
+        let old_budget = TestWorkingGroup::budget();
 
         let actual_result = self.call().map(|_| ());
 
         assert_eq!(actual_result.clone(), expected_result);
 
-        let new_budget = TestWorkingTeam::budget();
+        let new_budget = TestWorkingGroup::budget();
 
         if actual_result.is_ok() {
             assert_eq!(new_budget, self.new_budget);
@@ -943,7 +943,7 @@ impl UpdateRewardAccountFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let actual_result = TestWorkingTeam::update_reward_account(
+        let actual_result = TestWorkingGroup::update_reward_account(
             self.origin.clone().into(),
             self.worker_id,
             self.new_reward_account_id,
@@ -952,7 +952,7 @@ impl UpdateRewardAccountFixture {
         assert_eq!(actual_result.clone(), expected_result);
 
         if actual_result.is_ok() {
-            let worker = TestWorkingTeam::worker_by_id(self.worker_id);
+            let worker = TestWorkingGroup::worker_by_id(self.worker_id);
 
             assert_eq!(worker.reward_account_id, self.new_reward_account_id);
         }
@@ -987,7 +987,7 @@ impl UpdateRewardAmountFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let actual_result = TestWorkingTeam::update_reward_amount(
+        let actual_result = TestWorkingGroup::update_reward_amount(
             self.origin.clone().into(),
             self.worker_id,
             self.reward_per_block,
@@ -996,7 +996,7 @@ impl UpdateRewardAmountFixture {
         assert_eq!(actual_result.clone(), expected_result);
 
         if actual_result.is_ok() {
-            let worker = TestWorkingTeam::worker_by_id(self.worker_id);
+            let worker = TestWorkingGroup::worker_by_id(self.worker_id);
 
             assert_eq!(worker.reward_per_block, self.reward_per_block);
         }
@@ -1030,17 +1030,17 @@ impl SetStatusTextFixture {
     }
 
     pub fn call(&self) -> DispatchResult {
-        TestWorkingTeam::set_status_text(self.origin.clone().into(), self.new_status_text.clone())
+        TestWorkingGroup::set_status_text(self.origin.clone().into(), self.new_status_text.clone())
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let old_text_hash = TestWorkingTeam::status_text_hash();
+        let old_text_hash = TestWorkingGroup::status_text_hash();
 
         let actual_result = self.call().map(|_| ());
 
         assert_eq!(actual_result.clone(), expected_result);
 
-        let new_text_hash = TestWorkingTeam::status_text_hash();
+        let new_text_hash = TestWorkingGroup::status_text_hash();
 
         if actual_result.is_ok() {
             let expected_hash = <Test as frame_system::Trait>::Hashing::hash(
@@ -1086,7 +1086,7 @@ impl SpendFromBudgetFixture {
     }
 
     pub fn call(&self) -> DispatchResult {
-        TestWorkingTeam::spend_from_budget(
+        TestWorkingGroup::spend_from_budget(
             self.origin.clone().into(),
             self.account_id,
             self.amount,
@@ -1095,14 +1095,14 @@ impl SpendFromBudgetFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let old_budget = TestWorkingTeam::budget();
+        let old_budget = TestWorkingGroup::budget();
         let old_balance = Balances::usable_balance(&self.account_id);
 
         let actual_result = self.call().map(|_| ());
 
         assert_eq!(actual_result.clone(), expected_result);
 
-        let new_budget = TestWorkingTeam::budget();
+        let new_budget = TestWorkingGroup::budget();
         let new_balance = Balances::usable_balance(&self.account_id);
 
         if actual_result.is_ok() {

+ 3 - 3
runtime-modules/working-team/src/tests/hiring_workflow.rs → runtime-modules/working-group/src/tests/hiring_workflow.rs

@@ -4,7 +4,7 @@ use frame_system::RawOrigin;
 use crate::tests::fixtures::{
     setup_members, AddOpeningFixture, ApplyOnOpeningFixture, FillOpeningFixture, HireLeadFixture,
 };
-use crate::tests::mock::TestWorkingTeam;
+use crate::tests::mock::TestWorkingGroup;
 use crate::types::StakeParameters;
 use crate::{JobOpeningType, RewardPolicy, StakePolicy};
 
@@ -140,8 +140,8 @@ impl HiringWorkflow {
         let origin = match self.opening_type {
             JobOpeningType::Leader => RawOrigin::Root,
             JobOpeningType::Regular => {
-                let leader_worker_id = TestWorkingTeam::current_lead().unwrap();
-                let leader = TestWorkingTeam::worker_by_id(leader_worker_id);
+                let leader_worker_id = TestWorkingGroup::current_lead().unwrap();
+                let leader = TestWorkingGroup::worker_by_id(leader_worker_id);
                 let lead_account_id = leader.role_account_id;
 
                 RawOrigin::Signed(lead_account_id)

+ 4 - 4
runtime-modules/working-team/src/tests/mock/mod.rs → runtime-modules/working-group/src/tests/mock/mod.rs

@@ -16,7 +16,7 @@ impl_outer_origin! {
 
 mod staking_handler;
 
-mod working_team {
+mod working_group {
     pub use crate::Event;
 }
 
@@ -140,7 +140,7 @@ impl common::origin::ActorOriginValidator<Origin, u64, u64> for () {
     }
 }
 
-pub type TestWorkingTeam = Module<Test, DefaultInstance>;
+pub type TestWorkingGroup = Module<Test, DefaultInstance>;
 
 pub const STAKING_ACCOUNT_ID_FOR_FAILED_VALIDITY_CHECK: u64 = 111;
 pub const STAKING_ACCOUNT_ID_FOR_CONFLICTING_STAKES: u64 = 333;
@@ -159,9 +159,9 @@ pub fn build_test_externalities() -> sp_io::TestExternalities {
 pub fn run_to_block(n: u64) {
     while System::block_number() < n {
         <System as OnFinalize<u64>>::on_finalize(System::block_number());
-        <TestWorkingTeam as OnFinalize<u64>>::on_finalize(System::block_number());
+        <TestWorkingGroup as OnFinalize<u64>>::on_finalize(System::block_number());
         System::set_block_number(System::block_number() + 1);
         <System as OnInitialize<u64>>::on_initialize(System::block_number());
-        <TestWorkingTeam as OnInitialize<u64>>::on_initialize(System::block_number());
+        <TestWorkingGroup as OnInitialize<u64>>::on_initialize(System::block_number());
     }
 }

+ 0 - 0
runtime-modules/working-team/src/tests/mock/staking_handler.rs → runtime-modules/working-group/src/tests/mock/staking_handler.rs


+ 18 - 18
runtime-modules/working-team/src/tests/mod.rs → runtime-modules/working-group/src/tests/mod.rs

@@ -19,7 +19,7 @@ use crate::tests::mock::{
 use crate::types::StakeParameters;
 use crate::{
     DefaultInstance, Error, JobOpeningType, Penalty, RawEvent, RewardPolicy, StakePolicy,
-    TeamWorker,
+    GroupWorker,
 };
 use fixtures::{
     increase_total_balance_issuance_using_account_id, setup_members, AddOpeningFixture,
@@ -29,7 +29,7 @@ use fixtures::{
 };
 use frame_support::dispatch::DispatchError;
 use frame_support::StorageMap;
-use mock::{run_to_block, Balances, RewardPeriod, TestWorkingTeam, ACTOR_ORIGIN_ERROR};
+use mock::{run_to_block, Balances, RewardPeriod, TestWorkingGroup, ACTOR_ORIGIN_ERROR};
 use sp_runtime::traits::Hash;
 use sp_std::collections::btree_map::BTreeMap;
 
@@ -450,18 +450,18 @@ fn update_worker_role_account_by_leader_succeeds() {
         let new_account_id = 10;
         let worker_id = HireLeadFixture::default().hire_lead();
 
-        let old_lead = TestWorkingTeam::worker_by_id(worker_id);
+        let old_lead = TestWorkingGroup::worker_by_id(worker_id);
 
         let update_worker_account_fixture =
             UpdateWorkerRoleAccountFixture::default_with_ids(worker_id, new_account_id);
 
         update_worker_account_fixture.call_and_assert(Ok(()));
 
-        let new_lead = TestWorkingTeam::worker_by_id(worker_id);
+        let new_lead = TestWorkingGroup::worker_by_id(worker_id);
 
         assert_eq!(
             new_lead,
-            TeamWorker::<Test> {
+            GroupWorker::<Test> {
                 role_account_id: new_account_id,
                 ..old_lead
             }
@@ -595,16 +595,16 @@ fn leave_worker_role_succeeds_with_partial_payment_of_missed_reward() {
 fn leave_worker_role_by_leader_succeeds() {
     build_test_externalities().execute_with(|| {
         // Ensure that lead is default
-        assert_eq!(TestWorkingTeam::current_lead(), None);
+        assert_eq!(TestWorkingGroup::current_lead(), None);
         let worker_id = HireLeadFixture::default().hire_lead();
 
-        assert!(TestWorkingTeam::current_lead().is_some());
+        assert!(TestWorkingGroup::current_lead().is_some());
 
         let leave_worker_role_fixture = LeaveWorkerRoleFixture::default_for_worker_id(worker_id);
 
         leave_worker_role_fixture.call_and_assert(Ok(()));
 
-        assert_eq!(TestWorkingTeam::current_lead(), None);
+        assert_eq!(TestWorkingGroup::current_lead(), None);
     });
 }
 
@@ -745,7 +745,7 @@ fn terminate_leader_succeeds() {
 
         EventFixture::assert_last_crate_event(RawEvent::TerminatedLeader(worker_id));
 
-        assert_eq!(TestWorkingTeam::current_lead(), None);
+        assert_eq!(TestWorkingGroup::current_lead(), None);
     });
 }
 
@@ -755,7 +755,7 @@ fn terminate_worker_role_fails_with_unset_lead() {
         let worker_id = HireRegularWorkerFixture::default().hire();
 
         // Remove the leader from the storage.
-        TestWorkingTeam::unset_lead();
+        TestWorkingGroup::unset_lead();
 
         let terminate_worker_role_fixture =
             TerminateWorkerRoleFixture::default_for_worker_id(worker_id);
@@ -810,7 +810,7 @@ fn unset_lead_event_emitted() {
         HireRegularWorkerFixture::default().hire();
 
         // Remove the leader from the storage.
-        TestWorkingTeam::unset_lead();
+        TestWorkingGroup::unset_lead();
 
         EventFixture::assert_last_crate_event(RawEvent::LeaderUnset());
     });
@@ -829,7 +829,7 @@ fn set_lead_event_emitted() {
         let worker_id = 10;
 
         // Add the leader to the storage.
-        TestWorkingTeam::set_lead(worker_id);
+        TestWorkingGroup::set_lead(worker_id);
 
         EventFixture::assert_last_crate_event(RawEvent::LeaderSet(worker_id));
     });
@@ -1949,7 +1949,7 @@ fn rewards_payments_are_successful() {
             .with_reward_policy(reward_policy)
             .hire();
 
-        let worker = TestWorkingTeam::worker_by_id(worker_id);
+        let worker = TestWorkingGroup::worker_by_id(worker_id);
 
         let account_id = worker.role_account_id;
 
@@ -1977,7 +1977,7 @@ fn rewards_payments_with_no_budget() {
             .with_reward_policy(reward_policy)
             .hire();
 
-        let worker = TestWorkingTeam::worker_by_id(worker_id);
+        let worker = TestWorkingGroup::worker_by_id(worker_id);
 
         let account_id = worker.role_account_id;
 
@@ -1988,7 +1988,7 @@ fn rewards_payments_with_no_budget() {
 
         assert_eq!(Balances::usable_balance(&account_id), 0);
 
-        let worker = TestWorkingTeam::worker_by_id(worker_id);
+        let worker = TestWorkingGroup::worker_by_id(worker_id);
 
         assert_eq!(
             worker.missed_reward.unwrap(),
@@ -2007,7 +2007,7 @@ fn rewards_payments_with_insufficient_budget_and_restored_budget() {
             .with_reward_policy(reward_policy)
             .hire();
 
-        let worker = TestWorkingTeam::worker_by_id(worker_id);
+        let worker = TestWorkingGroup::worker_by_id(worker_id);
 
         let account_id = worker.reward_account_id;
 
@@ -2025,7 +2025,7 @@ fn rewards_payments_with_insufficient_budget_and_restored_budget() {
 
         assert_eq!(Balances::usable_balance(&account_id), first_budget);
 
-        let worker = TestWorkingTeam::worker_by_id(worker_id);
+        let worker = TestWorkingGroup::worker_by_id(worker_id);
 
         let effective_missed_reward: u64 = block_number * reward_per_block - first_budget;
 
@@ -2058,7 +2058,7 @@ fn rewards_payments_with_starting_block() {
             .with_reward_policy(reward_policy)
             .hire();
 
-        let worker = TestWorkingTeam::worker_by_id(worker_id);
+        let worker = TestWorkingGroup::worker_by_id(worker_id);
 
         let account_id = worker.reward_account_id;
 

+ 11 - 11
runtime-modules/working-team/src/types.rs → runtime-modules/working-group/src/types.rs

@@ -6,14 +6,14 @@ use sp_std::vec::Vec;
 #[cfg(feature = "std")]
 use serde::{Deserialize, Serialize};
 
-/// Team job application type alias.
+/// Group job application type alias.
 pub type JobApplication<T> = Application<<T as frame_system::Trait>::AccountId, MemberId<T>>;
 
 /// Member identifier in membership::member module.
 pub type MemberId<T> = <T as membership::Trait>::MemberId;
 
 /// Type identifier for a worker role, which must be same as membership actor identifier.
-pub type TeamWorkerId<T> = <T as membership::Trait>::ActorId;
+pub type GroupWorkerId<T> = <T as membership::Trait>::ActorId;
 
 // ApplicationId - JobApplication - helper struct.
 pub(crate) struct ApplicationInfo<T: crate::Trait<I>, I: crate::Instance> {
@@ -21,22 +21,22 @@ pub(crate) struct ApplicationInfo<T: crate::Trait<I>, I: crate::Instance> {
     pub application: JobApplication<T>,
 }
 
-// WorkerId - TeamWorker - helper struct.
+// WorkerId - GroupWorker - helper struct.
 pub(crate) struct WorkerInfo<T: membership::Trait + frame_system::Trait + balances::Trait> {
-    pub worker_id: TeamWorkerId<T>,
-    pub worker: TeamWorker<T>,
+    pub worker_id: GroupWorkerId<T>,
+    pub worker: GroupWorker<T>,
 }
 
 impl<T: membership::Trait + frame_system::Trait + balances::Trait>
-    From<(TeamWorkerId<T>, TeamWorker<T>)> for WorkerInfo<T>
+    From<(GroupWorkerId<T>, GroupWorker<T>)> for WorkerInfo<T>
 {
-    fn from((worker_id, worker): (TeamWorkerId<T>, TeamWorker<T>)) -> Self {
+    fn from((worker_id, worker): (GroupWorkerId<T>, GroupWorker<T>)) -> Self {
         WorkerInfo { worker_id, worker }
     }
 }
 
-/// Team worker type alias.
-pub type TeamWorker<T> = Worker<
+/// Group worker type alias.
+pub type GroupWorker<T> = Worker<
     <T as frame_system::Trait>::AccountId,
     MemberId<T>,
     <T as frame_system::Trait>::BlockNumber,
@@ -125,7 +125,7 @@ impl<AccountId: Clone, MemberId: Clone> Application<AccountId, MemberId> {
     }
 }
 
-/// Working team participant: regular worker or lead.
+/// Working group participant: regular worker or lead.
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 #[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
 pub struct Worker<AccountId, MemberId, BlockNumber, Balance> {
@@ -161,7 +161,7 @@ pub struct Worker<AccountId, MemberId, BlockNumber, Balance> {
 impl<AccountId: Clone, MemberId: Clone, BlockNumber, Balance>
     Worker<AccountId, MemberId, BlockNumber, Balance>
 {
-    /// Creates a new _TeamWorker_ using parameters.
+    /// Creates a new _GroupWorker_ using parameters.
     pub fn new(
         member_id: &MemberId,
         role_account_id: &AccountId,