Skip to content

Rome version of content working group#87

Merged
mnaamani merged 108 commits intoJoystream:developmentfrom
bedeho:add-content-wg
Jan 8, 2020
Merged

Rome version of content working group#87
mnaamani merged 108 commits intoJoystream:developmentfrom
bedeho:add-content-wg

Conversation

@bedeho
Copy link
Copy Markdown
Member

@bedeho bedeho commented Oct 29, 2019

Specification

#107

Progress

  • Main types and storage variables defined.
  • Main extrinsics defined
  • Main events defined.
  • create_channel
  • transfer_channel_ownership
  • add_curator_opening
  • accept_curator_applications
  • begin_curator_applicant_review
  • fill_curator_opening
  • terminate_curator_role
  • apply_on_curator_opening
  • set_lead
  • unset_lead
  • update_curator_creation_policies
  • leave_curator_role
  • terminate_curator_application
  • withdraw_curator_application
  • account_can_act_as_principal
  • update_curator_reward_account
  • update_curator_role_account
  • update_channel_curation_status
  • update_channel_as_owner
  • update_channel_as_curator

Future

  • update_curator_application_role_account: switch out account using membership, in case key was lost?

Dropped

These were all dropped when the principal model was simplified.

  • update_lead_credential
  • update_any_member_credential
  • update_any_curator_credential
  • create_dynamic_credential
  • update_dynamic_credential

Comments

  • There is significant effort involved in always checking whether a given member can or cannot step into a given role at some point in time, and then later to actually move them in and out of that role. In some cases, there may be a double check, such as the initial check when someone applies for a position, and then a second one when they are hired by the lead. All of this takes effort to manage, and mostly it exists so that one can model very fine-grained rules about who can step into what role at what time. We should at a later time reconsider the value of this because currently, we don't even have any policy in mind, it's just a blanket yes for everything.

Missing

@mnaamani
Copy link
Copy Markdown
Member

mnaamani commented Oct 31, 2019

@bedeho the build is currently failing because we need to update the dependencies to use the same commit hash for substrate, as well as some minor tweaks to fix issues that only show up when building for WASM. (specifically use of Vec)

@bedeho
Copy link
Copy Markdown
Member Author

bedeho commented Nov 1, 2019

Great that you are on top of it, I have a temporary fix for the Vec issue here

Joystream/substrate-versioned-store-permissions-module#3

so I am not blocked by that.

@bedeho
Copy link
Copy Markdown
Member Author

bedeho commented Nov 2, 2019

I know get this build error when doing cargo test

error[E0277]: `substrate_versioned_store::Property` doesn't implement `core::fmt::Debug`
   --> /Users/bedeho/.cargo/git/checkouts/substrate-versioned-store-permissions-module-9fdc387c352881a2/694a504/src/lib.rs:103:1
    |
103 | / decl_module! {
104 | |     pub struct Module<T: Trait> for enum Call where origin: T::Origin {
105 | |
106 | |         /// Sets the admins for a class
...   |
385 | |     }
386 | | }
    | |_^ `substrate_versioned_store::Property` cannot be formatted using `{:?}` because it doesn't implement `core::fmt::Debug`
    |
    = help: the trait `core::fmt::Debug` is not implemented for `substrate_versioned_store::Property`
    = note: required because of the requirements on the impl of `core::fmt::Debug` for `sr_api_hidden_includes_decl_storage::hidden_include::sr_primitives::sr_std::prelude::Vec<substrate_versioned_store::Property>`
    = note: required because of the requirements on the impl of `core::fmt::Debug` for `(core::option::Option<<T as Trait>::PrincipalId>, u64, sr_api_hidden_includes_decl_storage::hidden_include::sr_primitives::sr_std::prelude::Vec<u16>, sr_api_hidden_includes_decl_storage::hidden_include::sr_primitives::sr_std::prelude::Vec<substrate_versioned_store::Property>)`
    = note: required by `core::fmt::Debug::fmt`
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Property only auto-supports Debug trait through

#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]

which only includes the derives when we are not building the WASM target?

I hope we can have a more safe and sound solution to resolve this issue of things breaking when they are used in ways that are not so visible when they are built and run on their own.

@bedeho bedeho marked this pull request as ready for review November 29, 2019 11:35
@bedeho bedeho requested a review from mnaamani November 29, 2019 11:35
Copy link
Copy Markdown
Member

@mnaamani mnaamani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really clean and surprisingly easy to go through, despite the number of modules that come together in this module.

trait Store for Module<T: Trait> as ContentWorkingGroup {

/// The mint currently funding the rewards for this module.
pub Mint get(mint) config(): <T as minting::Trait>::MintId;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have configurable mints at genesis.. so setting a mintid at genesis is problematic atm.
Either we can have this be an Option<MintId> with the mint getting created later with a sudo call,
or my preferred way to use a build() with some extra_genesis values to create a new mint.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also just occurred to me, I don't see the mint id being used when creating reward relationships.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now the relationship is created through an extrinsic where the mintid is provided..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is one approach to create mint with build() at genesis: 438c031


Self::update_channel(
&channel_id,
&None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_channel_name isn't used to update

Suggested change
&None,
&new_channel_name,

pub fn fill_curator_opening(
origin,
curator_opening_id: CuratorOpeningId<T>,
successful_curator_application_ids: BTreeSet<CuratorApplicationId<T>>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does an empty set need to be handled in a special way?
Would have to look at behavior of hiring module when calling fill_opening with empty application set.

stake_id: StakeId<T>
) {
// Ensure its a runtime root origin
ensure_root(origin)?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be called via sudo extrinsic. I don't think this is what you intended. Its probably the method that will be called from handler for StakingEventHandler::unstaked ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No values are ever inserted into UnstakerByStakeId map. Is that step missing in apply_on_curator_opening()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction.. (as per chat) step is missing in deactivate_curator()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is a bug, we must add to this map whenever there is async unstaking initaited, that is staking with an unboding period.

Copy link
Copy Markdown
Member

@mnaamani mnaamani Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a commit from #103 which makes unstaked a normal method: 92ef426

member_id: T::MemberId,
curator_opening_id: CuratorOpeningId<T>,
role_account: T::AccountId,
source_account: T::AccountId,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no guarantees that the origin controls the funds in the source_account provided, which means they can stake funds from arbitrary accounts.

In the storage role staking module we split this staking into a two step process but I found that a little too complex both on the runtime and ui side.

So maybe we can opt for something simpler here, for example that the source account must be the member's root_account or controller_account?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted, quite a severe oversight, I don't love the remedy, but may be best to do for Rome, and fix properly later.

@mnaamani
Copy link
Copy Markdown
Member

mnaamani commented Dec 9, 2019

I think we need to add some extrinsics to give sudo ability to update the mint capacity, and or adjustment policy.

shamil-gadelshin and others added 3 commits December 26, 2019 19:44
- Update From<WrappedError<AddOpeningError>>: add message for the new error type - ApplicationRationingZeroMaxApplicants
- Cover From<WrappedError<AddOpeningError>> with tests
- update hiring-module dependency revision
- update stake-module dependency to restore compatibility with hiring module
- both dependencies are latest development revision to date
@mnaamani
Copy link
Copy Markdown
Member

mnaamani commented Jan 8, 2020

merging, but there are pending issues to be fixed. see #117

@mnaamani mnaamani merged commit fb4ecf3 into Joystream:development Jan 8, 2020
mnaamani pushed a commit to mnaamani/joystream that referenced this pull request Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants