12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160 |
- //! The Joystream Substrate Node runtime.
- #![cfg_attr(not(feature = "std"), no_std)]
- // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
- #![recursion_limit = "256"]
- //Substrate internal issues.
- #![allow(clippy::large_enum_variant)]
- #![allow(clippy::unnecessary_mut_passed)]
- #![allow(non_fmt_panic)]
- #![allow(clippy::from_over_into)]
- // Make the WASM binary available.
- // This is required only by the node build.
- // A dummy wasm_binary.rs will be built for the IDE.
- #[cfg(feature = "std")]
- include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
- #[cfg(feature = "std")]
- /// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics.
- pub fn wasm_binary_unwrap() -> &'static [u8] {
- WASM_BINARY.expect(
- "Development wasm binary is not available. This means the client is \
- built with `BUILD_DUMMY_WASM_BINARY` flag and it is only usable for \
- production chains. Please rebuild with the flag disabled.",
- )
- }
- mod constants;
- mod integration;
- pub mod primitives;
- mod proposals_configuration;
- mod runtime_api;
- #[cfg(test)]
- mod tests;
- /// Weights for pallets used in the runtime.
- mod weights; // Runtime integration tests
- #[macro_use]
- extern crate lazy_static; // for proposals_configuration module
- use frame_support::dispatch::DispatchResult;
- use frame_support::traits::{
- Currency, Imbalance, KeyOwnerProofSystem, LockIdentifier, OnUnbalanced,
- };
- use frame_support::weights::{
- constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
- Weight,
- };
- use frame_support::{construct_runtime, parameter_types};
- use frame_system::{EnsureOneOf, EnsureRoot, EnsureSigned};
- use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
- use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
- use pallet_session::historical as pallet_session_historical;
- use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
- use sp_core::crypto::KeyTypeId;
- use sp_core::Hasher;
- use sp_runtime::curve::PiecewiseLinear;
- use sp_runtime::traits::{BlakeTwo256, Block as BlockT, IdentityLookup, OpaqueKeys, Saturating};
- use sp_runtime::{create_runtime_str, generic, impl_opaque_keys, ModuleId, Perbill};
- use sp_std::boxed::Box;
- use sp_std::vec::Vec;
- #[cfg(feature = "std")]
- use sp_version::NativeVersion;
- use sp_version::RuntimeVersion;
- pub use constants::*;
- pub use primitives::*;
- pub use proposals_configuration::*;
- pub use runtime_api::*;
- use integration::proposals::{CouncilManager, ExtrinsicProposalEncoder};
- use common::working_group::{WorkingGroup, WorkingGroupAuthenticator, WorkingGroupBudgetHandler};
- use council::ReferendumConnection;
- use referendum::{CastVote, OptionResult};
- use staking_handler::{LockComparator, StakingManager};
- // Node dependencies
- pub use common;
- pub use council;
- pub use forum;
- pub use membership;
- #[cfg(any(feature = "std", test))]
- pub use pallet_balances::Call as BalancesCall;
- pub use pallet_staking::StakerStatus;
- pub use proposals_engine::ProposalParameters;
- pub use referendum;
- pub use working_group;
- pub use content;
- pub use content::MaxNumber;
- /// This runtime version.
- pub const VERSION: RuntimeVersion = RuntimeVersion {
- spec_name: create_runtime_str!("joystream-node"),
- impl_name: create_runtime_str!("joystream-node"),
- authoring_version: 10,
- spec_version: 0,
- impl_version: 0,
- apis: crate::runtime_api::EXPORTED_RUNTIME_API_VERSIONS,
- transaction_version: 1,
- };
- /// The version information used to identify this runtime when compiled natively.
- #[cfg(feature = "std")]
- pub fn native_version() -> NativeVersion {
- NativeVersion {
- runtime_version: VERSION,
- can_author_with: Default::default(),
- }
- }
- parameter_types! {
- pub const BlockHashCount: BlockNumber = 250;
- /// We allow for 2 seconds of compute with a 6 second average block time.
- pub const MaximumBlockWeight: Weight = 2 * frame_support::weights::constants::WEIGHT_PER_SECOND;
- pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
- pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
- pub const Version: RuntimeVersion = VERSION;
- /// Assume 10% of weight for average on_initialize calls.
- pub MaximumExtrinsicWeight: Weight =
- AvailableBlockRatio::get().saturating_sub(AVERAGE_ON_INITIALIZE_WEIGHT)
- * MaximumBlockWeight::get();
- }
- const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10);
- // TODO: We need to adjust weight of this pallet
- // once we move to a newer version of substrate where parameters
- // are not discarded. See the comment in 'scripts/generate-weights.sh'
- impl frame_system::Trait for Runtime {
- type BaseCallFilter = ();
- type Origin = Origin;
- type Call = Call;
- type Index = Index;
- type BlockNumber = BlockNumber;
- type Hash = Hash;
- type Hashing = BlakeTwo256;
- type AccountId = AccountId;
- type Lookup = IdentityLookup<AccountId>;
- type Header = generic::Header<BlockNumber, BlakeTwo256>;
- type Event = Event;
- type BlockHashCount = BlockHashCount;
- type MaximumBlockWeight = MaximumBlockWeight;
- type DbWeight = RocksDbWeight;
- type BlockExecutionWeight = BlockExecutionWeight;
- type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
- type MaximumExtrinsicWeight = MaximumExtrinsicWeight;
- type MaximumBlockLength = MaximumBlockLength;
- type AvailableBlockRatio = AvailableBlockRatio;
- type Version = Version;
- type PalletInfo = PalletInfo;
- type AccountData = pallet_balances::AccountData<Balance>;
- type OnNewAccount = ();
- type OnKilledAccount = ();
- type SystemWeightInfo = weights::frame_system::WeightInfo;
- }
- impl substrate_utility::Trait for Runtime {
- type Event = Event;
- type Call = Call;
- type WeightInfo = weights::substrate_utility::WeightInfo;
- }
- parameter_types! {
- pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64;
- pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
- }
- impl pallet_babe::Trait for Runtime {
- type EpochDuration = EpochDuration;
- type ExpectedBlockTime = ExpectedBlockTime;
- type EpochChangeTrigger = pallet_babe::ExternalTrigger;
- type KeyOwnerProofSystem = Historical;
- type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
- KeyTypeId,
- pallet_babe::AuthorityId,
- )>>::Proof;
- type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
- KeyTypeId,
- pallet_babe::AuthorityId,
- )>>::IdentificationTuple;
- type HandleEquivocation =
- pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
- type WeightInfo = ();
- }
- impl pallet_grandpa::Trait for Runtime {
- type Event = Event;
- type Call = Call;
- type KeyOwnerProof =
- <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
- type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
- KeyTypeId,
- GrandpaId,
- )>>::IdentificationTuple;
- type KeyOwnerProofSystem = Historical;
- type HandleEquivocation =
- pallet_grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
- type WeightInfo = ();
- }
- impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
- where
- Call: From<LocalCall>,
- {
- fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
- call: Call,
- public: <Signature as sp_runtime::traits::Verify>::Signer,
- account: AccountId,
- nonce: Index,
- ) -> Option<(
- Call,
- <UncheckedExtrinsic as sp_runtime::traits::Extrinsic>::SignaturePayload,
- )> {
- integration::transactions::create_transaction::<C>(call, public, account, nonce)
- }
- }
- impl frame_system::offchain::SigningTypes for Runtime {
- type Public = <Signature as sp_runtime::traits::Verify>::Signer;
- type Signature = Signature;
- }
- impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
- where
- Call: From<C>,
- {
- type Extrinsic = UncheckedExtrinsic;
- type OverarchingCall = Call;
- }
- parameter_types! {
- pub const MinimumPeriod: Moment = SLOT_DURATION / 2;
- }
- impl pallet_timestamp::Trait for Runtime {
- type Moment = Moment;
- type OnTimestampSet = Babe;
- type MinimumPeriod = MinimumPeriod;
- type WeightInfo = weights::pallet_timestamp::WeightInfo;
- }
- parameter_types! {
- pub const MaxLocks: u32 = 50;
- }
- impl pallet_balances::Trait for Runtime {
- type Balance = Balance;
- type DustRemoval = ();
- type Event = Event;
- type ExistentialDeposit = ExistentialDeposit;
- type AccountStore = System;
- type WeightInfo = weights::pallet_balances::WeightInfo;
- type MaxLocks = MaxLocks;
- }
- parameter_types! {
- pub const TransactionByteFee: Balance = 1;
- }
- type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
- pub struct Author;
- impl OnUnbalanced<NegativeImbalance> for Author {
- fn on_nonzero_unbalanced(amount: NegativeImbalance) {
- Balances::resolve_creating(&Authorship::author(), amount);
- }
- }
- pub struct DealWithFees;
- impl OnUnbalanced<NegativeImbalance> for DealWithFees {
- fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {
- if let Some(fees) = fees_then_tips.next() {
- // for fees, 20% to author, for now we don't have treasury so the 80% is ignored
- let mut split = fees.ration(80, 20);
- if let Some(tips) = fees_then_tips.next() {
- // For tips %100 are for the author
- tips.ration_merge_into(0, 100, &mut split);
- }
- Author::on_unbalanced(split.1);
- }
- }
- }
- impl pallet_transaction_payment::Trait for Runtime {
- type Currency = Balances;
- type OnTransactionPayment = DealWithFees;
- type TransactionByteFee = TransactionByteFee;
- type WeightToFee = constants::fees::WeightToFee;
- type FeeMultiplierUpdate = constants::fees::SlowAdjustingFeeUpdate<Self>;
- }
- impl pallet_sudo::Trait for Runtime {
- type Event = Event;
- type Call = Call;
- }
- parameter_types! {
- pub const UncleGenerations: BlockNumber = 0;
- }
- impl pallet_authorship::Trait for Runtime {
- type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
- type UncleGenerations = UncleGenerations;
- type FilterUncle = ();
- type EventHandler = (Staking, ImOnline);
- }
- impl_opaque_keys! {
- pub struct SessionKeys {
- pub grandpa: Grandpa,
- pub babe: Babe,
- pub im_online: ImOnline,
- pub authority_discovery: AuthorityDiscovery,
- }
- }
- // NOTE: `SessionHandler` and `SessionKeys` are co-dependent: One key will be used for each handler.
- // The number and order of items in `SessionHandler` *MUST* be the same number and order of keys in
- // `SessionKeys`.
- // TODO: Introduce some structure to tie these together to make it a bit less of a footgun. This
- // should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858
- parameter_types! {
- pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
- }
- impl pallet_session::Trait for Runtime {
- type Event = Event;
- type ValidatorId = AccountId;
- type ValidatorIdOf = pallet_staking::StashOf<Self>;
- type ShouldEndSession = Babe;
- type NextSessionRotation = Babe;
- type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
- type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
- type Keys = SessionKeys;
- type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
- type WeightInfo = weights::pallet_session::WeightInfo;
- }
- impl pallet_session::historical::Trait for Runtime {
- type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
- type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
- }
- pallet_staking_reward_curve::build! {
- const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
- min_inflation: 0_050_000,
- max_inflation: 0_750_000,
- ideal_stake: 0_300_000,
- falloff: 0_050_000,
- max_piece_count: 100,
- test_precision: 0_005_000,
- );
- }
- parameter_types! {
- pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _;
- pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
- /// We prioritize im-online heartbeats over election solution submission.
- pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
- }
- parameter_types! {
- pub const SessionsPerEra: sp_staking::SessionIndex = 6;
- pub const BondingDuration: pallet_staking::EraIndex = BONDING_DURATION;
- pub const SlashDeferDuration: pallet_staking::EraIndex = BONDING_DURATION - 1; // 'slightly less' than the bonding duration.
- pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
- pub const MaxNominatorRewardedPerValidator: u32 = 64;
- pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
- pub const MaxIterations: u32 = 10;
- // 0.05%. The higher the value, the more strict solution acceptance becomes.
- pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
- }
- impl pallet_staking::Trait for Runtime {
- type Currency = Balances;
- type UnixTime = Timestamp;
- type CurrencyToVote = CurrencyToVoteHandler;
- type RewardRemainder = (); // Could be Treasury.
- type Event = Event;
- type Slash = (); // Where to send the slashed funds. Could be Treasury.
- type Reward = (); // Rewards are minted from the void.
- type SessionsPerEra = SessionsPerEra;
- type BondingDuration = BondingDuration;
- type SlashDeferDuration = SlashDeferDuration;
- type SlashCancelOrigin = EnsureRoot<AccountId>; // Requires sudo. Parity recommends: a super-majority of the council can cancel the slash.
- type SessionInterface = Self;
- type RewardCurve = RewardCurve;
- type NextNewSession = Session;
- type ElectionLookahead = ElectionLookahead;
- type Call = Call;
- type MaxIterations = MaxIterations;
- type MinSolutionScoreBump = MinSolutionScoreBump;
- type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
- type UnsignedPriority = StakingUnsignedPriority;
- type WeightInfo = weights::pallet_staking::WeightInfo;
- }
- impl pallet_im_online::Trait for Runtime {
- type AuthorityId = ImOnlineId;
- type Event = Event;
- type SessionDuration = SessionDuration;
- type ReportUnresponsiveness = Offences;
- // Using the default weights until we check if we can run the benchmarks for this pallet in
- // the reference machine in an acceptable time.
- type WeightInfo = ();
- type UnsignedPriority = ImOnlineUnsignedPriority;
- }
- parameter_types! {
- pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get();
- }
- impl pallet_offences::Trait for Runtime {
- type Event = Event;
- type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
- type OnOffenceHandler = Staking;
- type WeightSoftLimit = OffencesWeightSoftLimit;
- }
- impl pallet_authority_discovery::Trait for Runtime {}
- parameter_types! {
- pub const WindowSize: BlockNumber = 101;
- pub const ReportLatency: BlockNumber = 1000;
- }
- impl pallet_finality_tracker::Trait for Runtime {
- type OnFinalizationStalled = ();
- type WindowSize = WindowSize;
- type ReportLatency = ReportLatency;
- }
- impl common::currency::GovernanceCurrency for Runtime {
- type Currency = pallet_balances::Module<Self>;
- }
- parameter_types! {
- pub const MaxNumberOfCuratorsPerGroup: MaxNumber = 50;
- pub const MaxModerators: u64 = 5; // TODO: update
- pub const CleanupMargin: u32 = 3; // TODO: update
- pub const CleanupCost: u32 = 1; // TODO: update
- pub const PricePerByte: u32 = 2; // TODO: update
- pub const ContentModuleId: ModuleId = ModuleId(*b"mContent"); // module content
- pub const BloatBondCap: u32 = 1000; // TODO: update
- pub const VideosMigrationsEachBlock: u64 = 100;
- pub const ChannelsMigrationsEachBlock: u64 = 25;
- }
- impl content::Trait for Runtime {
- type Event = Event;
- type ChannelCategoryId = ChannelCategoryId;
- type VideoId = VideoId;
- type VideoCategoryId = VideoCategoryId;
- type MaxNumberOfCuratorsPerGroup = MaxNumberOfCuratorsPerGroup;
- type DataObjectStorage = Storage;
- type VideoPostId = VideoPostId;
- type ReactionId = ReactionId;
- type MaxModerators = MaxModerators;
- type PricePerByte = PricePerByte;
- type BloatBondCap = BloatBondCap;
- type CleanupMargin = CleanupMargin;
- type CleanupCost = CleanupCost;
- type ModuleId = ContentModuleId;
- type VideosMigrationsEachBlock = VideosMigrationsEachBlock;
- type ChannelsMigrationsEachBlock = ChannelsMigrationsEachBlock;
- }
- // The referendum instance alias.
- pub type ReferendumInstance = referendum::Instance1;
- pub type ReferendumModule = referendum::Module<Runtime, ReferendumInstance>;
- pub type CouncilModule = council::Module<Runtime>;
- parameter_types! {
- // referendum parameters
- pub const MaxSaltLength: u64 = 32;
- pub const VoteStageDuration: BlockNumber = 5;
- pub const RevealStageDuration: BlockNumber = 7;
- pub const MinimumVotingStake: u64 = 10000;
- // council parameteres
- pub const MinNumberOfExtraCandidates: u64 = 1;
- pub const AnnouncingPeriodDuration: BlockNumber = 15;
- pub const IdlePeriodDuration: BlockNumber = 27;
- pub const CouncilSize: u64 = 3;
- pub const MinCandidateStake: u64 = 11000;
- pub const ElectedMemberRewardPeriod: BlockNumber = 10;
- pub const DefaultBudgetIncrement: u64 = 1000;
- pub const BudgetRefillPeriod: BlockNumber = 1000;
- pub const MaxWinnerTargetCount: u64 = 10;
- }
- impl referendum::Trait<ReferendumInstance> for Runtime {
- type Event = Event;
- type MaxSaltLength = MaxSaltLength;
- type StakingHandler = staking_handler::StakingManager<Self, VotingLockId>;
- type ManagerOrigin =
- EnsureOneOf<Self::AccountId, EnsureSigned<Self::AccountId>, EnsureRoot<Self::AccountId>>;
- type VotePower = Balance;
- type VoteStageDuration = VoteStageDuration;
- type RevealStageDuration = RevealStageDuration;
- type MinimumStake = MinimumVotingStake;
- type WeightInfo = weights::referendum::WeightInfo;
- type MaxWinnerTargetCount = MaxWinnerTargetCount;
- fn calculate_vote_power(
- _account_id: &<Self as frame_system::Trait>::AccountId,
- stake: &Balance,
- ) -> Self::VotePower {
- *stake
- }
- fn can_unlock_vote_stake(vote: &CastVote<Self::Hash, Balance, Self::MemberId>) -> bool {
- <CouncilModule as ReferendumConnection<Runtime>>::can_unlock_vote_stake(vote).is_ok()
- }
- fn process_results(winners: &[OptionResult<Self::MemberId, Self::VotePower>]) {
- let tmp_winners: Vec<OptionResult<Self::MemberId, Self::VotePower>> = winners
- .iter()
- .map(|item| OptionResult {
- option_id: item.option_id,
- vote_power: item.vote_power,
- })
- .collect();
- <CouncilModule as ReferendumConnection<Runtime>>::recieve_referendum_results(
- tmp_winners.as_slice(),
- );
- }
- fn is_valid_option_id(option_index: &u64) -> bool {
- <CouncilModule as ReferendumConnection<Runtime>>::is_valid_candidate_id(option_index)
- }
- fn get_option_power(option_id: &u64) -> Self::VotePower {
- <CouncilModule as ReferendumConnection<Runtime>>::get_option_power(option_id)
- }
- fn increase_option_power(option_id: &u64, amount: &Self::VotePower) {
- <CouncilModule as ReferendumConnection<Runtime>>::increase_option_power(option_id, amount);
- }
- }
- impl council::Trait for Runtime {
- type Event = Event;
- type Referendum = ReferendumModule;
- type MinNumberOfExtraCandidates = MinNumberOfExtraCandidates;
- type CouncilSize = CouncilSize;
- type AnnouncingPeriodDuration = AnnouncingPeriodDuration;
- type IdlePeriodDuration = IdlePeriodDuration;
- type MinCandidateStake = MinCandidateStake;
- type CandidacyLock = StakingManager<Self, CandidacyLockId>;
- type CouncilorLock = StakingManager<Self, CouncilorLockId>;
- type StakingAccountValidator = Members;
- type ElectedMemberRewardPeriod = ElectedMemberRewardPeriod;
- type BudgetRefillPeriod = BudgetRefillPeriod;
- type MemberOriginValidator = Members;
- type WeightInfo = weights::council::WeightInfo;
- fn new_council_elected(_elected_members: &[council::CouncilMemberOf<Self>]) {
- <proposals_engine::Module<Runtime>>::reject_active_proposals();
- <proposals_engine::Module<Runtime>>::reactivate_pending_constitutionality_proposals();
- }
- }
- impl common::StorageOwnership for Runtime {
- type ChannelId = ChannelId;
- type ContentId = ContentId;
- type DataObjectTypeId = DataObjectTypeId;
- }
- impl memo::Trait for Runtime {
- type Event = Event;
- }
- parameter_types! {
- pub const MaxDistributionBucketFamilyNumber: u64 = 200;
- pub const DataObjectDeletionPrize: Balance = 0; //TODO: Change during Olympia release
- pub const BlacklistSizeLimit: u64 = 10000; //TODO: adjust value
- pub const MaxRandomIterationNumber: u64 = 10; //TODO: adjust value
- pub const MaxNumberOfPendingInvitationsPerDistributionBucket: u64 = 20; //TODO: adjust value
- pub const StorageModuleId: ModuleId = ModuleId(*b"mstorage"); // module storage
- pub const StorageBucketsPerBagValueConstraint: storage::StorageBucketsPerBagValueConstraint =
- storage::StorageBucketsPerBagValueConstraint {min: 5, max_min_diff: 15}; //TODO: adjust value
- pub const DefaultMemberDynamicBagNumberOfStorageBuckets: u64 = 5; //TODO: adjust value
- pub const DefaultChannelDynamicBagNumberOfStorageBuckets: u64 = 5; //TODO: adjust value
- pub const DistributionBucketsPerBagValueConstraint: storage::DistributionBucketsPerBagValueConstraint =
- storage::DistributionBucketsPerBagValueConstraint {min: 1, max_min_diff: 100}; //TODO: adjust value
- pub const MaxDataObjectSize: u64 = 10 * 1024 * 1024 * 1024; // 10 GB
- }
- impl storage::Trait for Runtime {
- type Event = Event;
- type DataObjectId = DataObjectId;
- type StorageBucketId = StorageBucketId;
- type DistributionBucketIndex = DistributionBucketIndex;
- type DistributionBucketFamilyId = DistributionBucketFamilyId;
- type ChannelId = ChannelId;
- type DataObjectDeletionPrize = DataObjectDeletionPrize;
- type BlacklistSizeLimit = BlacklistSizeLimit;
- type ModuleId = StorageModuleId;
- type StorageBucketsPerBagValueConstraint = StorageBucketsPerBagValueConstraint;
- type DefaultMemberDynamicBagNumberOfStorageBuckets =
- DefaultMemberDynamicBagNumberOfStorageBuckets;
- type DefaultChannelDynamicBagNumberOfStorageBuckets =
- DefaultChannelDynamicBagNumberOfStorageBuckets;
- type Randomness = RandomnessCollectiveFlip;
- type MaxRandomIterationNumber = MaxRandomIterationNumber;
- type MaxDistributionBucketFamilyNumber = MaxDistributionBucketFamilyNumber;
- type DistributionBucketsPerBagValueConstraint = DistributionBucketsPerBagValueConstraint;
- type DistributionBucketOperatorId = DistributionBucketOperatorId;
- type MaxNumberOfPendingInvitationsPerDistributionBucket =
- MaxNumberOfPendingInvitationsPerDistributionBucket;
- type MaxDataObjectSize = MaxDataObjectSize;
- type ContentId = ContentId;
- fn ensure_storage_working_group_leader_origin(origin: Self::Origin) -> DispatchResult {
- StorageWorkingGroup::ensure_leader_origin(origin)
- }
- fn ensure_storage_worker_origin(origin: Self::Origin, worker_id: ActorId) -> DispatchResult {
- StorageWorkingGroup::ensure_worker_origin(origin, &worker_id)
- }
- fn ensure_storage_worker_exists(worker_id: &ActorId) -> DispatchResult {
- StorageWorkingGroup::ensure_worker_exists(&worker_id)
- }
- fn ensure_distribution_working_group_leader_origin(origin: Self::Origin) -> DispatchResult {
- DistributionWorkingGroup::ensure_leader_origin(origin)
- }
- fn ensure_distribution_worker_origin(
- origin: Self::Origin,
- worker_id: ActorId,
- ) -> DispatchResult {
- DistributionWorkingGroup::ensure_worker_origin(origin, &worker_id)
- }
- fn ensure_distribution_worker_exists(worker_id: &ActorId) -> DispatchResult {
- DistributionWorkingGroup::ensure_worker_exists(&worker_id)
- }
- }
- impl common::membership::MembershipTypes for Runtime {
- type MemberId = MemberId;
- type ActorId = ActorId;
- }
- parameter_types! {
- pub const DefaultMembershipPrice: Balance = 100;
- pub const ReferralCutMaximumPercent: u8 = 50;
- pub const DefaultInitialInvitationBalance: Balance = 100;
- // The candidate stake should be more than the transaction fee which currently is 53
- pub const CandidateStake: Balance = 200;
- }
- impl membership::Trait for Runtime {
- type Event = Event;
- type DefaultMembershipPrice = DefaultMembershipPrice;
- type DefaultInitialInvitationBalance = DefaultInitialInvitationBalance;
- type InvitedMemberStakingHandler = InvitedMemberStakingManager;
- type StakingCandidateStakingHandler = StakingCandidateStakingHandler;
- type WorkingGroup = MembershipWorkingGroup;
- type WeightInfo = weights::membership::WeightInfo;
- type ReferralCutMaximumPercent = ReferralCutMaximumPercent;
- type CandidateStake = CandidateStake;
- }
- parameter_types! {
- pub const MaxCategoryDepth: u64 = 6;
- pub const MaxSubcategories: u64 = 20;
- pub const MaxThreadsInCategory: u64 = 20;
- pub const MaxPostsInThread: u64 = 20;
- pub const MaxModeratorsForCategory: u64 = 20;
- pub const MaxCategories: u64 = 20;
- pub const MaxPollAlternativesNumber: u64 = 20;
- pub const ThreadDeposit: u64 = 30;
- pub const PostDeposit: u64 = 10;
- pub const ForumModuleId: ModuleId = ModuleId(*b"mo:forum"); // module : forum
- pub const PostLifeTime: BlockNumber = 3600;
- }
- pub struct MapLimits;
- impl forum::StorageLimits for MapLimits {
- type MaxSubcategories = MaxSubcategories;
- type MaxModeratorsForCategory = MaxModeratorsForCategory;
- type MaxCategories = MaxCategories;
- type MaxPollAlternativesNumber = MaxPollAlternativesNumber;
- }
- impl forum::Trait for Runtime {
- type Event = Event;
- type ThreadId = ThreadId;
- type PostId = PostId;
- type CategoryId = u64;
- type PostReactionId = u64;
- type MaxCategoryDepth = MaxCategoryDepth;
- type ThreadDeposit = ThreadDeposit;
- type PostDeposit = PostDeposit;
- type ModuleId = ForumModuleId;
- type MapLimits = MapLimits;
- type WeightInfo = weights::forum::WeightInfo;
- type WorkingGroup = ForumWorkingGroup;
- type MemberOriginValidator = Members;
- type PostLifeTime = PostLifeTime;
- fn calculate_hash(text: &[u8]) -> Self::Hash {
- Self::Hashing::hash(text)
- }
- }
- impl LockComparator<<Runtime as pallet_balances::Trait>::Balance> for Runtime {
- fn are_locks_conflicting(new_lock: &LockIdentifier, existing_locks: &[LockIdentifier]) -> bool {
- existing_locks
- .iter()
- .any(|lock| !ALLOWED_LOCK_COMBINATIONS.contains(&(*new_lock, *lock)))
- }
- }
- parameter_types! {
- pub const MaxWorkerNumberLimit: u32 = 100;
- pub const MinUnstakingPeriodLimit: u32 = 43200;
- pub const ForumWorkingGroupRewardPeriod: u32 = 14400 + 10;
- pub const StorageWorkingGroupRewardPeriod: u32 = 14400 + 20;
- pub const ContentWorkingGroupRewardPeriod: u32 = 14400 + 30;
- pub const MembershipRewardPeriod: u32 = 14400 + 40;
- pub const GatewayRewardPeriod: u32 = 14400 + 50;
- pub const DistributionRewardPeriod: u32 = 14400 + 50;
- pub const OperationsAlphaRewardPeriod: u32 = 14400 + 60;
- pub const OperationsBetaRewardPeriod: u32 = 14400 + 70;
- pub const OperationsGammaRewardPeriod: u32 = 14400 + 80;
- // This should be more costly than `apply_on_opening` fee with the current configuration
- // the base cost of `apply_on_opening` in tokens is 193. And has a very slight slope
- // with the lenght with the length of rationale, with 2000 stake we are probably safe.
- pub const MinimumApplicationStake: Balance = 2000;
- // This should be more costly than `add_opening` fee with the current configuration
- // the base cost of `add_opening` in tokens is 81. And has a very slight slope
- // with the lenght with the length of rationale, with 2000 stake we are probably safe.
- pub const LeaderOpeningStake: Balance = 2000;
- }
- // Staking managers type aliases.
- pub type ForumWorkingGroupStakingManager =
- staking_handler::StakingManager<Runtime, ForumGroupLockId>;
- pub type ContentWorkingGroupStakingManager =
- staking_handler::StakingManager<Runtime, ContentWorkingGroupLockId>;
- pub type StorageWorkingGroupStakingManager =
- staking_handler::StakingManager<Runtime, StorageWorkingGroupLockId>;
- pub type MembershipWorkingGroupStakingManager =
- staking_handler::StakingManager<Runtime, MembershipWorkingGroupLockId>;
- pub type InvitedMemberStakingManager =
- staking_handler::StakingManager<Runtime, InvitedMemberLockId>;
- pub type StakingCandidateStakingHandler =
- staking_handler::StakingManager<Runtime, StakingCandidateLockId>;
- pub type GatewayWorkingGroupStakingManager =
- staking_handler::StakingManager<Runtime, GatewayWorkingGroupLockId>;
- pub type OperationsWorkingGroupAlphaStakingManager =
- staking_handler::StakingManager<Runtime, OperationsWorkingGroupAlphaLockId>;
- pub type OperationsWorkingGroupBetaStakingManager =
- staking_handler::StakingManager<Runtime, OperationsWorkingGroupBetaLockId>;
- pub type OperationsWorkingGroupGammaStakingManager =
- staking_handler::StakingManager<Runtime, OperationsWorkingGroupGammaLockId>;
- pub type DistributionWorkingGroupStakingManager =
- staking_handler::StakingManager<Runtime, DistributionWorkingGroupLockId>;
- // The forum working group instance alias.
- pub type ForumWorkingGroupInstance = working_group::Instance1;
- // The storage working group instance alias.
- pub type StorageWorkingGroupInstance = working_group::Instance2;
- // The content directory working group instance alias.
- pub type ContentWorkingGroupInstance = working_group::Instance3;
- // The builder working group instance alias.
- pub type OperationsWorkingGroupInstanceAlpha = working_group::Instance4;
- // The gateway working group instance alias.
- pub type GatewayWorkingGroupInstance = working_group::Instance5;
- // The membership working group instance alias.
- pub type MembershipWorkingGroupInstance = working_group::Instance6;
- // The builder working group instance alias.
- pub type OperationsWorkingGroupInstanceBeta = working_group::Instance7;
- // The builder working group instance alias.
- pub type OperationsWorkingGroupInstanceGamma = working_group::Instance8;
- // The distribution working group instance alias.
- pub type DistributionWorkingGroupInstance = working_group::Instance9;
- impl working_group::Trait<ForumWorkingGroupInstance> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = ForumWorkingGroupStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = ForumWorkingGroupRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<StorageWorkingGroupInstance> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = StorageWorkingGroupStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = StorageWorkingGroupRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<ContentWorkingGroupInstance> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = ContentWorkingGroupStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = ContentWorkingGroupRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<MembershipWorkingGroupInstance> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = MembershipWorkingGroupStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = MembershipRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<OperationsWorkingGroupInstanceAlpha> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = OperationsWorkingGroupAlphaStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = OperationsAlphaRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<GatewayWorkingGroupInstance> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = GatewayWorkingGroupStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = GatewayRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<OperationsWorkingGroupInstanceBeta> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = OperationsWorkingGroupBetaStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = OperationsBetaRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<OperationsWorkingGroupInstanceGamma> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = OperationsWorkingGroupGammaStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = OperationsGammaRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- impl working_group::Trait<DistributionWorkingGroupInstance> for Runtime {
- type Event = Event;
- type MaxWorkerNumberLimit = MaxWorkerNumberLimit;
- type StakingHandler = DistributionWorkingGroupStakingManager;
- type StakingAccountValidator = Members;
- type MemberOriginValidator = Members;
- type MinUnstakingPeriodLimit = MinUnstakingPeriodLimit;
- type RewardPeriod = DistributionRewardPeriod;
- type WeightInfo = weights::working_group::WeightInfo;
- type MinimumApplicationStake = MinimumApplicationStake;
- type LeaderOpeningStake = LeaderOpeningStake;
- }
- parameter_types! {
- pub const ProposalCancellationFee: u64 = 10000;
- pub const ProposalRejectionFee: u64 = 5000;
- pub const ProposalTitleMaxLength: u32 = 40;
- pub const ProposalDescriptionMaxLength: u32 = 3000;
- pub const ProposalMaxActiveProposalLimit: u32 = 20;
- }
- impl proposals_engine::Trait for Runtime {
- type Event = Event;
- type ProposerOriginValidator = Members;
- type CouncilOriginValidator = Council;
- type TotalVotersCounter = CouncilManager<Self>;
- type ProposalId = u32;
- type StakingHandler = staking_handler::StakingManager<Self, ProposalsLockId>;
- type CancellationFee = ProposalCancellationFee;
- type RejectionFee = ProposalRejectionFee;
- type TitleMaxLength = ProposalTitleMaxLength;
- type DescriptionMaxLength = ProposalDescriptionMaxLength;
- type MaxActiveProposalLimit = ProposalMaxActiveProposalLimit;
- type DispatchableCallCode = Call;
- type ProposalObserver = ProposalsCodex;
- type WeightInfo = weights::proposals_engine::WeightInfo;
- type StakingAccountValidator = Members;
- }
- impl Default for Call {
- fn default() -> Self {
- panic!("shouldn't call default for Call");
- }
- }
- parameter_types! {
- pub const MaxWhiteListSize: u32 = 20;
- pub const ProposalsPostDeposit: Balance = 2000;
- // module : proposals_discussion
- pub const ProposalsDiscussionModuleId: ModuleId = ModuleId(*b"mo:prdis");
- pub const ForumPostLifeTime: BlockNumber = 3600;
- }
- macro_rules! call_wg {
- ($working_group:ident, $function:ident $(,$x:expr)*) => {{
- match $working_group {
- WorkingGroup::Content => <ContentWorkingGroup as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::Storage => <StorageWorkingGroup as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::Forum => <ForumWorkingGroup as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::Membership => <MembershipWorkingGroup as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::Gateway => <GatewayWorkingGroup as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::Distribution => <DistributionWorkingGroup as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::OperationsAlpha => <OperationsWorkingGroupAlpha as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::OperationsBeta => <OperationsWorkingGroupBeta as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- WorkingGroup::OperationsGamma => <OperationsWorkingGroupGamma as WorkingGroupBudgetHandler<Runtime>>::$function($($x,)*),
- }
- }};
- }
- impl proposals_discussion::Trait for Runtime {
- type Event = Event;
- type AuthorOriginValidator = Members;
- type CouncilOriginValidator = Council;
- type ThreadId = ThreadId;
- type PostId = PostId;
- type MaxWhiteListSize = MaxWhiteListSize;
- type WeightInfo = weights::proposals_discussion::WeightInfo;
- type PostDeposit = ProposalsPostDeposit;
- type ModuleId = ProposalsDiscussionModuleId;
- type PostLifeTime = ForumPostLifeTime;
- }
- impl joystream_utility::Trait for Runtime {
- type Event = Event;
- type WeightInfo = weights::joystream_utility::WeightInfo;
- fn get_working_group_budget(working_group: WorkingGroup) -> Balance {
- call_wg!(working_group, get_budget)
- }
- fn set_working_group_budget(working_group: WorkingGroup, budget: Balance) {
- call_wg!(working_group, set_budget, budget)
- }
- }
- parameter_types! {
- pub const RuntimeUpgradeWasmProposalMaxLength: u32 = 3_000_000;
- }
- impl proposals_codex::Trait for Runtime {
- type Event = Event;
- type MembershipOriginValidator = Members;
- type ProposalEncoder = ExtrinsicProposalEncoder;
- type SetMaxValidatorCountProposalParameters = SetMaxValidatorCountProposalParameters;
- type RuntimeUpgradeProposalParameters = RuntimeUpgradeProposalParameters;
- type SignalProposalParameters = SignalProposalParameters;
- type FundingRequestProposalParameters = FundingRequestProposalParameters;
- type CreateWorkingGroupLeadOpeningProposalParameters =
- CreateWorkingGroupLeadOpeningProposalParameters;
- type FillWorkingGroupLeadOpeningProposalParameters =
- FillWorkingGroupLeadOpeningProposalParameters;
- type UpdateWorkingGroupBudgetProposalParameters = UpdateWorkingGroupBudgetProposalParameters;
- type DecreaseWorkingGroupLeadStakeProposalParameters =
- DecreaseWorkingGroupLeadStakeProposalParameters;
- type SlashWorkingGroupLeadProposalParameters = SlashWorkingGroupLeadProposalParameters;
- type SetWorkingGroupLeadRewardProposalParameters = SetWorkingGroupLeadRewardProposalParameters;
- type TerminateWorkingGroupLeadProposalParameters = TerminateWorkingGroupLeadProposalParameters;
- type AmendConstitutionProposalParameters = AmendConstitutionProposalParameters;
- type CancelWorkingGroupLeadOpeningProposalParameters =
- CancelWorkingGroupLeadOpeningProposalParameters;
- type SetMembershipPriceProposalParameters = SetMembershipPriceProposalParameters;
- type SetCouncilBudgetIncrementProposalParameters = SetCouncilBudgetIncrementProposalParameters;
- type SetCouncilorRewardProposalParameters = SetCouncilorRewardProposalParameters;
- type SetInitialInvitationBalanceProposalParameters =
- SetInitialInvitationBalanceProposalParameters;
- type SetInvitationCountProposalParameters = SetInvitationCountProposalParameters;
- type SetMembershipLeadInvitationQuotaProposalParameters =
- SetMembershipLeadInvitationQuotaProposalParameters;
- type SetReferralCutProposalParameters = SetReferralCutProposalParameters;
- type CreateBlogPostProposalParameters = CreateBlogPostProposalParameters;
- type EditBlogPostProoposalParamters = EditBlogPostProoposalParamters;
- type LockBlogPostProposalParameters = LockBlogPostProposalParameters;
- type UnlockBlogPostProposalParameters = UnlockBlogPostProposalParameters;
- type VetoProposalProposalParameters = VetoProposalProposalParameters;
- type WeightInfo = weights::proposals_codex::WeightInfo;
- }
- impl pallet_constitution::Trait for Runtime {
- type Event = Event;
- type WeightInfo = weights::pallet_constitution::WeightInfo;
- }
- parameter_types! {
- pub const BountyModuleId: ModuleId = ModuleId(*b"m:bounty"); // module : bounty
- pub const ClosedContractSizeLimit: u32 = 50;
- pub const MinCherryLimit: Balance = 10;
- pub const MinFundingLimit: Balance = 10;
- pub const MinWorkEntrantStake: Balance = 100;
- }
- impl bounty::Trait for Runtime {
- type Event = Event;
- type ModuleId = BountyModuleId;
- type BountyId = u64;
- type Membership = Members;
- type WeightInfo = weights::bounty::WeightInfo;
- type CouncilBudgetManager = Council;
- type StakingHandler = staking_handler::StakingManager<Self, BountyLockId>;
- type EntryId = u64;
- type ClosedContractSizeLimit = ClosedContractSizeLimit;
- type MinCherryLimit = MinCherryLimit;
- type MinFundingLimit = MinFundingLimit;
- type MinWorkEntrantStake = MinWorkEntrantStake;
- }
- parameter_types! {
- pub const PostsMaxNumber: u64 = 20;
- pub const RepliesMaxNumber: u64 = 100;
- pub const ReplyDeposit: Balance = 2000;
- pub const BlogModuleId: ModuleId = ModuleId(*b"mod:blog"); // module : forum
- pub const ReplyLifetime: BlockNumber = 43_200;
- }
- pub type BlogInstance = blog::Instance1;
- impl blog::Trait<BlogInstance> for Runtime {
- type Event = Event;
- type PostsMaxNumber = PostsMaxNumber;
- type ParticipantEnsureOrigin = Members;
- type WeightInfo = weights::blog::WeightInfo;
- type ReplyId = u64;
- type ReplyDeposit = ReplyDeposit;
- type ModuleId = BlogModuleId;
- type ReplyLifetime = ReplyLifetime;
- }
- /// Forum identifier for category
- pub type CategoryId = u64;
- /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
- /// the specifics of the runtime. They can then be made to be agnostic over specific formats
- /// of data like extrinsics, allowing for them to continue syncing the network through upgrades
- /// to even the core datastructures.
- pub mod opaque {
- use super::*;
- pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
- /// Opaque block header type.
- pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
- /// Opaque block type.
- pub type Block = generic::Block<Header, UncheckedExtrinsic>;
- /// Opaque block identifier type.
- pub type BlockId = generic::BlockId<Block>;
- }
- construct_runtime!(
- pub enum Runtime where
- Block = Block,
- NodeBlock = opaque::Block,
- UncheckedExtrinsic = UncheckedExtrinsic
- {
- // Substrate
- System: frame_system::{Module, Call, Storage, Config, Event<T>},
- Utility: substrate_utility::{Module, Call, Event},
- Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned},
- Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
- Authorship: pallet_authorship::{Module, Call, Storage, Inherent},
- Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
- TransactionPayment: pallet_transaction_payment::{Module, Storage},
- Staking: pallet_staking::{Module, Call, Config<T>, Storage, Event<T>, ValidateUnsigned},
- Session: pallet_session::{Module, Call, Storage, Event, Config<T>},
- Historical: pallet_session_historical::{Module},
- FinalityTracker: pallet_finality_tracker::{Module, Call, Inherent},
- Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
- ImOnline: pallet_im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
- AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config},
- Offences: pallet_offences::{Module, Call, Storage, Event},
- RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
- Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
- // Joystream
- Council: council::{Module, Call, Storage, Event<T>, Config<T>},
- Referendum: referendum::<Instance1>::{Module, Call, Storage, Event<T>, Config<T>},
- 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>},
- Constitution: pallet_constitution::{Module, Call, Storage, Event},
- Bounty: bounty::{Module, Call, Storage, Event<T>},
- Blog: blog::<Instance1>::{Module, Call, Storage, Event<T>},
- JoystreamUtility: joystream_utility::{Module, Call, Event<T>},
- Content: content::{Module, Call, Storage, Event<T>, Config<T>},
- Storage: storage::{Module, Call, Storage, Event<T>},
- // --- Proposals
- ProposalsEngine: proposals_engine::{Module, Call, Storage, Event<T>},
- ProposalsDiscussion: proposals_discussion::{Module, Call, Storage, Event<T>},
- ProposalsCodex: proposals_codex::{Module, Call, Storage, Event<T>},
- // --- Working groups
- ForumWorkingGroup: working_group::<Instance1>::{Module, Call, Storage, Event<T>},
- StorageWorkingGroup: working_group::<Instance2>::{Module, Call, Storage, Event<T>},
- ContentWorkingGroup: working_group::<Instance3>::{Module, Call, Storage, Event<T>},
- OperationsWorkingGroupAlpha: working_group::<Instance4>::{Module, Call, Storage, Event<T>},
- GatewayWorkingGroup: working_group::<Instance5>::{Module, Call, Storage, Event<T>},
- MembershipWorkingGroup: working_group::<Instance6>::{Module, Call, Storage, Event<T>},
- OperationsWorkingGroupBeta: working_group::<Instance7>::{Module, Call, Storage, Event<T>},
- OperationsWorkingGroupGamma: working_group::<Instance8>::{Module, Call, Storage, Event<T>},
- DistributionWorkingGroup: working_group::<Instance9>::{Module, Call, Storage, Event<T>},
- }
- );
|