Browse Source

Merge pull request #851 from shamil-gadelshin/working_group_zero_stake_bugfix

Fix zero stake bug in the hiring module.
Bedeho Mender 4 years ago
parent
commit
b3a73b5e1f

+ 3 - 3
Cargo.lock

@@ -4694,7 +4694,7 @@ dependencies = [
 
 [[package]]
 name = "substrate-content-working-group-module"
-version = "1.0.0"
+version = "1.0.1"
 dependencies = [
  "parity-scale-codec",
  "serde",
@@ -4857,7 +4857,7 @@ dependencies = [
 
 [[package]]
 name = "substrate-hiring-module"
-version = "1.0.1"
+version = "1.0.2"
 dependencies = [
  "hex-literal 0.1.4",
  "mockall",
@@ -5568,7 +5568,7 @@ dependencies = [
 
 [[package]]
 name = "substrate-working-group-module"
-version = "1.0.0"
+version = "1.0.1"
 dependencies = [
  "parity-scale-codec",
  "serde",

+ 1 - 1
runtime-modules/content-working-group/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'substrate-content-working-group-module'
-version = '1.0.0'
+version = '1.0.1'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 11 - 1
runtime-modules/content-working-group/src/lib.rs

@@ -239,6 +239,10 @@ pub static MSG_ORIGIN_IS_NIETHER_MEMBER_CONTROLLER_OR_ROOT: &str =
     "Origin must be controller or root account of member";
 pub static MSG_MEMBER_HAS_ACTIVE_APPLICATION_ON_OPENING: &str =
     "Member already has an active application on the opening";
+pub static MSG_ADD_CURATOR_OPENING_ROLE_STAKE_CANNOT_BE_ZERO: &str =
+    "Add curator opening role stake cannot be zero";
+pub static MSG_ADD_CURATOR_OPENING_APPLICATION_STAKE_CANNOT_BE_ZERO: &str =
+    "Add curator opening application stake cannot be zero";
 
 /// The exit stage of a lead involvement in the working group.
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
@@ -836,7 +840,7 @@ impl rstd::convert::From<WrappedError<hiring::AddOpeningError>> for &str {
             hiring::AddOpeningError::OpeningMustActivateInTheFuture => {
                 MSG_ADD_CURATOR_OPENING_ACTIVATES_IN_THE_PAST
             }
-            hiring::AddOpeningError::StakeAmountLessThanMinimumCurrencyBalance(purpose) => {
+            hiring::AddOpeningError::StakeAmountLessThanMinimumStakeBalance(purpose) => {
                 match purpose {
                     hiring::StakePurpose::Role => {
                         MSG_ADD_CURATOR_OPENING_ROLE_STAKE_LESS_THAN_MINIMUM
@@ -849,6 +853,12 @@ impl rstd::convert::From<WrappedError<hiring::AddOpeningError>> for &str {
             hiring::AddOpeningError::ApplicationRationingZeroMaxApplicants => {
                 MSG_ADD_CURATOR_OPENING_ZERO_MAX_APPLICANT_COUNT
             }
+            hiring::AddOpeningError::StakeAmountCannotBeZero(purpose) => match purpose {
+                hiring::StakePurpose::Role => MSG_ADD_CURATOR_OPENING_ROLE_STAKE_CANNOT_BE_ZERO,
+                hiring::StakePurpose::Application => {
+                    MSG_ADD_CURATOR_OPENING_APPLICATION_STAKE_CANNOT_BE_ZERO
+                }
+            },
         }
     }
 }

+ 1 - 1
runtime-modules/hiring/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'substrate-hiring-module'
-version = '1.0.1'
+version = '1.0.2'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 4 - 1
runtime-modules/hiring/src/hiring/mod.rs

@@ -149,9 +149,12 @@ pub enum AddOpeningError {
 
     /// It is not possible to stake less than the minimum balance defined in the
     /// `Currency` module.
-    StakeAmountLessThanMinimumCurrencyBalance(StakePurpose),
+    StakeAmountLessThanMinimumStakeBalance(StakePurpose),
 
     /// It is not possible to provide application rationing policy with zero
     /// 'max_active_applicants' parameter.
     ApplicationRationingZeroMaxApplicants,
+
+    /// It is not possible to stake zero.
+    StakeAmountCannotBeZero(StakePurpose),
 }

+ 0 - 43
runtime-modules/hiring/src/hiring/opening.rs

@@ -6,7 +6,6 @@ use rstd::vec::Vec;
 use codec::{Decode, Encode};
 #[cfg(feature = "std")]
 use serde::{Deserialize, Serialize};
-use srml_support::ensure;
 
 use crate::hiring;
 use crate::hiring::*;
@@ -148,48 +147,6 @@ where
             panic!("stage MUST be active")
         }
     }
-
-    /// Performs all necessary check before adding an opening
-    pub(crate) fn ensure_can_add_opening(
-        current_block_height: BlockNumber,
-        activate_at: ActivateOpeningAt<BlockNumber>,
-        runtime_minimum_balance: Balance,
-        application_rationing_policy: Option<ApplicationRationingPolicy>,
-        application_staking_policy: Option<StakingPolicy<Balance, BlockNumber>>,
-        role_staking_policy: Option<StakingPolicy<Balance, BlockNumber>>,
-    ) -> Result<(), AddOpeningError> {
-        // Check that exact activation is actually in the future
-        ensure!(
-            match activate_at {
-                ActivateOpeningAt::ExactBlock(block_number) => block_number > current_block_height,
-                _ => true,
-            },
-            AddOpeningError::OpeningMustActivateInTheFuture
-        );
-
-        if let Some(app_rationing_policy) = application_rationing_policy {
-            ensure!(
-                app_rationing_policy.max_active_applicants > 0,
-                AddOpeningError::ApplicationRationingZeroMaxApplicants
-            );
-        }
-
-        // Check that staking amounts clear minimum balance required.
-        StakingPolicy::ensure_amount_valid_in_opt_staking_policy(
-            application_staking_policy,
-            runtime_minimum_balance.clone(),
-            AddOpeningError::StakeAmountLessThanMinimumCurrencyBalance(StakePurpose::Application),
-        )?;
-
-        // Check that staking amounts clear minimum balance required.
-        StakingPolicy::ensure_amount_valid_in_opt_staking_policy(
-            role_staking_policy,
-            runtime_minimum_balance,
-            AddOpeningError::StakeAmountLessThanMinimumCurrencyBalance(StakePurpose::Role),
-        )?;
-
-        Ok(())
-    }
 }
 
 /// The stage at which an `Opening` may be at.

+ 0 - 15
runtime-modules/hiring/src/hiring/staking_policy.rs

@@ -50,21 +50,6 @@ impl<Balance: PartialOrd + Clone, BlockNumber: Clone> StakingPolicy<Balance, Blo
             None
         }
     }
-
-    /// Ensures that optional staking policy prescribes value that clears minimum balance requirement
-    pub(crate) fn ensure_amount_valid_in_opt_staking_policy<Err>(
-        opt_staking_policy: Option<StakingPolicy<Balance, BlockNumber>>,
-        runtime_minimum_balance: Balance,
-        error: Err,
-    ) -> Result<(), Err> {
-        if let Some(ref staking_policy) = opt_staking_policy {
-            if staking_policy.amount < runtime_minimum_balance {
-                return Err(error);
-            }
-        }
-
-        Ok(())
-    }
 }
 
 /// Constraints around staking amount

+ 64 - 1
runtime-modules/hiring/src/lib.rs

@@ -184,7 +184,7 @@ impl<T: Trait> Module<T> {
     ) -> Result<T::OpeningId, AddOpeningError> {
         let current_block_height = <system::Module<T>>::block_number();
 
-        Opening::<BalanceOf<T>, T::BlockNumber, T::ApplicationId>::ensure_can_add_opening(
+        Self::ensure_can_add_opening(
             current_block_height,
             activate_at.clone(),
             T::Currency::minimum_balance(),
@@ -1406,6 +1406,69 @@ impl<T: Trait> Module<T> {
             None
         }
     }
+
+    /// Performs all necessary check before adding an opening
+    pub(crate) fn ensure_can_add_opening(
+        current_block_height: T::BlockNumber,
+        activate_at: ActivateOpeningAt<T::BlockNumber>,
+        minimum_stake_balance: BalanceOf<T>,
+        application_rationing_policy: Option<ApplicationRationingPolicy>,
+        application_staking_policy: Option<StakingPolicy<BalanceOf<T>, T::BlockNumber>>,
+        role_staking_policy: Option<StakingPolicy<BalanceOf<T>, T::BlockNumber>>,
+    ) -> Result<(), AddOpeningError> {
+        // Check that exact activation is actually in the future
+        ensure!(
+            match activate_at {
+                ActivateOpeningAt::ExactBlock(block_number) => block_number > current_block_height,
+                _ => true,
+            },
+            AddOpeningError::OpeningMustActivateInTheFuture
+        );
+
+        if let Some(app_rationing_policy) = application_rationing_policy {
+            ensure!(
+                app_rationing_policy.max_active_applicants > 0,
+                AddOpeningError::ApplicationRationingZeroMaxApplicants
+            );
+        }
+
+        // Check that staking amounts clear minimum balance required.
+        Self::ensure_amount_valid_in_opt_staking_policy(
+            application_staking_policy,
+            minimum_stake_balance,
+            StakePurpose::Application,
+        )?;
+
+        // Check that staking amounts clear minimum balance required.
+        Self::ensure_amount_valid_in_opt_staking_policy(
+            role_staking_policy,
+            minimum_stake_balance,
+            StakePurpose::Role,
+        )?;
+
+        Ok(())
+    }
+
+    /// Ensures that optional staking policy prescribes value that clears minimum balance requirement
+    pub(crate) fn ensure_amount_valid_in_opt_staking_policy(
+        opt_staking_policy: Option<StakingPolicy<BalanceOf<T>, T::BlockNumber>>,
+        minimum_stake_balance: BalanceOf<T>,
+        stake_purpose: StakePurpose,
+    ) -> Result<(), AddOpeningError> {
+        if let Some(ref staking_policy) = opt_staking_policy {
+            ensure!(
+                staking_policy.amount > Zero::zero(),
+                AddOpeningError::StakeAmountCannotBeZero(stake_purpose)
+            );
+
+            ensure!(
+                staking_policy.amount >= minimum_stake_balance,
+                AddOpeningError::StakeAmountLessThanMinimumStakeBalance(stake_purpose)
+            );
+        }
+
+        Ok(())
+    }
 }
 
 /*

+ 33 - 4
runtime-modules/hiring/src/test/public_api/add_opening.rs

@@ -1,6 +1,11 @@
-use crate::mock::*;
-use crate::test::*;
+use crate::mock::{build_test_externalities, Hiring, Test};
+use crate::test::{BlockNumber, OpeningId};
 use crate::StakingAmountLimitMode::Exact;
+use crate::*;
+use crate::{
+    ActivateOpeningAt, ActiveOpeningStage, AddOpeningError, ApplicationRationingPolicy, Opening,
+    OpeningStage, StakePurpose, StakingPolicy,
+};
 use rstd::collections::btree_set::BTreeSet;
 
 static FIRST_BLOCK_HEIGHT: <Test as system::Trait>::BlockNumber = 1;
@@ -143,6 +148,18 @@ fn add_opening_succeeds_or_fails_due_to_application_staking_policy() {
 
         opening_data.call_and_assert(Ok(0));
 
+        //Zero stake amount
+        opening_data.application_staking_policy = Some(StakingPolicy {
+            amount: 0,
+            amount_mode: Exact,
+            crowded_out_unstaking_period_length: None,
+            review_period_expired_unstaking_period_length: None,
+        });
+
+        opening_data.call_and_assert(Err(AddOpeningError::StakeAmountCannotBeZero(
+            StakePurpose::Application,
+        )));
+
         //Invalid stake amount
         opening_data.application_staking_policy = Some(StakingPolicy {
             amount: 1,
@@ -152,7 +169,7 @@ fn add_opening_succeeds_or_fails_due_to_application_staking_policy() {
         });
 
         opening_data.call_and_assert(Err(
-            AddOpeningError::StakeAmountLessThanMinimumCurrencyBalance(StakePurpose::Application),
+            AddOpeningError::StakeAmountLessThanMinimumStakeBalance(StakePurpose::Application),
         ));
     });
 }
@@ -171,6 +188,18 @@ fn add_opening_succeeds_or_fails_due_to_role_staking_policy() {
 
         opening_data.call_and_assert(Ok(0));
 
+        //Zero stake amount
+        opening_data.role_staking_policy = Some(StakingPolicy {
+            amount: 0,
+            amount_mode: Exact,
+            crowded_out_unstaking_period_length: None,
+            review_period_expired_unstaking_period_length: None,
+        });
+
+        opening_data.call_and_assert(Err(AddOpeningError::StakeAmountCannotBeZero(
+            StakePurpose::Role,
+        )));
+
         //Invalid stake amount
         opening_data.role_staking_policy = Some(StakingPolicy {
             amount: 1,
@@ -180,7 +209,7 @@ fn add_opening_succeeds_or_fails_due_to_role_staking_policy() {
         });
 
         opening_data.call_and_assert(Err(
-            AddOpeningError::StakeAmountLessThanMinimumCurrencyBalance(StakePurpose::Role),
+            AddOpeningError::StakeAmountLessThanMinimumStakeBalance(StakePurpose::Role),
         ));
     });
 }

+ 1 - 1
runtime-modules/working-group/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'substrate-working-group-module'
-version = '1.0.0'
+version = '1.0.1'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 13 - 1
runtime-modules/working-group/src/errors.rs

@@ -248,6 +248,12 @@ decl_error! {
         /// Working group size limit exceeded.
         MaxActiveWorkerNumberExceeded,
 
+        /// Add worker opening role stake cannot be zero.
+        AddWorkerOpeningRoleStakeCannotBeZero,
+
+        /// Add worker opening application stake cannot be zero.
+        AddWorkerOpeningApplicationStakeCannotBeZero,
+
         /// Invalid OpeningPolicyCommitment parameter:
         /// fill_opening_failed_applicant_application_stake_unstaking_period should be non-zero.
         FillOpeningFailedApplicantApplicationStakeUnstakingPeriodIsZero,
@@ -306,7 +312,7 @@ impl rstd::convert::From<WrappedError<hiring::AddOpeningError>> for Error {
             hiring::AddOpeningError::OpeningMustActivateInTheFuture => {
                 Error::AddWorkerOpeningActivatesInThePast
             }
-            hiring::AddOpeningError::StakeAmountLessThanMinimumCurrencyBalance(purpose) => {
+            hiring::AddOpeningError::StakeAmountLessThanMinimumStakeBalance(purpose) => {
                 match purpose {
                     hiring::StakePurpose::Role => Error::AddWorkerOpeningRoleStakeLessThanMinimum,
                     hiring::StakePurpose::Application => {
@@ -317,6 +323,12 @@ impl rstd::convert::From<WrappedError<hiring::AddOpeningError>> for Error {
             hiring::AddOpeningError::ApplicationRationingZeroMaxApplicants => {
                 Error::AddWorkerOpeningZeroMaxApplicantCount
             }
+            hiring::AddOpeningError::StakeAmountCannotBeZero(purpose) => match purpose {
+                hiring::StakePurpose::Role => Error::AddWorkerOpeningRoleStakeCannotBeZero,
+                hiring::StakePurpose::Application => {
+                    Error::AddWorkerOpeningApplicationStakeCannotBeZero
+                }
+            },
         }
     }
 }

+ 191 - 174
runtime-modules/working-group/src/tests/mod.rs

@@ -91,13 +91,13 @@ fn add_opening_fails_with_incorrect_unstaking_periods() {
 }
 
 #[test]
-fn add_worker_opening_succeeds() {
+fn add_opening_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
 
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::OpeningAdded(opening_id));
     });
@@ -108,10 +108,10 @@ fn add_leader_opening_succeeds_fails_with_incorrect_origin_for_opening_type() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture =
+        let add_opening_fixture =
             AddWorkerOpeningFixture::default().with_opening_type(OpeningType::Leader);
 
-        add_worker_opening_fixture.call_and_assert(Err(Error::RequireRootOrigin));
+        add_opening_fixture.call_and_assert(Err(Error::RequireRootOrigin));
     });
 }
 
@@ -120,25 +120,25 @@ fn add_leader_opening_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default()
+        let add_opening_fixture = AddWorkerOpeningFixture::default()
             .with_opening_type(OpeningType::Leader)
             .with_origin(RawOrigin::Root);
 
-        add_worker_opening_fixture.call_and_assert(Ok(()));
+        add_opening_fixture.call_and_assert(Ok(()));
     });
 }
 
 #[test]
-fn add_worker_opening_fails_with_lead_is_not_set() {
+fn add_opening_fails_with_lead_is_not_set() {
     build_test_externalities().execute_with(|| {
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
 
-        add_worker_opening_fixture.call_and_assert(Err(Error::CurrentLeadNotSet));
+        add_opening_fixture.call_and_assert(Err(Error::CurrentLeadNotSet));
     });
 }
 
 #[test]
-fn add_worker_opening_fails_with_invalid_human_readable_text() {
+fn add_opening_fails_with_invalid_human_readable_text() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
@@ -149,119 +149,119 @@ fn add_worker_opening_fails_with_invalid_human_readable_text() {
             },
         );
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default().with_text(Vec::new());
+        let add_opening_fixture = AddWorkerOpeningFixture::default().with_text(Vec::new());
 
-        add_worker_opening_fixture.call_and_assert(Err(Error::Other("OpeningTextTooShort")));
+        add_opening_fixture.call_and_assert(Err(Error::Other("OpeningTextTooShort")));
 
-        let add_worker_opening_fixture =
+        let add_opening_fixture =
             AddWorkerOpeningFixture::default().with_text(b"Long text".to_vec());
 
-        add_worker_opening_fixture.call_and_assert(Err(Error::Other("OpeningTextTooLong")));
+        add_opening_fixture.call_and_assert(Err(Error::Other("OpeningTextTooLong")));
     });
 }
 
 #[test]
-fn add_worker_opening_fails_with_hiring_error() {
+fn add_opening_fails_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default()
+        let add_opening_fixture = AddWorkerOpeningFixture::default()
             .with_activate_at(hiring::ActivateOpeningAt::ExactBlock(0));
 
-        add_worker_opening_fixture.call_and_assert(Err(Error::AddWorkerOpeningActivatesInThePast));
+        add_opening_fixture.call_and_assert(Err(Error::AddWorkerOpeningActivatesInThePast));
     });
 }
 
 #[test]
-fn accept_worker_applications_succeeds() {
+fn accept_applications_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default()
+        let add_opening_fixture = AddWorkerOpeningFixture::default()
             .with_activate_at(hiring::ActivateOpeningAt::ExactBlock(5));
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let accept_worker_applications_fixture =
+        let accept_applications_fixture =
             AcceptWorkerApplicationsFixture::default_for_opening_id(opening_id);
-        accept_worker_applications_fixture.call_and_assert(Ok(()));
+        accept_applications_fixture.call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::AcceptedApplications(opening_id));
     });
 }
 
 #[test]
-fn accept_worker_applications_fails_for_invalid_opening_type() {
+fn accept_applications_fails_for_invalid_opening_type() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default()
+        let add_opening_fixture = AddWorkerOpeningFixture::default()
             .with_origin(RawOrigin::Root)
             .with_opening_type(OpeningType::Leader)
             .with_activate_at(hiring::ActivateOpeningAt::ExactBlock(5));
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let accept_worker_applications_fixture =
+        let accept_applications_fixture =
             AcceptWorkerApplicationsFixture::default_for_opening_id(opening_id);
-        accept_worker_applications_fixture.call_and_assert(Err(Error::RequireRootOrigin));
+        accept_applications_fixture.call_and_assert(Err(Error::RequireRootOrigin));
     });
 }
 
 #[test]
-fn accept_worker_applications_fails_with_hiring_error() {
+fn accept_applications_fails_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let accept_worker_applications_fixture =
+        let accept_applications_fixture =
             AcceptWorkerApplicationsFixture::default_for_opening_id(opening_id);
-        accept_worker_applications_fixture.call_and_assert(Err(
+        accept_applications_fixture.call_and_assert(Err(
             Error::AcceptWorkerApplicationsOpeningIsNotWaitingToBegin,
         ));
     });
 }
 
 #[test]
-fn accept_worker_applications_fails_with_not_lead() {
+fn accept_applications_fails_with_not_lead() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         SetLeadFixture::set_lead_with_ids(2, 2, 2);
 
-        let accept_worker_applications_fixture =
+        let accept_applications_fixture =
             AcceptWorkerApplicationsFixture::default_for_opening_id(opening_id);
-        accept_worker_applications_fixture.call_and_assert(Err(Error::IsNotLeadAccount));
+        accept_applications_fixture.call_and_assert(Err(Error::IsNotLeadAccount));
     });
 }
 
 #[test]
-fn accept_worker_applications_fails_with_no_opening() {
+fn accept_applications_fails_with_no_opening() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
         let opening_id = 55; // random opening id
 
-        let accept_worker_applications_fixture =
+        let accept_applications_fixture =
             AcceptWorkerApplicationsFixture::default_for_opening_id(opening_id);
-        accept_worker_applications_fixture.call_and_assert(Err(Error::OpeningDoesNotExist));
+        accept_applications_fixture.call_and_assert(Err(Error::OpeningDoesNotExist));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_succeeds() {
+fn apply_on_opening_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::AppliedOnOpening(
             opening_id,
@@ -271,59 +271,58 @@ fn apply_on_worker_opening_succeeds() {
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_no_opening() {
+fn apply_on_opening_fails_with_no_opening() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
         let opening_id = 123; // random opening id
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        appy_on_worker_opening_fixture.call_and_assert(Err(Error::OpeningDoesNotExist));
+        apply_on_opening_fixture.call_and_assert(Err(Error::OpeningDoesNotExist));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_not_set_members() {
+fn apply_on_opening_fails_with_not_set_members() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_origin(RawOrigin::Signed(55), 55);
-        appy_on_worker_opening_fixture
-            .call_and_assert(Err(Error::OriginIsNeitherMemberControllerOrRoot));
+        apply_on_opening_fixture.call_and_assert(Err(Error::OriginIsNeitherMemberControllerOrRoot));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_hiring_error() {
+fn apply_on_opening_fails_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         increase_total_balance_issuance_using_account_id(1, 500000);
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_application_stake(100);
-        appy_on_worker_opening_fixture
+        apply_on_opening_fixture
             .call_and_assert(Err(Error::AddWorkerOpeningStakeProvidedWhenRedundant));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_invalid_application_stake() {
+fn apply_on_opening_fails_with_invalid_application_stake() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
         let stake = 100;
 
-        let add_worker_opening_fixture =
+        let add_opening_fixture =
             AddWorkerOpeningFixture::default().with_policy_commitment(OpeningPolicyCommitment {
                 application_staking_policy: Some(hiring::StakingPolicy {
                     amount: stake,
@@ -331,24 +330,45 @@ fn apply_on_worker_opening_fails_with_invalid_application_stake() {
                 }),
                 ..OpeningPolicyCommitment::default()
             });
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_origin(RawOrigin::Signed(2), 2)
                 .with_application_stake(stake);
-        appy_on_worker_opening_fixture.call_and_assert(Err(Error::InsufficientBalanceToApply));
+        apply_on_opening_fixture.call_and_assert(Err(Error::InsufficientBalanceToApply));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_invalid_role_stake() {
+fn add_opening_fails_with_invalid_zero_application_stake() {
+    build_test_externalities().execute_with(|| {
+        HireLeadFixture::default().hire_lead();
+
+        let zero_stake = 0;
+
+        let add_opening_fixture =
+            AddWorkerOpeningFixture::default().with_policy_commitment(OpeningPolicyCommitment {
+                application_staking_policy: Some(hiring::StakingPolicy {
+                    amount: zero_stake,
+                    amount_mode: hiring::StakingAmountLimitMode::AtLeast,
+                    ..hiring::StakingPolicy::default()
+                }),
+                ..OpeningPolicyCommitment::default()
+            });
+        add_opening_fixture
+            .call_and_assert(Err(Error::AddWorkerOpeningApplicationStakeCannotBeZero));
+    });
+}
+
+#[test]
+fn apply_on_opening_fails_with_invalid_role_stake() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
         let stake = 100;
 
-        let add_worker_opening_fixture =
+        let add_opening_fixture =
             AddWorkerOpeningFixture::default().with_policy_commitment(OpeningPolicyCommitment {
                 role_staking_policy: Some(hiring::StakingPolicy {
                     amount: stake,
@@ -356,23 +376,23 @@ fn apply_on_worker_opening_fails_with_invalid_role_stake() {
                 }),
                 ..OpeningPolicyCommitment::default()
             });
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_role_stake(Some(stake))
                 .with_origin(RawOrigin::Signed(2), 2);
-        appy_on_worker_opening_fixture.call_and_assert(Err(Error::InsufficientBalanceToApply));
+        apply_on_opening_fixture.call_and_assert(Err(Error::InsufficientBalanceToApply));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_invalid_text() {
+fn apply_on_opening_fails_with_invalid_text() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         <crate::WorkerApplicationHumanReadableText<TestWorkingGroupInstance>>::put(
             InputValidationLengthConstraint {
@@ -381,33 +401,31 @@ fn apply_on_worker_opening_fails_with_invalid_text() {
             },
         );
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id).with_text(Vec::new());
-        appy_on_worker_opening_fixture
+        apply_on_opening_fixture
             .call_and_assert(Err(Error::Other("WorkerApplicationTextTooShort")));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_text(b"Long text".to_vec());
-        appy_on_worker_opening_fixture
-            .call_and_assert(Err(Error::Other("WorkerApplicationTextTooLong")));
+        apply_on_opening_fixture.call_and_assert(Err(Error::Other("WorkerApplicationTextTooLong")));
     });
 }
 
 #[test]
-fn apply_on_worker_opening_fails_with_already_active_application() {
+fn apply_on_opening_fails_with_already_active_application() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        apply_on_opening_fixture.call_and_assert(Ok(()));
 
-        appy_on_worker_opening_fixture
-            .call_and_assert(Err(Error::MemberHasActiveApplicationOnOpening));
+        apply_on_opening_fixture.call_and_assert(Err(Error::MemberHasActiveApplicationOnOpening));
     });
 }
 
@@ -416,12 +434,12 @@ fn withdraw_worker_application_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let withdraw_application_fixture =
             WithdrawApplicationFixture::default_for_application_id(application_id);
@@ -447,12 +465,12 @@ fn withdraw_worker_application_fails_invalid_origin() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let withdraw_application_fixture =
             WithdrawApplicationFixture::default_for_application_id(application_id)
@@ -466,12 +484,12 @@ fn withdraw_worker_application_fails_with_invalid_application_author() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let invalid_author_account_id = 55;
         let withdraw_application_fixture =
@@ -486,12 +504,12 @@ fn withdraw_worker_application_fails_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let withdraw_application_fixture =
             WithdrawApplicationFixture::default_for_application_id(application_id);
@@ -506,12 +524,12 @@ fn terminate_worker_application_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let terminate_application_fixture =
             TerminateApplicationFixture::default_for_application_id(application_id);
@@ -526,12 +544,12 @@ fn terminate_worker_application_fails_with_invalid_application_author() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let invalid_author_account_id = 55;
         let terminate_application_fixture =
@@ -546,12 +564,12 @@ fn terminate_worker_application_fails_invalid_origin() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let terminate_application_fixture =
             TerminateApplicationFixture::default_for_application_id(application_id)
@@ -578,12 +596,12 @@ fn terminate_worker_application_fails_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let terminate_application_fixture =
             TerminateApplicationFixture::default_for_application_id(application_id);
@@ -598,8 +616,8 @@ fn begin_review_worker_applications_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id);
@@ -614,10 +632,10 @@ fn begin_review_worker_applications_fails_with_invalid_origin_for_opening_type()
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default()
+        let add_opening_fixture = AddWorkerOpeningFixture::default()
             .with_origin(RawOrigin::Root)
             .with_opening_type(OpeningType::Leader);
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id);
@@ -630,8 +648,8 @@ fn begin_review_worker_applications_fails_with_not_a_lead() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         SetLeadFixture::set_lead_with_ids(2, 2, 2);
 
@@ -659,8 +677,8 @@ fn begin_review_worker_applications_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id);
@@ -676,8 +694,8 @@ fn begin_review_worker_applications_fails_with_invalid_origin() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id)
@@ -687,12 +705,12 @@ fn begin_review_worker_applications_fails_with_invalid_origin() {
 }
 
 #[test]
-fn fill_worker_opening_succeeds() {
+fn fill_opening_succeeds() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
         increase_total_balance_issuance_using_account_id(1, 10000);
 
-        let add_worker_opening_fixture =
+        let add_opening_fixture =
             AddWorkerOpeningFixture::default().with_policy_commitment(OpeningPolicyCommitment {
                 role_staking_policy: Some(hiring::StakingPolicy {
                     amount: 10,
@@ -702,12 +720,12 @@ fn fill_worker_opening_succeeds() {
                 }),
                 ..OpeningPolicyCommitment::default()
             });
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_role_stake(Some(10));
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id);
@@ -716,14 +734,14 @@ fn fill_worker_opening_succeeds() {
         let mint_id = create_mint();
         set_mint_id(mint_id);
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(opening_id, vec![application_id])
                 .with_reward_policy(RewardPolicy {
                     amount_per_payout: 1000,
                     next_payment_at_block: 20,
                     payout_interval: None,
                 });
-        let worker_id = fill_worker_opening_fixture.call_and_assert(Ok(()));
+        let worker_id = fill_opening_fixture.call_and_assert(Ok(()));
 
         let mut worker_application_dictionary = BTreeMap::new();
         worker_application_dictionary.insert(application_id, worker_id);
@@ -736,12 +754,12 @@ fn fill_worker_opening_succeeds() {
 }
 
 #[test]
-fn fill_worker_opening_fails_with_invalid_origin_for_opening_type() {
+fn fill_opening_fails_with_invalid_origin_for_opening_type() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
         increase_total_balance_issuance_using_account_id(1, 10000);
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default()
+        let add_opening_fixture = AddWorkerOpeningFixture::default()
             .with_policy_commitment(OpeningPolicyCommitment {
                 role_staking_policy: Some(hiring::StakingPolicy {
                     amount: 10,
@@ -753,12 +771,12 @@ fn fill_worker_opening_fails_with_invalid_origin_for_opening_type() {
             })
             .with_opening_type(OpeningType::Leader)
             .with_origin(RawOrigin::Root);
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id)
                 .with_role_stake(Some(10));
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id)
@@ -767,119 +785,118 @@ fn fill_worker_opening_fails_with_invalid_origin_for_opening_type() {
 
         set_mint_id(create_mint());
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(opening_id, vec![application_id])
                 .with_reward_policy(RewardPolicy {
                     amount_per_payout: 1000,
                     next_payment_at_block: 20,
                     payout_interval: None,
                 });
-        fill_worker_opening_fixture.call_and_assert(Err(Error::RequireRootOrigin));
+        fill_opening_fixture.call_and_assert(Err(Error::RequireRootOrigin));
     });
 }
 
 #[test]
-fn fill_worker_opening_fails_with_invalid_origin() {
+fn fill_opening_fails_with_invalid_origin() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(opening_id, Vec::new())
                 .with_origin(RawOrigin::None);
-        fill_worker_opening_fixture.call_and_assert(Err(Error::RequireSignedOrigin));
+        fill_opening_fixture.call_and_assert(Err(Error::RequireSignedOrigin));
     });
 }
 
 #[test]
-fn fill_worker_opening_fails_with_not_a_lead() {
+fn fill_opening_fails_with_not_a_lead() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
         SetLeadFixture::set_lead_with_ids(2, 2, 2);
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(opening_id, Vec::new());
-        fill_worker_opening_fixture.call_and_assert(Err(Error::IsNotLeadAccount));
+        fill_opening_fixture.call_and_assert(Err(Error::IsNotLeadAccount));
     });
 }
 
 #[test]
-fn fill_worker_opening_fails_with_invalid_opening() {
+fn fill_opening_fails_with_invalid_opening() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
         let invalid_opening_id = 6;
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(invalid_opening_id, Vec::new());
-        fill_worker_opening_fixture.call_and_assert(Err(Error::OpeningDoesNotExist));
+        fill_opening_fixture.call_and_assert(Err(Error::OpeningDoesNotExist));
     });
 }
 
 #[test]
-fn fill_worker_opening_fails_with_invalid_application_list() {
+fn fill_opening_fails_with_invalid_application_list() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id);
         begin_review_worker_applications_fixture.call_and_assert(Ok(()));
 
         let invalid_application_id = 66;
-        let fill_worker_opening_fixture = FillWorkerOpeningFixture::default_for_ids(
+        let fill_opening_fixture = FillWorkerOpeningFixture::default_for_ids(
             opening_id,
             vec![application_id, invalid_application_id],
         );
-        fill_worker_opening_fixture
-            .call_and_assert(Err(Error::SuccessfulWorkerApplicationDoesNotExist));
+        fill_opening_fixture.call_and_assert(Err(Error::SuccessfulWorkerApplicationDoesNotExist));
     });
 }
 
 #[test]
-fn fill_worker_opening_fails_with_invalid_application_with_hiring_error() {
+fn fill_opening_fails_with_invalid_application_with_hiring_error() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(opening_id, Vec::new());
-        fill_worker_opening_fixture
+        fill_opening_fixture
             .call_and_assert(Err(Error::FullWorkerOpeningOpeningNotInReviewPeriodStage));
     });
 }
 
 #[test]
-fn fill_worker_opening_fails_with_invalid_reward_policy() {
+fn fill_opening_fails_with_invalid_reward_policy() {
     build_test_externalities().execute_with(|| {
         HireLeadFixture::default().hire_lead();
 
-        let add_worker_opening_fixture = AddWorkerOpeningFixture::default();
-        let opening_id = add_worker_opening_fixture.call_and_assert(Ok(()));
+        let add_opening_fixture = AddWorkerOpeningFixture::default();
+        let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        let appy_on_worker_opening_fixture =
+        let apply_on_opening_fixture =
             ApplyOnWorkerOpeningFixture::default_for_opening_id(opening_id);
-        let application_id = appy_on_worker_opening_fixture.call_and_assert(Ok(()));
+        let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         let begin_review_worker_applications_fixture =
             BeginReviewWorkerApplicationsFixture::default_for_opening_id(opening_id);
         begin_review_worker_applications_fixture.call_and_assert(Ok(()));
 
-        let fill_worker_opening_fixture =
+        let fill_opening_fixture =
             FillWorkerOpeningFixture::default_for_ids(opening_id, vec![application_id])
                 .with_reward_policy(RewardPolicy {
                     amount_per_payout: 10000,
@@ -887,7 +904,7 @@ fn fill_worker_opening_fails_with_invalid_reward_policy() {
                     next_payment_at_block: 0,
                     payout_interval: None,
                 });
-        fill_worker_opening_fixture
+        fill_opening_fixture
     });
 }