From 363f83bdb1ef8d5e0d49500cd95aab9aa45adf63 Mon Sep 17 00:00:00 2001 From: yooml Date: Wed, 11 Oct 2023 17:38:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20gov?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/bifrost-kusama/src/governance/mod.rs | 14 ++++- runtime/bifrost-kusama/src/lib.rs | 52 ++++++------------- runtime/bifrost-kusama/src/xcm_config.rs | 2 +- .../bifrost-polkadot/src/governance/mod.rs | 14 ++++- runtime/bifrost-polkadot/src/lib.rs | 52 ++++++------------- runtime/bifrost-polkadot/src/xcm_config.rs | 2 +- 6 files changed, 60 insertions(+), 76 deletions(-) diff --git a/runtime/bifrost-kusama/src/governance/mod.rs b/runtime/bifrost-kusama/src/governance/mod.rs index 2d21427b5..019de14ae 100644 --- a/runtime/bifrost-kusama/src/governance/mod.rs +++ b/runtime/bifrost-kusama/src/governance/mod.rs @@ -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, +>; + +pub type TechAdminOrCouncil = EitherOfDiverse< + TechAdmin, + EitherOfDiverse, +>; diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index 9e41efc41..4a53cfe8c 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -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; @@ -711,7 +714,7 @@ parameter_types! { pub VotingBondFactor: Balance = deposit::(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; @@ -1137,7 +1140,7 @@ impl bifrost_flexible_fee::Config for Runtime { type WeightInfo = weights::bifrost_flexible_fee::BifrostWeight; type ExtraFeeMatcher = ExtraFeeMatcher; type ParachainId = ParachainInfo; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type XcmWeightAndFeeHandler = XcmInterface; } @@ -1256,10 +1259,7 @@ impl bifrost_salp::Config for Runtime { type SlotLength = SlotLength; type VSBondValidPeriod = VSBondValidPeriod; type WeightInfo = weights::bifrost_salp::BifrostWeight; - type EnsureConfirmAsGovernance = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type EnsureConfirmAsGovernance = EitherOfDiverse; type XcmInterface = XcmInterface; type TreasuryAccount = BifrostTreasuryAccount; type BuybackPalletId = BuybackPalletId; @@ -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, - >; + type UpdateOrigin = CoreAdminOrCouncil; type WeightInfo = weights::bifrost_call_switchgear::BifrostWeight; } @@ -1367,10 +1364,7 @@ impl bifrost_slp::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type ControlOrigin = EitherOfDiverse; type WeightInfo = weights::bifrost_slp::BifrostWeight; type VtokenMinting = VtokenMinting; type BifrostSlpx = Slpx; @@ -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, - >; + type ControlOrigin = CoreAdminOrCouncil; type VsbondAccount = BifrostVsbondPalletId; type CurrencyIdConversion = AssetIdMaps; type WeightInfo = weights::bifrost_vstoken_conversion::BifrostWeight; @@ -1407,10 +1398,7 @@ parameter_types! { impl bifrost_farming::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type ControlOrigin = TechAdminOrCouncil; type TreasuryAccount = BifrostTreasuryAccount; type Keeper = FarmingKeeperPalletId; type RewardIssuer = FarmingRewardIssuerPalletId; @@ -1430,10 +1418,7 @@ parameter_types! { impl bifrost_system_staking::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type EnsureConfirmAsGovernance = EitherOfDiverse< - CoreAdmin, - EitherOfDiverse, - >; + type EnsureConfirmAsGovernance = EitherOfDiverse; type WeightInfo = weights::bifrost_system_staking::BifrostWeight; type FarmingInfo = Farming; type VtokenMintingInterface = VtokenMinting; @@ -1461,7 +1446,7 @@ impl bifrost_system_maker::Config for Runtime { impl bifrost_fee_share::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = CoreAdminOrCouncil; type WeightInfo = weights::bifrost_fee_share::BifrostWeight; type FeeSharePalletId = FeeSharePalletId; } @@ -1469,7 +1454,7 @@ impl bifrost_fee_share::Config for Runtime { impl bifrost_cross_in_out::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type EntrancePalletId = SlpEntrancePalletId; type WeightInfo = weights::bifrost_cross_in_out::BifrostWeight; type MaxLengthLimit = MaxLengthLimit; @@ -1613,10 +1598,7 @@ parameter_types! { impl bifrost_vtoken_minting::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type ControlOrigin = TechAdminOrCouncil; type MaximumUnlockIdOfUser = MaximumUnlockIdOfUser; type MaximumUnlockIdOfTimeUnit = MaximumUnlockIdOfTimeUnit; type EntranceAccount = SlpEntrancePalletId; @@ -1637,7 +1619,7 @@ impl bifrost_vtoken_minting::Config for Runtime { impl bifrost_slpx::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type MultiCurrency = Currencies; type DexOperator = ZenlinkProtocol; type VtokenMintingInterface = VtokenMinting; @@ -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; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type CurrencyId = CurrencyId; type MultiCurrency = Currencies; type StableAsset = StableAsset; diff --git a/runtime/bifrost-kusama/src/xcm_config.rs b/runtime/bifrost-kusama/src/xcm_config.rs index 73f556869..1661bb3ee 100644 --- a/runtime/bifrost-kusama/src/xcm_config.rs +++ b/runtime/bifrost-kusama/src/xcm_config.rs @@ -905,7 +905,7 @@ parameter_types! { impl xcm_interface::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type UpdateOrigin = EitherOfDiverse; + type UpdateOrigin = TechAdminOrCouncil; type MultiCurrency = Currencies; type RelayNetwork = RelayNetwork; type RelaychainCurrencyId = RelayCurrencyId; diff --git a/runtime/bifrost-polkadot/src/governance/mod.rs b/runtime/bifrost-polkadot/src/governance/mod.rs index 2d21427b5..019de14ae 100644 --- a/runtime/bifrost-polkadot/src/governance/mod.rs +++ b/runtime/bifrost-polkadot/src/governance/mod.rs @@ -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, +>; + +pub type TechAdminOrCouncil = EitherOfDiverse< + TechAdmin, + EitherOfDiverse, +>; diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 082e2fe48..6762c60dd 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -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 { @@ -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; @@ -993,7 +996,7 @@ impl bifrost_flexible_fee::Config for Runtime { type WeightInfo = weights::bifrost_flexible_fee::BifrostWeight; type ExtraFeeMatcher = ExtraFeeMatcher; type ParachainId = ParachainInfo; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type XcmWeightAndFeeHandler = XcmInterface; } @@ -1111,10 +1114,7 @@ impl bifrost_salp::Config for Runtime { type SlotLength = SlotLength; type VSBondValidPeriod = VSBondValidPeriod; type WeightInfo = weights::bifrost_salp::BifrostWeight; - type EnsureConfirmAsGovernance = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type EnsureConfirmAsGovernance = EitherOfDiverse; type XcmInterface = XcmInterface; type TreasuryAccount = BifrostTreasuryAccount; type BuybackPalletId = BuybackPalletId; @@ -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, - >; + type UpdateOrigin = CoreAdminOrCouncil; type WeightInfo = weights::bifrost_call_switchgear::BifrostWeight; } @@ -1195,10 +1192,7 @@ impl bifrost_slp::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type ControlOrigin = EitherOfDiverse; type WeightInfo = weights::bifrost_slp::BifrostWeight; type VtokenMinting = VtokenMinting; type BifrostSlpx = Slpx; @@ -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, - >; + type ControlOrigin = CoreAdminOrCouncil; type VsbondAccount = BifrostVsbondPalletId; type CurrencyIdConversion = AssetIdMaps; type WeightInfo = weights::bifrost_vstoken_conversion::BifrostWeight; @@ -1239,10 +1230,7 @@ parameter_types! { impl bifrost_farming::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type ControlOrigin = TechAdminOrCouncil; type TreasuryAccount = BifrostTreasuryAccount; type Keeper = FarmingKeeperPalletId; type RewardIssuer = FarmingRewardIssuerPalletId; @@ -1262,10 +1250,7 @@ parameter_types! { impl bifrost_system_staking::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type EnsureConfirmAsGovernance = EitherOfDiverse< - CoreAdmin, - EitherOfDiverse, - >; + type EnsureConfirmAsGovernance = EitherOfDiverse; type WeightInfo = weights::bifrost_system_staking::BifrostWeight; type FarmingInfo = Farming; type VtokenMintingInterface = VtokenMinting; @@ -1293,7 +1278,7 @@ impl bifrost_system_maker::Config for Runtime { impl bifrost_fee_share::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = CoreAdminOrCouncil; type WeightInfo = weights::bifrost_fee_share::BifrostWeight; type FeeSharePalletId = FeeSharePalletId; } @@ -1301,7 +1286,7 @@ impl bifrost_fee_share::Config for Runtime { impl bifrost_cross_in_out::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type EntrancePalletId = SlpEntrancePalletId; type WeightInfo = weights::bifrost_cross_in_out::BifrostWeight; type MaxLengthLimit = MaxLengthLimit; @@ -1309,7 +1294,7 @@ impl bifrost_cross_in_out::Config for Runtime { impl bifrost_slpx::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type MultiCurrency = Currencies; type DexOperator = ZenlinkProtocol; type VtokenMintingInterface = VtokenMinting; @@ -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; - type ControlOrigin = EitherOfDiverse; + type ControlOrigin = TechAdminOrCouncil; type CurrencyId = CurrencyId; type MultiCurrency = Currencies; type StableAsset = StableAsset; @@ -1450,10 +1435,7 @@ parameter_types! { impl bifrost_vtoken_minting::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; - type ControlOrigin = EitherOfDiverse< - TechAdmin, - EitherOfDiverse, - >; + type ControlOrigin = TechAdminOrCouncil; type MaximumUnlockIdOfUser = MaximumUnlockIdOfUser; type MaximumUnlockIdOfTimeUnit = MaximumUnlockIdOfTimeUnit; type EntranceAccount = SlpEntrancePalletId; diff --git a/runtime/bifrost-polkadot/src/xcm_config.rs b/runtime/bifrost-polkadot/src/xcm_config.rs index 50e4f6c87..809744930 100644 --- a/runtime/bifrost-polkadot/src/xcm_config.rs +++ b/runtime/bifrost-polkadot/src/xcm_config.rs @@ -718,7 +718,7 @@ parameter_types! { impl xcm_interface::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type UpdateOrigin = EitherOfDiverse; + type UpdateOrigin = TechAdminOrCouncil; type MultiCurrency = Currencies; type RelayNetwork = RelayNetwork; type RelaychainCurrencyId = RelayCurrencyId;