Skip to content

Commit

Permalink
Modify Shibuya governance params (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard authored Sep 9, 2024
1 parent 4af1ccb commit f1475d0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 41 deletions.
15 changes: 15 additions & 0 deletions primitives/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ pub type EnsureRootOrTwoThirdsMainCouncil = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 2, 3>,
>;

pub type EnsureRootOrHalfMainCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, MainCouncilCollectiveInst, 1, 2>,
>;

// Technical Committee
pub type EnsureRootOrAllTechnicalCommittee = EitherOfDiverse<
EnsureRoot<AccountId>,
Expand All @@ -55,6 +60,11 @@ pub type EnsureRootOrTwoThirdsTechnicalCommittee = EitherOfDiverse<
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 2, 3>,
>;

pub type EnsureRootOrHalfTechnicalCommittee = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeCollectiveInst, 1, 2>,
>;

// Community Council
pub type EnsureRootOrAllCommunityCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
Expand All @@ -65,3 +75,8 @@ pub type EnsureRootOrTwoThirdsCommunityCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 2, 3>,
>;

pub type EnsureRootOrHalfCommunityCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CommunityCouncilCollectiveInst, 1, 2>,
>;
82 changes: 41 additions & 41 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ use astar_primitives::{
governance::{
CommunityCouncilCollectiveInst, CommunityCouncilMembershipInst, CommunityTreasuryInst,
EnsureRootOrAllMainCouncil, EnsureRootOrAllTechnicalCommittee,
EnsureRootOrTwoThirdsCommunityCouncil, EnsureRootOrTwoThirdsMainCouncil,
EnsureRootOrTwoThirdsTechnicalCommittee, MainCouncilCollectiveInst,
MainCouncilMembershipInst, MainTreasuryInst, OracleMembershipInst,
TechnicalCommitteeCollectiveInst, TechnicalCommitteeMembershipInst,
EnsureRootOrHalfCommunityCouncil, EnsureRootOrHalfMainCouncil,
EnsureRootOrHalfTechnicalCommittee, MainCouncilCollectiveInst, MainCouncilMembershipInst,
MainTreasuryInst, OracleMembershipInst, TechnicalCommitteeCollectiveInst,
TechnicalCommitteeMembershipInst,
},
oracle::{CurrencyAmount, CurrencyId, DummyCombineData, Price},
xcm::AssetLocationIdConverter,
Expand Down Expand Up @@ -462,9 +462,9 @@ impl pallet_dapp_staking::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type Currency = Balances;
type SmartContract = SmartContract<AccountId>;
type ContractRegisterOrigin = EnsureRootOrTwoThirdsCommunityCouncil;
type ContractRegisterOrigin = EnsureRootOrHalfCommunityCouncil;
type ContractUnregisterOrigin = frame_system::EnsureRoot<AccountId>;
type ManagerOrigin = EnsureRootOrTwoThirdsTechnicalCommittee;
type ManagerOrigin = EnsureRootOrHalfTechnicalCommittee;
type NativePriceProvider = PriceAggregator;
type StakingRewardHandler = Inflation;
type CycleConfiguration = InflationCycleConfig;
Expand Down Expand Up @@ -1240,11 +1240,11 @@ impl orml_oracle::Config for Runtime {

impl pallet_membership::Config<OracleMembershipInst> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsMainCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil;
type AddOrigin = EnsureRootOrHalfMainCouncil;
type RemoveOrigin = EnsureRootOrHalfMainCouncil;
type SwapOrigin = EnsureRootOrHalfMainCouncil;
type ResetOrigin = EnsureRootOrHalfMainCouncil;
type PrimeOrigin = EnsureRootOrHalfMainCouncil;
type MembershipInitialized = ();
type MembershipChanged = ();
type MaxMembers = ConstU32<16>;
Expand Down Expand Up @@ -1277,11 +1277,11 @@ parameter_types! {

impl pallet_membership::Config<MainCouncilMembershipInst> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsMainCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil;
type AddOrigin = EnsureRootOrHalfMainCouncil;
type RemoveOrigin = EnsureRootOrHalfMainCouncil;
type SwapOrigin = EnsureRootOrHalfMainCouncil;
type ResetOrigin = EnsureRootOrHalfMainCouncil;
type PrimeOrigin = EnsureRootOrHalfMainCouncil;
type MembershipInitialized = Council;
type MembershipChanged = Council;
type MaxMembers = CouncilMaxMembers;
Expand All @@ -1290,11 +1290,11 @@ impl pallet_membership::Config<MainCouncilMembershipInst> for Runtime {

impl pallet_membership::Config<TechnicalCommitteeMembershipInst> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsMainCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil;
type AddOrigin = EnsureRootOrHalfMainCouncil;
type RemoveOrigin = EnsureRootOrHalfMainCouncil;
type SwapOrigin = EnsureRootOrHalfMainCouncil;
type ResetOrigin = EnsureRootOrHalfMainCouncil;
type PrimeOrigin = EnsureRootOrHalfMainCouncil;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = TechnicalCommitteeMaxMembers;
Expand All @@ -1303,11 +1303,11 @@ impl pallet_membership::Config<TechnicalCommitteeMembershipInst> for Runtime {

impl pallet_membership::Config<CommunityCouncilMembershipInst> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsMainCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsMainCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsMainCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsMainCouncil;
type AddOrigin = EnsureRootOrHalfMainCouncil;
type RemoveOrigin = EnsureRootOrHalfMainCouncil;
type SwapOrigin = EnsureRootOrHalfMainCouncil;
type ResetOrigin = EnsureRootOrHalfMainCouncil;
type PrimeOrigin = EnsureRootOrHalfMainCouncil;
type MembershipInitialized = CommunityCouncil;
type MembershipChanged = CommunityCouncil;
type MaxMembers = CommunityCouncilMaxMembers;
Expand All @@ -1322,7 +1322,7 @@ impl pallet_collective::Config<MainCouncilCollectiveInst> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU32<{ 2 * DAYS }>;
type MotionDuration = ConstU32<{ 5 * DAYS }>;
type MaxProposals = ConstU32<16>;
type MaxMembers = CouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
Expand All @@ -1335,7 +1335,7 @@ impl pallet_collective::Config<TechnicalCommitteeCollectiveInst> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU32<{ 2 * DAYS }>;
type MotionDuration = ConstU32<{ 5 * DAYS }>;
type MaxProposals = ConstU32<16>;
type MaxMembers = TechnicalCommitteeMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
Expand All @@ -1348,7 +1348,7 @@ impl pallet_collective::Config<CommunityCouncilCollectiveInst> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU32<{ 2 * DAYS }>;
type MotionDuration = ConstU32<{ 5 * DAYS }>;
type MaxProposals = ConstU32<16>;
type MaxMembers = CommunityCouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
Expand All @@ -1360,9 +1360,9 @@ impl pallet_collective::Config<CommunityCouncilCollectiveInst> for Runtime {
impl pallet_democracy::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type EnactmentPeriod = ConstU32<{ 2 * HOURS }>;
type LaunchPeriod = ConstU32<{ 3 * DAYS }>;
type VotingPeriod = ConstU32<{ 3 * DAYS }>;
type EnactmentPeriod = ConstU32<{ 2 * DAYS }>;
type LaunchPeriod = ConstU32<{ 4 * DAYS }>;
type VotingPeriod = ConstU32<{ 4 * DAYS }>;
type VoteLockingPeriod = ConstU32<{ 1 * DAYS }>;
type MinimumDeposit = ConstU128<{ 10 * SBY }>;
type FastTrackVotingPeriod = ConstU32<{ 1 * HOURS }>;
Expand All @@ -1374,21 +1374,21 @@ impl pallet_democracy::Config for Runtime {
type MaxBlacklisted = ConstU32<128>;

/// A two third majority of the Council can choose the next external "super majority approve" proposal.
type ExternalOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ExternalOrigin = EnsureRootOrHalfMainCouncil;
/// A two third majority of the Council can choose the next external "majority approve" proposal. Also bypasses blacklist filter.
type ExternalMajorityOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ExternalMajorityOrigin = EnsureRootOrHalfMainCouncil;
/// Unanimous approval of the Council can choose the next external "super majority against" proposal.
type ExternalDefaultOrigin = EnsureRootOrAllMainCouncil;
/// A two third majority of the Technical Committee can have an external proposal tabled immediately
/// for a _fast track_ vote, and a custom enactment period.
type FastTrackOrigin = EnsureRootOrTwoThirdsTechnicalCommittee;
type FastTrackOrigin = EnsureRootOrHalfTechnicalCommittee;
/// Unanimous approval of the Technical Committee can have an external proposal tabled immediately
/// for a completely custom _voting period length_ vote, and a custom enactment period.
type InstantOrigin = EnsureRootOrAllTechnicalCommittee;
type InstantAllowed = ConstBool<true>;

/// A two third majority of the Council can cancel a passed proposal. Can happen only once per unique proposal.
type CancellationOrigin = EnsureRootOrTwoThirdsMainCouncil;
type CancellationOrigin = EnsureRootOrHalfMainCouncil;
/// Only a passed public referendum can permanently blacklist a proposal.
type BlacklistOrigin = EnsureRoot<AccountId>;
/// An unanimous Technical Committee can cancel a public proposal, slashing the deposit(s).
Expand All @@ -1415,8 +1415,8 @@ impl pallet_treasury::Config<MainTreasuryInst> for Runtime {
type RuntimeEvent = RuntimeEvent;

// Two origins which can either approve or reject the spending proposal
type ApproveOrigin = EnsureRootOrTwoThirdsMainCouncil;
type RejectOrigin = EnsureRootOrTwoThirdsMainCouncil;
type ApproveOrigin = EnsureRootOrHalfMainCouncil;
type RejectOrigin = EnsureRootOrHalfMainCouncil;

type OnSlash = Treasury;
type ProposalBond = ProposalBond;
Expand Down Expand Up @@ -1455,8 +1455,8 @@ impl pallet_treasury::Config<CommunityTreasuryInst> for Runtime {
type RuntimeEvent = RuntimeEvent;

// Two origins which can either approve or reject the spending proposal
type ApproveOrigin = EnsureRootOrTwoThirdsCommunityCouncil;
type RejectOrigin = EnsureRootOrTwoThirdsCommunityCouncil;
type ApproveOrigin = EnsureRootOrHalfCommunityCouncil;
type RejectOrigin = EnsureRootOrHalfCommunityCouncil;

type OnSlash = CommunityTreasury;
type ProposalBond = ProposalBond;
Expand Down Expand Up @@ -1505,7 +1505,7 @@ impl InstanceFilter<RuntimeCall> for CommunityCouncilCallFilter {
impl pallet_collective_proxy::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type CollectiveProxy = EnsureRootOrTwoThirdsCommunityCouncil;
type CollectiveProxy = EnsureRootOrHalfCommunityCouncil;
type ProxyAccountId = CommunityTreasuryAccountId;
type CallFilter = CommunityCouncilCallFilter;
type WeightInfo = pallet_collective_proxy::weights::SubstrateWeight<Runtime>;
Expand Down

0 comments on commit f1475d0

Please sign in to comment.