Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add pallet-society and pallet-recovery to substrate node #4622

Merged
merged 3 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ pallet-membership = { version = "2.0.0", default-features = false, path = "../..
pallet-nicks = { version = "2.0.0", default-features = false, path = "../../../frame/nicks" }
pallet-offences = { version = "2.0.0", default-features = false, path = "../../../frame/offences" }
pallet-randomness-collective-flip = { version = "2.0.0", default-features = false, path = "../../../frame/randomness-collective-flip" }
pallet-recovery = { version = "2.0.0", default-features = false, path = "../../../frame/recovery" }
pallet-session = { version = "2.0.0", features = ["historical"], path = "../../../frame/session", default-features = false }
pallet-staking = { version = "2.0.0", features = ["migrate"], path = "../../../frame/staking", default-features = false }
pallet-staking-reward-curve = { version = "2.0.0", path = "../../../frame/staking/reward-curve" }
pallet-sudo = { version = "2.0.0", default-features = false, path = "../../../frame/sudo" }
pallet-society = { version = "2.0.0", default-features = false, path = "../../../frame/society" }
pallet-timestamp = { version = "2.0.0", default-features = false, path = "../../../frame/timestamp" }
pallet-treasury = { version = "2.0.0", default-features = false, path = "../../../frame/treasury" }
pallet-utility = { version = "2.0.0", default-features = false, path = "../../../frame/utility" }
Expand Down Expand Up @@ -119,4 +121,6 @@ std = [
"sp-transaction-pool/std",
"pallet-utility/std",
"sp-version/std",
"pallet-society/std",
"pallet-recovery/std",
]
50 changes: 48 additions & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 203,
impl_version: 203,
spec_version: 204,
impl_version: 204,
apis: RUNTIME_API_VERSIONS,
};

Expand Down Expand Up @@ -543,6 +543,50 @@ impl frame_system::offchain::CreateTransaction<Runtime, UncheckedExtrinsic> for
}
}

parameter_types! {
pub const ConfigDepositBase: Balance = 5 * DOLLARS;
pub const FriendDepositFactor: Balance = 50 * CENTS;
pub const MaxFriends: u16 = 9;
pub const RecoveryDeposit: Balance = 5 * DOLLARS;
}

impl pallet_recovery::Trait for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor;
type MaxFriends = MaxFriends;
type RecoveryDeposit = RecoveryDeposit;
}

parameter_types! {
pub const CandidateDeposit: Balance = 10 * DOLLARS;
pub const WrongSideDeduction: Balance = 2 * DOLLARS;
pub const MaxStrikes: u32 = 10;
pub const RotationPeriod: BlockNumber = 80 * HOURS;
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 {
type Event = Event;
type Currency = Balances;
type Randomness = RandomnessCollectiveFlip;
type CandidateDeposit = CandidateDeposit;
type WrongSideDeduction = WrongSideDeduction;
type MaxStrikes = MaxStrikes;
type PeriodSpend = PeriodSpend;
type MembershipChanged = ();
type RotationPeriod = RotationPeriod;
type MaxLockDuration = MaxLockDuration;
type FounderSetOrigin = pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
type SuspensionJudgementOrigin = pallet_society::EnsureFounder<Runtime>;
type ChallengePeriod = ChallengePeriod;
}

construct_runtime!(
pub enum Runtime where
Block = Block,
Expand Down Expand Up @@ -574,6 +618,8 @@ construct_runtime!(
Offences: pallet_offences::{Module, Call, Storage, Event},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Nicks: pallet_nicks::{Module, Call, Storage, Event<T>},
Society: pallet_society::{Module, Call, Storage, Event<T>},
Recovery: pallet_recovery::{Module, Call, Storage, Event<T>},
}
);

Expand Down