Browse Source

runtime and types: drop service_discovery module

Mokhtar Naamani 4 years ago
parent
commit
8768c1bebf

+ 1 - 25
Cargo.lock

@@ -2053,7 +2053,7 @@ dependencies = [
 
 [[package]]
 name = "joystream-node-runtime"
-version = "7.14.0"
+version = "7.15.0"
 dependencies = [
  "frame-benchmarking",
  "frame-executive",
@@ -2083,7 +2083,6 @@ dependencies = [
  "pallet-proposals-engine",
  "pallet-randomness-collective-flip",
  "pallet-recurring-reward",
- "pallet-service-discovery",
  "pallet-session",
  "pallet-session-benchmarking",
  "pallet-stake",
@@ -3599,29 +3598,6 @@ dependencies = [
  "sp-runtime",
 ]
 
-[[package]]
-name = "pallet-service-discovery"
-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-working-group",
- "parity-scale-codec",
- "serde",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std 2.0.0-rc4",
-]
-
 [[package]]
 name = "pallet-session"
 version = "2.0.0-rc4"

+ 0 - 1
Cargo.toml

@@ -11,7 +11,6 @@ members = [
 	"runtime-modules/membership",
 	"runtime-modules/memo",
 	"runtime-modules/recurring-reward",
-	"runtime-modules/service-discovery",
 	"runtime-modules/stake",
 	"runtime-modules/storage",
 	"runtime-modules/token-minting",

+ 0 - 39
runtime-modules/service-discovery/Cargo.toml

@@ -1,39 +0,0 @@
-[package]
-name = 'pallet-service-discovery'
-version = '3.0.0'
-authors = ['Joystream contributors']
-edition = '2018'
-
-[dependencies]
-serde = { version = "1.0.101", optional = true, features = ["derive"] }
-codec = { package = 'parity-scale-codec', version = '1.3.1', default-features = false, features = ['derive'] }
-sp-std = { package = 'sp-std', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-frame-support = { package = 'frame-support', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-system = { package = 'frame-system', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group'}
-common = { package = 'pallet-common', default-features = false, path = '../common'}
-
-[dev-dependencies]
-sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
-membership = { package = 'pallet-membership', default-features = false, path = '../membership'}
-stake = { package = 'pallet-stake', default-features = false, path = '../stake'}
-hiring = { package = 'pallet-hiring', default-features = false, path = '../hiring'}
-minting = { package = 'pallet-token-mint', default-features = false, path = '../token-minting'}
-recurringrewards = { package = 'pallet-recurring-reward', default-features = false, path = '../recurring-reward'}
-
-[features]
-default = ['std']
-std = [
-	'serde',
-	'codec/std',
-	'sp-std/std',
-	'frame-support/std',
-	'system/std',
-	'sp-runtime/std',
-	'working-group/std',
-	'common/std'
-]

+ 0 - 188
runtime-modules/service-discovery/src/lib.rs

@@ -1,188 +0,0 @@
-//! # Service discovery module
-//! Service discovery module for the Joystream platform supports the storage providers.
-//! It registers their 'pings' in the system with the expiration time, and stores the bootstrap
-//! nodes for the Colossus.
-//!
-//! ## Comments
-//!
-//! Service discovery module uses working group module to authorize actions. It is generally used by
-//! the Colossus service.
-//!
-//! ## Supported extrinsics
-//!
-//! - [set_ipns_id](./struct.Module.html#method.set_ipns_id) - Creates the ServiceProviderRecord to save an IPNS identity for the storage provider.
-//! - [unset_ipns_id](./struct.Module.html#method.unset_ipns_id) - Deletes the ServiceProviderRecord with the IPNS identity for the storage provider.
-//! - [set_default_lifetime](./struct.Module.html#method.set_default_lifetime) - Sets default lifetime for storage providers accounts info.
-//! - [set_bootstrap_endpoints](./struct.Module.html#method.set_bootstrap_endpoints) - Sets bootstrap endpoints for the Colossus.
-//!
-
-// Ensure we're `no_std` when compiling for Wasm.
-#![cfg_attr(not(feature = "std"), no_std)]
-
-mod mock;
-mod tests;
-
-use codec::{Decode, Encode};
-use common::Url;
-
-#[cfg(feature = "std")]
-use serde::{Deserialize, Serialize};
-
-use frame_support::{decl_event, decl_module, decl_storage, ensure};
-use sp_std::vec::Vec;
-use system::ensure_root;
-/*
-  Although there is support for ed25519 keys as the IPNS identity key and we could potentially
-  reuse the same key for the role account and ipns (and make this discovery module obselete)
-  it is probably better to separate concerns.
-  Why not to use a fixed size 32byte -> SHA256 hash of public key: because we would have to force
-  specific key type on ipfs side.
-  pub struct IPNSIdentity(pub [u8; 32]); // we loose the key type!
-  pub type IPNSIdentity(pub u8, pub [u8; 32]); // we could add the keytype?
-  can we use rust library in wasm runtime?
-  https://github.com/multiformats/rust-multihash
-  https://github.com/multiformats/multicodec/
-  https://github.com/multiformats/multihash/
-*/
-/// base58 encoded IPNS identity multihash codec
-pub type IPNSIdentity = Vec<u8>;
-
-// The storage working group instance alias.
-pub(crate) type StorageWorkingGroupInstance = working_group::Instance2;
-
-// Alias for storage working group.
-pub(crate) type StorageWorkingGroup<T> = working_group::Module<T, StorageWorkingGroupInstance>;
-
-/// Storage provider is a worker from the  working_group module.
-pub type StorageProviderId<T> = working_group::WorkerId<T>;
-
-pub(crate) const MINIMUM_LIFETIME: u32 = 600; // 1hr assuming 6s block times
-pub(crate) const DEFAULT_LIFETIME: u32 = MINIMUM_LIFETIME * 24; // 24hr
-
-/// Defines the expiration date for the storage provider.
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq)]
-pub struct ServiceProviderRecord<BlockNumber> {
-    /// IPNS Identity.
-    pub identity: IPNSIdentity,
-    /// Block at which information expires.
-    pub expires_at: BlockNumber,
-}
-
-/// The _Service discovery_ main _Trait_.
-pub trait Trait: system::Trait + working_group::Trait<StorageWorkingGroupInstance> {
-    /// _Service discovery_ event type.
-    type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
-}
-
-decl_storage! {
-    trait Store for Module<T: Trait> as Discovery {
-        /// Bootstrap endpoints maintained by root
-        pub BootstrapEndpoints get(fn bootstrap_endpoints): Vec<Url>;
-
-        /// Mapping of service providers' storage provider id to their ServiceProviderRecord
-        pub AccountInfoByStorageProviderId get(fn account_info_by_storage_provider_id):
-            map hasher(blake2_128_concat) StorageProviderId<T> => ServiceProviderRecord<T::BlockNumber>;
-
-        /// Lifetime of an ServiceProviderRecord record in AccountInfoByAccountId map
-        pub DefaultLifetime get(fn default_lifetime) config():
-            T::BlockNumber = T::BlockNumber::from(DEFAULT_LIFETIME);
-    }
-}
-
-decl_event! {
-    /// _Service discovery_ events
-    pub enum Event<T> where
-        StorageProviderId = StorageProviderId<T>
-       {
-        /// Emits on updating of the account info.
-        /// Params:
-        /// - Id of the storage provider.
-        /// - Id of the IPNS.
-        AccountInfoUpdated(StorageProviderId, IPNSIdentity),
-
-        /// Emits on removing of the account info.
-        /// Params:
-        /// - Id of the storage provider.
-        AccountInfoRemoved(StorageProviderId),
-    }
-}
-
-decl_module! {
-    /// _Service discovery_ substrate module.
-    pub struct Module<T: Trait> for enum Call where origin: T::Origin {
-        /// Default deposit_event() handler
-        fn deposit_event() = default;
-
-        /// Creates the ServiceProviderRecord to save an IPNS identity for the storage provider.
-        /// Requires signed storage provider credentials.
-        #[weight = 10_000_000] // TODO: adjust weight
-        pub fn set_ipns_id(
-            origin,
-            storage_provider_id: StorageProviderId<T>,
-            id: Vec<u8>,
-        ) {
-            <StorageWorkingGroup<T>>::ensure_worker_signed(origin, &storage_provider_id)?;
-
-            // TODO: ensure id is a valid base58 encoded IPNS identity
-
-            //
-            // == MUTATION SAFE ==
-            //
-
-            <AccountInfoByStorageProviderId<T>>::insert(storage_provider_id, ServiceProviderRecord {
-                identity: id.clone(),
-                expires_at: <system::Module<T>>::block_number() + Self::default_lifetime(),
-            });
-
-            Self::deposit_event(RawEvent::AccountInfoUpdated(storage_provider_id, id));
-        }
-
-        /// Deletes the ServiceProviderRecord with the IPNS identity for the storage provider.
-        /// Requires signed storage provider credentials.
-        #[weight = 10_000_000] // TODO: adjust weight
-        pub fn unset_ipns_id(origin, storage_provider_id: StorageProviderId<T>) {
-            <StorageWorkingGroup<T>>::ensure_worker_signed(origin, &storage_provider_id)?;
-
-            // == MUTATION SAFE ==
-
-            if <AccountInfoByStorageProviderId<T>>::contains_key(storage_provider_id) {
-                <AccountInfoByStorageProviderId<T>>::remove(storage_provider_id);
-                Self::deposit_event(RawEvent::AccountInfoRemoved(storage_provider_id));
-            }
-        }
-
-        // Privileged methods
-
-        /// Sets default lifetime for storage providers accounts info. Requires root privileges.
-        #[weight = 10_000_000] // TODO: adjust weight
-        pub fn set_default_lifetime(origin, lifetime: T::BlockNumber) {
-            ensure_root(origin)?;
-            ensure!(lifetime >= T::BlockNumber::from(MINIMUM_LIFETIME),
-                "discovery: default lifetime must be gte minimum lifetime");
-
-            // == MUTATION SAFE ==
-
-            <DefaultLifetime<T>>::put(lifetime);
-        }
-
-        /// Sets bootstrap endpoints for the Colossus. Requires root privileges.
-        #[weight = 10_000_000] // TODO: adjust weight
-        pub fn set_bootstrap_endpoints(origin, endpoints: Vec<Url>) {
-            ensure_root(origin)?;
-
-            // == MUTATION SAFE ==
-
-            BootstrapEndpoints::put(endpoints);
-        }
-    }
-}
-
-impl<T: Trait> Module<T> {
-    /// Verifies that account info for the storage provider is still valid.
-    pub fn is_account_info_expired(storage_provider_id: &StorageProviderId<T>) -> bool {
-        !<AccountInfoByStorageProviderId<T>>::contains_key(storage_provider_id)
-            || <system::Module<T>>::block_number()
-                > <AccountInfoByStorageProviderId<T>>::get(storage_provider_id).expires_at
-    }
-}

+ 0 - 183
runtime-modules/service-discovery/src/mock.rs

@@ -1,183 +0,0 @@
-#![cfg(test)]
-
-pub use crate::*;
-
-use frame_support::{impl_outer_event, impl_outer_origin, parameter_types};
-use sp_core::H256;
-use sp_runtime::{
-    testing::Header,
-    traits::{BlakeTwo256, IdentityLookup},
-    Perbill,
-};
-
-// The storage working group instance alias.
-pub type StorageWorkingGroupInstance = working_group::Instance2;
-
-mod working_group_mod {
-    pub use super::StorageWorkingGroupInstance;
-    pub use working_group::Event;
-    pub use working_group::Trait;
-}
-
-mod membership_mod {
-    pub use membership::Event;
-}
-
-mod discovery {
-    pub use crate::Event;
-}
-
-impl_outer_origin! {
-    pub enum Origin for Test {}
-}
-
-impl_outer_event! {
-    pub enum MetaEvent for Test {
-        discovery<T>,
-        balances<T>,
-        membership_mod<T>,
-        working_group_mod StorageWorkingGroupInstance <T>,
-        system<T>,
-    }
-}
-
-// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
-#[derive(Clone, PartialEq, Eq, Debug)]
-pub struct Test;
-parameter_types! {
-    pub const BlockHashCount: u64 = 250;
-    pub const MaximumBlockWeight: u32 = 1024;
-    pub const MaximumBlockLength: u32 = 2 * 1024;
-    pub const AvailableBlockRatio: Perbill = Perbill::one();
-    pub const MinimumPeriod: u64 = 5;
-    pub const StakePoolId: [u8; 8] = *b"joystake";
-    pub const ExistentialDeposit: u32 = 0;
-}
-
-impl system::Trait for Test {
-    type BaseCallFilter = ();
-    type Origin = Origin;
-    type Call = ();
-    type Index = u64;
-    type BlockNumber = u64;
-    type Hash = H256;
-    type Hashing = BlakeTwo256;
-    type AccountId = u64;
-    type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
-    type Event = MetaEvent;
-    type BlockHashCount = BlockHashCount;
-    type MaximumBlockWeight = MaximumBlockWeight;
-    type DbWeight = ();
-    type BlockExecutionWeight = ();
-    type ExtrinsicBaseWeight = ();
-    type MaximumExtrinsicWeight = ();
-    type MaximumBlockLength = MaximumBlockLength;
-    type AvailableBlockRatio = AvailableBlockRatio;
-    type Version = ();
-    type ModuleToIndex = ();
-    type AccountData = balances::AccountData<u64>;
-    type OnNewAccount = ();
-    type OnKilledAccount = ();
-}
-
-impl Trait for Test {
-    type Event = MetaEvent;
-}
-
-impl hiring::Trait for Test {
-    type OpeningId = u64;
-    type ApplicationId = u64;
-    type ApplicationDeactivatedHandler = ();
-    type StakeHandlerProvider = hiring::Module<Self>;
-}
-
-impl minting::Trait for Test {
-    type Currency = Balances;
-    type MintId = u64;
-}
-
-impl stake::Trait for Test {
-    type Currency = Balances;
-    type StakePoolId = StakePoolId;
-    type StakingEventsHandler = ();
-    type StakeId = u64;
-    type SlashId = u64;
-}
-
-parameter_types! {
-    pub const ScreenedMemberMaxInitialBalance: u64 = 500;
-}
-
-impl membership::Trait for Test {
-    type Event = MetaEvent;
-    type MemberId = u64;
-    type PaidTermId = u64;
-    type SubscriptionId = u64;
-    type ActorId = u64;
-    type ScreenedMemberMaxInitialBalance = ScreenedMemberMaxInitialBalance;
-}
-
-impl common::currency::GovernanceCurrency for Test {
-    type Currency = Balances;
-}
-
-impl balances::Trait for Test {
-    type Balance = u64;
-    type DustRemoval = ();
-    type Event = MetaEvent;
-    type ExistentialDeposit = ExistentialDeposit;
-    type AccountStore = System;
-}
-
-impl recurringrewards::Trait for Test {
-    type PayoutStatusHandler = ();
-    type RecipientId = u64;
-    type RewardRelationshipId = u64;
-}
-
-parameter_types! {
-    pub const MaxWorkerNumberLimit: u32 = 3;
-}
-
-impl working_group::Trait<StorageWorkingGroupInstance> for Test {
-    type Event = MetaEvent;
-    type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
-}
-
-impl pallet_timestamp::Trait for Test {
-    type Moment = u64;
-    type OnTimestampSet = ();
-    type MinimumPeriod = MinimumPeriod;
-}
-
-pub fn initial_test_ext() -> sp_io::TestExternalities {
-    let t = system::GenesisConfig::default()
-        .build_storage::<Test>()
-        .unwrap();
-
-    t.into()
-}
-
-pub type Balances = balances::Module<Test>;
-pub type System = system::Module<Test>;
-pub type Discovery = Module<Test>;
-
-pub(crate) fn hire_storage_provider() -> (u64, u64) {
-    let storage_provider_id = 1;
-    let role_account_id = 1;
-
-    let storage_provider = working_group::Worker {
-        member_id: 1,
-        role_account_id,
-        reward_relationship: None,
-        role_stake_profile: None,
-    };
-
-    <working_group::WorkerById<Test, StorageWorkingGroupInstance>>::insert(
-        storage_provider_id,
-        storage_provider,
-    );
-
-    (role_account_id, storage_provider_id)
-}

+ 0 - 178
runtime-modules/service-discovery/src/tests.rs

@@ -1,178 +0,0 @@
-#![cfg(test)]
-
-use super::mock::*;
-
-use system::{EventRecord, Phase, RawOrigin};
-
-#[test]
-fn set_ipns_id() {
-    initial_test_ext().execute_with(|| {
-        let current_block_number = 1000;
-        System::set_block_number(current_block_number);
-
-        let (storage_provider_account_id, storage_provider_id) = hire_storage_provider();
-
-        let identity = "alice".as_bytes().to_vec();
-        let ttl = <Test as system::Trait>::BlockNumber::from(DEFAULT_LIFETIME);
-        assert!(Discovery::set_ipns_id(
-            Origin::signed(storage_provider_account_id),
-            storage_provider_id,
-            identity.clone(),
-        )
-        .is_ok());
-
-        assert!(<AccountInfoByStorageProviderId<Test>>::contains_key(
-            &storage_provider_id
-        ));
-        let account_info = Discovery::account_info_by_storage_provider_id(&storage_provider_id);
-        assert_eq!(
-            account_info,
-            ServiceProviderRecord {
-                identity: identity.clone(),
-                expires_at: current_block_number + ttl
-            }
-        );
-
-        assert_eq!(
-            *System::events().last().unwrap(),
-            EventRecord {
-                phase: Phase::Initialization,
-                event: MetaEvent::discovery(RawEvent::AccountInfoUpdated(
-                    storage_provider_id,
-                    identity.clone()
-                )),
-                topics: vec![]
-            }
-        );
-
-        // Invalid storage provider data
-        let invalid_storage_provider_id = 2;
-        let invalid_storage_provider_account_id = 2;
-        assert!(Discovery::set_ipns_id(
-            Origin::signed(invalid_storage_provider_id),
-            invalid_storage_provider_account_id,
-            identity.clone(),
-        )
-        .is_err());
-        assert!(!<AccountInfoByStorageProviderId<Test>>::contains_key(
-            &invalid_storage_provider_id
-        ));
-    });
-}
-
-#[test]
-fn unset_ipns_id() {
-    initial_test_ext().execute_with(|| {
-        let current_block_number = 1000;
-        System::set_block_number(current_block_number);
-
-        let (storage_provider_account_id, storage_provider_id) = hire_storage_provider();
-
-        <AccountInfoByStorageProviderId<Test>>::insert(
-            &storage_provider_id,
-            ServiceProviderRecord {
-                expires_at: 1000,
-                identity: "alice".as_bytes().to_vec(),
-            },
-        );
-
-        assert!(<AccountInfoByStorageProviderId<Test>>::contains_key(
-            &storage_provider_account_id
-        ));
-
-        assert!(Discovery::unset_ipns_id(
-            Origin::signed(storage_provider_account_id),
-            storage_provider_id
-        )
-        .is_ok());
-        assert!(!<AccountInfoByStorageProviderId<Test>>::contains_key(
-            &storage_provider_account_id
-        ));
-
-        assert_eq!(
-            *System::events().last().unwrap(),
-            EventRecord {
-                phase: Phase::Initialization,
-                event: MetaEvent::discovery(RawEvent::AccountInfoRemoved(storage_provider_id)),
-                topics: vec![]
-            }
-        );
-
-        // Invalid storage provider data
-        let invalid_storage_provider_id = 2;
-        let invalid_storage_provider_account_id = 2;
-        assert!(Discovery::unset_ipns_id(
-            Origin::signed(invalid_storage_provider_id),
-            invalid_storage_provider_account_id,
-        )
-        .is_err());
-        assert!(!<AccountInfoByStorageProviderId<Test>>::contains_key(
-            &invalid_storage_provider_id
-        ));
-    });
-}
-
-#[test]
-fn is_account_info_expired() {
-    initial_test_ext().execute_with(|| {
-        let storage_provider_id = 1;
-        let expires_at = 1000;
-        let id = "alice".as_bytes().to_vec();
-        <AccountInfoByStorageProviderId<Test>>::insert(
-            &storage_provider_id,
-            ServiceProviderRecord {
-                expires_at,
-                identity: id.clone(),
-            },
-        );
-
-        System::set_block_number(expires_at - 10);
-        assert!(!Discovery::is_account_info_expired(&storage_provider_id));
-
-        System::set_block_number(expires_at + 10);
-        assert!(Discovery::is_account_info_expired(&storage_provider_id));
-    });
-}
-
-#[test]
-fn set_default_lifetime() {
-    initial_test_ext().execute_with(|| {
-        let lifetime = <Test as system::Trait>::BlockNumber::from(MINIMUM_LIFETIME + 2000);
-        // privileged method should fail if not from root origin
-        assert!(
-            Discovery::set_default_lifetime(Origin::signed(1), lifetime).is_err(),
-            ""
-        );
-        assert!(
-            Discovery::set_default_lifetime(RawOrigin::Root.into(), lifetime).is_ok(),
-            ""
-        );
-        assert_eq!(Discovery::default_lifetime(), lifetime, "");
-
-        // cannot set default lifetime to less than minimum
-        let less_than_min_lifetime =
-            <Test as system::Trait>::BlockNumber::from(MINIMUM_LIFETIME - 1);
-        assert!(
-            Discovery::set_default_lifetime(RawOrigin::Root.into(), less_than_min_lifetime)
-                .is_err(),
-            ""
-        );
-    });
-}
-
-#[test]
-fn set_bootstrap_endpoints() {
-    initial_test_ext().execute_with(|| {
-        let endpoints = vec!["endpoint1".as_bytes().to_vec()];
-        // privileged method should fail if not from root origin
-        assert!(
-            Discovery::set_bootstrap_endpoints(Origin::signed(1), endpoints.clone()).is_err(),
-            ""
-        );
-        assert!(
-            Discovery::set_bootstrap_endpoints(RawOrigin::Root.into(), endpoints.clone()).is_ok(),
-            ""
-        );
-        assert_eq!(Discovery::bootstrap_endpoints(), endpoints, "");
-    });
-}

+ 1 - 3
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.14.0'
+version = '7.15.0'
 
 [dependencies]
 # Third-party dependencies
@@ -71,7 +71,6 @@ minting = { package = 'pallet-token-mint', default-features = false, path = '../
 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'}
 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'}
 proposals-discussion = { package = 'pallet-proposals-discussion', default-features = false, path = '../runtime-modules/proposals/discussion'}
 proposals-codex = { package = 'pallet-proposals-codex', default-features = false, path = '../runtime-modules/proposals/codex'}
@@ -145,7 +144,6 @@ std = [
     'recurring-rewards/std',
     'working-group/std',
     'storage/std',
-    'service-discovery/std',
     'proposals-engine/std',
     'proposals-discussion/std',
     'proposals-codex/std',

+ 6 - 5
runtime/src/integration/storage.rs

@@ -10,16 +10,17 @@ impl storage::data_directory::StorageProviderHelper<Runtime> for StorageProvider
     fn get_random_storage_provider() -> Result<ActorId, storage::data_directory::Error<Runtime>> {
         let ids = crate::StorageWorkingGroup::get_all_worker_ids();
 
-        let live_ids: Vec<ActorId> = ids
+        // Filter workers that have set value for their storage value
+        let ids: Vec<ActorId> = ids
             .into_iter()
-            .filter(|id| !<service_discovery::Module<Runtime>>::is_account_info_expired(id))
+            .filter(|id| !crate::StorageWorkingGroup::worker_storage(id).is_empty())
             .collect();
 
-        if live_ids.is_empty() {
+        if ids.is_empty() {
             Err(storage::data_directory::Error::<Runtime>::NoProviderAvailable)
         } else {
-            let index = Self::random_index(live_ids.len());
-            Ok(live_ids[index])
+            let index = Self::random_index(ids.len());
+            Ok(ids[index])
         }
     }
 }

+ 1 - 6
runtime/src/lib.rs

@@ -71,7 +71,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: 14,
+    spec_version: 15,
     impl_version: 0,
     apis: crate::runtime_api::EXPORTED_RUNTIME_API_VERSIONS,
     transaction_version: 1,
@@ -529,10 +529,6 @@ impl working_group::Trait<GatewayWorkingGroupInstance> for Runtime {
     type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
 }
 
-impl service_discovery::Trait for Runtime {
-    type Event = Event;
-}
-
 parameter_types! {
     pub const ProposalCancellationFee: u64 = 10000;
     pub const ProposalRejectionFee: u64 = 5000;
@@ -654,7 +650,6 @@ construct_runtime!(
         DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event<T>, Config<T>},
         DataDirectory: data_directory::{Module, Call, Storage, Event<T>, Config<T>},
         DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event<T>, Config<T>},
-        Discovery: service_discovery::{Module, Call, Storage, Event<T>},
         // --- Proposals
         ProposalsEngine: proposals_engine::{Module, Call, Storage, Event<T>},
         ProposalsDiscussion: proposals_discussion::{Module, Call, Storage, Event<T>},

+ 4 - 9
runtime/src/tests/storage_integration.rs

@@ -24,18 +24,13 @@ fn storage_provider_helper_succeeds() {
 		<working_group::WorkerById<Runtime, Instance2>>::insert(worker_id2, Worker::default());
 		<working_group::WorkerById<Runtime, Instance2>>::insert(worker_id3, Worker::default());
 
-		// Still error - not registered in the service discovery.
+		// Still error - endpoints not set in worker storage value.
 		let random_provider_result = <StorageProviderHelper as storage::data_directory::StorageProviderHelper<Runtime>>::get_random_storage_provider();
 		assert!(random_provider_result.is_err());
 
-		let account_info = service_discovery::ServiceProviderRecord{
-			identity: Vec::new(),
-			expires_at: 1000
-		};
-
-		<service_discovery::AccountInfoByStorageProviderId<Runtime>>::insert(worker_id1,account_info.clone());
-		<service_discovery::AccountInfoByStorageProviderId<Runtime>>::insert(worker_id2,account_info.clone());
-		<service_discovery::AccountInfoByStorageProviderId<Runtime>>::insert(worker_id3,account_info);
+		<working_group::WorkerStorage<Runtime, Instance2>>::insert(worker_id1, b"http://storage1.net/".to_vec());
+		<working_group::WorkerStorage<Runtime, Instance2>>::insert(worker_id2, b"http://storage2.net/".to_vec());
+		<working_group::WorkerStorage<Runtime, Instance2>>::insert(worker_id3, b"http://storage3.net/".to_vec());
 
 		// Should work now.
 		let worker_ids = vec![worker_id1, worker_id2, worker_id3];

File diff suppressed because it is too large
+ 1 - 2
types/augment-codec/all.ts


+ 1 - 15
types/augment-codec/augment-api-query.ts

@@ -4,7 +4,7 @@
 import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
 import { Option, Vec } from '@polkadot/types/codec';
 import { Bytes, bool, u16, u32, u64 } from '@polkadot/types/primitive';
-import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, ObjectOwner, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, ServiceProviderRecord, Stake, StakeId, StorageProviderId, Thread, ThreadCounter, ThreadId, TransferableStake, Url, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, Voucher, WorkerId, WorkerOf } from './all';
+import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, ObjectOwner, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, Stake, StakeId, Thread, ThreadCounter, ThreadId, TransferableStake, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, Voucher, WorkerId, WorkerOf } from './all';
 import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
 import { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
 import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
@@ -383,20 +383,6 @@ declare module '@polkadot/api/types/storage' {
        **/
       nextDataObjectTypeId: AugmentedQuery<ApiType, () => Observable<DataObjectTypeId>>;
     };
-    discovery: {
-      /**
-       * Mapping of service providers' storage provider id to their ServiceProviderRecord
-       **/
-      accountInfoByStorageProviderId: AugmentedQuery<ApiType, (arg: StorageProviderId | AnyNumber | Uint8Array) => Observable<ServiceProviderRecord>>;
-      /**
-       * Bootstrap endpoints maintained by root
-       **/
-      bootstrapEndpoints: AugmentedQuery<ApiType, () => Observable<Vec<Url>>>;
-      /**
-       * Lifetime of an ServiceProviderRecord record in AccountInfoByAccountId map
-       **/
-      defaultLifetime: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
-    };
     forum: {
       /**
        * Map category identifier to corresponding category.

+ 1 - 21
types/augment-codec/augment-api-tx.ts

@@ -4,7 +4,7 @@
 import { AnyNumber } from '@polkadot/types/types';
 import { Compact, Option, Vec } from '@polkadot/types/codec';
 import { Bytes, bool, u16, u32, u64 } from '@polkadot/types/primitive';
-import { ActivateOpeningAt, AddOpeningParameters, ApplicationId, ApplicationIdSet, BalanceOfMint, CategoryId, ChannelCategoryCreationParameters, ChannelCategoryId, ChannelCategoryUpdateParameters, ChannelCreationParameters, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ChannelUpdateParameters, ContentActor, ContentId, ContentParameters, CuratorGroupId, CuratorId, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, ElectionParameters, FillOpeningParameters, MemberId, MemoText, ObjectOwner, OpeningId, OpeningPolicyCommitment, OpeningType, PaidTermId, PersonActor, PersonCreationParameters, PersonId, PersonUpdateParameters, PlaylistCreationParameters, PlaylistId, PlaylistUpdateParameters, PostId, ProposalId, RewardPolicy, SeriesId, SeriesParameters, StorageProviderId, TerminateRoleParameters, ThreadId, Url, VideoCategoryCreationParameters, VideoCategoryId, VideoCategoryUpdateParameters, VideoCreationParameters, VideoId, VideoUpdateParameters, VoteKind, WorkerId, WorkingGroup } from './all';
+import { ActivateOpeningAt, AddOpeningParameters, ApplicationId, ApplicationIdSet, BalanceOfMint, CategoryId, ChannelCategoryCreationParameters, ChannelCategoryId, ChannelCategoryUpdateParameters, ChannelCreationParameters, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ChannelUpdateParameters, ContentActor, ContentId, ContentParameters, CuratorGroupId, CuratorId, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, ElectionParameters, FillOpeningParameters, MemberId, MemoText, ObjectOwner, OpeningId, OpeningPolicyCommitment, OpeningType, PaidTermId, PersonActor, PersonCreationParameters, PersonId, PersonUpdateParameters, PlaylistCreationParameters, PlaylistId, PlaylistUpdateParameters, PostId, ProposalId, RewardPolicy, SeriesId, SeriesParameters, StorageProviderId, TerminateRoleParameters, ThreadId, VideoCategoryCreationParameters, VideoCategoryId, VideoCategoryUpdateParameters, VideoCreationParameters, VideoId, VideoUpdateParameters, VoteKind, WorkerId, WorkingGroup } from './all';
 import { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics';
 import { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa';
 import { Heartbeat } from '@polkadot/types/interfaces/imOnline';
@@ -433,26 +433,6 @@ declare module '@polkadot/api/types/submittable' {
        **/
       updateDataObjectType: AugmentedSubmittable<(id: DataObjectTypeId | AnyNumber | Uint8Array, dataObjectType: DataObjectType | { description?: any; active?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
     };
-    discovery: {
-      /**
-       * Sets bootstrap endpoints for the Colossus. Requires root privileges.
-       **/
-      setBootstrapEndpoints: AugmentedSubmittable<(endpoints: Vec<Url> | (Url | string)[]) => SubmittableExtrinsic<ApiType>>;
-      /**
-       * Sets default lifetime for storage providers accounts info. Requires root privileges.
-       **/
-      setDefaultLifetime: AugmentedSubmittable<(lifetime: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
-      /**
-       * Creates the ServiceProviderRecord to save an IPNS identity for the storage provider.
-       * Requires signed storage provider credentials.
-       **/
-      setIpnsId: AugmentedSubmittable<(storageProviderId: StorageProviderId | AnyNumber | Uint8Array, id: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
-      /**
-       * Deletes the ServiceProviderRecord with the IPNS identity for the storage provider.
-       * Requires signed storage provider credentials.
-       **/
-      unsetIpnsId: AugmentedSubmittable<(storageProviderId: StorageProviderId | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
-    };
     finalityTracker: {
       /**
        * Hint that the author of this block thinks the best finalized

+ 6 - 6
types/augment-codec/augment-types.ts

@@ -2060,6 +2060,12 @@ declare module '@polkadot/types/types/registry' {
     FailedAt: FailedAt;
     'Option<FailedAt>': Option<FailedAt>;
     'Vec<FailedAt>': Vec<FailedAt>;
+    IPNSIdentity: IPNSIdentity;
+    'Option<IPNSIdentity>': Option<IPNSIdentity>;
+    'Vec<IPNSIdentity>': Vec<IPNSIdentity>;
+    ServiceProviderRecord: ServiceProviderRecord;
+    'Option<ServiceProviderRecord>': Option<ServiceProviderRecord>;
+    'Vec<ServiceProviderRecord>': Vec<ServiceProviderRecord>;
     BlockAndTime: BlockAndTime;
     'Option<BlockAndTime>': Option<BlockAndTime>;
     'Vec<BlockAndTime>': Vec<BlockAndTime>;
@@ -2345,12 +2351,6 @@ declare module '@polkadot/types/types/registry' {
     RoleStakeProfile: RoleStakeProfile;
     'Option<RoleStakeProfile>': Option<RoleStakeProfile>;
     'Vec<RoleStakeProfile>': Vec<RoleStakeProfile>;
-    IPNSIdentity: IPNSIdentity;
-    'Option<IPNSIdentity>': Option<IPNSIdentity>;
-    'Vec<IPNSIdentity>': Vec<IPNSIdentity>;
-    ServiceProviderRecord: ServiceProviderRecord;
-    'Option<ServiceProviderRecord>': Option<ServiceProviderRecord>;
-    'Vec<ServiceProviderRecord>': Vec<ServiceProviderRecord>;
     ContentId: ContentId;
     'Option<ContentId>': Option<ContentId>;
     'Vec<ContentId>': Vec<ContentId>;

+ 2 - 5
types/augment/all/defs.json

@@ -68,6 +68,8 @@
     "Operation": "Null",
     "ReferenceConstraint": "Null",
     "FailedAt": "Null",
+    "IPNSIdentity": "Null",
+    "ServiceProviderRecord": "Null",
     "BlockAndTime": {
         "block": "u32",
         "time": "u64"
@@ -479,11 +481,6 @@
         "termination_unstaking_period": "Option<u32>",
         "exit_unstaking_period": "Option<u32>"
     },
-    "IPNSIdentity": "Text",
-    "ServiceProviderRecord": {
-        "identity": "IPNSIdentity",
-        "expires_at": "u32"
-    },
     "ContentId": "[u8;32]",
     "LiaisonJudgement": {
         "_enum": [

+ 2 - 5
types/augment/all/types.ts

@@ -520,7 +520,7 @@ export interface InputValidationLengthConstraint extends Struct {
 export interface InputValue extends Null {}
 
 /** @name IPNSIdentity */
-export interface IPNSIdentity extends Text {}
+export interface IPNSIdentity extends Null {}
 
 /** @name Lead */
 export interface Lead extends Null {}
@@ -1052,10 +1052,7 @@ export interface SeriesParameters extends Struct {
 }
 
 /** @name ServiceProviderRecord */
-export interface ServiceProviderRecord extends Struct {
-  readonly identity: IPNSIdentity;
-  readonly expires_at: u32;
-}
+export interface ServiceProviderRecord extends Null {}
 
 /** @name SetLeadParams */
 export interface SetLeadParams extends ITuple<[MemberId, GenericAccountId]> {}

+ 1 - 15
types/augment/augment-api-query.ts

@@ -4,7 +4,7 @@
 import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
 import { Option, Vec } from '@polkadot/types/codec';
 import { Bytes, bool, u16, u32, u64 } from '@polkadot/types/primitive';
-import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, ObjectOwner, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, ServiceProviderRecord, Stake, StakeId, StorageProviderId, Thread, ThreadCounter, ThreadId, TransferableStake, Url, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, Voucher, WorkerId, WorkerOf } from './all';
+import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, ObjectOwner, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, Stake, StakeId, Thread, ThreadCounter, ThreadId, TransferableStake, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, Voucher, WorkerId, WorkerOf } from './all';
 import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
 import { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
 import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
@@ -383,20 +383,6 @@ declare module '@polkadot/api/types/storage' {
        **/
       nextDataObjectTypeId: AugmentedQuery<ApiType, () => Observable<DataObjectTypeId>>;
     };
-    discovery: {
-      /**
-       * Mapping of service providers' storage provider id to their ServiceProviderRecord
-       **/
-      accountInfoByStorageProviderId: AugmentedQuery<ApiType, (arg: StorageProviderId | AnyNumber | Uint8Array) => Observable<ServiceProviderRecord>>;
-      /**
-       * Bootstrap endpoints maintained by root
-       **/
-      bootstrapEndpoints: AugmentedQuery<ApiType, () => Observable<Vec<Url>>>;
-      /**
-       * Lifetime of an ServiceProviderRecord record in AccountInfoByAccountId map
-       **/
-      defaultLifetime: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
-    };
     forum: {
       /**
        * Map category identifier to corresponding category.

+ 1 - 21
types/augment/augment-api-tx.ts

@@ -4,7 +4,7 @@
 import { AnyNumber } from '@polkadot/types/types';
 import { Compact, Option, Vec } from '@polkadot/types/codec';
 import { Bytes, bool, u16, u32, u64 } from '@polkadot/types/primitive';
-import { ActivateOpeningAt, AddOpeningParameters, ApplicationId, ApplicationIdSet, BalanceOfMint, CategoryId, ChannelCategoryCreationParameters, ChannelCategoryId, ChannelCategoryUpdateParameters, ChannelCreationParameters, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ChannelUpdateParameters, ContentActor, ContentId, ContentParameters, CuratorGroupId, CuratorId, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, ElectionParameters, FillOpeningParameters, MemberId, MemoText, ObjectOwner, OpeningId, OpeningPolicyCommitment, OpeningType, PaidTermId, PersonActor, PersonCreationParameters, PersonId, PersonUpdateParameters, PlaylistCreationParameters, PlaylistId, PlaylistUpdateParameters, PostId, ProposalId, RewardPolicy, SeriesId, SeriesParameters, StorageProviderId, TerminateRoleParameters, ThreadId, Url, VideoCategoryCreationParameters, VideoCategoryId, VideoCategoryUpdateParameters, VideoCreationParameters, VideoId, VideoUpdateParameters, VoteKind, WorkerId, WorkingGroup } from './all';
+import { ActivateOpeningAt, AddOpeningParameters, ApplicationId, ApplicationIdSet, BalanceOfMint, CategoryId, ChannelCategoryCreationParameters, ChannelCategoryId, ChannelCategoryUpdateParameters, ChannelCreationParameters, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ChannelUpdateParameters, ContentActor, ContentId, ContentParameters, CuratorGroupId, CuratorId, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, ElectionParameters, FillOpeningParameters, MemberId, MemoText, ObjectOwner, OpeningId, OpeningPolicyCommitment, OpeningType, PaidTermId, PersonActor, PersonCreationParameters, PersonId, PersonUpdateParameters, PlaylistCreationParameters, PlaylistId, PlaylistUpdateParameters, PostId, ProposalId, RewardPolicy, SeriesId, SeriesParameters, StorageProviderId, TerminateRoleParameters, ThreadId, VideoCategoryCreationParameters, VideoCategoryId, VideoCategoryUpdateParameters, VideoCreationParameters, VideoId, VideoUpdateParameters, VoteKind, WorkerId, WorkingGroup } from './all';
 import { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics';
 import { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa';
 import { Heartbeat } from '@polkadot/types/interfaces/imOnline';
@@ -433,26 +433,6 @@ declare module '@polkadot/api/types/submittable' {
        **/
       updateDataObjectType: AugmentedSubmittable<(id: DataObjectTypeId | AnyNumber | Uint8Array, dataObjectType: DataObjectType | { description?: any; active?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
     };
-    discovery: {
-      /**
-       * Sets bootstrap endpoints for the Colossus. Requires root privileges.
-       **/
-      setBootstrapEndpoints: AugmentedSubmittable<(endpoints: Vec<Url> | (Url | string)[]) => SubmittableExtrinsic<ApiType>>;
-      /**
-       * Sets default lifetime for storage providers accounts info. Requires root privileges.
-       **/
-      setDefaultLifetime: AugmentedSubmittable<(lifetime: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
-      /**
-       * Creates the ServiceProviderRecord to save an IPNS identity for the storage provider.
-       * Requires signed storage provider credentials.
-       **/
-      setIpnsId: AugmentedSubmittable<(storageProviderId: StorageProviderId | AnyNumber | Uint8Array, id: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
-      /**
-       * Deletes the ServiceProviderRecord with the IPNS identity for the storage provider.
-       * Requires signed storage provider credentials.
-       **/
-      unsetIpnsId: AugmentedSubmittable<(storageProviderId: StorageProviderId | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
-    };
     finalityTracker: {
       /**
        * Hint that the author of this block thinks the best finalized

+ 6 - 6
types/augment/augment-types.ts

@@ -2060,6 +2060,12 @@ declare module '@polkadot/types/types/registry' {
     FailedAt: FailedAt;
     'Option<FailedAt>': Option<FailedAt>;
     'Vec<FailedAt>': Vec<FailedAt>;
+    IPNSIdentity: IPNSIdentity;
+    'Option<IPNSIdentity>': Option<IPNSIdentity>;
+    'Vec<IPNSIdentity>': Vec<IPNSIdentity>;
+    ServiceProviderRecord: ServiceProviderRecord;
+    'Option<ServiceProviderRecord>': Option<ServiceProviderRecord>;
+    'Vec<ServiceProviderRecord>': Vec<ServiceProviderRecord>;
     BlockAndTime: BlockAndTime;
     'Option<BlockAndTime>': Option<BlockAndTime>;
     'Vec<BlockAndTime>': Vec<BlockAndTime>;
@@ -2345,12 +2351,6 @@ declare module '@polkadot/types/types/registry' {
     RoleStakeProfile: RoleStakeProfile;
     'Option<RoleStakeProfile>': Option<RoleStakeProfile>;
     'Vec<RoleStakeProfile>': Vec<RoleStakeProfile>;
-    IPNSIdentity: IPNSIdentity;
-    'Option<IPNSIdentity>': Option<IPNSIdentity>;
-    'Vec<IPNSIdentity>': Vec<IPNSIdentity>;
-    ServiceProviderRecord: ServiceProviderRecord;
-    'Option<ServiceProviderRecord>': Option<ServiceProviderRecord>;
-    'Vec<ServiceProviderRecord>': Vec<ServiceProviderRecord>;
     ContentId: ContentId;
     'Option<ContentId>': Option<ContentId>;
     'Vec<ContentId>': Vec<ContentId>;

+ 0 - 17
types/src/discovery.ts

@@ -1,17 +0,0 @@
-import { u32, Text } from '@polkadot/types'
-import { RegistryTypes } from '@polkadot/types/types'
-import { JoyStructDecorated } from './common'
-
-export class IPNSIdentity extends Text {}
-
-export class ServiceProviderRecord extends JoyStructDecorated({
-  identity: IPNSIdentity,
-  expires_at: u32, // BlockNumber
-}) {}
-
-export const discoveryTypes: RegistryTypes = {
-  IPNSIdentity,
-  ServiceProviderRecord,
-}
-
-export default discoveryTypes

+ 0 - 3
types/src/index.ts

@@ -9,7 +9,6 @@ import mint from './mint'
 import recurringRewards from './recurring-rewards'
 import hiring from './hiring'
 import workingGroup from './working-group'
-import discovery from './discovery'
 import storage from './storage'
 import proposals from './proposals'
 import contentDirectory from './content'
@@ -31,7 +30,6 @@ export {
   recurringRewards,
   hiring,
   workingGroup,
-  discovery,
   storage,
   proposals,
   contentDirectory,
@@ -50,7 +48,6 @@ export const types: RegistryTypes = {
   ...recurringRewards,
   ...hiring,
   ...workingGroup,
-  ...discovery,
   ...storage,
   ...proposals,
   ...contentDirectory,

+ 6 - 0
types/src/legacy.ts

@@ -89,6 +89,10 @@ export class ReferenceConstraint extends Null {}
 export class InputEntityValuesMap extends Null {}
 export class FailedAt extends Null {}
 
+// From discovery_service
+export class IPNSIdentity extends Null {}
+export class ServiceProviderRecord extends Null {}
+
 export const legacyTypes: RegistryTypes = {
   ChannelContentType,
   ChannelCurationStatus,
@@ -159,6 +163,8 @@ export const legacyTypes: RegistryTypes = {
   Operation,
   ReferenceConstraint,
   FailedAt,
+  IPNSIdentity,
+  ServiceProviderRecord,
 }
 
 export default legacyTypes

+ 0 - 2
types/src/scripts/generateAugmentCodec.ts

@@ -18,7 +18,6 @@ import mint from '../mint'
 import recurringRewards from '../recurring-rewards'
 import hiring from '../hiring'
 import workingGroup from '../working-group'
-import discovery from '../discovery'
 import storage from '../storage'
 import proposals from '../proposals'
 import contentDirectory from '../content'
@@ -41,7 +40,6 @@ const typesByModule = {
   'recurring-rewards': recurringRewards,
   'hiring': hiring,
   'working-group': workingGroup,
-  'discovery': discovery,
   'storage': storage,
   'proposals': proposals,
   'content': contentDirectory,

Some files were not shown because too many files changed in this diff