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

fix: 🐛 gov #1056

Merged
merged 1 commit into from
Oct 12, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions runtime/bifrost-kusama/src/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ pub use bifrost_runtime_common::dollar;
mod fellowship;
mod origins;
pub use origins::{
custom_origins, Fellows, FellowshipAdmin, FellowshipExperts, FellowshipInitiates,
custom_origins, CoreAdmin, Fellows, FellowshipAdmin, FellowshipExperts, FellowshipInitiates,
FellowshipMasters, ReferendumCanceller, ReferendumKiller, SALPAdmin, SystemStakingAdmin,
ValidatorElection, WhitelistedCaller, *,
TechAdmin, ValidatorElection, WhitelistedCaller, *,
};
mod tracks;
pub use tracks::TracksInfo;

pub type CoreAdminOrCouncil = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;

pub type TechAdminOrCouncil = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
52 changes: 17 additions & 35 deletions runtime/bifrost-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ use zenlink_stable_amm::traits::{StableAmmApi, StablePoolLpCurrencyIdGenerate, V

// Governance configurations.
pub mod governance;
use governance::{custom_origins, CoreAdmin, TechAdmin};
use governance::{
custom_origins, CoreAdmin, CoreAdminOrCouncil, SALPAdmin, SystemStakingAdmin, TechAdmin,
TechAdminOrCouncil, ValidatorElection,
};

// xcm config
mod xcm_config;
Expand Down Expand Up @@ -711,7 +714,7 @@ parameter_types! {
pub VotingBondFactor: Balance = deposit::<Runtime>(0, 32);
/// Daily council elections
pub const TermDuration: BlockNumber = 24 * HOURS;
pub const DesiredMembers: u32 = 7;
pub const DesiredMembers: u32 = 3;
pub const DesiredRunnersUp: u32 = 7;
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
pub const MaxVoters: u32 = 512;
Expand Down Expand Up @@ -1137,7 +1140,7 @@ impl bifrost_flexible_fee::Config for Runtime {
type WeightInfo = weights::bifrost_flexible_fee::BifrostWeight<Runtime>;
type ExtraFeeMatcher = ExtraFeeMatcher;
type ParachainId = ParachainInfo;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type XcmWeightAndFeeHandler = XcmInterface;
}

Expand Down Expand Up @@ -1256,10 +1259,7 @@ impl bifrost_salp::Config for Runtime {
type SlotLength = SlotLength;
type VSBondValidPeriod = VSBondValidPeriod;
type WeightInfo = weights::bifrost_salp::BifrostWeight<Runtime>;
type EnsureConfirmAsGovernance = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type EnsureConfirmAsGovernance = EitherOfDiverse<TechAdminOrCouncil, SALPAdmin>;
type XcmInterface = XcmInterface;
type TreasuryAccount = BifrostTreasuryAccount;
type BuybackPalletId = BuybackPalletId;
Expand Down Expand Up @@ -1298,10 +1298,7 @@ impl bifrost_token_issuer::Config for Runtime {

impl bifrost_call_switchgear::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type UpdateOrigin = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type UpdateOrigin = CoreAdminOrCouncil;
type WeightInfo = weights::bifrost_call_switchgear::BifrostWeight<Runtime>;
}

Expand Down Expand Up @@ -1367,10 +1364,7 @@ impl bifrost_slp::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = EitherOfDiverse<TechAdminOrCouncil, ValidatorElection>;
type WeightInfo = weights::bifrost_slp::BifrostWeight<Runtime>;
type VtokenMinting = VtokenMinting;
type BifrostSlpx = Slpx;
Expand All @@ -1391,10 +1385,7 @@ impl bifrost_vstoken_conversion::Config for Runtime {
type MultiCurrency = Currencies;
type RelayCurrencyId = RelayCurrencyId;
type TreasuryAccount = BifrostTreasuryAccount;
type ControlOrigin = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = CoreAdminOrCouncil;
type VsbondAccount = BifrostVsbondPalletId;
type CurrencyIdConversion = AssetIdMaps<Runtime>;
type WeightInfo = weights::bifrost_vstoken_conversion::BifrostWeight<Runtime>;
Expand All @@ -1407,10 +1398,7 @@ parameter_types! {
impl bifrost_farming::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = TechAdminOrCouncil;
type TreasuryAccount = BifrostTreasuryAccount;
type Keeper = FarmingKeeperPalletId;
type RewardIssuer = FarmingRewardIssuerPalletId;
Expand All @@ -1430,10 +1418,7 @@ parameter_types! {
impl bifrost_system_staking::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type EnsureConfirmAsGovernance = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type EnsureConfirmAsGovernance = EitherOfDiverse<CoreAdminOrCouncil, SystemStakingAdmin>;
type WeightInfo = weights::bifrost_system_staking::BifrostWeight<Runtime>;
type FarmingInfo = Farming;
type VtokenMintingInterface = VtokenMinting;
Expand Down Expand Up @@ -1461,15 +1446,15 @@ impl bifrost_system_maker::Config for Runtime {
impl bifrost_fee_share::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = CoreAdminOrCouncil;
type WeightInfo = weights::bifrost_fee_share::BifrostWeight<Runtime>;
type FeeSharePalletId = FeeSharePalletId;
}

impl bifrost_cross_in_out::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type EntrancePalletId = SlpEntrancePalletId;
type WeightInfo = weights::bifrost_cross_in_out::BifrostWeight<Runtime>;
type MaxLengthLimit = MaxLengthLimit;
Expand Down Expand Up @@ -1613,10 +1598,7 @@ parameter_types! {
impl bifrost_vtoken_minting::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = TechAdminOrCouncil;
type MaximumUnlockIdOfUser = MaximumUnlockIdOfUser;
type MaximumUnlockIdOfTimeUnit = MaximumUnlockIdOfTimeUnit;
type EntranceAccount = SlpEntrancePalletId;
Expand All @@ -1637,7 +1619,7 @@ impl bifrost_vtoken_minting::Config for Runtime {

impl bifrost_slpx::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type MultiCurrency = Currencies;
type DexOperator = ZenlinkProtocol;
type VtokenMintingInterface = VtokenMinting;
Expand Down Expand Up @@ -1678,7 +1660,7 @@ impl nutsfinance_stable_asset::Config for Runtime {

impl bifrost_stable_pool::Config for Runtime {
type WeightInfo = weights::bifrost_stable_pool::BifrostWeight<Runtime>;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type CurrencyId = CurrencyId;
type MultiCurrency = Currencies;
type StableAsset = StableAsset;
Expand Down
2 changes: 1 addition & 1 deletion runtime/bifrost-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ parameter_types! {

impl xcm_interface::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type UpdateOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type UpdateOrigin = TechAdminOrCouncil;
type MultiCurrency = Currencies;
type RelayNetwork = RelayNetwork;
type RelaychainCurrencyId = RelayCurrencyId;
Expand Down
14 changes: 12 additions & 2 deletions runtime/bifrost-polkadot/src/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ pub use bifrost_runtime_common::dollar;
mod fellowship;
mod origins;
pub use origins::{
custom_origins, Fellows, FellowshipAdmin, FellowshipExperts, FellowshipInitiates,
custom_origins, CoreAdmin, Fellows, FellowshipAdmin, FellowshipExperts, FellowshipInitiates,
FellowshipMasters, ReferendumCanceller, ReferendumKiller, SALPAdmin, SystemStakingAdmin,
ValidatorElection, WhitelistedCaller, *,
TechAdmin, ValidatorElection, WhitelistedCaller, *,
};
mod tracks;
pub use tracks::TracksInfo;

pub type CoreAdminOrCouncil = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;

pub type TechAdminOrCouncil = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
52 changes: 17 additions & 35 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ use xcm_config::{
use xcm_executor::XcmExecutor;

pub mod governance;
use governance::{custom_origins, CoreAdmin, TechAdmin};
use governance::{
custom_origins, CoreAdminOrCouncil, SALPAdmin, SystemStakingAdmin, TechAdmin,
TechAdminOrCouncil, ValidatorElection,
};

impl_opaque_keys! {
pub struct SessionKeys {
Expand Down Expand Up @@ -681,7 +684,7 @@ parameter_types! {
pub const VotingBondFactor: Balance = deposit(0, 32);
/// Daily council elections
pub const TermDuration: BlockNumber = 7 * DAYS;
pub const DesiredMembers: u32 = 13;
pub const DesiredMembers: u32 = 3;
pub const DesiredRunnersUp: u32 = 20;
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
pub const MaxVoters: u32 = 512;
Expand Down Expand Up @@ -993,7 +996,7 @@ impl bifrost_flexible_fee::Config for Runtime {
type WeightInfo = weights::bifrost_flexible_fee::BifrostWeight<Runtime>;
type ExtraFeeMatcher = ExtraFeeMatcher;
type ParachainId = ParachainInfo;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type XcmWeightAndFeeHandler = XcmInterface;
}

Expand Down Expand Up @@ -1111,10 +1114,7 @@ impl bifrost_salp::Config for Runtime {
type SlotLength = SlotLength;
type VSBondValidPeriod = VSBondValidPeriod;
type WeightInfo = weights::bifrost_salp::BifrostWeight<Runtime>;
type EnsureConfirmAsGovernance = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type EnsureConfirmAsGovernance = EitherOfDiverse<TechAdminOrCouncil, SALPAdmin>;
type XcmInterface = XcmInterface;
type TreasuryAccount = BifrostTreasuryAccount;
type BuybackPalletId = BuybackPalletId;
Expand All @@ -1128,10 +1128,7 @@ impl bifrost_salp::Config for Runtime {

impl bifrost_call_switchgear::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type UpdateOrigin = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type UpdateOrigin = CoreAdminOrCouncil;
type WeightInfo = weights::bifrost_call_switchgear::BifrostWeight<Runtime>;
}

Expand Down Expand Up @@ -1195,10 +1192,7 @@ impl bifrost_slp::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = EitherOfDiverse<TechAdminOrCouncil, ValidatorElection>;
type WeightInfo = weights::bifrost_slp::BifrostWeight<Runtime>;
type VtokenMinting = VtokenMinting;
type BifrostSlpx = Slpx;
Expand All @@ -1223,10 +1217,7 @@ impl bifrost_vstoken_conversion::Config for Runtime {
type MultiCurrency = Currencies;
type RelayCurrencyId = RelayCurrencyId;
type TreasuryAccount = BifrostTreasuryAccount;
type ControlOrigin = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = CoreAdminOrCouncil;
type VsbondAccount = BifrostVsbondPalletId;
type CurrencyIdConversion = AssetIdMaps<Runtime>;
type WeightInfo = weights::bifrost_vstoken_conversion::BifrostWeight<Runtime>;
Expand All @@ -1239,10 +1230,7 @@ parameter_types! {
impl bifrost_farming::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = TechAdminOrCouncil;
type TreasuryAccount = BifrostTreasuryAccount;
type Keeper = FarmingKeeperPalletId;
type RewardIssuer = FarmingRewardIssuerPalletId;
Expand All @@ -1262,10 +1250,7 @@ parameter_types! {
impl bifrost_system_staking::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type EnsureConfirmAsGovernance = EitherOfDiverse<
CoreAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type EnsureConfirmAsGovernance = EitherOfDiverse<CoreAdminOrCouncil, SystemStakingAdmin>;
type WeightInfo = weights::bifrost_system_staking::BifrostWeight<Runtime>;
type FarmingInfo = Farming;
type VtokenMintingInterface = VtokenMinting;
Expand Down Expand Up @@ -1293,23 +1278,23 @@ impl bifrost_system_maker::Config for Runtime {
impl bifrost_fee_share::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = CoreAdminOrCouncil;
type WeightInfo = weights::bifrost_fee_share::BifrostWeight<Runtime>;
type FeeSharePalletId = FeeSharePalletId;
}

impl bifrost_cross_in_out::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type EntrancePalletId = SlpEntrancePalletId;
type WeightInfo = weights::bifrost_cross_in_out::BifrostWeight<Runtime>;
type MaxLengthLimit = MaxLengthLimit;
}

impl bifrost_slpx::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type MultiCurrency = Currencies;
type DexOperator = ZenlinkProtocol;
type VtokenMintingInterface = VtokenMinting;
Expand Down Expand Up @@ -1350,7 +1335,7 @@ impl nutsfinance_stable_asset::Config for Runtime {

impl bifrost_stable_pool::Config for Runtime {
type WeightInfo = weights::bifrost_stable_pool::BifrostWeight<Runtime>;
type ControlOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type ControlOrigin = TechAdminOrCouncil;
type CurrencyId = CurrencyId;
type MultiCurrency = Currencies;
type StableAsset = StableAsset;
Expand Down Expand Up @@ -1450,10 +1435,7 @@ parameter_types! {
impl bifrost_vtoken_minting::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
type ControlOrigin = EitherOfDiverse<
TechAdmin,
EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>,
>;
type ControlOrigin = TechAdminOrCouncil;
type MaximumUnlockIdOfUser = MaximumUnlockIdOfUser;
type MaximumUnlockIdOfTimeUnit = MaximumUnlockIdOfTimeUnit;
type EntranceAccount = SlpEntrancePalletId;
Expand Down
2 changes: 1 addition & 1 deletion runtime/bifrost-polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ parameter_types! {

impl xcm_interface::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type UpdateOrigin = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>;
type UpdateOrigin = TechAdminOrCouncil;
type MultiCurrency = Currencies;
type RelayNetwork = RelayNetwork;
type RelaychainCurrencyId = RelayCurrencyId;
Expand Down
Loading