From cf29013951f8f9bdc2e3903ba350cb020ebd22cc Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 30 Jan 2025 17:24:18 +0000 Subject: [PATCH] Allow GeneralAdmin track when FastGeneralAdmin track is allowed --- runtime/moonbase/src/governance/referenda.rs | 3 ++- runtime/moonbase/src/lib.rs | 11 +++++++---- runtime/moonbase/src/xcm_config.rs | 12 +++++++++--- runtime/moonbeam/src/governance/referenda.rs | 3 ++- runtime/moonbeam/src/lib.rs | 10 +++++++--- runtime/moonbeam/src/xcm_config.rs | 12 +++++++++--- runtime/moonriver/src/governance/referenda.rs | 3 ++- runtime/moonriver/src/lib.rs | 10 +++++++--- runtime/moonriver/src/xcm_config.rs | 12 +++++++++--- 9 files changed, 54 insertions(+), 22 deletions(-) diff --git a/runtime/moonbase/src/governance/referenda.rs b/runtime/moonbase/src/governance/referenda.rs index 21cd96253f..03e078bc2d 100644 --- a/runtime/moonbase/src/governance/referenda.rs +++ b/runtime/moonbase/src/governance/referenda.rs @@ -52,7 +52,8 @@ parameter_types! { pub type GeneralAdminOrRoot = EitherOf, origins::GeneralAdmin>; /// The policy allows for Root or FastGeneralAdmin. -pub type FastGeneralAdminOrRoot = EitherOf, origins::FastGeneralAdmin>; +pub type FastGeneralAdminOrRoot = + EitherOf, EitherOf>; impl custom_origins::Config for Runtime {} diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index 5cd1c82cc1..c916b25c9d 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -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, @@ -1122,7 +1122,10 @@ pub type ForeignAssetMigratorOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; diff --git a/runtime/moonbase/src/xcm_config.rs b/runtime/moonbase/src/xcm_config.rs index 935194b4bd..18a1b8a29a 100644 --- a/runtime/moonbase/src/xcm_config.rs +++ b/runtime/moonbase/src/xcm_config.rs @@ -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}; @@ -699,7 +699,10 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; @@ -730,7 +733,10 @@ pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; diff --git a/runtime/moonbeam/src/governance/referenda.rs b/runtime/moonbeam/src/governance/referenda.rs index 62720a0d60..ae7ca1c524 100644 --- a/runtime/moonbeam/src/governance/referenda.rs +++ b/runtime/moonbeam/src/governance/referenda.rs @@ -51,7 +51,8 @@ parameter_types! { // Origin for general admin or root pub type GeneralAdminOrRoot = EitherOf, origins::GeneralAdmin>; // The policy allows for Root or FastGeneralAdmin. -pub type FastGeneralAdminOrRoot = EitherOf, origins::FastGeneralAdmin>; +pub type FastGeneralAdminOrRoot = + EitherOf, EitherOf>; impl custom_origins::Config for Runtime {} diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index 9190d2804a..ea2f2c2090 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -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, @@ -1118,7 +1119,10 @@ pub type ForeignAssetMigratorOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; diff --git a/runtime/moonbeam/src/xcm_config.rs b/runtime/moonbeam/src/xcm_config.rs index fe9d62b2c6..b0bc7c0d98 100644 --- a/runtime/moonbeam/src/xcm_config.rs +++ b/runtime/moonbeam/src/xcm_config.rs @@ -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::{ @@ -685,7 +685,10 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; @@ -716,7 +719,10 @@ pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; diff --git a/runtime/moonriver/src/governance/referenda.rs b/runtime/moonriver/src/governance/referenda.rs index d3c06af793..be271ce5f9 100644 --- a/runtime/moonriver/src/governance/referenda.rs +++ b/runtime/moonriver/src/governance/referenda.rs @@ -51,7 +51,8 @@ parameter_types! { // Origin for general admin or root pub type GeneralAdminOrRoot = EitherOf, origins::GeneralAdmin>; // The policy allows for Root or FastGeneralAdmin. -pub type FastGeneralAdminOrRoot = EitherOf, origins::FastGeneralAdmin>; +pub type FastGeneralAdminOrRoot = + EitherOf, EitherOf>; impl custom_origins::Config for Runtime {} diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index e8c82f3377..b6b28c81ae 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -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, @@ -1126,7 +1127,10 @@ pub type ForeignAssetMigratorOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; diff --git a/runtime/moonriver/src/xcm_config.rs b/runtime/moonriver/src/xcm_config.rs index fc3e0b6e67..dee3e35a1b 100644 --- a/runtime/moonriver/src/xcm_config.rs +++ b/runtime/moonriver/src/xcm_config.rs @@ -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::{ @@ -698,7 +698,10 @@ pub type ForeignAssetManagerOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >; @@ -729,7 +732,10 @@ pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse< EnsureRoot, EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, - governance::custom_origins::FastGeneralAdmin, + EitherOf< + governance::custom_origins::GeneralAdmin, + governance::custom_origins::FastGeneralAdmin, + >, >, >;