Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,6 @@ pub fn testnet_genesis(
.set_election_parameters_proposal_voting_period,
set_election_parameters_proposal_grace_period: cpcp
.set_election_parameters_proposal_grace_period,
set_content_working_group_mint_capacity_proposal_voting_period: cpcp
.set_content_working_group_mint_capacity_proposal_voting_period,
set_content_working_group_mint_capacity_proposal_grace_period: cpcp
.set_content_working_group_mint_capacity_proposal_grace_period,
set_lead_proposal_voting_period: cpcp.set_lead_proposal_voting_period,
set_lead_proposal_grace_period: cpcp.set_lead_proposal_grace_period,
spending_proposal_voting_period: cpcp.spending_proposal_voting_period,
spending_proposal_grace_period: cpcp.spending_proposal_grace_period,
add_working_group_opening_proposal_voting_period: cpcp
Expand All @@ -373,9 +367,9 @@ pub fn testnet_genesis(
fill_working_group_leader_opening_proposal_grace_period: cpcp
.fill_working_group_leader_opening_proposal_grace_period,
set_working_group_mint_capacity_proposal_voting_period: cpcp
.set_content_working_group_mint_capacity_proposal_voting_period,
.set_working_group_mint_capacity_proposal_voting_period,
set_working_group_mint_capacity_proposal_grace_period: cpcp
.set_content_working_group_mint_capacity_proposal_grace_period,
.set_working_group_mint_capacity_proposal_grace_period,
decrease_working_group_leader_stake_proposal_voting_period: cpcp
.decrease_working_group_leader_stake_proposal_voting_period,
decrease_working_group_leader_stake_proposal_grace_period: cpcp
Expand Down
4 changes: 4 additions & 0 deletions runtime-modules/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ edition = '2018'

[dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] }
strum = {version = "0.19", optional = true}
strum_macros = {version = "0.19", optional = true}
codec = { package = 'parity-scale-codec', version = '1.3.1', default-features = false, features = ['derive'] }
sp-runtime = { package = 'sp-runtime', 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'}
Expand All @@ -16,6 +18,8 @@ pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git
default = ['std']
std = [
'serde',
'strum',
'strum_macros',
'codec/std',
'sp-runtime/std',
'frame-support/std',
Expand Down
6 changes: 5 additions & 1 deletion runtime-modules/common/src/working_group.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use codec::{Decode, Encode};
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use strum_macros::EnumIter;

/// Defines well-known working groups.
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, EnumIter))]
#[derive(Encode, Decode, Clone, PartialEq, Eq, Copy, Debug)]
pub enum WorkingGroup {
/* Reserved
Expand All @@ -12,4 +14,6 @@ pub enum WorkingGroup {
*/
/// Storage working group: working_group::Instance2.
Storage,
/// Storage working group: working_group::Instance3.
Content,
}
4 changes: 2 additions & 2 deletions runtime-modules/content-directory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2554,9 +2554,9 @@ impl<T: Trait> Module<T> {
maximum_entities_count: T::EntityId,
default_entity_creation_voucher_upper_bound: T::EntityId,
) -> Result<(), Error<T>> {
// Ensure `per_controller_entities_creation_limit` does not exceed
// Ensure default_entity_creation_voucher_upper_bound does not exceed default_entity_creation_voucher_upper_bound
ensure!(
default_entity_creation_voucher_upper_bound < maximum_entities_count,
default_entity_creation_voucher_upper_bound <= maximum_entities_count,
Error::<T>::PerControllerEntitiesCreationLimitExceedsOverallLimit
);

Expand Down
2 changes: 1 addition & 1 deletion runtime-modules/governance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl election::Trait for Test {
}
impl membership::Trait for Test {
type Event = ();
type MemberId = u32;
type MemberId = u64;
type SubscriptionId = u32;
type PaidTermId = u32;
type ActorId = u32;
Expand Down
2 changes: 1 addition & 1 deletion runtime-modules/membership/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl GovernanceCurrency for Test {

impl Trait for Test {
type Event = ();
type MemberId = u32;
type MemberId = u64;
type PaidTermId = u32;
type SubscriptionId = u32;
type ActorId = u32;
Expand Down
2 changes: 1 addition & 1 deletion runtime-modules/membership/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::mock::*;

use frame_support::*;

fn get_membership_by_id(member_id: u32) -> crate::Membership<Test> {
fn get_membership_by_id(member_id: u64) -> crate::Membership<Test> {
if <crate::MembershipById<Test>>::contains_key(member_id) {
Members::membership(member_id)
} else {
Expand Down
5 changes: 1 addition & 4 deletions runtime-modules/proposals/codex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ governance = { package = 'pallet-governance', default-features = false, path = '
hiring = { package = 'pallet-hiring', default-features = false, path = '../../hiring'}
minting = { package = 'pallet-token-mint', default-features = false, path = '../../token-minting'}
working-group = { package = 'pallet-working-group', default-features = false, path = '../../working-group'}
content-working-group = { package = 'pallet-content-working-group', default-features = false, path = '../../content-working-group'}
common = { package = 'pallet-common', default-features = false, path = '../../common'}
proposals-engine = { package = 'pallet-proposals-engine', default-features = false, path = '../engine'}
proposals-discussion = { package = 'pallet-proposals-discussion', default-features = false, path = '../discussion'}
Expand All @@ -32,8 +31,7 @@ sp-core = { package = 'sp-core', default-features = false, git = 'https://github
sp-staking = { package = 'sp-staking', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
pallet-staking-reward-curve = { package = 'pallet-staking-reward-curve', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = '00768a1f21a579c478fe5d4f51e1fa71f7db9fd4'}
recurring-rewards = { package = 'pallet-recurring-reward', default-features = false, path = '../../recurring-reward'}
versioned-store = { package = 'pallet-versioned-store', default-features = false, path = '../../versioned-store'}
versioned-store-permissions = { package = 'pallet-versioned-store-permissions', default-features = false, path = '../../versioned-store-permissions'}
strum = {version = "0.19", default-features = false}

[features]
default = ['std']
Expand All @@ -53,7 +51,6 @@ std = [
'governance/std',
'hiring/std',
'minting/std',
'content-working-group/std',
'working-group/std',
'common/std',
'proposals-engine/std',
Expand Down
100 changes: 1 addition & 99 deletions runtime-modules/proposals/codex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
//! - [create_set_election_parameters_proposal](./struct.Module.html#method.create_set_election_parameters_proposal)
//! - [create_spending_proposal](./struct.Module.html#method.create_spending_proposal)
//!
//! ### Content working group proposals
//! - [create_set_lead_proposal](./struct.Module.html#method.create_set_lead_proposal)
//! - [create_set_content_working_group_mint_capacity_proposal](./struct.Module.html#method.create_set_content_working_group_mint_capacity_proposal)
//!
//! ### Working group proposals
//! - [create_add_working_group_leader_opening_proposal](./struct.Module.html#method.create_add_working_group_leader_opening_proposal)
//! - [create_begin_review_working_group_leader_applications_proposal](./struct.Module.html#method.create_begin_review_working_group_leader_applications_proposal)
Expand Down Expand Up @@ -86,8 +82,6 @@ pub use proposal_types::{ProposalDetails, ProposalDetailsOf, ProposalEncoder};

// 'Set working group mint capacity' proposal limit
const WORKING_GROUP_MINT_CAPACITY_MAX_VALUE: u32 = 5_000_000;
// 'Set content working group mint capacity' proposal limit
const CONTENT_WORKING_GROUP_MINT_CAPACITY_MAX_VALUE: u32 = 1_000_000;
// Max allowed value for 'spending' proposal
const MAX_SPENDING_PROPOSAL_VALUE: u32 = 5_000_000_u32;
// Max validator count for the 'set validator count' proposal
Expand Down Expand Up @@ -145,7 +139,7 @@ pub trait Trait:
+ proposals_discussion::Trait
+ membership::Trait
+ governance::election::Trait
+ content_working_group::Trait
+ hiring::Trait
+ staking::Trait
{
/// Defines max allowed text proposal length.
Expand Down Expand Up @@ -294,22 +288,6 @@ decl_storage! {
/// Grace period for the 'text' proposal
pub TextProposalGracePeriod get(fn text_proposal_grace_period) config(): T::BlockNumber;

/// Voting period for the 'set content working group mint capacity' proposal
pub SetContentWorkingGroupMintCapacityProposalVotingPeriod get(fn set_content_working_group_mint_capacity_proposal_voting_period)
config(): T::BlockNumber;

/// Grace period for the 'set content working group mint capacity' proposal
pub SetContentWorkingGroupMintCapacityProposalGracePeriod get(fn set_content_working_group_mint_capacity_proposal_grace_period)
config(): T::BlockNumber;

/// Voting period for the 'set lead' proposal
pub SetLeadProposalVotingPeriod get(fn set_lead_proposal_voting_period)
config(): T::BlockNumber;

/// Grace period for the 'set lead' proposal
pub SetLeadProposalGracePeriod get(fn set_lead_proposal_grace_period)
config(): T::BlockNumber;

/// Voting period for the 'spending' proposal
pub SpendingProposalVotingPeriod get(fn spending_proposal_voting_period) config(): T::BlockNumber;

Expand Down Expand Up @@ -477,37 +455,6 @@ decl_module! {
Self::create_proposal(params)?;
}

/// Create 'Set content working group mint capacity' proposal type.
/// This proposal uses `set_mint_capacity()` extrinsic from the `content-working-group` module.
#[weight = 10_000_000] // TODO: adjust weight
pub fn create_set_content_working_group_mint_capacity_proposal(
origin,
member_id: MemberId<T>,
title: Vec<u8>,
description: Vec<u8>,
stake_balance: Option<BalanceOf<T>>,
mint_balance: BalanceOfMint<T>,
) {
ensure!(
mint_balance <= <BalanceOfMint<T>>::from(CONTENT_WORKING_GROUP_MINT_CAPACITY_MAX_VALUE),
Error::<T>::InvalidContentWorkingGroupMintCapacity
);

let proposal_details = ProposalDetails::SetContentWorkingGroupMintCapacity(mint_balance);
let params = CreateProposalParameters{
origin,
member_id,
title,
description,
stake_balance,
proposal_details: proposal_details.clone(),
proposal_parameters: proposal_types::parameters::set_content_working_group_mint_capacity_proposal::<T>(),
proposal_code: T::ProposalEncoder::encode_proposal(proposal_details)
};

Self::create_proposal(params)?;
}

/// Create 'Spending' proposal type.
/// This proposal uses `spend_from_council_mint()` extrinsic from the `governance::council` module.
#[weight = 10_000_000] // TODO: adjust weight
Expand Down Expand Up @@ -541,39 +488,6 @@ decl_module! {
Self::create_proposal(params)?;
}

/// Create 'Set lead' proposal type.
/// This proposal uses `replace_lead()` extrinsic from the `content_working_group` module.
#[weight = 10_000_000] // TODO: adjust weight
pub fn create_set_lead_proposal(
origin,
member_id: MemberId<T>,
title: Vec<u8>,
description: Vec<u8>,
stake_balance: Option<BalanceOf<T>>,
new_lead: Option<(T::MemberId, T::AccountId)>
) {
if let Some(lead) = new_lead.clone() {
let account_id = lead.1;
ensure!(
!<governance::council::Module<T>>::is_councilor(&account_id),
Error::<T>::InvalidSetLeadParameterCannotBeCouncilor
);
}
let proposal_details = ProposalDetails::SetLead(new_lead);
let params = CreateProposalParameters{
origin,
member_id,
title,
description,
stake_balance,
proposal_details: proposal_details.clone(),
proposal_parameters: proposal_types::parameters::set_lead_proposal::<T>(),
proposal_code: T::ProposalEncoder::encode_proposal(proposal_details)
};

Self::create_proposal(params)?;
}

/// Create 'Evict storage provider' proposal type.
/// This proposal uses `set_validator_count()` extrinsic from the Substrate `staking` module.
#[weight = 10_000_000] // TODO: adjust weight
Expand Down Expand Up @@ -1063,18 +977,6 @@ impl<T: Trait> Module<T> {
<SetElectionParametersProposalGracePeriod<T>>::put(T::BlockNumber::from(
p.set_election_parameters_proposal_grace_period,
));
<SetContentWorkingGroupMintCapacityProposalVotingPeriod<T>>::put(T::BlockNumber::from(
p.set_content_working_group_mint_capacity_proposal_voting_period,
));
<SetContentWorkingGroupMintCapacityProposalGracePeriod<T>>::put(T::BlockNumber::from(
p.set_content_working_group_mint_capacity_proposal_grace_period,
));
<SetLeadProposalVotingPeriod<T>>::put(T::BlockNumber::from(
p.set_lead_proposal_voting_period,
));
<SetLeadProposalGracePeriod<T>>::put(T::BlockNumber::from(
p.set_lead_proposal_grace_period,
));
<SpendingProposalVotingPeriod<T>>::put(T::BlockNumber::from(
p.spending_proposal_voting_period,
));
Expand Down
Loading