Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.8.7 #597

Merged
merged 10 commits into from
Jan 11, 2021
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
Prev Previous commit
Next Next commit
add: democracy, close #596
  • Loading branch information
aurexav committed Jan 11, 2021
commit 1814a8dcd5dfde648ee975b77fdff21ae65729ee
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ version = "0.8.7"
# crates
codec = { package = "parity-scale-codec", version = "1.3.5", default-features = false, features = ["derive"] }
serde = { version = "1.0.118", optional = true }
smallvec = { version = "1.6.0" }
smallvec = { version = "1.6.1" }
static_assertions = { version = "1.1.0" }
# darwinia frame
darwinia-balances = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
Expand Down
4 changes: 3 additions & 1 deletion runtime/darwinia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ array-bytes = { version = "0.3.0" }
codec = { package = "parity-scale-codec", version = "1.3.5", default-features = false, features = ["derive"] }
serde = { version = "1.0.118", optional = true }
serde_json = { version = "1.0.61", optional = true }
smallvec = { version = "1.6.0" }
smallvec = { version = "1.6.1" }
static_assertions = { version = "1.1.0" }
# darwinia frame
darwinia-balances = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-balances-rpc-runtime-api = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-crab-backing = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-democracy = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-elections-phragmen = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-ethereum-backing = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-ethereum-relay = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
Expand Down Expand Up @@ -95,6 +96,7 @@ std = [
"darwinia-balances/std",
"darwinia-balances-rpc-runtime-api/std",
"darwinia-crab-backing/std",
"darwinia-democracy/std",
"darwinia-elections-phragmen/std",
"darwinia-ethereum-backing/std",
"darwinia-ethereum-relay/std",
Expand Down
89 changes: 88 additions & 1 deletion runtime/darwinia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,88 @@ impl darwinia_treasury::Trait for Runtime {
type WeightInfo = weights::darwinia_treasury::WeightInfo<Runtime>;
}

parameter_types! {
pub const LaunchPeriod: BlockNumber = 28 * DAYS;
pub const VotingPeriod: BlockNumber = 28 * DAYS;
pub const FastTrackVotingPeriod: BlockNumber = 3 * HOURS;
aurexav marked this conversation as resolved.
Show resolved Hide resolved
pub const MinimumDeposit: Balance = 100 * COIN;
pub const EnactmentPeriod: BlockNumber = 28 * DAYS;
pub const CooloffPeriod: BlockNumber = 7 * DAYS;
// One milli: $10,000 / MB
pub const PreimageByteDeposit: Balance = 1 * MILLI;
pub const InstantAllowed: bool = true;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
}
impl darwinia_democracy::Trait for Runtime {
type Proposal = Call;
type Event = Event;
type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod;
type LaunchPeriod = LaunchPeriod;
type VotingPeriod = VotingPeriod;
type MinimumDeposit = MinimumDeposit;
/// A straight majority of the council can decide what their next motion is.
type ExternalOrigin = frame_system::EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>,
frame_system::EnsureRoot<AccountId>,
>;
/// A 60% super-majority can have the next scheduled referendum be a straight majority-carries vote.
type ExternalMajorityOrigin = frame_system::EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>,
frame_system::EnsureRoot<AccountId>,
>;
/// A unanimous council can have the next scheduled referendum be a straight default-carries
/// (NTB) vote.
type ExternalDefaultOrigin = frame_system::EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>,
frame_system::EnsureRoot<AccountId>,
>;
/// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote
/// be tabled immediately and with a shorter voting/enactment period.
type FastTrackOrigin = frame_system::EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, TechnicalCollective>,
frame_system::EnsureRoot<AccountId>,
>;
type InstantOrigin = frame_system::EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>,
frame_system::EnsureRoot<AccountId>,
>;
type InstantAllowed = InstantAllowed;
type FastTrackVotingPeriod = FastTrackVotingPeriod;
// To cancel a proposal which has been passed, 2/3 of the council must agree to it.
type CancellationOrigin = EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>,
EnsureRoot<AccountId>,
>;
// To cancel a proposal before it has been passed, the technical committee must be unanimous or
// Root must agree.
type CancelProposalOrigin = EnsureOneOf<
AccountId,
pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>,
EnsureRoot<AccountId>,
>;
type BlacklistOrigin = EnsureRoot<AccountId>;
// Any single technical committee member may veto a coming council proposal, however they can
// only do it once and it lasts only for the cooloff period.
type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
type CooloffPeriod = CooloffPeriod;
type PreimageByteDeposit = PreimageByteDeposit;
type OperationalPreimageOrigin = pallet_collective::EnsureMember<AccountId, CouncilCollective>;
type Slash = Treasury;
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = MaxVotes;
type WeightInfo = weights::darwinia_democracy::WeightInfo<Runtime>;
type MaxProposals = MaxProposals;
}

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * MILLI;
}
Expand Down Expand Up @@ -740,6 +822,7 @@ impl InstanceFilter<Call> for ProxyType {
Call::ElectionsPhragmen(..) |
Call::TechnicalMembership(..) |
Call::Treasury(..) |
Call::Democracy(..) |
Call::Utility(..) |
Call::Identity(..) |
Call::Society(..) |
Expand All @@ -766,7 +849,8 @@ impl InstanceFilter<Call> for ProxyType {
Call::Council(..)
| Call::TechnicalCommittee(..)
| Call::ElectionsPhragmen(..)
| Call::Treasury(..) | Call::Utility(..)
| Call::Treasury(..) | Call::Democracy(..)
| Call::Utility(..)
),
ProxyType::Staking => matches!(c, Call::Staking(..) | Call::Utility(..)),
ProxyType::IdentityJudgement => matches!(
Expand Down Expand Up @@ -1031,6 +1115,9 @@ construct_runtime!(

// Ethereum bridge.
EthereumRelayAuthorities: darwinia_relay_authorities::<Instance0>::{Module, Call, Storage, Event<T>},

// Governance stuff; uncallable initially.
Democracy: darwinia_democracy::{Module, Call, Storage, Config, Event<T>},
}
);

Expand Down
154 changes: 154 additions & 0 deletions runtime/darwinia/src/weights/darwinia_democracy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
//! Weights for pallet_democracy
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0
//! DATE: 2020-10-29, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: []
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 128

#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for pallet_democracy.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Trait> darwinia_democracy::WeightInfo for WeightInfo<T> {
fn propose() -> Weight {
(73_078_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn second(s: u32) -> Weight {
(48_015_000 as Weight)
.saturating_add((189_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn vote_new(r: u32) -> Weight {
(57_512_000 as Weight)
.saturating_add((224_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vote_existing(r: u32) -> Weight {
(57_230_000 as Weight)
.saturating_add((232_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn emergency_cancel() -> Weight {
(35_343_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn blacklist(p: u32) -> Weight {
(116_283_000 as Weight)
.saturating_add((795_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
fn external_propose(v: u32) -> Weight {
(17_593_000 as Weight)
.saturating_add((107_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn external_propose_majority() -> Weight {
(4_194_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn external_propose_default() -> Weight {
(4_251_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn fast_track() -> Weight {
(36_616_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn veto_external(v: u32) -> Weight {
(37_973_000 as Weight)
.saturating_add((179_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn cancel_proposal(p: u32) -> Weight {
(80_686_000 as Weight)
.saturating_add((868_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn cancel_referendum() -> Weight {
(21_630_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn cancel_queued(r: u32) -> Weight {
(40_264_000 as Weight)
.saturating_add((3_366_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn on_initialize_base(r: u32) -> Weight {
(12_654_000 as Weight)
.saturating_add((6_431_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight)))
}
fn delegate(r: u32) -> Weight {
(74_755_000 as Weight)
.saturating_add((9_558_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight)))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight)))
}
fn undelegate(r: u32) -> Weight {
(38_083_000 as Weight)
.saturating_add((9_501_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight)))
}
fn clear_public_proposals() -> Weight {
(3_453_000 as Weight).saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn note_preimage(b: u32) -> Weight {
(54_883_000 as Weight)
.saturating_add((4_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn note_imminent_preimage(b: u32) -> Weight {
(37_558_000 as Weight)
.saturating_add((3_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn reap_preimage(b: u32) -> Weight {
(51_340_000 as Weight)
.saturating_add((3_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn unlock_remove(r: u32) -> Weight {
(48_671_000 as Weight)
.saturating_add((39_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn unlock_set(r: u32) -> Weight {
(44_076_000 as Weight)
.saturating_add((222_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn remove_vote(r: u32) -> Weight {
(26_536_000 as Weight)
.saturating_add((218_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn remove_other_vote(r: u32) -> Weight {
(26_723_000 as Weight)
.saturating_add((219_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
}
1 change: 1 addition & 0 deletions runtime/darwinia/src/weights/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! A collection of weight modules used for pallets in the runtime.

pub mod darwinia_balances;
pub mod darwinia_democracy;
pub mod darwinia_elections_phragmen;
pub mod darwinia_staking;
pub mod darwinia_treasury;
Expand Down