Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(gov): normalize FastGeneralAdmin track origin for creating new foreign assets #3159

Merged
merged 5 commits into from
Jan 31, 2025
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
5 changes: 3 additions & 2 deletions runtime/moonbase/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ 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>;
/// The policy allows for Root, GeneralAdmin or 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 @@ -67,9 +67,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 @@ -1124,7 +1124,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
33 changes: 26 additions & 7 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 All @@ -726,18 +729,34 @@ impl frame_support::traits::Contains<Location> for AssetFeesFilter {
}
}

pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
EitherOf<
governance::custom_origins::GeneralAdmin,
governance::custom_origins::FastGeneralAdmin,
>,
>,
>;

pub type RemoveSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
>;

impl pallet_xcm_weight_trader::Config for Runtime {
type AccountIdToLocation = AccountIdToLocation<AccountId>;
type AddSupportedAssetOrigin = EnsureRoot<AccountId>;
type AddSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type AssetLocationFilter = AssetFeesFilter;
type AssetTransactor = AssetTransactors;
type Balance = Balance;
type EditSupportedAssetOrigin = EnsureRoot<AccountId>;
type EditSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type NativeLocation = SelfReserve;
type PauseSupportedAssetOrigin = EnsureRoot<AccountId>;
type RemoveSupportedAssetOrigin = EnsureRoot<AccountId>;
type PauseSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type ResumeSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type RemoveSupportedAssetOrigin = RemoveSupportedAssetOrigin;
type RuntimeEvent = RuntimeEvent;
type ResumeSupportedAssetOrigin = EnsureRoot<AccountId>;
type WeightInfo = moonbase_weights::pallet_xcm_weight_trader::WeightInfo<Runtime>;
type WeightToFee = <Runtime as pallet_transaction_payment::Config>::WeightToFee;
type XcmFeesAccount = XcmFeesAccount;
Expand Down
5 changes: 3 additions & 2 deletions runtime/moonbeam/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ 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>;
/// The policy allows for Root, GeneralAdmin or 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 @@ -1120,7 +1121,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
30 changes: 14 additions & 16 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 All @@ -712,19 +715,14 @@ impl frame_support::traits::Contains<Location> for AssetFeesFilter {
}
}

pub type AddSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::GeneralAdmin,
>,
>;

pub type EditSupportedAssetOrigin = EitherOfDiverse<
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 All @@ -735,16 +733,16 @@ pub type RemoveSupportedAssetOrigin = EitherOfDiverse<

impl pallet_xcm_weight_trader::Config for Runtime {
type AccountIdToLocation = AccountIdToLocation<AccountId>;
type AddSupportedAssetOrigin = AddSupportedAssetOrigin;
type AddSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type AssetLocationFilter = AssetFeesFilter;
type AssetTransactor = AssetTransactors;
type Balance = Balance;
type EditSupportedAssetOrigin = EditSupportedAssetOrigin;
type EditSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type NativeLocation = SelfReserve;
type PauseSupportedAssetOrigin = EditSupportedAssetOrigin;
type PauseSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type ResumeSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type RemoveSupportedAssetOrigin = RemoveSupportedAssetOrigin;
type RuntimeEvent = RuntimeEvent;
type ResumeSupportedAssetOrigin = RemoveSupportedAssetOrigin;
type WeightInfo = moonbeam_weights::pallet_xcm_weight_trader::WeightInfo<Runtime>;
type WeightToFee = <Runtime as pallet_transaction_payment::Config>::WeightToFee;
type XcmFeesAccount = XcmFeesAccount;
Expand Down
5 changes: 3 additions & 2 deletions runtime/moonriver/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ 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>;
/// The policy allows for Root, GeneralAdmin or 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 @@ -1128,7 +1129,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
31 changes: 14 additions & 17 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 All @@ -725,19 +728,14 @@ impl frame_support::traits::Contains<Location> for AssetFeesFilter {
}
}

pub type AddSupportedAssetOrigin = EitherOfDiverse<
pub type AddAndEditSupportedAssetOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, OpenTechCommitteeInstance, 5, 9>,
governance::custom_origins::GeneralAdmin,
>,
>;

pub type EditSupportedAssetOrigin = 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 All @@ -748,17 +746,16 @@ pub type RemoveSupportedAssetOrigin = EitherOfDiverse<

impl pallet_xcm_weight_trader::Config for Runtime {
type AccountIdToLocation = AccountIdToLocation<AccountId>;
type AddSupportedAssetOrigin = AddSupportedAssetOrigin;
type AddSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type AssetLocationFilter = AssetFeesFilter;
type AssetTransactor = AssetTransactors;
type Balance = Balance;
type EditSupportedAssetOrigin = EditSupportedAssetOrigin;
type EditSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type NativeLocation = SelfReserve;
type PauseSupportedAssetOrigin = EditSupportedAssetOrigin;
type PauseSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type ResumeSupportedAssetOrigin = AddAndEditSupportedAssetOrigin;
type RemoveSupportedAssetOrigin = RemoveSupportedAssetOrigin;
type RuntimeEvent = RuntimeEvent;
type ResumeSupportedAssetOrigin = RemoveSupportedAssetOrigin;

type WeightInfo = moonriver_weights::pallet_xcm_weight_trader::WeightInfo<Runtime>;
type WeightToFee = <Runtime as pallet_transaction_payment::Config>::WeightToFee;
type XcmFeesAccount = XcmFeesAccount;
Expand Down
Loading