Patch practical usability issues with Society (#4651)

* Add `max_members` to `found`, add society genesis for Substrate node

* Update test

* Use `Option<bool>` rather than `Option<()>`

* Update from feedback
This commit is contained in:
Shawn Tabrizi
2020-01-17 15:43:09 +01:00
committed by Gavin Wood
parent ba1d446b48
commit d5ecec3775
9 changed files with 45 additions and 23 deletions
+1
View File
@@ -72,6 +72,7 @@ pallet-transaction-payment = { version = "2.0.0", path = "../../../frame/transac
frame-support = { version = "2.0.0", default-features = false, path = "../../../frame/support" }
pallet-im-online = { version = "2.0.0", default-features = false, path = "../../../frame/im-online" }
pallet-authority-discovery = { version = "2.0.0", path = "../../../frame/authority-discovery" }
pallet-society = { version = "2.0.0", path = "../../../frame/society" }
# node-specific dependencies
node-runtime = { version = "2.0.0", path = "../runtime" }
+7 -2
View File
@@ -21,8 +21,8 @@ use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519};
use serde::{Serialize, Deserialize};
use node_runtime::{
AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, ContractsConfig, CouncilConfig, DemocracyConfig,
GrandpaConfig, ImOnlineConfig, IndicesConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, SudoConfig,
SystemConfig, TechnicalCommitteeConfig, WASM_BINARY,
GrandpaConfig, ImOnlineConfig, IndicesConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig,
SocietyConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, WASM_BINARY,
};
use node_runtime::Block;
use node_runtime::constants::currency::*;
@@ -295,6 +295,11 @@ pub fn testnet_genesis(
}),
pallet_membership_Instance1: Some(Default::default()),
pallet_treasury: Some(Default::default()),
pallet_society: Some(SocietyConfig {
members: endowed_accounts[0..3].to_vec(),
pot: 0,
max_members: 999,
})
}
}
+1 -2
View File
@@ -571,7 +571,6 @@ parameter_types! {
pub const PeriodSpend: Balance = 500 * DOLLARS;
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxMembers: u32 = 999;
}
impl pallet_society::Trait for Runtime {
@@ -621,7 +620,7 @@ construct_runtime!(
Offences: pallet_offences::{Module, Call, Storage, Event},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Identity: pallet_identity::{Module, Call, Storage, Event<T>},
Society: pallet_society::{Module, Call, Storage, Event<T>},
Society: pallet_society::{Module, Call, Storage, Event<T>, Config<T>},
Recovery: pallet_recovery::{Module, Call, Storage, Event<T>},
}
);
+1
View File
@@ -20,6 +20,7 @@ sp-core = { version = "2.0.0", path = "../../../primitives/core" }
sp-io = { version = "2.0.0", path = "../../../primitives/io" }
frame-support = { version = "2.0.0", path = "../../../frame/support" }
pallet-session = { version = "2.0.0", path = "../../../frame/session" }
pallet-society = { version = "2.0.0", path = "../../../frame/society" }
sp-runtime = { version = "2.0.0", path = "../../../primitives/runtime" }
pallet-staking = { version = "2.0.0", path = "../../../frame/staking" }
sc-executor = { version = "0.8", path = "../../../client/executor" }
+6 -1
View File
@@ -20,7 +20,7 @@ use crate::keyring::*;
use sp_keyring::{Ed25519Keyring, Sr25519Keyring};
use node_runtime::{
GenesisConfig, BalancesConfig, SessionConfig, StakingConfig, SystemConfig,
GrandpaConfig, IndicesConfig, ContractsConfig, WASM_BINARY,
GrandpaConfig, IndicesConfig, ContractsConfig, SocietyConfig, WASM_BINARY,
};
use node_runtime::constants::currency::*;
use sp_core::ChangesTrieConfiguration;
@@ -96,5 +96,10 @@ pub fn config(support_changes_trie: bool, code: Option<&[u8]>) -> GenesisConfig
pallet_membership_Instance1: Some(Default::default()),
pallet_sudo: Some(Default::default()),
pallet_treasury: Some(Default::default()),
pallet_society: Some(SocietyConfig {
members: vec![alice(), bob()],
pot: 0,
max_members: 999,
}),
}
}