Browse Source

runtime: Move StakingHandler to the runtime.

- move the staking handler out of the proposals engine module to the runtime
- move staking handler Trait to the membership module
Shamil Gadelshin 4 years ago
parent
commit
5f007215cb

+ 2 - 1
runtime-modules/membership/Cargo.toml

@@ -14,11 +14,11 @@ sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'ht
 sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 common = { package = 'pallet-common', default-features = false, path = '../common'}
+balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 
 [dev-dependencies]
 sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
-balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 
 [features]
 default = ['std']
@@ -32,4 +32,5 @@ std = [
 	'sp-runtime/std',
 	'pallet-timestamp/std',
 	'common/std',
+	'balances/std',
 ]

+ 1 - 0
runtime-modules/membership/src/lib.rs

@@ -7,6 +7,7 @@
 
 pub mod genesis;
 pub(crate) mod mock;
+pub mod staking_handler;
 mod tests;
 
 use codec::{Codec, Decode, Encode};

+ 41 - 0
runtime-modules/membership/src/staking_handler.rs

@@ -0,0 +1,41 @@
+use frame_support::dispatch::DispatchResult;
+
+// Type alias for member id.
+pub type MemberId<T> = <T as crate::Trait>::MemberId;
+
+/// Balance alias for `balances` module.
+pub type BalanceOf<T> = <T as balances::Trait>::Balance;
+
+/// Defines abstract staking handler to manage user stakes for different activities
+/// like adding a proposal. Implementation should use built-in LockableCurrency
+/// and LockIdentifier to lock balance consistently with pallet_staking.
+pub trait StakingHandler<T: frame_system::Trait + crate::Trait + balances::Trait> {
+    /// Locks the specified balance on the account using specific lock identifier.
+    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>);
+
+    /// Removes the specified lock on the account.
+    fn unlock(account_id: &T::AccountId);
+
+    /// Slash the specified balance on the account using specific lock identifier.
+    /// No limits, no actions on zero stake.
+    /// If slashing balance greater than the existing stake - stake is slashed to zero.
+    /// Returns actually slashed balance.
+    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T>;
+
+    /// Sets the new stake to a given amount.
+    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult;
+
+    /// Verifies that staking account bound to the member.
+    fn is_member_staking_account(member_id: &MemberId<T>, account_id: &T::AccountId) -> bool;
+
+    /// Verifies that there no conflicting stakes on the staking account.
+    fn is_account_free_of_conflicting_stakes(account_id: &T::AccountId) -> bool;
+
+    /// Verifies that staking account balance is sufficient for staking.
+    /// During the balance check we should consider already locked stake. Effective balance to check
+    /// is 'already locked funds' + 'usable funds'.
+    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool;
+
+    /// Returns the current stake on the account.
+    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T>;
+}

+ 3 - 1
runtime-modules/proposals/codex/src/tests/mock.rs → runtime-modules/proposals/codex/src/tests/mock/mod.rs

@@ -16,6 +16,8 @@ use crate::{ProposalDetailsOf, ProposalEncoder, ProposalParameters};
 use proposals_engine::VotersParameters;
 use sp_runtime::testing::TestXt;
 
+mod staking_handler;
+
 impl_outer_origin! {
     pub enum Origin for Test {}
 }
@@ -90,7 +92,7 @@ impl proposals_engine::Trait for Test {
     type VoterOriginValidator = ();
     type TotalVotersCounter = MockVotersParameters;
     type ProposalId = u32;
-    type StakingHandler = proposals_engine::StakingManager<Test, LockId>;
+    type StakingHandler = staking_handler::StakingManager<Test, LockId>;
     type CancellationFee = CancellationFee;
     type RejectionFee = RejectionFee;
     type TitleMaxLength = TitleMaxLength;

+ 98 - 0
runtime-modules/proposals/codex/src/tests/mock/staking_handler.rs

@@ -0,0 +1,98 @@
+use frame_support::dispatch::{DispatchError, DispatchResult};
+use frame_support::traits::{Currency, Get, LockIdentifier, LockableCurrency, WithdrawReasons};
+use membership::staking_handler::{BalanceOf, MemberId, StakingHandler};
+use sp_arithmetic::traits::Zero;
+use sp_std::marker::PhantomData;
+
+/// Implementation of the StakingHandler.
+pub struct StakingManager<
+    T: frame_system::Trait + membership::Trait + balances::Trait,
+    LockId: Get<LockIdentifier>,
+> {
+    trait_marker: PhantomData<T>,
+    lock_id_marker: PhantomData<LockId>,
+}
+
+impl<T: frame_system::Trait + membership::Trait + balances::Trait, LockId: Get<LockIdentifier>>
+    StakingHandler<T> for StakingManager<T, LockId>
+{
+    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>) {
+        <balances::Module<T>>::set_lock(LockId::get(), &account_id, amount, WithdrawReasons::all())
+    }
+
+    fn unlock(account_id: &T::AccountId) {
+        T::Currency::remove_lock(LockId::get(), &account_id);
+    }
+
+    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T> {
+        let locks = <balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        let mut actually_slashed_balance = Default::default();
+        if let Some(existing_lock) = existing_lock {
+            Self::unlock(&account_id);
+
+            let mut slashable_amount = existing_lock.amount;
+            if let Some(amount) = amount {
+                if existing_lock.amount > amount {
+                    let new_amount = existing_lock.amount - amount;
+                    Self::lock(&account_id, new_amount);
+
+                    slashable_amount = amount;
+                }
+            }
+
+            let _ = <balances::Module<T>>::slash(&account_id, slashable_amount);
+
+            actually_slashed_balance = slashable_amount
+        }
+
+        actually_slashed_balance
+    }
+
+    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult {
+        let current_stake = Self::current_stake(account_id);
+
+        //Unlock previous stake if its not zero.
+        if current_stake > Zero::zero() {
+            Self::unlock(account_id);
+        }
+
+        if !Self::is_enough_balance_for_stake(account_id, new_stake) {
+            //Restore previous stake if its not zero.
+            if current_stake > Zero::zero() {
+                Self::lock(account_id, current_stake);
+            }
+            return Err(DispatchError::Other("Not enough balance for a new stake."));
+        }
+
+        Self::lock(account_id, new_stake);
+
+        Ok(())
+    }
+
+    fn is_member_staking_account(_member_id: &MemberId<T>, _account_id: &T::AccountId) -> bool {
+        true
+    }
+
+    fn is_account_free_of_conflicting_stakes(account_id: &T::AccountId) -> bool {
+        let locks = <balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        existing_lock.is_none()
+    }
+
+    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool {
+        <balances::Module<T>>::usable_balance(account_id) >= amount
+    }
+
+    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T> {
+        let locks = <balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        existing_lock.map_or(Zero::zero(), |lock| lock.amount)
+    }
+}

+ 3 - 90
runtime-modules/proposals/engine/src/lib.rs

@@ -114,7 +114,7 @@ use types::{MemberId, ProposalOf};
 pub use types::{
     ApprovedProposalDecision, BalanceOf, ExecutionStatus, Proposal, ProposalCodeDecoder,
     ProposalCreationParameters, ProposalDecision, ProposalExecutable, ProposalParameters,
-    ProposalStatus, StakingHandler, VoteKind, VotersParameters, VotingResults,
+    ProposalStatus, VoteKind, VotersParameters, VotingResults,
 };
 
 pub(crate) mod types;
@@ -124,9 +124,8 @@ mod tests;
 
 use codec::Decode;
 use frame_support::dispatch::{DispatchError, DispatchResult, UnfilteredDispatchable};
-use frame_support::sp_std::marker::PhantomData;
 use frame_support::storage::IterableStorageMap;
-use frame_support::traits::{Currency, Get, LockIdentifier, LockableCurrency, WithdrawReasons};
+use frame_support::traits::Get;
 use frame_support::{
     decl_error, decl_event, decl_module, decl_storage, ensure, Parameter, StorageDoubleMap,
 };
@@ -135,6 +134,7 @@ use sp_arithmetic::traits::Zero;
 use sp_std::vec::Vec;
 
 use common::origin::ActorOriginValidator;
+use membership::staking_handler::StakingHandler;
 
 /// Proposals engine trait.
 pub trait Trait:
@@ -795,90 +795,3 @@ impl<T: Trait> Module<T> {
         }
     }
 }
-
-pub struct StakingManager<T: Trait, LockId: Get<LockIdentifier>> {
-    trait_marker: PhantomData<T>,
-    lock_id_marker: PhantomData<LockId>,
-}
-
-impl<T: Trait, LockId: Get<LockIdentifier>> StakingHandler<T> for StakingManager<T, LockId> {
-    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>) {
-        <balances::Module<T>>::set_lock(LockId::get(), &account_id, amount, WithdrawReasons::all())
-    }
-
-    fn unlock(account_id: &T::AccountId) {
-        T::Currency::remove_lock(LockId::get(), &account_id);
-    }
-
-    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T> {
-        let locks = <balances::Module<T>>::locks(&account_id);
-
-        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
-
-        let mut actually_slashed_balance = Default::default();
-        if let Some(existing_lock) = existing_lock {
-            Self::unlock(&account_id);
-
-            let mut slashable_amount = existing_lock.amount;
-            if let Some(amount) = amount {
-                if existing_lock.amount > amount {
-                    let new_amount = existing_lock.amount - amount;
-                    Self::lock(&account_id, new_amount);
-
-                    slashable_amount = amount;
-                }
-            }
-
-            let _ = <balances::Module<T>>::slash(&account_id, slashable_amount);
-
-            actually_slashed_balance = slashable_amount
-        }
-
-        actually_slashed_balance
-    }
-
-    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult {
-        let current_stake = Self::current_stake(account_id);
-
-        //Unlock previous stake if its not zero.
-        if current_stake > Zero::zero() {
-            Self::unlock(account_id);
-        }
-
-        if !Self::is_enough_balance_for_stake(account_id, new_stake) {
-            //Restore previous stake if its not zero.
-            if current_stake > Zero::zero() {
-                Self::lock(account_id, current_stake);
-            }
-            return Err(DispatchError::Other("Not enough balance for a new stake."));
-        }
-
-        Self::lock(account_id, new_stake);
-
-        Ok(())
-    }
-
-    fn is_member_staking_account(_member_id: &MemberId<T>, _account_id: &T::AccountId) -> bool {
-        true
-    }
-
-    fn is_account_free_of_conflicting_stakes(account_id: &T::AccountId) -> bool {
-        let locks = <balances::Module<T>>::locks(&account_id);
-
-        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
-
-        existing_lock.is_none()
-    }
-
-    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool {
-        <balances::Module<T>>::usable_balance(account_id) >= amount
-    }
-
-    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T> {
-        let locks = <balances::Module<T>>::locks(&account_id);
-
-        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
-
-        existing_lock.map_or(Zero::zero(), |lock| lock.amount)
-    }
-}

+ 2 - 1
runtime-modules/proposals/engine/src/tests/mock/mod.rs

@@ -17,6 +17,7 @@ use sp_runtime::{
 };
 
 pub(crate) mod proposals;
+pub(crate) mod staking_handler;
 
 use crate::ProposalObserver;
 pub use proposals::*;
@@ -89,7 +90,7 @@ impl crate::Trait for Test {
     type VoterOriginValidator = ();
     type TotalVotersCounter = ();
     type ProposalId = u32;
-    type StakingHandler = crate::StakingManager<Test, LockId>;
+    type StakingHandler = staking_handler::StakingManager<Test, LockId>;
     type CancellationFee = CancellationFee;
     type RejectionFee = RejectionFee;
     type TitleMaxLength = TitleMaxLength;

+ 98 - 0
runtime-modules/proposals/engine/src/tests/mock/staking_handler.rs

@@ -0,0 +1,98 @@
+use frame_support::dispatch::{DispatchError, DispatchResult};
+use frame_support::traits::{Currency, Get, LockIdentifier, LockableCurrency, WithdrawReasons};
+use membership::staking_handler::{BalanceOf, MemberId, StakingHandler};
+use sp_arithmetic::traits::Zero;
+use sp_std::marker::PhantomData;
+
+/// Implementation of the StakingHandler.
+pub struct StakingManager<
+    T: frame_system::Trait + membership::Trait + balances::Trait,
+    LockId: Get<LockIdentifier>,
+> {
+    trait_marker: PhantomData<T>,
+    lock_id_marker: PhantomData<LockId>,
+}
+
+impl<T: frame_system::Trait + membership::Trait + balances::Trait, LockId: Get<LockIdentifier>>
+    StakingHandler<T> for StakingManager<T, LockId>
+{
+    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>) {
+        <balances::Module<T>>::set_lock(LockId::get(), &account_id, amount, WithdrawReasons::all())
+    }
+
+    fn unlock(account_id: &T::AccountId) {
+        T::Currency::remove_lock(LockId::get(), &account_id);
+    }
+
+    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T> {
+        let locks = <balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        let mut actually_slashed_balance = Default::default();
+        if let Some(existing_lock) = existing_lock {
+            Self::unlock(&account_id);
+
+            let mut slashable_amount = existing_lock.amount;
+            if let Some(amount) = amount {
+                if existing_lock.amount > amount {
+                    let new_amount = existing_lock.amount - amount;
+                    Self::lock(&account_id, new_amount);
+
+                    slashable_amount = amount;
+                }
+            }
+
+            let _ = <balances::Module<T>>::slash(&account_id, slashable_amount);
+
+            actually_slashed_balance = slashable_amount
+        }
+
+        actually_slashed_balance
+    }
+
+    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult {
+        let current_stake = Self::current_stake(account_id);
+
+        //Unlock previous stake if its not zero.
+        if current_stake > Zero::zero() {
+            Self::unlock(account_id);
+        }
+
+        if !Self::is_enough_balance_for_stake(account_id, new_stake) {
+            //Restore previous stake if its not zero.
+            if current_stake > Zero::zero() {
+                Self::lock(account_id, current_stake);
+            }
+            return Err(DispatchError::Other("Not enough balance for a new stake."));
+        }
+
+        Self::lock(account_id, new_stake);
+
+        Ok(())
+    }
+
+    fn is_member_staking_account(_member_id: &MemberId<T>, _account_id: &T::AccountId) -> bool {
+        true
+    }
+
+    fn is_account_free_of_conflicting_stakes(account_id: &T::AccountId) -> bool {
+        let locks = <balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        existing_lock.is_none()
+    }
+
+    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool {
+        <balances::Module<T>>::usable_balance(account_id) >= amount
+    }
+
+    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T> {
+        let locks = <balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        existing_lock.map_or(Zero::zero(), |lock| lock.amount)
+    }
+}

+ 0 - 34
runtime-modules/proposals/engine/src/types/mod.rs

@@ -420,37 +420,3 @@ pub(crate) type ProposalOf<T> = Proposal<
     BalanceOf<T>,
     <T as frame_system::Trait>::AccountId,
 >;
-
-/// Defines abstract staking handler to manage user stakes for different activities
-/// like adding a proposal. Implementation should use built-in LockableCurrency
-/// and LockIdentifier to lock balance consistently with pallet_staking.
-pub trait StakingHandler<T: frame_system::Trait + membership::Trait + balances::Trait> {
-    /// Locks the specified balance on the account using specific lock identifier.
-    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>);
-
-    /// Removes the specified lock on the account.
-    fn unlock(account_id: &T::AccountId);
-
-    /// Slash the specified balance on the account using specific lock identifier.
-    /// No limits, no actions on zero stake.
-    /// If slashing balance greater than the existing stake - stake is slashed to zero.
-    /// Returns actually slashed balance.
-    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T>;
-
-    /// Sets the new stake to a given amount.
-    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult;
-
-    /// Verifies that staking account bound to the member.
-    fn is_member_staking_account(member_id: &MemberId<T>, account_id: &T::AccountId) -> bool;
-
-    /// Verifies that there no conflicting stakes on the staking account.
-    fn is_account_free_of_conflicting_stakes(account_id: &T::AccountId) -> bool;
-
-    /// Verifies that staking account balance is sufficient for staking.
-    /// During the balance check we should consider already locked stake. Effective balance to check
-    /// is 'already locked funds' + 'usable funds'.
-    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool;
-
-    /// Returns the current stake on the account.
-    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T>;
-}

+ 1 - 0
runtime/src/integration/mod.rs

@@ -2,6 +2,7 @@ pub mod content_directory;
 pub mod content_working_group;
 pub mod forum;
 pub mod proposals;
+pub mod staking_handler;
 pub mod storage;
 pub mod transactions;
 pub mod versioned_store_permissions;

+ 105 - 0
runtime/src/integration/staking_handler.rs

@@ -0,0 +1,105 @@
+use frame_support::dispatch::{DispatchError, DispatchResult};
+use frame_support::traits::{Currency, Get, LockIdentifier, LockableCurrency, WithdrawReasons};
+use membership::staking_handler::{BalanceOf, MemberId, StakingHandler};
+use sp_arithmetic::traits::Zero;
+use sp_std::marker::PhantomData;
+
+/// Implementation of the StakingHandler.
+pub struct StakingManager<
+    T: frame_system::Trait + membership::Trait + pallet_balances::Trait,
+    LockId: Get<LockIdentifier>,
+> {
+    trait_marker: PhantomData<T>,
+    lock_id_marker: PhantomData<LockId>,
+}
+
+impl<
+        T: frame_system::Trait + membership::Trait + pallet_balances::Trait,
+        LockId: Get<LockIdentifier>,
+    > StakingHandler<T> for StakingManager<T, LockId>
+{
+    fn lock(account_id: &T::AccountId, amount: BalanceOf<T>) {
+        <pallet_balances::Module<T>>::set_lock(
+            LockId::get(),
+            &account_id,
+            amount,
+            WithdrawReasons::all(),
+        )
+    }
+
+    fn unlock(account_id: &T::AccountId) {
+        T::Currency::remove_lock(LockId::get(), &account_id);
+    }
+
+    fn slash(account_id: &T::AccountId, amount: Option<BalanceOf<T>>) -> BalanceOf<T> {
+        let locks = <pallet_balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        let mut actually_slashed_balance = Default::default();
+        if let Some(existing_lock) = existing_lock {
+            Self::unlock(&account_id);
+
+            let mut slashable_amount = existing_lock.amount;
+            if let Some(amount) = amount {
+                if existing_lock.amount > amount {
+                    let new_amount = existing_lock.amount - amount;
+                    Self::lock(&account_id, new_amount);
+
+                    slashable_amount = amount;
+                }
+            }
+
+            let _ = <pallet_balances::Module<T>>::slash(&account_id, slashable_amount);
+
+            actually_slashed_balance = slashable_amount
+        }
+
+        actually_slashed_balance
+    }
+
+    fn set_stake(account_id: &T::AccountId, new_stake: BalanceOf<T>) -> DispatchResult {
+        let current_stake = Self::current_stake(account_id);
+
+        //Unlock previous stake if its not zero.
+        if current_stake > Zero::zero() {
+            Self::unlock(account_id);
+        }
+
+        if !Self::is_enough_balance_for_stake(account_id, new_stake) {
+            //Restore previous stake if its not zero.
+            if current_stake > Zero::zero() {
+                Self::lock(account_id, current_stake);
+            }
+            return Err(DispatchError::Other("Not enough balance for a new stake."));
+        }
+
+        Self::lock(account_id, new_stake);
+
+        Ok(())
+    }
+
+    fn is_member_staking_account(_member_id: &MemberId<T>, _account_id: &T::AccountId) -> bool {
+        true
+    }
+
+    fn is_account_free_of_conflicting_stakes(account_id: &T::AccountId) -> bool {
+        let locks = <pallet_balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        existing_lock.is_none()
+    }
+
+    fn is_enough_balance_for_stake(account_id: &T::AccountId, amount: BalanceOf<T>) -> bool {
+        <pallet_balances::Module<T>>::usable_balance(account_id) >= amount
+    }
+
+    fn current_stake(account_id: &T::AccountId) -> BalanceOf<T> {
+        let locks = <pallet_balances::Module<T>>::locks(&account_id);
+
+        let existing_lock = locks.iter().find(|lock| lock.id == LockId::get());
+
+        existing_lock.map_or(Zero::zero(), |lock| lock.amount)
+    }
+}

+ 1 - 1
runtime/src/lib.rs

@@ -598,7 +598,7 @@ impl proposals_engine::Trait for Runtime {
     type VoterOriginValidator = CouncilManager<Self>;
     type TotalVotersCounter = CouncilManager<Self>;
     type ProposalId = u32;
-    type StakingHandler = proposals_engine::StakingManager<Self, ProposalsLockId>;
+    type StakingHandler = integration::staking_handler::StakingManager<Self, ProposalsLockId>;
     type CancellationFee = ProposalCancellationFee;
     type RejectionFee = ProposalRejectionFee;
     type TitleMaxLength = ProposalTitleMaxLength;