Skip to content

Commit

Permalink
Allow GeneralAdmin track when FastGeneralAdmin track is allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
RomarQ committed Jan 30, 2025
1 parent 14374c1 commit cf29013
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 22 deletions.
3 changes: 2 additions & 1 deletion runtime/moonbase/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ parameter_types! {
pub type GeneralAdminOrRoot = EitherOf<EnsureRoot<AccountId>, origins::GeneralAdmin>;

/// The policy allows for Root or FastGeneralAdmin.
pub type FastGeneralAdminOrRoot = EitherOf<EnsureRoot<AccountId>, origins::FastGeneralAdmin>;
pub type FastGeneralAdminOrRoot =
EitherOf<EnsureRoot<AccountId>, EitherOf<origins::GeneralAdmin, origins::FastGeneralAdmin>>;

impl custom_origins::Config for Runtime {}

Expand Down
11 changes: 7 additions & 4 deletions runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ use frame_support::{
traits::{
fungible::{Balanced, Credit, HoldConsideration, Inspect},
tokens::{PayFromAccount, UnityAssetBalanceConversion},
ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse,
EqualPrivilegeOnly, FindAuthor, InstanceFilter, LinearStoragePrice, OnFinalize,
OnUnbalanced,
ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOf,
EitherOfDiverse, EqualPrivilegeOnly, FindAuthor, InstanceFilter, LinearStoragePrice,
OnFinalize, OnUnbalanced,
},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
Expand Down Expand Up @@ -1122,7 +1122,10 @@ pub type ForeignAssetMigratorOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down
12 changes: 9 additions & 3 deletions runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use sp_runtime::{

use frame_support::{
parameter_types,
traits::{EitherOfDiverse, Everything, Nothing, PalletInfoAccess, TransformOrigin},
traits::{EitherOf, EitherOfDiverse, Everything, Nothing, PalletInfoAccess, TransformOrigin},
};

use frame_system::{EnsureRoot, RawOrigin};
Expand Down Expand Up @@ -699,7 +699,10 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down Expand Up @@ -730,7 +733,10 @@ pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down
3 changes: 2 additions & 1 deletion runtime/moonbeam/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ parameter_types! {
// Origin for general admin or root
pub type GeneralAdminOrRoot = EitherOf<EnsureRoot<AccountId>, origins::GeneralAdmin>;
// The policy allows for Root or FastGeneralAdmin.
pub type FastGeneralAdminOrRoot = EitherOf<EnsureRoot<AccountId>, origins::FastGeneralAdmin>;
pub type FastGeneralAdminOrRoot =
EitherOf<EnsureRoot<AccountId>, EitherOf<origins::GeneralAdmin, origins::FastGeneralAdmin>>;

impl custom_origins::Config for Runtime {}

Expand Down
10 changes: 7 additions & 3 deletions runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ use frame_support::{
traits::{
fungible::{Balanced, Credit, HoldConsideration, Inspect},
tokens::{PayFromAccount, UnityAssetBalanceConversion},
ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse,
EqualPrivilegeOnly, InstanceFilter, LinearStoragePrice, OnFinalize, OnUnbalanced,
ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOf,
EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, LinearStoragePrice, OnFinalize,
OnUnbalanced,
},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
Expand Down Expand Up @@ -1118,7 +1119,10 @@ pub type ForeignAssetMigratorOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down
12 changes: 9 additions & 3 deletions runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use super::{
use super::moonbeam_weights;
use frame_support::{
parameter_types,
traits::{EitherOfDiverse, Everything, Nothing, PalletInfoAccess, TransformOrigin},
traits::{EitherOf, EitherOfDiverse, Everything, Nothing, PalletInfoAccess, TransformOrigin},
};
use moonkit_xcm_primitives::AccountIdAssetIdConversion;
use sp_runtime::{
Expand Down Expand Up @@ -685,7 +685,10 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down Expand Up @@ -716,7 +719,10 @@ pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down
3 changes: 2 additions & 1 deletion runtime/moonriver/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ parameter_types! {
// Origin for general admin or root
pub type GeneralAdminOrRoot = EitherOf<EnsureRoot<AccountId>, origins::GeneralAdmin>;
// The policy allows for Root or FastGeneralAdmin.
pub type FastGeneralAdminOrRoot = EitherOf<EnsureRoot<AccountId>, origins::FastGeneralAdmin>;
pub type FastGeneralAdminOrRoot =
EitherOf<EnsureRoot<AccountId>, EitherOf<origins::GeneralAdmin, origins::FastGeneralAdmin>>;

impl custom_origins::Config for Runtime {}

Expand Down
10 changes: 7 additions & 3 deletions runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ use frame_support::{
traits::{
fungible::{Balanced, Credit, HoldConsideration, Inspect},
tokens::{PayFromAccount, UnityAssetBalanceConversion},
ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse,
EqualPrivilegeOnly, InstanceFilter, LinearStoragePrice, OnFinalize, OnUnbalanced,
ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOf,
EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, LinearStoragePrice, OnFinalize,
OnUnbalanced,
},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
Expand Down Expand Up @@ -1126,7 +1127,10 @@ pub type ForeignAssetMigratorOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down
12 changes: 9 additions & 3 deletions runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use super::{
use super::moonriver_weights;
use frame_support::{
parameter_types,
traits::{EitherOfDiverse, Everything, Nothing, PalletInfoAccess, TransformOrigin},
traits::{EitherOf, EitherOfDiverse, Everything, Nothing, PalletInfoAccess, TransformOrigin},
};
use moonkit_xcm_primitives::AccountIdAssetIdConversion;
use sp_runtime::{
Expand Down Expand Up @@ -698,7 +698,10 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down Expand Up @@ -729,7 +732,10 @@ pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::FastGeneralAdmin,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

Expand Down

0 comments on commit cf29013

Please sign in to comment.