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

Adjust Advisory Committee voting ratios #975

Merged
merged 7 commits into from Feb 23, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion node/src/chain_spec/battery_station.rs
Expand Up @@ -26,7 +26,7 @@ use sc_service::ChainType;
use sp_core::crypto::UncheckedInto;
use zeitgeist_primitives::{
constants::{
ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD, STAKING_PTD},
ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD},
BASE,
},
types::AccountId,
Expand All @@ -40,6 +40,7 @@ use {
CollatorDeposit, DefaultBlocksPerRound, DefaultCollatorCommission,
DefaultParachainBondReservePercent, EligibilityValue, PolkadotXcmConfig,
},
zeitgeist_primitives::constants::ztg::STAKING_PTD,
zeitgeist_primitives::constants::ztg::TOTAL_INITIAL_ZTG,
};

Expand Down
3 changes: 2 additions & 1 deletion node/src/chain_spec/dev.rs
Expand Up @@ -31,13 +31,14 @@ use battery_station_runtime::{
use sc_service::ChainType;
use sp_core::sr25519;
use zeitgeist_primitives::{
constants::ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD, STAKING_PTD},
constants::ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD},
types::Balance,
};
#[cfg(feature = "parachain")]
use {
super::battery_station::inflation_config,
sp_runtime::Perbill,
zeitgeist_primitives::constants::ztg::STAKING_PTD,
zeitgeist_primitives::constants::{ztg::TOTAL_INITIAL_ZTG, BASE},
};

Expand Down
3 changes: 2 additions & 1 deletion node/src/chain_spec/zeitgeist.rs
Expand Up @@ -27,12 +27,13 @@ use sc_service::ChainType;
use sp_core::crypto::UncheckedInto;
use zeitgeist_runtime::parameters::SS58Prefix;

use zeitgeist_primitives::constants::ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD, STAKING_PTD};
use zeitgeist_primitives::constants::ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD};

#[cfg(feature = "parachain")]
use {
super::{generate_inflation_config_function, Extensions},
crate::KUSAMA_PARACHAIN_ID,
zeitgeist_primitives::constants::ztg::STAKING_PTD,
zeitgeist_primitives::constants::ztg::TOTAL_INITIAL_ZTG,
zeitgeist_runtime::{
CollatorDeposit, DefaultBlocksPerRound, DefaultCollatorCommission,
Expand Down
1 change: 1 addition & 0 deletions runtime/battery-station/src/lib.rs
Expand Up @@ -35,6 +35,7 @@ pub use frame_system::{
#[cfg(feature = "parachain")]
pub use pallet_author_slot_filter::EligibilityValue;
pub use pallet_balances::Call as BalancesCall;
use pallet_collective::EnsureProportionMoreThan;

#[cfg(feature = "parachain")]
pub use crate::parachain_params::*;
Expand Down
37 changes: 21 additions & 16 deletions runtime/common/src/lib.rs
Expand Up @@ -133,14 +133,25 @@ macro_rules! decl_common_types {
EnsureProportionAtLeast<AccountId, TechnicalCommitteeInstance, 1, 1>,
>;

// Advisory committee vote proportions
// At least 50%
type EnsureRootOrHalfAdvisoryCommittee = EitherOfDiverse<
// Advisory Committee vote proportions
// More than 33%
type EnsureRootOrMoreThanOneThirdAdvisoryCommittee = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureProportionAtLeast<AccountId, AdvisoryCommitteeInstance, 1, 2>,
EnsureProportionMoreThan<AccountId, AdvisoryCommitteeInstance, 1, 3>,
>;

// More than 50%
type EnsureRootOrMoreThanHalfAdvisoryCommittee = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureProportionMoreThan<AccountId, AdvisoryCommitteeInstance, 1, 2>,
>;

// More than 66%
type EnsureRootOrMoreThanTwoThirdsAdvisoryCommittee = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureProportionMoreThan<AccountId, AdvisoryCommitteeInstance, 2, 3>,
>;

// Technical committee vote proportions
// At least 66%
type EnsureRootOrTwoThirdsAdvisoryCommittee = EitherOfDiverse<
EnsureRoot<AccountId>,
Expand Down Expand Up @@ -920,7 +931,7 @@ macro_rules! impl_config_traits {
impl parachain_info::Config for Runtime {}

impl zrml_authorized::Config for Runtime {
type AuthorizedDisputeResolutionOrigin = EnsureRootOrHalfAdvisoryCommittee;
type AuthorizedDisputeResolutionOrigin = EnsureRootOrMoreThanHalfAdvisoryCommittee;
type CorrectionPeriod = CorrectionPeriod;
type DisputeResolution = zrml_prediction_markets::Pallet<Runtime>;
type Event = Event;
Expand Down Expand Up @@ -980,13 +991,10 @@ macro_rules! impl_config_traits {
impl zrml_prediction_markets::Config for Runtime {
type AdvisoryBond = AdvisoryBond;
type AdvisoryBondSlashPercentage = AdvisoryBondSlashPercentage;
type ApproveOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureMember<AccountId, AdvisoryCommitteeInstance>
>;
type ApproveOrigin = EnsureRootOrMoreThanOneThirdAdvisoryCommittee;
type Authorized = Authorized;
type Court = Court;
type CloseOrigin = EnsureRootOrTwoThirdsAdvisoryCommittee;
type CloseOrigin = EnsureRoot<AccountId>;
type DestroyOrigin = EnsureRootOrAllAdvisoryCommittee;
type DisputeBond = DisputeBond;
type DisputeFactor = DisputeFactor;
Expand Down Expand Up @@ -1015,11 +1023,8 @@ macro_rules! impl_config_traits {
type OracleBond = OracleBond;
type OutsiderBond = OutsiderBond;
type PalletId = PmPalletId;
type RejectOrigin = EnsureRootOrHalfAdvisoryCommittee;
type RequestEditOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureMember<AccountId, AdvisoryCommitteeInstance>,
>;
type RejectOrigin = EnsureRootOrMoreThanTwoThirdsAdvisoryCommittee;
type RequestEditOrigin = EnsureRootOrMoreThanOneThirdAdvisoryCommittee;
type ResolveOrigin = EnsureRoot<AccountId>;
type AssetManager = AssetManager;
#[cfg(feature = "parachain")]
Expand Down
2 changes: 1 addition & 1 deletion runtime/zeitgeist/src/lib.rs
Expand Up @@ -45,7 +45,7 @@ use frame_support::{
weights::{constants::RocksDbWeight, ConstantMultiplier, IdentityFee},
};
use frame_system::EnsureRoot;
use pallet_collective::{EnsureProportionAtLeast, PrimeDefaultVote};
use pallet_collective::{EnsureProportionAtLeast, EnsureProportionMoreThan, PrimeDefaultVote};
use pallet_transaction_payment::ChargeTransactionPayment;
use sp_runtime::traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256};
#[cfg(feature = "std")]
Expand Down