Browse Source

runtime, node, chain-spec-build: remove dead modules

Mokhtar Naamani 4 years ago
parent
commit
f92309efff

+ 0 - 62
Cargo.lock

@@ -2068,7 +2068,6 @@ dependencies = [
  "pallet-collective",
  "pallet-common",
  "pallet-content-directory",
- "pallet-content-working-group",
  "pallet-finality-tracker",
  "pallet-forum",
  "pallet-governance",
@@ -2097,8 +2096,6 @@ dependencies = [
  "pallet-transaction-payment",
  "pallet-transaction-payment-rpc-runtime-api",
  "pallet-utility",
- "pallet-versioned-store",
- "pallet-versioned-store-permissions",
  "pallet-working-group",
  "parity-scale-codec",
  "serde",
@@ -3321,31 +3318,6 @@ dependencies = [
  "sp-std",
 ]
 
-[[package]]
-name = "pallet-content-working-group"
-version = "3.0.0"
-dependencies = [
- "frame-support",
- "frame-system",
- "pallet-balances",
- "pallet-common",
- "pallet-hiring",
- "pallet-membership",
- "pallet-recurring-reward",
- "pallet-stake",
- "pallet-timestamp",
- "pallet-token-mint",
- "pallet-versioned-store",
- "pallet-versioned-store-permissions",
- "parity-scale-codec",
- "serde",
- "sp-arithmetic",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
 [[package]]
 name = "pallet-finality-tracker"
 version = "2.0.0-rc4"
@@ -3860,40 +3832,6 @@ dependencies = [
  "sp-std",
 ]
 
-[[package]]
-name = "pallet-versioned-store"
-version = "3.0.0"
-dependencies = [
- "frame-support",
- "frame-system",
- "pallet-common",
- "pallet-timestamp",
- "parity-scale-codec",
- "serde",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "pallet-versioned-store-permissions"
-version = "3.0.0"
-dependencies = [
- "frame-support",
- "frame-system",
- "pallet-common",
- "pallet-timestamp",
- "pallet-versioned-store",
- "parity-scale-codec",
- "serde",
- "sp-arithmetic",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
 [[package]]
 name = "pallet-working-group"
 version = "3.0.0"

+ 0 - 3
Cargo.toml

@@ -5,7 +5,6 @@ members = [
 	"runtime-modules/proposals/codex",
 	"runtime-modules/proposals/discussion",
 	"runtime-modules/common",
-	"runtime-modules/content-working-group",
 	"runtime-modules/forum",
 	"runtime-modules/governance",
 	"runtime-modules/hiring",
@@ -16,8 +15,6 @@ members = [
 	"runtime-modules/stake",
 	"runtime-modules/storage",
 	"runtime-modules/token-minting",
-	"runtime-modules/versioned-store",
-	"runtime-modules/versioned-store-permissions",
 	"runtime-modules/working-group",
 	"runtime-modules/content-directory",
 	"node",

+ 1 - 1
node/Cargo.toml

@@ -3,7 +3,7 @@ authors = ['Joystream contributors']
 build = 'build.rs'
 edition = '2018'
 name = 'joystream-node'
-version = '3.5.0'
+version = '3.6.0'
 default-run = "joystream-node"
 
 [[bin]]

+ 1 - 299
node/src/chain_spec/content_config.rs

@@ -1,14 +1,5 @@
 use codec::Decode;
-use node_runtime::common::constraints::InputValidationLengthConstraint;
-use node_runtime::{
-    content_wg::{Channel, ChannelId, Principal, PrincipalId},
-    data_directory::DataObject,
-    primitives::{AccountId, BlockNumber, Credential},
-    versioned_store::{Class, ClassId, Entity, EntityId},
-    versioned_store_permissions::ClassPermissions,
-    ContentId, ContentWorkingGroupConfig, DataDirectoryConfig, Runtime, VersionedStoreConfig,
-    VersionedStorePermissionsConfig,
-};
+use node_runtime::{data_directory::DataObject, ContentId, DataDirectoryConfig, Runtime};
 use serde::Deserialize;
 use std::{fs, path::Path};
 
@@ -16,18 +7,6 @@ use std::{fs, path::Path};
 // the string types return a `string` not the `Text` type so when we are serializing
 // them to json we get a string rather than an array of bytes, so deserializing them
 // is failing. So we are relying on parity codec encoding instead..
-#[derive(Decode)]
-struct ClassAndPermissions {
-    class: Class,
-    permissions: ClassPermissions<ClassId, Credential, u16, BlockNumber>,
-}
-
-#[derive(Decode)]
-struct EntityAndMaintainer {
-    entity: Entity,
-    maintainer: Option<Credential>,
-}
-
 #[derive(Decode)]
 struct DataObjectAndContentId {
     content_id: ContentId,
@@ -36,60 +15,8 @@ struct DataObjectAndContentId {
 
 #[derive(Decode)]
 struct ContentData {
-    /// classes and their associted permissions
-    classes: Vec<ClassAndPermissions>,
-    /// entities and their associated maintainer
-    entities: Vec<EntityAndMaintainer>,
     /// DataObject(s) and ContentId
     data_objects: Vec<DataObjectAndContentId>,
-    /// Media Channels
-    channels: Vec<ChannelAndId>,
-}
-
-#[derive(Deserialize)]
-struct EncodedClassAndPermissions {
-    /// hex encoded Class
-    class: String,
-    /// hex encoded ClassPermissions<ClassId, Credential, u16, BlockNumber>,
-    permissions: String,
-}
-
-impl EncodedClassAndPermissions {
-    fn decode(&self) -> ClassAndPermissions {
-        // hex string must not include '0x' prefix!
-        let encoded_class =
-            hex::decode(&self.class[2..].as_bytes()).expect("failed to parse class hex string");
-        let encoded_permissions = hex::decode(&self.permissions[2..].as_bytes())
-            .expect("failed to parse class permissions hex string");
-        ClassAndPermissions {
-            class: Decode::decode(&mut encoded_class.as_slice()).unwrap(),
-            permissions: Decode::decode(&mut encoded_permissions.as_slice()).unwrap(),
-        }
-    }
-}
-
-#[derive(Deserialize)]
-struct EncodedEntityAndMaintainer {
-    /// hex encoded Entity
-    entity: String,
-    /// hex encoded Option<Credential>
-    maintainer: Option<String>,
-}
-
-impl EncodedEntityAndMaintainer {
-    fn decode(&self) -> EntityAndMaintainer {
-        // hex string must not include '0x' prefix!
-        let encoded_entity =
-            hex::decode(&self.entity[2..].as_bytes()).expect("failed to parse entity hex string");
-        let encoded_maintainer = self.maintainer.as_ref().map(|maintainer| {
-            hex::decode(&maintainer[2..].as_bytes()).expect("failed to parse maintainer hex string")
-        });
-        EntityAndMaintainer {
-            entity: Decode::decode(&mut encoded_entity.as_slice()).unwrap(),
-            maintainer: encoded_maintainer
-                .map(|maintainer| Decode::decode(&mut maintainer.as_slice()).unwrap()),
-        }
-    }
 }
 
 #[derive(Deserialize)]
@@ -114,42 +41,10 @@ impl EncodedDataObjectAndContentId {
     }
 }
 
-#[derive(Decode)]
-struct ChannelAndId {
-    id: ChannelId<Runtime>,
-    channel: Channel<u64, AccountId, BlockNumber, PrincipalId<Runtime>>,
-}
-
-#[derive(Deserialize)]
-struct EncodedChannelAndId {
-    /// ChannelId number
-    id: u64,
-    /// hex encoded Channel
-    channel: String,
-}
-
-impl EncodedChannelAndId {
-    fn decode(&self) -> ChannelAndId {
-        let id = self.id;
-        let encoded_channel =
-            hex::decode(&self.channel[2..].as_bytes()).expect("failed to parse channel hex string");
-        ChannelAndId {
-            id: id as ChannelId<Runtime>,
-            channel: Decode::decode(&mut encoded_channel.as_slice()).unwrap(),
-        }
-    }
-}
-
 #[derive(Deserialize)]
 struct EncodedContentData {
-    /// classes and their associted permissions
-    classes: Vec<EncodedClassAndPermissions>,
-    /// entities and their associated maintainer
-    entities: Vec<EncodedEntityAndMaintainer>,
     /// DataObject(s) and ContentId
     data_objects: Vec<EncodedDataObjectAndContentId>,
-    /// Media Channels
-    channels: Vec<EncodedChannelAndId>,
 }
 
 fn parse_content_data(data_file: &Path) -> EncodedContentData {
@@ -160,123 +55,15 @@ fn parse_content_data(data_file: &Path) -> EncodedContentData {
 impl EncodedContentData {
     pub fn decode(&self) -> ContentData {
         ContentData {
-            classes: self
-                .classes
-                .iter()
-                .map(|class_and_perm| class_and_perm.decode())
-                .collect(),
-            entities: self
-                .entities
-                .iter()
-                .map(|entities_and_maintainer| entities_and_maintainer.decode())
-                .collect(),
             data_objects: self
                 .data_objects
                 .iter()
                 .map(|data_objects| data_objects.decode())
                 .collect(),
-            channels: self
-                .channels
-                .iter()
-                .map(|channel_and_id| channel_and_id.decode())
-                .collect(),
         }
     }
 }
 
-/// Generates a VersionedStoreConfig genesis config
-/// with pre-populated classes and entities parsed from a json file serialized
-/// as a ContentData struct.
-pub fn versioned_store_config_from_json(data_file: &Path) -> VersionedStoreConfig {
-    let content = parse_content_data(data_file).decode();
-    let base_config = empty_versioned_store_config();
-    let first_id = 1;
-
-    let next_class_id: ClassId = content
-        .classes
-        .last()
-        .map_or(first_id, |class_and_perm| class_and_perm.class.id + 1);
-    assert_eq!(next_class_id, (content.classes.len() + 1) as ClassId);
-
-    let next_entity_id: EntityId = content
-        .entities
-        .last()
-        .map_or(first_id, |entity_and_maintainer| {
-            entity_and_maintainer.entity.id + 1
-        });
-
-    VersionedStoreConfig {
-        class_by_id: content
-            .classes
-            .into_iter()
-            .map(|class_and_permissions| {
-                (class_and_permissions.class.id, class_and_permissions.class)
-            })
-            .collect(),
-        entity_by_id: content
-            .entities
-            .into_iter()
-            .map(|entity_and_maintainer| {
-                (
-                    entity_and_maintainer.entity.id,
-                    entity_and_maintainer.entity,
-                )
-            })
-            .collect(),
-        next_class_id,
-        next_entity_id,
-        ..base_config
-    }
-}
-
-/// Generates basic empty VersionedStoreConfig genesis config
-pub fn empty_versioned_store_config() -> VersionedStoreConfig {
-    VersionedStoreConfig {
-        class_by_id: vec![],
-        entity_by_id: vec![],
-        next_class_id: 1,
-        next_entity_id: 1,
-        property_name_constraint: InputValidationLengthConstraint::new(1, 99),
-        property_description_constraint: InputValidationLengthConstraint::new(1, 999),
-        class_name_constraint: InputValidationLengthConstraint::new(1, 99),
-        class_description_constraint: InputValidationLengthConstraint::new(1, 999),
-    }
-}
-
-/// Generates a basic empty VersionedStorePermissionsConfig genesis config
-pub fn empty_versioned_store_permissions_config() -> VersionedStorePermissionsConfig {
-    VersionedStorePermissionsConfig {
-        class_permissions_by_class_id: vec![],
-        entity_maintainer_by_entity_id: vec![],
-    }
-}
-
-/// Generates a `VersionedStorePermissionsConfig` genesis config
-/// pre-populated with permissions and entity maintainers parsed from
-/// a json file serialized as a `ContentData` struct.
-pub fn versioned_store_permissions_config_from_json(
-    data_file: &Path,
-) -> VersionedStorePermissionsConfig {
-    let content = parse_content_data(data_file).decode();
-
-    VersionedStorePermissionsConfig {
-        class_permissions_by_class_id: content
-            .classes
-            .into_iter()
-            .map(|class_and_perm| (class_and_perm.class.id, class_and_perm.permissions))
-            .collect(),
-        entity_maintainer_by_entity_id: content
-            .entities
-            .into_iter()
-            .filter_map(|entity_and_maintainer| {
-                entity_and_maintainer
-                    .maintainer
-                    .map(|maintainer| (entity_and_maintainer.entity.id, maintainer))
-            })
-            .collect(),
-    }
-}
-
 /// Generates a basic empty `DataDirectoryConfig` genesis config
 pub fn empty_data_directory_config() -> DataDirectoryConfig {
     DataDirectoryConfig {
@@ -304,88 +91,3 @@ pub fn data_directory_config_from_json(data_file: &Path) -> DataDirectoryConfig
             .collect(),
     }
 }
-
-/// Generates a basic `ContentWorkingGroupConfig` genesis config without any active curators
-/// curator lead or channels.
-pub fn empty_content_working_group_config() -> ContentWorkingGroupConfig {
-    ContentWorkingGroupConfig {
-        mint_capacity: 0,
-        curator_opening_by_id: vec![],
-        next_curator_opening_id: 0,
-        curator_application_by_id: vec![],
-        next_curator_application_id: 0,
-        channel_by_id: vec![],
-        next_channel_id: 1,
-        channel_id_by_handle: vec![],
-        curator_by_id: vec![],
-        next_curator_id: 0,
-        principal_by_id: vec![],
-        next_principal_id: 0,
-        channel_creation_enabled: true, // there is no extrinsic to change it so enabling at genesis
-        unstaker_by_stake_id: vec![],
-        channel_handle_constraint: InputValidationLengthConstraint::new(5, 20),
-        channel_description_constraint: InputValidationLengthConstraint::new(1, 1024),
-        opening_human_readable_text: InputValidationLengthConstraint::new(1, 2048),
-        curator_application_human_readable_text: InputValidationLengthConstraint::new(1, 2048),
-        curator_exit_rationale_text: InputValidationLengthConstraint::new(1, 2048),
-        channel_avatar_constraint: InputValidationLengthConstraint::new(5, 1024),
-        channel_banner_constraint: InputValidationLengthConstraint::new(5, 1024),
-        channel_title_constraint: InputValidationLengthConstraint::new(5, 1024),
-    }
-}
-
-/// Generates a `ContentWorkingGroupConfig` genesis config
-/// pre-populated with channels and corresponding princial channel owners
-/// parsed from a json file serialized as a `ContentData` struct
-pub fn content_working_group_config_from_json(data_file: &Path) -> ContentWorkingGroupConfig {
-    let content = parse_content_data(data_file).decode();
-    let first_channel_id = 1;
-    let first_principal_id = 0;
-
-    let next_channel_id: ChannelId<Runtime> = content
-        .channels
-        .last()
-        .map_or(first_channel_id, |channel_and_id| channel_and_id.id + 1);
-    assert_eq!(
-        next_channel_id,
-        (content.channels.len() + 1) as ChannelId<Runtime>
-    );
-
-    let base_config = empty_content_working_group_config();
-
-    ContentWorkingGroupConfig {
-        channel_by_id: content
-            .channels
-            .iter()
-            .enumerate()
-            .map(|(ix, channel_and_id)| {
-                (
-                    channel_and_id.id,
-                    Channel {
-                        principal_id: first_principal_id + ix as PrincipalId<Runtime>,
-                        ..channel_and_id.channel.clone()
-                    },
-                )
-            })
-            .collect(),
-        next_channel_id,
-        channel_id_by_handle: content
-            .channels
-            .iter()
-            .map(|channel_and_id| (channel_and_id.channel.handle.clone(), channel_and_id.id))
-            .collect(),
-        principal_by_id: content
-            .channels
-            .iter()
-            .enumerate()
-            .map(|(ix, channel_and_id)| {
-                (
-                    first_principal_id + ix as PrincipalId<Runtime>,
-                    Principal::ChannelOwner(channel_and_id.id),
-                )
-            })
-            .collect(),
-        next_principal_id: first_principal_id + content.channels.len() as PrincipalId<Runtime>,
-        ..base_config
-    }
-}

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

@@ -30,12 +30,12 @@ use sp_runtime::Perbill;
 
 use node_runtime::{
     membership, AuthorityDiscoveryConfig, BabeConfig, Balance, BalancesConfig,
-    ContentDirectoryConfig, ContentDirectoryWorkingGroupConfig, ContentWorkingGroupConfig,
-    CouncilConfig, CouncilElectionConfig, DataDirectoryConfig, DataObjectStorageRegistryConfig,
+    ContentDirectoryConfig, ContentDirectoryWorkingGroupConfig, CouncilConfig,
+    CouncilElectionConfig, DataDirectoryConfig, DataObjectStorageRegistryConfig,
     DataObjectTypeRegistryConfig, ElectionParameters, ForumConfig, GrandpaConfig, ImOnlineConfig,
     MembersConfig, Moment, ProposalsCodexConfig, SessionConfig, SessionKeys, Signature,
-    StakerStatus, StakingConfig, StorageWorkingGroupConfig, SudoConfig, SystemConfig,
-    VersionedStoreConfig, VersionedStorePermissionsConfig, DAYS, WASM_BINARY,
+    StakerStatus, StakingConfig, StorageWorkingGroupConfig, SudoConfig, SystemConfig, DAYS,
+    WASM_BINARY,
 };
 
 // Exported to be used by chain-spec-builder
@@ -136,10 +136,7 @@ impl Alternative {
                         proposals_config::development(),
                         initial_members::none(),
                         forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
-                        content_config::empty_versioned_store_config(),
-                        content_config::empty_versioned_store_permissions_config(),
                         content_config::empty_data_directory_config(),
-                        content_config::empty_content_working_group_config(),
                         vec![],
                     )
                 },
@@ -177,10 +174,7 @@ impl Alternative {
                         proposals_config::development(),
                         initial_members::none(),
                         forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
-                        content_config::empty_versioned_store_config(),
-                        content_config::empty_versioned_store_permissions_config(),
                         content_config::empty_data_directory_config(),
-                        content_config::empty_content_working_group_config(),
                         vec![],
                     )
                 },
@@ -223,10 +217,7 @@ pub fn testnet_genesis(
     cpcp: node_runtime::ProposalsConfigParameters,
     members: Vec<membership::genesis::Member<u64, AccountId, Moment>>,
     forum_config: ForumConfig,
-    versioned_store_config: VersionedStoreConfig,
-    versioned_store_permissions_config: VersionedStorePermissionsConfig,
     data_directory_config: DataDirectoryConfig,
-    content_working_group_config: ContentWorkingGroupConfig,
     initial_balances: Vec<(AccountId, Balance)>,
 ) -> GenesisConfig {
     const STASH: Balance = 5_000;
@@ -338,9 +329,6 @@ pub fn testnet_genesis(
                 next_curator_group_id: 1,
             }
         }),
-        versioned_store: Some(versioned_store_config),
-        versioned_store_permissions: Some(versioned_store_permissions_config),
-        content_wg: Some(content_working_group_config),
         proposals_codex: Some(ProposalsCodexConfig {
             set_validator_count_proposal_voting_period: cpcp
                 .set_validator_count_proposal_voting_period,
@@ -406,10 +394,7 @@ pub(crate) mod tests {
             proposals_config::development(),
             initial_members::none(),
             forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
-            content_config::empty_versioned_store_config(),
-            content_config::empty_versioned_store_permissions_config(),
             content_config::empty_data_directory_config(),
-            content_config::empty_content_working_group_config(),
             vec![],
         )
     }
@@ -443,10 +428,7 @@ pub(crate) mod tests {
             proposals_config::development(),
             initial_members::none(),
             forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
-            content_config::empty_versioned_store_config(),
-            content_config::empty_versioned_store_permissions_config(),
             content_config::empty_data_directory_config(),
-            content_config::empty_content_working_group_config(),
             vec![],
         )
     }

+ 1 - 7
runtime/Cargo.toml

@@ -4,7 +4,7 @@ edition = '2018'
 name = 'joystream-node-runtime'
 # Follow convention: https://github.com/Joystream/substrate-runtime-joystream/issues/1
 # {Authoring}.{Spec}.{Impl} of the RuntimeVersion
-version = '7.9.0'
+version = '7.10.0'
 
 [dependencies]
 # Third-party dependencies
@@ -70,9 +70,6 @@ hiring = { package = 'pallet-hiring', default-features = false, path = '../runti
 minting = { package = 'pallet-token-mint', default-features = false, path = '../runtime-modules/token-minting'}
 recurring-rewards = { package = 'pallet-recurring-reward', default-features = false, path = '../runtime-modules/recurring-reward'}
 working-group = { package = 'pallet-working-group', default-features = false, path = '../runtime-modules/working-group'}
-content-working-group = { package = 'pallet-content-working-group', default-features = false, path = '../runtime-modules/content-working-group'}
-versioned-store = { package = 'pallet-versioned-store', default-features = false, path = '../runtime-modules/versioned-store'}
-versioned-store-permissions = { package = 'pallet-versioned-store-permissions', default-features = false, path = '../runtime-modules/versioned-store-permissions'}
 storage = { package = 'pallet-storage', default-features = false, path = '../runtime-modules/storage'}
 service-discovery = { package = 'pallet-service-discovery', default-features = false, path = '../runtime-modules/service-discovery'}
 proposals-engine = { package = 'pallet-proposals-engine', default-features = false, path = '../runtime-modules/proposals/engine'}
@@ -147,9 +144,6 @@ std = [
     'minting/std',
     'recurring-rewards/std',
     'working-group/std',
-    'content-working-group/std',
-    'versioned-store/std',
-    'versioned-store-permissions/std',
     'storage/std',
     'service-discovery/std',
     'proposals-engine/std',

+ 0 - 142
runtime/src/integration/content_working_group.rs

@@ -1,142 +0,0 @@
-use crate::{AccountId, Credential, Runtime};
-
-use frame_support::traits::{Currency, Imbalance};
-use frame_support::{parameter_types, IterableStorageMap, StorageMap};
-
-parameter_types! {
-    pub const CurrentLeadCredential: Credential = 0;
-    pub const AnyActiveCuratorCredential: Credential = 1;
-    pub const AnyActiveChannelOwnerCredential: Credential = 2;
-    pub const PrincipalIdMappingStartsAtCredential: Credential = 1000;
-}
-
-pub struct ContentWorkingGroupCredentials {}
-impl versioned_store_permissions::CredentialChecker<Runtime> for ContentWorkingGroupCredentials {
-    fn account_has_credential(
-        account: &AccountId,
-        credential: <Runtime as versioned_store_permissions::Trait>::Credential,
-    ) -> bool {
-        match credential {
-            // Credentials from 0..999 represents groups or more complex requirements
-            // Current Lead if set
-            credential if credential == CurrentLeadCredential::get() => {
-                match <content_working_group::Module<Runtime>>::ensure_lead_is_set() {
-                    Ok((_, lead)) => lead.role_account == *account,
-                    _ => false,
-                }
-            }
-            // Any Active Curator
-            credential if credential == AnyActiveCuratorCredential::get() => {
-                // Look for a Curator with a matching role account
-                for (_principal_id, principal) in
-                    <content_working_group::PrincipalById<Runtime>>::iter()
-                {
-                    if let content_working_group::Principal::Curator(curator_id) = principal {
-                        let curator =
-                            <content_working_group::CuratorById<Runtime>>::get(curator_id);
-                        if curator.role_account == *account
-                            && curator.stage == content_working_group::CuratorRoleStage::Active
-                        {
-                            return true;
-                        }
-                    }
-                }
-
-                false
-            }
-            // Any Active Channel Owner
-            credential if credential == AnyActiveChannelOwnerCredential::get() => {
-                // Look for a ChannelOwner with a matching role account
-                for (_principal_id, principal) in
-                    <content_working_group::PrincipalById<Runtime>>::iter()
-                {
-                    if let content_working_group::Principal::ChannelOwner(channel_id) = principal {
-                        let channel =
-                            <content_working_group::ChannelById<Runtime>>::get(channel_id);
-                        if channel.role_account == *account {
-                            return true; // should we also take publishing_status/curation_status into account ?
-                        }
-                    }
-                }
-
-                false
-            }
-            // mapping to working group principal id
-            n if n >= PrincipalIdMappingStartsAtCredential::get() => {
-                <content_working_group::Module<Runtime>>::account_has_credential(
-                    account,
-                    n - PrincipalIdMappingStartsAtCredential::get(),
-                )
-            }
-            _ => false,
-        }
-    }
-}
-
-#[allow(dead_code)]
-pub struct ContentWorkingGroupStakingEventHandler {}
-impl stake::StakingEventsHandler<Runtime> for ContentWorkingGroupStakingEventHandler {
-    fn unstaked(
-        stake_id: &<Runtime as stake::Trait>::StakeId,
-        _unstaked_amount: stake::BalanceOf<Runtime>,
-        remaining_imbalance: stake::NegativeImbalance<Runtime>,
-    ) -> stake::NegativeImbalance<Runtime> {
-        if !hiring::ApplicationIdByStakingId::<Runtime>::contains_key(stake_id) {
-            // Stake not related to a staked role managed by the hiring module
-            return remaining_imbalance;
-        }
-
-        let application_id = hiring::ApplicationIdByStakingId::<Runtime>::get(stake_id);
-
-        if !content_working_group::CuratorApplicationById::<Runtime>::contains_key(application_id) {
-            // Stake not for a Curator
-            return remaining_imbalance;
-        }
-
-        // Notify the Hiring module - is there a potential re-entrancy bug if
-        // instant unstaking is occuring?
-        hiring::Module::<Runtime>::unstaked(*stake_id);
-
-        // Only notify working group module if non instantaneous unstaking occured
-        if content_working_group::UnstakerByStakeId::<Runtime>::contains_key(stake_id) {
-            content_working_group::Module::<Runtime>::unstaked(*stake_id);
-        }
-
-        // Determine member id of the curator
-        let curator_application =
-            content_working_group::CuratorApplicationById::<Runtime>::get(application_id);
-        let member_id = curator_application.member_id;
-
-        // get member's profile
-        let member_profile = membership::MembershipById::<Runtime>::get(member_id);
-
-        // deposit funds to member's root_account
-        // The application doesn't recorded the original source_account from which staked funds were
-        // provided, so we don't really have another option at the moment.
-        <Runtime as stake::Trait>::Currency::resolve_creating(
-            &member_profile.root_account,
-            remaining_imbalance,
-        );
-
-        stake::NegativeImbalance::<Runtime>::zero()
-    }
-
-    // Handler for slashing event
-    fn slashed(
-        _id: &<Runtime as stake::Trait>::StakeId,
-        _slash_id: Option<<Runtime as stake::Trait>::SlashId>,
-        _slashed_amount: stake::BalanceOf<Runtime>,
-        _remaining_stake: stake::BalanceOf<Runtime>,
-        remaining_imbalance: stake::NegativeImbalance<Runtime>,
-    ) -> stake::NegativeImbalance<Runtime> {
-        // Check if the stake is associated with a hired curator or applicant
-        // if their stake goes below minimum required for the role,
-        // they should get deactivated.
-        // Since we don't currently implement any slash initiation in working group,
-        // there is nothing to do for now.
-
-        // Not interested in transfering the slashed amount anywhere for now,
-        // so return it to next handler.
-        remaining_imbalance
-    }
-}

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

@@ -1,8 +1,6 @@
 pub mod content_directory;
-pub mod content_working_group;
 pub mod forum;
 pub mod proposals;
 pub mod storage;
 pub mod transactions;
-pub mod versioned_store_permissions;
 pub mod working_group;

+ 0 - 50
runtime/src/integration/versioned_store_permissions.rs

@@ -1,50 +0,0 @@
-use crate::{AccountId, Runtime};
-use frame_support::{StorageMap, StorageValue};
-
-// Credential Checker that gives the sudo key holder all credentials
-pub struct SudoKeyHasAllCredentials {}
-impl versioned_store_permissions::CredentialChecker<Runtime> for SudoKeyHasAllCredentials {
-    fn account_has_credential(
-        account: &AccountId,
-        _credential: <Runtime as versioned_store_permissions::Trait>::Credential,
-    ) -> bool {
-        <pallet_sudo::Module<Runtime>>::key() == *account
-    }
-}
-
-// Allow sudo key holder permission to create classes
-pub struct SudoKeyCanCreateClasses {}
-impl versioned_store_permissions::CreateClassPermissionsChecker<Runtime>
-    for SudoKeyCanCreateClasses
-{
-    fn account_can_create_class_permissions(account: &AccountId) -> bool {
-        <pallet_sudo::Module<Runtime>>::key() == *account
-    }
-}
-
-pub struct ContentLeadOrSudoKeyCanCreateClasses {}
-impl versioned_store_permissions::CreateClassPermissionsChecker<Runtime>
-    for ContentLeadOrSudoKeyCanCreateClasses
-{
-    fn account_can_create_class_permissions(account: &AccountId) -> bool {
-        ContentLeadCanCreateClasses::account_can_create_class_permissions(account)
-            || SudoKeyCanCreateClasses::account_can_create_class_permissions(account)
-    }
-}
-
-// Allow content working group lead to create classes in content directory
-pub struct ContentLeadCanCreateClasses {}
-impl versioned_store_permissions::CreateClassPermissionsChecker<Runtime>
-    for ContentLeadCanCreateClasses
-{
-    fn account_can_create_class_permissions(account: &AccountId) -> bool {
-        // get current lead id
-        let maybe_current_lead_id = content_working_group::CurrentLeadId::<Runtime>::get();
-        if let Some(lead_id) = maybe_current_lead_id {
-            let lead = content_working_group::LeadById::<Runtime>::get(lead_id);
-            lead.role_account == *account
-        } else {
-            false
-        }
-    }
-}

+ 1 - 25
runtime/src/lib.rs

@@ -52,7 +52,6 @@ use storage::data_object_storage_registry;
 
 // Node dependencies
 pub use common;
-pub use content_working_group as content_wg;
 pub use forum;
 pub use governance::election_params::ElectionParameters;
 pub use membership;
@@ -61,8 +60,6 @@ pub use pallet_balances::Call as BalancesCall;
 pub use pallet_staking::StakerStatus;
 pub use proposals_codex::ProposalsConfigParameters;
 pub use storage::{data_directory, data_object_type_registry};
-pub use versioned_store;
-pub use versioned_store_permissions;
 pub use working_group;
 
 pub use content_directory;
@@ -75,7 +72,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
     spec_name: create_runtime_str!("joystream-node"),
     impl_name: create_runtime_str!("joystream-node"),
     authoring_version: 7,
-    spec_version: 9,
+    spec_version: 10,
     impl_version: 0,
     apis: crate::runtime_api::EXPORTED_RUNTIME_API_VERSIONS,
     transaction_version: 1,
@@ -371,20 +368,6 @@ impl pallet_finality_tracker::Trait for Runtime {
     type ReportLatency = ReportLatency;
 }
 
-impl versioned_store::Trait for Runtime {
-    type Event = Event;
-}
-
-impl versioned_store_permissions::Trait for Runtime {
-    type Credential = Credential;
-    type CredentialChecker = (
-        integration::content_working_group::ContentWorkingGroupCredentials,
-        integration::versioned_store_permissions::SudoKeyHasAllCredentials,
-    );
-    type CreateClassPermissionsChecker =
-        integration::versioned_store_permissions::ContentLeadOrSudoKeyCanCreateClasses;
-}
-
 type EntityId = <Runtime as content_directory::Trait>::EntityId;
 
 parameter_types! {
@@ -463,10 +446,6 @@ impl stake::Trait for Runtime {
     type SlashId = u64;
 }
 
-impl content_wg::Trait for Runtime {
-    type Event = Event;
-}
-
 impl common::currency::GovernanceCurrency for Runtime {
     type Currency = pallet_balances::Module<Self>;
 }
@@ -660,13 +639,10 @@ construct_runtime!(
         Memo: memo::{Module, Call, Storage, Event<T>},
         Members: membership::{Module, Call, Storage, Event<T>, Config<T>},
         Forum: forum::{Module, Call, Storage, Event<T>, Config<T>},
-        VersionedStore: versioned_store::{Module, Call, Storage, Event<T>, Config},
-        VersionedStorePermissions: versioned_store_permissions::{Module, Call, Storage, Config<T>},
         Stake: stake::{Module, Call, Storage},
         Minting: minting::{Module, Call, Storage},
         RecurringRewards: recurring_rewards::{Module, Call, Storage},
         Hiring: hiring::{Module, Call, Storage},
-        ContentWorkingGroup: content_wg::{Module, Call, Storage, Event<T>, Config<T>},
         ContentDirectory: content_directory::{Module, Call, Storage, Event<T>, Config<T>},
         // --- Storage
         DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event<T>, Config<T>},

+ 3 - 21
utils/chain-spec-builder/src/main.rs

@@ -241,27 +241,12 @@ fn genesis_constructor(
         .map(|path| forum_config::from_json(sudo_account.clone(), path.as_path()))
         .unwrap_or_else(|| forum_config::empty(sudo_account.clone()));
 
-    let (
-        versioned_store_cfg,
-        versioned_store_permissions_cfg,
-        data_directory_config,
-        content_working_group_config,
-    ) = if let Some(path) = initial_content_path {
+    let data_directory_config = if let Some(path) = initial_content_path {
         let path = path.as_path();
 
-        (
-            content_config::versioned_store_config_from_json(path),
-            content_config::versioned_store_permissions_config_from_json(path),
-            content_config::data_directory_config_from_json(path),
-            content_config::content_working_group_config_from_json(path),
-        )
+        content_config::data_directory_config_from_json(path)
     } else {
-        (
-            content_config::empty_versioned_store_config(),
-            content_config::empty_versioned_store_permissions_config(),
-            content_config::empty_data_directory_config(),
-            content_config::empty_content_working_group_config(),
-        )
+        content_config::empty_data_directory_config()
     };
 
     let initial_account_balances = initial_balances_path
@@ -282,10 +267,7 @@ fn genesis_constructor(
         proposals_cfg,
         members,
         forum_cfg,
-        versioned_store_cfg,
-        versioned_store_permissions_cfg,
         data_directory_config,
-        content_working_group_config,
         initial_account_balances,
     )
 }