Browse Source

Merge branch 'new-operations-wg' into storage_v2_new_wg_merge

# Conflicts:
#	node/src/chain_spec/content_config.rs
#	node/src/chain_spec/mod.rs
#	runtime-modules/common/src/lib.rs
#	runtime-modules/common/src/storage.rs
#	runtime-modules/common/src/working_group.rs
#	runtime-modules/content/src/lib.rs
#	runtime-modules/content/src/permissions/mod.rs
#	runtime-modules/content/src/tests/mock.rs
#	runtime-modules/storage/src/data_directory.rs
#	runtime-modules/storage/src/lib.rs
#	runtime-modules/storage/src/tests/mock.rs
#	runtime/src/integration/proposals/proposal_encoder.rs
#	runtime/src/integration/working_group.rs
#	runtime/src/lib.rs
#	runtime/src/primitives.rs
#	runtime/src/tests/proposals_integration/working_group_proposals.rs
Shamil Gadelshin 3 years ago
parent
commit
1964deb906
44 changed files with 548 additions and 356 deletions
  1. 12 12
      Cargo.lock
  2. 3 0
      devops/infrastructure/node-network/Pulumi.yaml
  3. 12 1
      devops/infrastructure/node-network/README.md
  4. 26 7
      devops/infrastructure/node-network/index.ts
  5. 21 4
      node/src/chain_spec/mod.rs
  6. 13 22
      pioneer/packages/joy-forum/src/ForumRoot.tsx
  7. 78 14
      pioneer/packages/joy-forum/src/ViewThread.tsx
  8. 3 7
      pioneer/packages/joy-utils/src/transport/proposals.ts
  9. 11 0
      runtime-modules/common/src/lib.rs
  10. 8 2
      runtime-modules/common/src/working_group.rs
  11. 1 1
      runtime-modules/content/Cargo.toml
  12. 4 4
      runtime-modules/content/src/lib.rs
  13. 2 10
      runtime-modules/content/src/permissions/mod.rs
  14. 1 2
      runtime-modules/content/src/tests/mock.rs
  15. 1 1
      runtime-modules/forum/Cargo.toml
  16. 1 1
      runtime-modules/governance/Cargo.toml
  17. 5 2
      runtime-modules/governance/src/mock.rs
  18. 1 1
      runtime-modules/hiring/Cargo.toml
  19. 1 1
      runtime-modules/membership/Cargo.toml
  20. 4 22
      runtime-modules/membership/src/lib.rs
  21. 5 2
      runtime-modules/membership/src/mock.rs
  22. 1 1
      runtime-modules/memo/Cargo.toml
  23. 1 1
      runtime-modules/proposals/codex/src/lib.rs
  24. 5 2
      runtime-modules/proposals/codex/src/tests/mock.rs
  25. 1 1
      runtime-modules/proposals/discussion/Cargo.toml
  26. 1 1
      runtime-modules/proposals/discussion/src/lib.rs
  27. 5 2
      runtime-modules/proposals/discussion/src/tests/mock.rs
  28. 1 1
      runtime-modules/proposals/engine/Cargo.toml
  29. 1 1
      runtime-modules/proposals/engine/src/lib.rs
  30. 5 2
      runtime-modules/proposals/engine/src/tests/mock/mod.rs
  31. 1 1
      runtime-modules/recurring-reward/Cargo.toml
  32. 1 1
      runtime-modules/stake/Cargo.toml
  33. 2 2
      runtime-modules/storage/src/lib.rs
  34. 5 2
      runtime-modules/storage/src/tests/mocks.rs
  35. 1 1
      runtime-modules/token-minting/Cargo.toml
  36. 1 1
      runtime-modules/working-group/Cargo.toml
  37. 2 2
      runtime-modules/working-group/src/lib.rs
  38. 5 2
      runtime-modules/working-group/src/tests/mock.rs
  39. 1 1
      runtime/src/integration/proposals/membership_origin_validator.rs
  40. 9 1
      runtime/src/integration/proposals/proposal_encoder.rs
  41. 79 156
      runtime/src/integration/working_group.rs
  42. 36 10
      runtime/src/lib.rs
  43. 2 3
      runtime/src/primitives.rs
  44. 169 45
      runtime/src/tests/proposals_integration/working_group_proposals.rs

+ 12 - 12
Cargo.lock

@@ -3822,7 +3822,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-content"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3859,7 +3859,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-forum"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3876,7 +3876,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-governance"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3919,7 +3919,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-hiring"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3957,7 +3957,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-membership"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3975,7 +3975,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-memo"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -4054,7 +4054,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-proposals-discussion"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -4072,7 +4072,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-proposals-engine"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -4106,7 +4106,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-recurring-reward"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -4157,7 +4157,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-stake"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -4259,7 +4259,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-token-mint"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -4337,7 +4337,7 @@ dependencies = [
 
 [[package]]
 name = "pallet-working-group"
-version = "3.1.1"
+version = "3.2.0"
 dependencies = [
  "frame-support",
  "frame-system",

+ 3 - 0
devops/infrastructure/node-network/Pulumi.yaml

@@ -22,3 +22,6 @@ template:
     nodeImage:
       description: Docker image with tag to be used as validator and RPC nodes
       default: 'joystream/node:latest'
+    encryptionKey:
+      description: Key to encrypt the 7z containing secrets with
+      default: '1234'

+ 12 - 1
devops/infrastructure/node-network/README.md

@@ -39,7 +39,7 @@ After cloning this repo, from this working directory, run these commands:
    ```bash
    $ pulumi config set-all --plaintext aws:region=us-east-1 --plaintext aws:profile=joystream-user \
     --plaintext numberOfValidators=2 --plaintext isMinikube=true --plaintext networkSuffix=8122 \
-    --plaintext nodeImage=joystream/node:latest
+    --plaintext nodeImage=joystream/node:latest --plaintext encryptionKey=password
    ```
 
    If you want to build the stack on AWS set the `isMinikube` config to `false`
@@ -67,6 +67,11 @@ After cloning this repo, from this working directory, run these commands:
 
    The ws-rpc endpoint is `https://<ENDPOINT>/ws-rpc` and http-rpc endpoint is `https://<ENDPOINT>/http-rpc`
 
+1. If you are using Minikube, run `minikube service node-network -n $(pulumi stack output namespaceName)`
+
+   This will setup a proxy for your `node-network` service, which can then be accessed at
+   the URL given in the output
+
 1. Access the Kubernetes Cluster using `kubectl`
 
    To access your new Kubernetes cluster using `kubectl`, we need to set up the
@@ -106,6 +111,12 @@ After cloning this repo, from this working directory, run these commands:
    $ kubectl exec --stdin --tty <PODNAME> -c colossus -- /bin/bash
    ```
 
+1. To get the chain-data and secrets, run the below command
+
+   ```bash
+   $ kubectl cp $(kubectl get pods | grep rpc-node | awk '{print $1}'):/chain-data/chain-data.7z ./chain-data.7z
+   ```
+
 1. Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
 
    ```bash

+ 26 - 7
devops/infrastructure/node-network/index.ts

@@ -57,6 +57,7 @@ const numberOfValidators = config.getNumber('numberOfValidators') || 1
 const chainDataPath = '/chain-data'
 const chainSpecPath = `${chainDataPath}/chainspec-raw.json`
 const nodeImage = config.get('nodeImage') || 'joystream/node:latest'
+const encryptKey = config.get('encryptionKey') || '1234'
 
 const subkeyContainers = getSubkeyContainers(numberOfValidators, chainDataPath)
 let pvcClaimName: pulumi.Output<any>
@@ -178,6 +179,18 @@ const chainDataPrepareJob = new k8s.batch.v1.Job(
                 },
               ],
             },
+            {
+              name: '7z',
+              image: 'danielwhatmuff/7z-docker',
+              command: ['/bin/sh', '-c'],
+              args: [`7z a -p${encryptKey} ${chainDataPath}/chain-data.7z ${chainDataPath}/*`],
+              volumeMounts: [
+                {
+                  name: 'config-data',
+                  mountPath: chainDataPath,
+                },
+              ],
+            },
           ],
           volumes: [
             {
@@ -289,6 +302,7 @@ const service = new k8s.core.v1.Service(
       name: 'node-network',
     },
     spec: {
+      type: isMinikube ? 'NodePort' : 'ClusterIP',
       ports: [
         { name: 'port-1', port: 9944 },
         { name: 'port-2', port: 9933 },
@@ -313,11 +327,16 @@ const caddyEndpoints = [
 }`,
 ]
 
-const caddy = new CaddyServiceDeployment(
-  'caddy-proxy',
-  { lbReady, namespaceName: namespaceName, isMinikube, caddyEndpoints },
-  resourceOptions
-)
+export let endpoint1: pulumi.Output<string>
+export let endpoint2: pulumi.Output<string>
 
-export const endpoint1 = caddy.primaryEndpoint
-export const endpoint2 = caddy.secondaryEndpoint
+if (!isMinikube) {
+  const caddy = new CaddyServiceDeployment(
+    'caddy-proxy',
+    { lbReady, namespaceName: namespaceName, isMinikube, caddyEndpoints },
+    resourceOptions
+  )
+
+  endpoint1 = pulumi.interpolate`${caddy.primaryEndpoint}`
+  endpoint2 = pulumi.interpolate`${caddy.secondaryEndpoint}`
+}

+ 21 - 4
node/src/chain_spec/mod.rs

@@ -34,9 +34,10 @@ use node_runtime::{
     membership, wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig, Balance, BalancesConfig,
     ContentConfig, ContentWorkingGroupConfig, CouncilConfig, CouncilElectionConfig,
     DistributionWorkingGroupConfig, ElectionParameters, ForumConfig, GatewayWorkingGroupConfig,
-    GrandpaConfig, ImOnlineConfig, MembersConfig, Moment, OperationsWorkingGroupConfig,
-    ProposalsCodexConfig, SessionConfig, SessionKeys, Signature, StakerStatus, StakingConfig,
-    StorageWorkingGroupConfig, SudoConfig, SystemConfig, DAYS,
+    GrandpaConfig, ImOnlineConfig, MembersConfig, Moment, OperationsWorkingGroupAlphaConfig,
+    OperationsWorkingGroupBetaConfig, OperationsWorkingGroupGammaConfig, ProposalsCodexConfig,
+    SessionConfig, SessionKeys, Signature, StakerStatus, StakingConfig, StorageWorkingGroupConfig,
+    SudoConfig, SystemConfig, DAYS,
 };
 
 // Exported to be used by chain-spec-builder
@@ -314,7 +315,7 @@ pub fn testnet_genesis(
             worker_exit_rationale_text_constraint: default_text_constraint,
             worker_storage_size_constraint: default_storage_size_constraint,
         }),
-        working_group_Instance4: Some(OperationsWorkingGroupConfig {
+        working_group_Instance4: Some(OperationsWorkingGroupAlphaConfig {
             phantom: Default::default(),
             working_group_mint_capacity: 0,
             opening_human_readable_text_constraint: default_text_constraint,
@@ -338,6 +339,22 @@ pub fn testnet_genesis(
             worker_exit_rationale_text_constraint: default_text_constraint,
             worker_storage_size_constraint: default_storage_size_constraint,
         }),
+        working_group_Instance7: Some(OperationsWorkingGroupBetaConfig {
+            phantom: Default::default(),
+            working_group_mint_capacity: 0,
+            opening_human_readable_text_constraint: default_text_constraint,
+            worker_application_human_readable_text_constraint: default_text_constraint,
+            worker_exit_rationale_text_constraint: default_text_constraint,
+            worker_storage_size_constraint: default_storage_size_constraint,
+        }),
+        working_group_Instance8: Some(OperationsWorkingGroupGammaConfig {
+            phantom: Default::default(),
+            working_group_mint_capacity: 0,
+            opening_human_readable_text_constraint: default_text_constraint,
+            worker_application_human_readable_text_constraint: default_text_constraint,
+            worker_exit_rationale_text_constraint: default_text_constraint,
+            worker_storage_size_constraint: default_storage_size_constraint,
+        }),
         content: Some({
             ContentConfig {
                 next_curator_group_id: 1,

+ 13 - 22
pioneer/packages/joy-forum/src/ForumRoot.tsx

@@ -1,7 +1,6 @@
 import React, { useState, useEffect } from 'react';
 import { Link } from 'react-router-dom';
 import styled from 'styled-components';
-import { orderBy } from 'lodash';
 import BN from 'bn.js';
 
 import { Section } from '@polkadot/joy-utils/react/components';
@@ -63,36 +62,28 @@ const InnerRecentActivity: React.FC<RecentActivityProps> = ({ nextPostId, api })
       if (!nextPostId) return;
 
       const newId = (id: number | BN) => api.createType('PostId', id);
-      const apiCalls: Promise<Post>[] = [];
-      let id = newId(1);
+      let id = newId(nextPostId.toNumber() - 1);
 
-      while (nextPostId.gt(id)) {
-        apiCalls.push(api.query.forum.postById(id) as Promise<Post>);
-        id = newId(id.add(newId(1)));
-      }
+      const threadsIdsLookup = {} as Record<number, boolean>;
+      const recentUniquePosts = new Array<Post>();
 
-      const allPosts = await Promise.all(apiCalls);
-      const sortedPosts = orderBy(
-        allPosts,
-        [(x) => x.id.toNumber()],
-        ['desc']
-      );
+      while (id.gt(newId(0))) {
+        const post = await api.query.forum.postById(id) as Post;
 
-      const threadsIdsLookup = {} as Record<number, boolean>;
-      const postsWithUniqueThreads = sortedPosts.reduce((acc, post) => {
         const threadId = post.thread_id.toNumber();
 
-        if (threadsIdsLookup[threadId]) return acc;
+        id = newId(id.toNumber() - 1);
+
+        if (threadsIdsLookup[threadId]) continue;
 
         threadsIdsLookup[threadId] = true;
 
-        return [
-          ...acc,
-          post
-        ];
-      }, [] as Post[]);
+        recentUniquePosts.push(post);
 
-      const recentUniquePosts = postsWithUniqueThreads.slice(0, RecentActivityPostsCount);
+        if (recentUniquePosts.length === RecentActivityPostsCount) {
+          break;
+        }
+      }
 
       setRecentPosts(recentUniquePosts);
       setLoaded(true);

+ 78 - 14
pioneer/packages/joy-forum/src/ViewThread.tsx

@@ -5,7 +5,7 @@ import styled from 'styled-components';
 import { Table, Button, Label, Icon } from 'semantic-ui-react';
 import BN from 'bn.js';
 
-import { ThreadId } from '@joystream/types/common';
+import { PostId, ThreadId } from '@joystream/types/common';
 import { Category, Thread, Post } from '@joystream/types/forum';
 import { Pagination, RepliesPerPage, CategoryCrumbs, TimeAgoDate, usePagination, useQueryParam, ReplyIdxQueryParam, ReplyEditIdQueryParam } from './utils';
 import { ViewReply } from './ViewReply';
@@ -22,6 +22,7 @@ import MemberPreview from '@polkadot/joy-utils/react/components/MemberByAccountP
 import { formatDate } from '@polkadot/joy-utils/functions/date';
 import { NewReply, EditReply } from './EditReply';
 import { useApi } from '@polkadot/react-hooks';
+import { ApiPromise } from '@polkadot/api/promise';
 
 type ThreadTitleProps = {
   thread: Thread;
@@ -124,6 +125,77 @@ type ViewThreadProps = ApiProps & InnerViewThreadProps & {
   nextPostId?: ThreadId;
 };
 
+const POSTS_THREAD_MAP_CACHE_KEY = 'postsThreadMap';
+
+async function refreshPostsInThreadCache (nextPostId: PostId, api: ApiPromise) {
+  const newId = (id: number | BN) => api.createType('PostId', id);
+  const apiCalls: Promise<Post>[] = [];
+  let idToFetch = newId(1);
+
+  let postsToThread = getPostsIdsInThreadCache();
+  const nextThreadId = await api.query.forum.nextThreadId() as ThreadId;
+
+  if (postsToThread.size >= nextThreadId.toNumber()) { // invalid cache
+    postsToThread = new Map<number, number[]>();
+  }
+
+  if (postsToThread.size > 0) {
+    const lastPostIdInCache = Math.max(...Array.from(postsToThread.values()).flat());
+
+    idToFetch = newId(lastPostIdInCache + 1);
+    const lastPost = await api.query.forum.postById(lastPostIdInCache) as Post;
+
+    if (lastPost) {
+      const postsInThread = postsToThread.get(lastPost.thread_id.toNumber());
+
+      if (!postsInThread || !postsInThread.includes(lastPostIdInCache)) { // cache doesn't match the data in chain
+        postsToThread = new Map<number, number[]>();
+      }
+    } else {
+      postsToThread = new Map<number, number[]>();
+    }
+  }
+
+  const lastPostId = nextPostId.sub(new BN(1));
+
+  while (lastPostId.gte(idToFetch)) {
+    apiCalls.push(api.query.forum.postById(idToFetch) as Promise<Post>);
+    idToFetch = newId(idToFetch.add(newId(1)));
+  }
+
+  const newPosts = await Promise.all<Post>(apiCalls);
+
+  const newPostsToThread = new Map<number, number[]>();
+
+  newPosts.forEach((newPost) => {
+    const previousNewPostIds = newPostsToThread.get(newPost.thread_id.toNumber()) ?? [];
+
+    newPostsToThread.set(newPost.thread_id.toNumber(), [...previousNewPostIds, newPost.id.toNumber()]);
+  });
+
+  if (postsToThread.size > 0) {
+    newPostsToThread.forEach((postIds, threadId) => {
+      const existingPostIds = postsToThread.get(threadId) ?? [];
+
+      postsToThread.set(threadId, [...existingPostIds, ...postIds]);
+    });
+  } else {
+    postsToThread = newPostsToThread;
+  }
+
+  localStorage.setItem(POSTS_THREAD_MAP_CACHE_KEY, JSON.stringify([...postsToThread]));
+}
+
+function getPostsIdsInThreadCache (): Map<number, number[]> {
+  const serializedMap = localStorage.getItem(POSTS_THREAD_MAP_CACHE_KEY);
+
+  if (!serializedMap) {
+    return new Map<number, number[]>();
+  }
+
+  return new Map<number, number[]>(JSON.parse(serializedMap));
+}
+
 function InnerViewThread (props: ViewThreadProps) {
   const [showModerateForm, setShowModerateForm] = useState(false);
   const [displayedPosts, setDisplayedPosts] = useState<Post[]>([]);
@@ -154,20 +226,12 @@ function InnerViewThread (props: ViewThreadProps) {
     const loadPosts = async () => {
       if (!nextPostId || totalPostsInThread === 0 || thread.isEmpty) return;
 
-      const newId = (id: number | BN) => api.createType('PostId', id);
-      const apiCalls: Promise<Post>[] = [];
-      let id = newId(1);
-
-      while (nextPostId.gt(id)) {
-        apiCalls.push(api.query.forum.postById(id) as Promise<Post>);
-        id = newId(id.add(newId(1)));
-      }
+      await refreshPostsInThreadCache(nextPostId, api);
+      const mapPostToThread = getPostsIdsInThreadCache();
+      const postIdsInThread = mapPostToThread.get(thread.id.toNumber()) as number[];
+      const postsInThisThread = await Promise.all(postIdsInThread
+        ? postIdsInThread.map((postId: number) => api.query.forum.postById(postId)) : []) as Post[];
 
-      const allPosts = await Promise.all<Post>(apiCalls);
-      const postsInThisThread = allPosts.filter((item) =>
-        !item.isEmpty &&
-        item.thread_id.eq(thread.id)
-      );
       const sortedPosts = orderBy(
         postsInThisThread,
         [(x) => x.nr_in_thread.toNumber()],

+ 3 - 7
pioneer/packages/joy-utils/src/transport/proposals.ts

@@ -187,14 +187,10 @@ export default class ProposalsTransport extends BaseTransport {
   }
 
   async voteByProposalAndMember (proposalId: ProposalId, voterId: MemberId): Promise<VoteKind | null> {
-    const votesEntries = await this.api.query.proposalsEngine.voteExistsByProposalByVoter.entries(proposalId);
-    const voteEntry = votesEntries.find((voteEntry) => {
-      const memberId = voteEntry[0].args[1] as MemberId;
+    const vote = (await this.proposalsEngine.voteExistsByProposalByVoter(proposalId, voterId)) as VoteKind;
+    const hasVoted = (await this.api.query.proposalsEngine.voteExistsByProposalByVoter.size(proposalId, voterId)).toNumber();
 
-      return memberId.eq(voterId);
-    });
-
-    return voteEntry ? voteEntry[1] as VoteKind : null;
+    return hasVoted ? vote : null;
   }
 
   async votes (proposalId: ProposalId): Promise<ProposalVotes> {

+ 11 - 0
runtime-modules/common/src/lib.rs

@@ -66,6 +66,17 @@ pub trait StorageOwnership {
         + Ord
         + PartialEq;
 
+    /// Dao id representation.
+    type DaoId: Parameter
+        + Member
+        + BaseArithmetic
+        + Codec
+        + Default
+        + Copy
+        + MaybeSerialize
+        + Ord
+        + PartialEq;
+
     /// Content id representation.
     type ContentId: Parameter + Member + Codec + Default + Copy + MaybeSerialize + Ord + PartialEq;
 

+ 8 - 2
runtime-modules/common/src/working_group.rs

@@ -22,11 +22,17 @@ pub enum WorkingGroup {
     Content = 3isize,
 
     /// Operations working group: working_group::Instance4.
-    Operations = 4isize,
+    OperationsAlpha = 4isize,
 
     /// Gateway working group: working_group::Instance5.
     Gateway = 5isize,
 
-    /// Distribution working group: working_group::Instance4.
+    /// Distribution working group: working_group::Instance6.
     Distribution = 6isize,
+
+    /// Operations working group: working_group::Instance7.
+    OperationsBeta = 7isize,
+
+    /// Operations working group: working_group::Instance8.
+    OperationsGamma = 8isize,
 }

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-content'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 4 - 4
runtime-modules/content/src/lib.rs

@@ -127,7 +127,7 @@ pub enum ChannelOwner<MemberId, CuratorGroupId> {
 // simplification type
 pub(crate) type ActorToChannelOwnerResult<T> = Result<
     ChannelOwner<
-        <T as membership::Trait>::MemberId,
+        <T as common::MembershipTypes>::MemberId,
         <T as ContentActorAuthenticator>::CuratorGroupId,
     >,
     Error<T>,
@@ -185,7 +185,7 @@ pub struct ChannelRecord<MemberId, CuratorGroupId, AccountId> {
 
 // Channel alias type for simplification.
 pub type Channel<T> = ChannelRecord<
-    <T as membership::Trait>::MemberId,
+    <T as common::MembershipTypes>::MemberId,
     <T as ContentActorAuthenticator>::CuratorGroupId,
     <T as frame_system::Trait>::AccountId,
 >;
@@ -209,7 +209,7 @@ pub struct ChannelOwnershipTransferRequestRecord<
 // ChannelOwnershipTransferRequest type alias for simplification.
 pub type ChannelOwnershipTransferRequest<T> = ChannelOwnershipTransferRequestRecord<
     <T as storage::Trait>::ChannelId,
-    <T as membership::Trait>::MemberId,
+    <T as common::MembershipTypes>::MemberId,
     <T as ContentActorAuthenticator>::CuratorGroupId,
     BalanceOf<T>,
     <T as frame_system::Trait>::AccountId,
@@ -1477,7 +1477,7 @@ decl_event!(
         ContentActor = ContentActor<
             <T as ContentActorAuthenticator>::CuratorGroupId,
             <T as ContentActorAuthenticator>::CuratorId,
-            <T as membership::Trait>::MemberId,
+            <T as common::MembershipTypes>::MemberId,
         >,
         CuratorGroupId = <T as ContentActorAuthenticator>::CuratorGroupId,
         CuratorId = <T as ContentActorAuthenticator>::CuratorId,

+ 2 - 10
runtime-modules/content/src/permissions/mod.rs

@@ -104,26 +104,18 @@ pub fn ensure_actor_authorized_to_create_channel<T: Trait>(
 ) -> DispatchResult {
     match actor {
         // Lead should use their member or curator role to create or update channel assets.
-        ContentActor::Lead => {
-            Err(Error::<T>::ActorCannotOwnChannel.into())
-        }
+        ContentActor::Lead => Err(Error::<T>::ActorCannotOwnChannel.into()),
         ContentActor::Curator(curator_group_id, curator_id) => {
             let sender = ensure_signed(origin)?;
 
             // Authorize curator, performing all checks to ensure curator can act
-            CuratorGroup::<T>::perform_curator_in_group_auth(
-                curator_id,
-                curator_group_id,
-                &sender,
-            )
+            CuratorGroup::<T>::perform_curator_in_group_auth(curator_id, curator_group_id, &sender)
         }
         ContentActor::Member(member_id) => {
             let sender = ensure_signed(origin)?;
 
             ensure_member_auth_success::<T>(member_id, &sender)
         }
-        // TODO:
-        // ContentActor::Dao(_daoId) => ...,
     }
 }
 

+ 1 - 2
runtime-modules/content/src/tests/mock.rs

@@ -125,6 +125,7 @@ impl common::MembershipTypes for Test {
 
 impl common::StorageOwnership for Test {
     type ChannelId = u64;
+    type DaoId = u64;
     type ContentId = u64;
     type DataObjectTypeId = u64;
 }
@@ -153,10 +154,8 @@ parameter_types! {
 
 impl membership::Trait for Test {
     type Event = MetaEvent;
-    type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = u64;
     type ScreenedMemberMaxInitialBalance = ();
 }
 

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-forum'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-governance'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 5 - 2
runtime-modules/governance/src/mock.rs

@@ -76,12 +76,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 500;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl membership::Trait for Test {
     type Event = ();
-    type MemberId = u64;
     type SubscriptionId = u32;
     type PaidTermId = u32;
-    type ActorId = u32;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 impl minting::Trait for Test {

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-hiring'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-membership'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 4 - 22
runtime-modules/membership/src/lib.rs

@@ -23,18 +23,11 @@ use sp_std::vec;
 use sp_std::vec::Vec;
 
 use common::currency::{BalanceOf, GovernanceCurrency};
-pub trait Trait: frame_system::Trait + GovernanceCurrency + pallet_timestamp::Trait {
+pub trait Trait:
+    frame_system::Trait + GovernanceCurrency + pallet_timestamp::Trait + common::MembershipTypes
+{
     type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
 
-    type MemberId: Parameter
-        + Member
-        + BaseArithmetic
-        + Codec
-        + Default
-        + Copy
-        + MaybeSerialize
-        + PartialEq;
-
     type PaidTermId: Parameter
         + Member
         + BaseArithmetic
@@ -53,17 +46,6 @@ pub trait Trait: frame_system::Trait + GovernanceCurrency + pallet_timestamp::Tr
         + MaybeSerialize
         + PartialEq;
 
-    /// Describes the common type for the working group members (workers).
-    type ActorId: Parameter
-        + Member
-        + BaseArithmetic
-        + Codec
-        + Default
-        + Copy
-        + MaybeSerialize
-        + PartialEq
-        + Ord;
-
     /// The maximum amount of initial funds that may be endowed to new members added by
     /// screening authority. If set to zero, no initial balance can be given.
     type ScreenedMemberMaxInitialBalance: Get<BalanceOf<Self>>;
@@ -246,7 +228,7 @@ decl_storage! {
 decl_event! {
     pub enum Event<T> where
       <T as frame_system::Trait>::AccountId,
-      <T as Trait>::MemberId,
+      <T as common::MembershipTypes>::MemberId,
       <T as Trait>::PaidTermId,
     {
         MemberRegistered(MemberId, AccountId, EntryMethod<PaidTermId, AccountId>),

+ 5 - 2
runtime-modules/membership/src/mock.rs

@@ -86,12 +86,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 500;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl Trait for Test {
     type Event = ();
-    type MemberId = u64;
     type PaidTermId = u32;
     type SubscriptionId = u32;
-    type ActorId = u32;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-memo'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 1 - 1
runtime-modules/proposals/codex/src/lib.rs

@@ -181,7 +181,7 @@ pub type NegativeImbalance<T> = <<T as stake::Trait>::Currency as Currency<
     <T as frame_system::Trait>::AccountId,
 >>::NegativeImbalance;
 
-type MemberId<T> = <T as membership::Trait>::MemberId;
+type MemberId<T> = <T as common::MembershipTypes>::MemberId;
 
 decl_error! {
     /// Codex module predefined errors

+ 5 - 2
runtime-modules/proposals/codex/src/tests/mock.rs

@@ -50,12 +50,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 500;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl membership::Trait for Test {
     type Event = ();
-    type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = u64;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 

+ 1 - 1
runtime-modules/proposals/discussion/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-proposals-discussion'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 1 - 1
runtime-modules/proposals/discussion/src/lib.rs

@@ -59,7 +59,7 @@ use sp_std::vec::Vec;
 use common::origin::ActorOriginValidator;
 use types::{DiscussionPost, DiscussionThread, ThreadCounter};
 
-type MemberId<T> = <T as membership::Trait>::MemberId;
+type MemberId<T> = <T as common::MembershipTypes>::MemberId;
 
 decl_event!(
     /// Proposals engine events

+ 5 - 2
runtime-modules/proposals/discussion/src/tests/mock.rs

@@ -77,12 +77,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 500;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl membership::Trait for Test {
     type Event = TestEvent;
-    type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = u64;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 

+ 1 - 1
runtime-modules/proposals/engine/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-proposals-engine'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 1 - 1
runtime-modules/proposals/engine/src/lib.rs

@@ -143,7 +143,7 @@ use sp_std::vec::Vec;
 
 use common::origin::ActorOriginValidator;
 
-type MemberId<T> = <T as membership::Trait>::MemberId;
+type MemberId<T> = <T as common::MembershipTypes>::MemberId;
 
 /// Proposals engine trait.
 pub trait Trait:

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

@@ -90,12 +90,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 500;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl membership::Trait for Test {
     type Event = TestEvent;
-    type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = u64;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 

+ 1 - 1
runtime-modules/recurring-reward/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-recurring-reward'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-stake'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

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

@@ -452,10 +452,10 @@ pub type Cid = Vec<u8>;
 type Balances<T> = balances::Module<T>;
 
 /// Alias for the member id.
-pub type MemberId<T> = <T as membership::Trait>::MemberId;
+pub type MemberId<T> = <T as common::MembershipTypes>::MemberId;
 
 /// Type identifier for worker role, which must be same as membership actor identifier
-pub type WorkerId<T> = <T as membership::Trait>::ActorId;
+pub type WorkerId<T> = <T as common::MembershipTypes>::ActorId;
 
 /// Balance alias for `balances` module.
 pub type BalanceOf<T> = <T as balances::Trait>::Balance;

+ 5 - 2
runtime-modules/storage/src/tests/mocks.rs

@@ -189,12 +189,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 5000;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl membership::Trait for Test {
     type Event = TestEvent;
-    type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = u64;
     type ScreenedMemberMaxInitialBalance = ();
 }
 

+ 1 - 1
runtime-modules/token-minting/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-token-mint'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

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

@@ -1,6 +1,6 @@
 [package]
 name = 'pallet-working-group'
-version = '3.1.1'
+version = '3.2.0'
 authors = ['Joystream contributors']
 edition = '2018'
 

+ 2 - 2
runtime-modules/working-group/src/lib.rs

@@ -78,7 +78,7 @@ pub use types::{
 pub type StakeId<T> = <T as stake::Trait>::StakeId;
 
 /// Member identifier in membership::member module
-pub type MemberId<T> = <T as membership::Trait>::MemberId;
+pub type MemberId<T> = <T as common::MembershipTypes>::MemberId;
 
 /// Workaround for BTreeSet type
 pub type ApplicationIdSet<T> = BTreeSet<ApplicationId<T>>;
@@ -109,7 +109,7 @@ pub type NegativeImbalance<T> = <<T as stake::Trait>::Currency as Currency<
 pub type ApplicationIdToWorkerIdMap<T> = BTreeMap<ApplicationId<T>, WorkerId<T>>;
 
 /// Type identifier for worker role, which must be same as membership actor identifier
-pub type WorkerId<T> = <T as membership::Trait>::ActorId;
+pub type WorkerId<T> = <T as common::MembershipTypes>::ActorId;
 
 /// Alias for the application id from the hiring module.
 pub type HiringApplicationId<T> = <T as hiring::Trait>::ApplicationId;

+ 5 - 2
runtime-modules/working-group/src/tests/mock.rs

@@ -101,12 +101,15 @@ parameter_types! {
     pub const ScreenedMemberMaxInitialBalance: u64 = 500;
 }
 
+impl common::MembershipTypes for Test {
+    type MemberId = u64;
+    type ActorId = u64;
+}
+
 impl membership::Trait for Test {
     type Event = TestEvent;
-    type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = u64;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 

+ 1 - 1
runtime/src/integration/proposals/membership_origin_validator.rs

@@ -6,7 +6,7 @@ use common::origin::ActorOriginValidator;
 use frame_system::ensure_signed;
 
 /// Member of the Joystream organization
-pub type MemberId<T> = <T as membership::Trait>::MemberId;
+pub type MemberId<T> = <T as common::MembershipTypes>::MemberId;
 
 /// Default membership actor origin validator.
 pub struct MembershipOriginValidator<T> {

+ 9 - 1
runtime/src/integration/proposals/proposal_encoder.rs

@@ -23,7 +23,15 @@ macro_rules! wrap_working_group_call {
             WorkingGroup::Distribution => {
                 Call::DistributionWorkingGroup($working_group_instance_call)
             }
-            WorkingGroup::Operations => Call::OperationsWorkingGroup($working_group_instance_call),
+            WorkingGroup::OperationsAlpha => {
+                Call::OperationsWorkingGroupAlpha($working_group_instance_call)
+            }
+            WorkingGroup::OperationsBeta => {
+                Call::OperationsWorkingGroupBeta($working_group_instance_call)
+            }
+            WorkingGroup::OperationsGamma => {
+                Call::OperationsWorkingGroupGamma($working_group_instance_call)
+            }
             WorkingGroup::Gateway => Call::GatewayWorkingGroup($working_group_instance_call),
         }
     }};

+ 79 - 156
runtime/src/integration/working_group.rs

@@ -2,185 +2,108 @@ use frame_support::StorageMap;
 use sp_std::marker::PhantomData;
 
 use crate::{
-    ContentWorkingGroupInstance, GatewayWorkingGroupInstance, OperationsWorkingGroupInstance,
+    ContentWorkingGroupInstance, GatewayWorkingGroupInstance, OperationsWorkingGroupInstanceAlpha,
+    OperationsWorkingGroupInstanceBeta, OperationsWorkingGroupInstanceGamma,
     StorageWorkingGroupInstance,
 };
 use stake::{BalanceOf, NegativeImbalance};
 
+macro_rules! wg_staking_event_impl {
+    ($operation_wg_instance:ident, $operation_wg_staking_event_handler:ty) => {
+        impl<T: stake::Trait + working_group::Trait<$operation_wg_instance>>
+            stake::StakingEventsHandler<T> for $operation_wg_staking_event_handler
+        {
+            /// Unstake remaining sum back to the source_account_id
+            fn unstaked(
+                stake_id: &<T as stake::Trait>::StakeId,
+                _unstaked_amount: BalanceOf<T>,
+                remaining_imbalance: NegativeImbalance<T>,
+            ) -> NegativeImbalance<T> {
+                // Stake not related to a staked role managed by the hiring module.
+                if !hiring::ApplicationIdByStakingId::<T>::contains_key(*stake_id) {
+                return remaining_imbalance;
+            }
+
+            let hiring_application_id = hiring::ApplicationIdByStakingId::<T>::get(*stake_id);
+
+            if working_group::MemberIdByHiringApplicationId::<T, $operation_wg_instance>::contains_key(
+                hiring_application_id,
+            ) {
+                return <working_group::Module<T, $operation_wg_instance>>::refund_working_group_stake(
+                *stake_id,
+                remaining_imbalance,
+                );
+            }
+
+                remaining_imbalance
+            }
+
+            /// Empty handler for the slashing.
+            fn slashed(
+                _: &<T as stake::Trait>::StakeId,
+                _: Option<<T as stake::Trait>::SlashId>,
+                _: BalanceOf<T>,
+                _: BalanceOf<T>,
+                remaining_imbalance: NegativeImbalance<T>,
+            ) -> NegativeImbalance<T> {
+                remaining_imbalance
+            }
+        }
+    }
+}
+
 // Will be removed in the next releases.
 #[allow(clippy::upper_case_acronyms)]
 pub struct ContentDirectoryWgStakingEventsHandler<T> {
     pub marker: PhantomData<T>,
 }
 
-impl<T: stake::Trait + working_group::Trait<ContentWorkingGroupInstance>>
-    stake::StakingEventsHandler<T> for ContentDirectoryWgStakingEventsHandler<T>
-{
-    /// Unstake remaining sum back to the source_account_id
-    fn unstaked(
-        stake_id: &<T as stake::Trait>::StakeId,
-        _unstaked_amount: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        // Stake not related to a staked role managed by the hiring module.
-        if !hiring::ApplicationIdByStakingId::<T>::contains_key(*stake_id) {
-            return remaining_imbalance;
-        }
-
-        let hiring_application_id = hiring::ApplicationIdByStakingId::<T>::get(*stake_id);
-
-        if working_group::MemberIdByHiringApplicationId::<T, ContentWorkingGroupInstance>::contains_key(
-            hiring_application_id,
-        ) {
-            return <working_group::Module<T, ContentWorkingGroupInstance>>::refund_working_group_stake(
-				*stake_id,
-				remaining_imbalance,
-			);
-        }
-
-        remaining_imbalance
-    }
-
-    /// Empty handler for the slashing.
-    fn slashed(
-        _: &<T as stake::Trait>::StakeId,
-        _: Option<<T as stake::Trait>::SlashId>,
-        _: BalanceOf<T>,
-        _: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        remaining_imbalance
-    }
-}
-
 pub struct StorageWgStakingEventsHandler<T> {
     pub marker: PhantomData<T>,
 }
 
-impl<T: stake::Trait + working_group::Trait<StorageWorkingGroupInstance>>
-    stake::StakingEventsHandler<T> for StorageWgStakingEventsHandler<T>
-{
-    /// Unstake remaining sum back to the source_account_id
-    fn unstaked(
-        stake_id: &<T as stake::Trait>::StakeId,
-        _unstaked_amount: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        // Stake not related to a staked role managed by the hiring module.
-        if !hiring::ApplicationIdByStakingId::<T>::contains_key(*stake_id) {
-            return remaining_imbalance;
-        }
-
-        let hiring_application_id = hiring::ApplicationIdByStakingId::<T>::get(*stake_id);
-
-        if working_group::MemberIdByHiringApplicationId::<T, StorageWorkingGroupInstance>::contains_key(
-            hiring_application_id,
-        ) {
-            return <working_group::Module<T, StorageWorkingGroupInstance>>::refund_working_group_stake(
-				*stake_id,
-				remaining_imbalance,
-			);
-        }
-
-        remaining_imbalance
-    }
-
-    /// Empty handler for the slashing.
-    fn slashed(
-        _: &<T as stake::Trait>::StakeId,
-        _: Option<<T as stake::Trait>::SlashId>,
-        _: BalanceOf<T>,
-        _: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        remaining_imbalance
-    }
+pub struct OperationsWgStakingEventsHandlerAlpha<T> {
+    pub marker: PhantomData<T>,
 }
 
-pub struct OperationsWgStakingEventsHandler<T> {
+pub struct OperationsWgStakingEventsHandlerBeta<T> {
     pub marker: PhantomData<T>,
 }
 
-impl<T: stake::Trait + working_group::Trait<OperationsWorkingGroupInstance>>
-    stake::StakingEventsHandler<T> for OperationsWgStakingEventsHandler<T>
-{
-    /// Unstake remaining sum back to the source_account_id
-    fn unstaked(
-        stake_id: &<T as stake::Trait>::StakeId,
-        _unstaked_amount: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        // Stake not related to a staked role managed by the hiring module.
-        if !hiring::ApplicationIdByStakingId::<T>::contains_key(*stake_id) {
-            return remaining_imbalance;
-        }
-
-        let hiring_application_id = hiring::ApplicationIdByStakingId::<T>::get(*stake_id);
-
-        if working_group::MemberIdByHiringApplicationId::<T, OperationsWorkingGroupInstance>::contains_key(
-            hiring_application_id,
-        ) {
-            return <working_group::Module<T, OperationsWorkingGroupInstance>>::refund_working_group_stake(
-				*stake_id,
-				remaining_imbalance,
-			);
-        }
-
-        remaining_imbalance
-    }
-
-    /// Empty handler for the slashing.
-    fn slashed(
-        _: &<T as stake::Trait>::StakeId,
-        _: Option<<T as stake::Trait>::SlashId>,
-        _: BalanceOf<T>,
-        _: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        remaining_imbalance
-    }
+pub struct OperationsWgStakingEventsHandlerGamma<T> {
+    pub marker: PhantomData<T>,
 }
 
 pub struct GatewayWgStakingEventsHandler<T> {
     pub marker: PhantomData<T>,
 }
 
-impl<T: stake::Trait + working_group::Trait<GatewayWorkingGroupInstance>>
-    stake::StakingEventsHandler<T> for GatewayWgStakingEventsHandler<T>
-{
-    /// Unstake remaining sum back to the source_account_id
-    fn unstaked(
-        stake_id: &<T as stake::Trait>::StakeId,
-        _unstaked_amount: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        // Stake not related to a staked role managed by the hiring module.
-        if !hiring::ApplicationIdByStakingId::<T>::contains_key(*stake_id) {
-            return remaining_imbalance;
-        }
-
-        let hiring_application_id = hiring::ApplicationIdByStakingId::<T>::get(*stake_id);
-
-        if working_group::MemberIdByHiringApplicationId::<T, GatewayWorkingGroupInstance>::contains_key(
-            hiring_application_id,
-        ) {
-            return <working_group::Module<T, GatewayWorkingGroupInstance>>::refund_working_group_stake(
-				*stake_id,
-				remaining_imbalance,
-			);
-        }
-
-        remaining_imbalance
-    }
+wg_staking_event_impl!(
+    ContentWorkingGroupInstance,
+    ContentDirectoryWgStakingEventsHandler<T>
+);
 
-    /// Empty handler for the slashing.
-    fn slashed(
-        _: &<T as stake::Trait>::StakeId,
-        _: Option<<T as stake::Trait>::SlashId>,
-        _: BalanceOf<T>,
-        _: BalanceOf<T>,
-        remaining_imbalance: NegativeImbalance<T>,
-    ) -> NegativeImbalance<T> {
-        remaining_imbalance
-    }
-}
+wg_staking_event_impl!(
+    StorageWorkingGroupInstance,
+    StorageWgStakingEventsHandler<T>
+);
+
+wg_staking_event_impl!(
+    GatewayWorkingGroupInstance,
+    GatewayWgStakingEventsHandler<T>
+);
+
+wg_staking_event_impl!(
+    OperationsWorkingGroupInstanceAlpha,
+    OperationsWgStakingEventsHandlerAlpha<T>
+);
+
+wg_staking_event_impl!(
+    OperationsWorkingGroupInstanceBeta,
+    OperationsWgStakingEventsHandlerBeta<T>
+);
+
+wg_staking_event_impl!(
+    OperationsWorkingGroupInstanceGamma,
+    OperationsWgStakingEventsHandlerGamma<T>
+);

+ 36 - 10
runtime/src/lib.rs

@@ -478,7 +478,17 @@ impl stake::Trait for Runtime {
                 crate::integration::working_group::StorageWgStakingEventsHandler<Self>,
             ),
             (
-                crate::integration::working_group::OperationsWgStakingEventsHandler<Self>,
+                (
+                    (
+                        crate::integration::working_group::OperationsWgStakingEventsHandlerAlpha<
+                            Self,
+                        >,
+                        crate::integration::working_group::OperationsWgStakingEventsHandlerBeta<
+                            Self,
+                        >,
+                    ),
+                    crate::integration::working_group::OperationsWgStakingEventsHandlerGamma<Self>,
+                ),
                 crate::integration::working_group::GatewayWgStakingEventsHandler<Self>,
             ),
         ),
@@ -498,6 +508,7 @@ impl common::MembershipTypes for Runtime {
 
 impl common::StorageOwnership for Runtime {
     type ChannelId = ChannelId;
+    type DaoId = DaoId;
     type ContentId = ContentId;
     type DataObjectTypeId = DataObjectTypeId;
 }
@@ -522,10 +533,8 @@ parameter_types! {
 
 impl membership::Trait for Runtime {
     type Event = Event;
-    type MemberId = MemberId;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type ActorId = ActorId;
     type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
 }
 
@@ -545,12 +554,18 @@ pub type ContentWorkingGroupInstance = working_group::Instance3;
 // The distribution working group instance alias.
 pub type DistributionWorkingGroupInstance = working_group::Instance6;
 
-// The builder working group instance alias.
-pub type OperationsWorkingGroupInstance = working_group::Instance4;
-
 // The gateway working group instance alias.
 pub type GatewayWorkingGroupInstance = working_group::Instance5;
 
+// The operation working group alpha instance alias.
+pub type OperationsWorkingGroupInstanceAlpha = working_group::Instance4;
+
+// The operation working group beta instance alias .
+pub type OperationsWorkingGroupInstanceBeta = working_group::Instance7;
+
+// The operation working group gamma instance alias .
+pub type OperationsWorkingGroupInstanceGamma = working_group::Instance8;
+
 parameter_types! {
     pub const MaxWorkerNumberLimit: u32 = 100;
 }
@@ -570,7 +585,7 @@ impl working_group::Trait<DistributionWorkingGroupInstance> for Runtime {
     type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
 }
 
-impl working_group::Trait<OperationsWorkingGroupInstance> for Runtime {
+impl working_group::Trait<OperationsWorkingGroupInstanceAlpha> for Runtime {
     type Event = Event;
     type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
 }
@@ -580,6 +595,16 @@ impl working_group::Trait<GatewayWorkingGroupInstance> for Runtime {
     type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
 }
 
+impl working_group::Trait<OperationsWorkingGroupInstanceBeta> for Runtime {
+    type Event = Event;
+    type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
+}
+
+impl working_group::Trait<OperationsWorkingGroupInstanceGamma> for Runtime {
+    type Event = Event;
+    type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
+}
+
 parameter_types! {
     pub const ProposalCancellationFee: u64 = 10000;
     pub const ProposalRejectionFee: u64 = 5000;
@@ -779,14 +804,15 @@ construct_runtime!(
         ProposalsEngine: proposals_engine::{Module, Call, Storage, Event<T>},
         ProposalsDiscussion: proposals_discussion::{Module, Call, Storage, Event<T>},
         ProposalsCodex: proposals_codex::{Module, Call, Storage, Config<T>},
+        Storage: storage::{Module, Call, Storage, Event<T>},
         // --- Working groups
         // reserved for the future use: ForumWorkingGroup: working_group::<Instance1>::{Module, Call, Storage, Config<T>, Event<T>},
         StorageWorkingGroup: working_group::<Instance2>::{Module, Call, Storage, Config<T>, Event<T>},
         ContentWorkingGroup: working_group::<Instance3>::{Module, Call, Storage, Config<T>, Event<T>},
-        OperationsWorkingGroup: working_group::<Instance4>::{Module, Call, Storage, Config<T>, Event<T>},
+        OperationsWorkingGroupAlpha: working_group::<Instance4>::{Module, Call, Storage, Config<T>, Event<T>},
         GatewayWorkingGroup: working_group::<Instance5>::{Module, Call, Storage, Config<T>, Event<T>},
         DistributionWorkingGroup: working_group::<Instance6>::{Module, Call, Storage, Config<T>, Event<T>},
-        //
-        Storage: storage::{Module, Call, Storage, Event<T>},
+        OperationsWorkingGroupBeta: working_group::<Instance7>::{Module, Call, Storage, Config<T>, Event<T>},
+        OperationsWorkingGroupGamma: working_group::<Instance8>::{Module, Call, Storage, Config<T>, Event<T>},
     }
 );

+ 2 - 3
runtime/src/primitives.rs

@@ -14,9 +14,8 @@ pub type TransactionPriority = u64;
 /// Alias for ContentId, used in various places.
 pub type ContentId = sp_core::H256;
 
-#[allow(clippy::upper_case_acronyms)]
-/// Alias for DAOId, used in various places.
-pub type DAOId = u64;
+/// Alias for DaoId, used in various places.
+pub type DaoId = u64;
 
 /// Alias for DataObjectTypeId, used in various places.
 pub type DataObjectTypeId = u64;

+ 169 - 45
runtime/src/tests/proposals_integration/working_group_proposals.rs

@@ -13,8 +13,10 @@ use working_group::{OpeningPolicyCommitment, RewardPolicy};
 use crate::{
     Balance, BlockNumber, ContentWorkingGroup, ContentWorkingGroupInstance,
     DistributionWorkingGroup, DistributionWorkingGroupInstance, GatewayWorkingGroup,
-    GatewayWorkingGroupInstance, OperationsWorkingGroup, OperationsWorkingGroupInstance,
-    StorageWorkingGroup, StorageWorkingGroupInstance,
+    GatewayWorkingGroupInstance, OperationsWorkingGroupAlpha, OperationsWorkingGroupBeta,
+    OperationsWorkingGroupGamma, OperationsWorkingGroupInstanceAlpha,
+    OperationsWorkingGroupInstanceBeta, OperationsWorkingGroupInstanceGamma, StorageWorkingGroup,
+    StorageWorkingGroupInstance,
 };
 use sp_std::collections::btree_set::BTreeSet;
 
@@ -62,11 +64,27 @@ fn add_opening(
             >>::contains_key(opening_id));
             opening_id
         }
-        WorkingGroup::Operations => {
-            let opening_id = OperationsWorkingGroup::next_opening_id();
+        WorkingGroup::OperationsAlpha => {
+            let opening_id = OperationsWorkingGroupAlpha::next_opening_id();
             assert!(!<working_group::OpeningById<
                 Runtime,
-                OperationsWorkingGroupInstance,
+                OperationsWorkingGroupInstanceAlpha,
+            >>::contains_key(opening_id));
+            opening_id
+        }
+        WorkingGroup::OperationsBeta => {
+            let opening_id = OperationsWorkingGroupBeta::next_opening_id();
+            assert!(!<working_group::OpeningById<
+                Runtime,
+                OperationsWorkingGroupInstanceBeta,
+            >>::contains_key(opening_id));
+            opening_id
+        }
+        WorkingGroup::OperationsGamma => {
+            let opening_id = OperationsWorkingGroupGamma::next_opening_id();
+            assert!(!<working_group::OpeningById<
+                Runtime,
+                OperationsWorkingGroupInstanceGamma,
             >>::contains_key(opening_id));
             opening_id
         }
@@ -362,10 +380,22 @@ fn create_add_working_group_leader_opening_proposal_execution_succeeds() {
                     DistributionWorkingGroupInstance,
                 >(group);
             }
-            WorkingGroup::Operations => {
+            WorkingGroup::OperationsAlpha => {
                 run_create_add_working_group_leader_opening_proposal_execution_succeeds::<
                     Runtime,
-                    OperationsWorkingGroupInstance,
+                    OperationsWorkingGroupInstanceAlpha,
+                >(group);
+            }
+            WorkingGroup::OperationsBeta => {
+                run_create_add_working_group_leader_opening_proposal_execution_succeeds::<
+                    Runtime,
+                    OperationsWorkingGroupInstanceBeta,
+                >(group);
+            }
+            WorkingGroup::OperationsGamma => {
+                run_create_add_working_group_leader_opening_proposal_execution_succeeds::<
+                    Runtime,
+                    OperationsWorkingGroupInstanceGamma,
                 >(group);
             }
             WorkingGroup::Gateway => {
@@ -384,7 +414,7 @@ fn run_create_add_working_group_leader_opening_proposal_execution_succeeds<
 >(
     working_group: WorkingGroup,
 ) where
-    <T as membership::Trait>::MemberId: From<u64>,
+    <T as common::MembershipTypes>::MemberId: From<u64>,
     <T as hiring::Trait>::OpeningId: From<u64>,
 {
     initial_test_ext().execute_with(|| {
@@ -434,16 +464,29 @@ fn create_begin_review_working_group_leader_applications_proposal_execution_succ
             }
             WorkingGroup::Distribution => {
                 run_create_begin_review_working_group_leader_applications_proposal_execution_succeeds::<
-                Runtime,
+                    Runtime,
                     DistributionWorkingGroupInstance,
+                >(group);
+            }
+            WorkingGroup::OperationsAlpha => {
+                run_create_begin_review_working_group_leader_applications_proposal_execution_succeeds::<
+                Runtime,
+                OperationsWorkingGroupInstanceAlpha,
+            >(group);
+            }
+            WorkingGroup::OperationsBeta => {
+                run_create_begin_review_working_group_leader_applications_proposal_execution_succeeds::<
+                Runtime,
+                OperationsWorkingGroupInstanceBeta,
             >(group);
             }
-            WorkingGroup::Operations => {
+            WorkingGroup::OperationsGamma => {
                 run_create_begin_review_working_group_leader_applications_proposal_execution_succeeds::<
                 Runtime,
-                OperationsWorkingGroupInstance,
+                OperationsWorkingGroupInstanceGamma,
             >(group);
             }
+
             WorkingGroup::Gateway => {
                 run_create_begin_review_working_group_leader_applications_proposal_execution_succeeds::<
                 Runtime,
@@ -536,12 +579,25 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
                     DistributionWorkingGroupInstance,
                 >(group);
             }
-            WorkingGroup::Operations => {
+            WorkingGroup::OperationsAlpha => {
+                run_create_fill_working_group_leader_opening_proposal_execution_succeeds::<
+                    Runtime,
+                    OperationsWorkingGroupInstanceAlpha,
+                >(group);
+            }
+            WorkingGroup::OperationsBeta => {
+                run_create_fill_working_group_leader_opening_proposal_execution_succeeds::<
+                    Runtime,
+                    OperationsWorkingGroupInstanceBeta,
+                >(group);
+            }
+            WorkingGroup::OperationsGamma => {
                 run_create_fill_working_group_leader_opening_proposal_execution_succeeds::<
                     Runtime,
-                    OperationsWorkingGroupInstance,
+                    OperationsWorkingGroupInstanceGamma,
                 >(group);
             }
+
             WorkingGroup::Gateway => {
                 run_create_fill_working_group_leader_opening_proposal_execution_succeeds::<
                     Runtime,
@@ -558,7 +614,7 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
         working_group: WorkingGroup,
     ) where
         <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
-        <T as membership::Trait>::MemberId: From<u64>,
+        <T as common::MembershipTypes>::MemberId: From<u64>,
         <T as hiring::Trait>::OpeningId: From<u64>,
     {
         initial_test_ext().execute_with(|| {
@@ -631,12 +687,25 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
                         DistributionWorkingGroupInstance,
                     >(group);
                 }
-                WorkingGroup::Operations => {
+                WorkingGroup::OperationsAlpha => {
+                    run_create_decrease_group_leader_stake_proposal_execution_succeeds::<
+                        Runtime,
+                        OperationsWorkingGroupInstanceAlpha,
+                    >(group);
+                }
+                WorkingGroup::OperationsBeta => {
+                    run_create_decrease_group_leader_stake_proposal_execution_succeeds::<
+                        Runtime,
+                        OperationsWorkingGroupInstanceBeta,
+                    >(group);
+                }
+                WorkingGroup::OperationsGamma => {
                     run_create_decrease_group_leader_stake_proposal_execution_succeeds::<
                         Runtime,
-                        OperationsWorkingGroupInstance,
+                        OperationsWorkingGroupInstanceGamma,
                     >(group);
                 }
+
                 WorkingGroup::Gateway => {
                     run_create_decrease_group_leader_stake_proposal_execution_succeeds::<
                         Runtime,
@@ -655,8 +724,8 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
     ) where
         <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
         <T as hiring::Trait>::OpeningId: From<u64>,
-        <T as membership::Trait>::MemberId: From<u64>,
-        <T as membership::Trait>::ActorId: Into<u64>,
+        <T as common::MembershipTypes>::MemberId: From<u64>,
+        <T as common::MembershipTypes>::ActorId: Into<u64>,
         <<T as stake::Trait>::Currency as traits::Currency<
             <T as frame_system::Trait>::AccountId,
         >>::Balance: From<u128>,
@@ -766,10 +835,22 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
                         DistributionWorkingGroupInstance,
                     >(group)
                 }
-                WorkingGroup::Operations => {
+                WorkingGroup::OperationsAlpha => {
+                    run_create_slash_group_leader_stake_proposal_execution_succeeds::<
+                        Runtime,
+                        OperationsWorkingGroupInstanceAlpha,
+                    >(group)
+                }
+                WorkingGroup::OperationsBeta => {
+                    run_create_slash_group_leader_stake_proposal_execution_succeeds::<
+                        Runtime,
+                        OperationsWorkingGroupInstanceBeta,
+                    >(group)
+                }
+                WorkingGroup::OperationsGamma => {
                     run_create_slash_group_leader_stake_proposal_execution_succeeds::<
                         Runtime,
-                        OperationsWorkingGroupInstance,
+                        OperationsWorkingGroupInstanceGamma,
                     >(group)
                 }
                 WorkingGroup::Gateway => {
@@ -790,8 +871,8 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
     ) where
         <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
         <T as hiring::Trait>::OpeningId: From<u64>,
-        <T as membership::Trait>::MemberId: From<u64>,
-        <T as membership::Trait>::ActorId: Into<u64>,
+        <T as common::MembershipTypes>::MemberId: From<u64>,
+        <T as common::MembershipTypes>::ActorId: Into<u64>,
         <<T as stake::Trait>::Currency as traits::Currency<
             <T as frame_system::Trait>::AccountId,
         >>::Balance: From<u128>,
@@ -902,11 +983,23 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
                         DistributionWorkingGroupInstance,
                     >(group);
                 }
-                WorkingGroup::Operations => {
+                WorkingGroup::OperationsAlpha => {
                     run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
                         Runtime,
-                        OperationsWorkingGroupInstance,
-                    >(group);
+                        OperationsWorkingGroupInstanceAlpha,
+                    >(group)
+                }
+                WorkingGroup::OperationsBeta => {
+                    run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                        Runtime,
+                        OperationsWorkingGroupInstanceBeta,
+                    >(group)
+                }
+                WorkingGroup::OperationsGamma => {
+                    run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                        Runtime,
+                        OperationsWorkingGroupInstanceGamma,
+                    >(group)
                 }
                 WorkingGroup::Gateway => {
                     run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
@@ -924,7 +1017,7 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
             working_group: WorkingGroup,
         ) where
             <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
-            <T as membership::Trait>::MemberId: From<u64>,
+            <T as common::MembershipTypes>::MemberId: From<u64>,
             <T as minting::Trait>::MintId: From<u64>,
             <<T as minting::Trait>::Currency as traits::Currency<
                 <T as frame_system::Trait>::AccountId,
@@ -959,31 +1052,43 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
             for group in WorkingGroup::iter() {
                 match group {
                     WorkingGroup::Content => {
-                        run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
                             Runtime,
                             ContentWorkingGroupInstance,
                         >(group);
                     }
                     WorkingGroup::Storage => {
-                        run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
                             Runtime,
                             StorageWorkingGroupInstance,
                         >(group);
                     }
                     WorkingGroup::Distribution => {
-                        run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
                             Runtime,
                             DistributionWorkingGroupInstance,
                         >(group);
                     }
-                    WorkingGroup::Operations => {
-                        run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                    WorkingGroup::OperationsAlpha => {
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
                             Runtime,
-                            OperationsWorkingGroupInstance,
-                        >(group);
+                            OperationsWorkingGroupInstanceAlpha,
+                        >(group)
+                    }
+                    WorkingGroup::OperationsBeta => {
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
+                            Runtime,
+                            OperationsWorkingGroupInstanceBeta,
+                        >(group)
+                    }
+                    WorkingGroup::OperationsGamma => {
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
+                            Runtime,
+                            OperationsWorkingGroupInstanceGamma,
+                        >(group)
                     }
                     WorkingGroup::Gateway => {
-                        run_create_set_working_group_mint_capacity_proposal_execution_succeeds::<
+                        run_create_set_group_leader_reward_proposal_execution_succeeds::<
                             Runtime,
                             GatewayWorkingGroupInstance,
                         >(group);
@@ -999,8 +1104,8 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
             working_group: WorkingGroup,
         ) where
             <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
-            <T as membership::Trait>::MemberId: From<u64>,
-            <T as membership::Trait>::ActorId: Into<u64>,
+            <T as common::MembershipTypes>::MemberId: From<u64>,
+            <T as common::MembershipTypes>::ActorId: Into<u64>,
             <T as minting::Trait>::MintId: From<u64>,
             <T as hiring::Trait>::OpeningId: From<u64>,
             <<T as minting::Trait>::Currency as traits::Currency<
@@ -1117,12 +1222,25 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
                             DistributionWorkingGroupInstance,
                         >(group);
                     }
-                    WorkingGroup::Operations => {
+                    WorkingGroup::OperationsAlpha => {
                         run_create_terminate_group_leader_role_proposal_execution_succeeds::<
                             Runtime,
-                            OperationsWorkingGroupInstance,
-                        >(group);
+                            OperationsWorkingGroupInstanceAlpha,
+                        >(group)
+                    }
+                    WorkingGroup::OperationsBeta => {
+                        run_create_terminate_group_leader_role_proposal_execution_succeeds::<
+                            Runtime,
+                            OperationsWorkingGroupInstanceBeta,
+                        >(group)
+                    }
+                    WorkingGroup::OperationsGamma => {
+                        run_create_terminate_group_leader_role_proposal_execution_succeeds::<
+                            Runtime,
+                            OperationsWorkingGroupInstanceGamma,
+                        >(group)
                     }
+
                     WorkingGroup::Gateway => {
                         run_create_terminate_group_leader_role_proposal_execution_succeeds::<
                             Runtime,
@@ -1140,8 +1258,8 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
             working_group: WorkingGroup,
         ) where
             <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
-            <T as membership::Trait>::MemberId: From<u64>,
-            <T as membership::Trait>::ActorId: Into<u64>,
+            <T as common::MembershipTypes>::MemberId: From<u64>,
+            <T as common::MembershipTypes>::ActorId: Into<u64>,
             <T as minting::Trait>::MintId: From<u64>,
             <T as hiring::Trait>::OpeningId: From<u64>,
             <<T as stake::Trait>::Currency as traits::Currency<
@@ -1251,8 +1369,14 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
                     WorkingGroup::Distribution => {
                         run_create_terminate_group_leader_role_proposal_with_slashing_execution_succeeds::<Runtime, DistributionWorkingGroupInstance>(group);
                     }
-                    WorkingGroup::Operations => {
-                        run_create_terminate_group_leader_role_proposal_with_slashing_execution_succeeds::<Runtime, OperationsWorkingGroupInstance>(group);
+                    WorkingGroup::OperationsAlpha => {
+                        run_create_terminate_group_leader_role_proposal_with_slashing_execution_succeeds::<Runtime, OperationsWorkingGroupInstanceAlpha>(group);
+                    }
+                    WorkingGroup::OperationsBeta => {
+                        run_create_terminate_group_leader_role_proposal_with_slashing_execution_succeeds::<Runtime, OperationsWorkingGroupInstanceBeta>(group);
+                    }
+                    WorkingGroup::OperationsGamma => {
+                        run_create_terminate_group_leader_role_proposal_with_slashing_execution_succeeds::<Runtime, OperationsWorkingGroupInstanceGamma>(group);
                     }
                     WorkingGroup::Gateway => {
                         run_create_terminate_group_leader_role_proposal_with_slashing_execution_succeeds::<Runtime, GatewayWorkingGroupInstance>(group);
@@ -1268,8 +1392,8 @@ fn create_fill_working_group_leader_opening_proposal_execution_succeeds() {
             working_group: WorkingGroup,
         ) where
             <T as frame_system::Trait>::AccountId: From<[u8; 32]>,
-            <T as membership::Trait>::MemberId: From<u64>,
-            <T as membership::Trait>::ActorId: Into<u64>,
+            <T as common::MembershipTypes>::MemberId: From<u64>,
+            <T as common::MembershipTypes>::ActorId: Into<u64>,
             <T as minting::Trait>::MintId: From<u64>,
             <T as hiring::Trait>::OpeningId: From<u64>,
             <<T as stake::Trait>::Currency as traits::Currency<