Skip to content

Commit

Permalink
Adjust Advisory Committee voting ratios (#975)
Browse files Browse the repository at this point in the history
* Adjust Advisory Committee's voting ratios

* Remove unused imports

* Fix imports

* Change `request_edit` threshold to 30%

* Fix formatting

* Fix voting ratios

* Fix name of 1/3 AC
  • Loading branch information
maltekliemann committed Feb 23, 2023
1 parent c2c7ce9 commit 1f7ea61
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 20 deletions.
3 changes: 2 additions & 1 deletion node/src/chain_spec/battery_station.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 1f7ea61

Please sign in to comment.