diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 8df40f677f68a4046179b3b0da4adcaf9e564ddb..ed9b50fae202f42483f0175317a308a11f77f9fa 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -938,7 +938,7 @@ impl pallet_asset_rewards::Config for Runtime { type Balance = Balance; type Assets = NativeAndAllAssets; type AssetId = xcm::v3::Location; - type PermissionedOrigin = EnsureWithSuccess< + type CreatePoolOrigin = EnsureWithSuccess< EitherOfDiverse< EnsureRoot<AccountId>, EnsureXcm<IsVoiceOfBody<GovernanceLocation, TreasurerBodyId>>, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index b6b4f7eab3d10f92b0395441a663b98598e72617..2319e6cd8a691cac4a348f63202b1460f4688e37 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -393,7 +393,7 @@ impl pallet_asset_rewards::Config for Runtime { type Balance = Balance; type Assets = NativeAndAllAssets; type AssetId = xcm::v3::Location; - type PermissionedOrigin = EnsureWithSuccess< + type CreatePoolOrigin = EnsureWithSuccess< EitherOfDiverse< EnsureRoot<AccountId>, EnsureXcm<IsVoiceOfBody<GovernanceLocation, TreasurerBodyId>>, diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 096b43a3739abb785bdd0a73b026c1eff5019cd9..26feeaf28136180c8b29b1567a493fb56a33252e 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1782,7 +1782,7 @@ impl pallet_asset_rewards::Config for Runtime { type Balance = u128; type Assets = NativeAndAssets; type PalletId = StakingRewardsPalletId; - type PermissionedOrigin = AssetRewardsPermissionedOrigin; + type CreatePoolOrigin = AssetRewardsPermissionedOrigin; type WeightInfo = (); #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = AssetRewardsBenchmarkHelper; diff --git a/substrate/frame/asset-rewards/src/benchmarking.rs b/substrate/frame/asset-rewards/src/benchmarking.rs index 278c2a2e7bff2098a38b7dd244f7ec7ebbe3c24b..2ebae50d5c7fe3b7282474e117e73ea579c900a8 100644 --- a/substrate/frame/asset-rewards/src/benchmarking.rs +++ b/substrate/frame/asset-rewards/src/benchmarking.rs @@ -17,7 +17,7 @@ //! Asset Rewards pallet benchmarking. //! -//! Note: these benchmarks assume that Root passes the `PermissionedOrigin` checks. +//! Note: these benchmarks assume that Root passes the `CreatePoolOrigin` checks. use super::*; use crate::Pallet as AssetRewards; @@ -87,7 +87,7 @@ mod benchmarks { fn create_pool() { use super::*; - let root_acc = T::PermissionedOrigin::ensure_origin(Root.into()).unwrap(); + let root_acc = T::CreatePoolOrigin::ensure_origin(Root.into()).unwrap(); let staked_asset = T::BenchmarkHelper::to_asset_id(1); let reward_asset = T::BenchmarkHelper::to_asset_id(2); create_and_mint_asset::<T>( @@ -114,7 +114,7 @@ mod benchmarks { assert_last_event::<T>( Event::PoolCreated { creator: root_acc.clone(), - admin: root_acc, + admin: Some(root_acc), staked_asset_id: staked_asset, reward_asset_id: reward_asset, reward_rate_per_block: 100u32.into(), @@ -328,7 +328,9 @@ mod benchmarks { #[extrinsic_call] _(Root, 0u32.into(), new_admin.clone()); - assert_last_event::<T>(Event::PoolAdminModified { pool_id: 0u32.into(), new_admin }.into()); + assert_last_event::<T>( + Event::PoolAdminModified { pool_id: 0u32.into(), new_admin: Some(new_admin) }.into(), + ); } #[benchmark] diff --git a/substrate/frame/asset-rewards/src/lib.rs b/substrate/frame/asset-rewards/src/lib.rs index d15abb28d4630c8720aeea26e12800a6398a1004..692d54c708b85cedc7d6f2fd60257748b3222106 100644 --- a/substrate/frame/asset-rewards/src/lib.rs +++ b/substrate/frame/asset-rewards/src/lib.rs @@ -193,7 +193,7 @@ pub mod pallet { /// /// The Origin must return an AccountId. This can be achieved for any Origin by wrapping it /// with `EnsureSuccess`. - type PermissionedOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>; + type CreatePoolOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>; /// Registry of assets that can be configured to either stake for rewards, or be offered as /// rewards for staking. @@ -333,7 +333,7 @@ pub mod pallet { admin: Option<T::AccountId>, ) -> DispatchResult { // Check the origin. - let creator = T::PermissionedOrigin::ensure_origin(origin.clone())?; + let creator = T::CreatePoolOrigin::ensure_origin(origin.clone())?; // Ensure the assets exist. ensure!( @@ -507,7 +507,7 @@ pub mod pallet { pool_id: PoolId, new_reward_rate_per_block: T::Balance, ) -> DispatchResult { - let caller = T::PermissionedOrigin::ensure_origin(origin.clone()) + let caller = T::CreatePoolOrigin::ensure_origin(origin.clone()) .or_else(|_| ensure_signed(origin))?; let pool_info = Pools::<T>::get(pool_id).ok_or(Error::<T>::NonExistentPool)?; @@ -537,7 +537,7 @@ pub mod pallet { pool_id: PoolId, new_admin: T::AccountId, ) -> DispatchResult { - let caller = T::PermissionedOrigin::ensure_origin(origin.clone()) + let caller = T::CreatePoolOrigin::ensure_origin(origin.clone()) .or_else(|_| ensure_signed(origin))?; let mut pool_info = Pools::<T>::get(pool_id).ok_or(Error::<T>::NonExistentPool)?; @@ -559,7 +559,7 @@ pub mod pallet { pool_id: PoolId, new_expiry_block: BlockNumberFor<T>, ) -> DispatchResult { - let caller = T::PermissionedOrigin::ensure_origin(origin.clone()) + let caller = T::CreatePoolOrigin::ensure_origin(origin.clone()) .or_else(|_| ensure_signed(origin))?; ensure!( @@ -616,7 +616,7 @@ pub mod pallet { amount: T::Balance, dest: T::AccountId, ) -> DispatchResult { - let caller = T::PermissionedOrigin::ensure_origin(origin.clone()) + let caller = T::CreatePoolOrigin::ensure_origin(origin.clone()) .or_else(|_| ensure_signed(origin))?; let pool_info = Pools::<T>::get(pool_id).ok_or(Error::<T>::NonExistentPool)?; diff --git a/substrate/frame/asset-rewards/src/mock.rs b/substrate/frame/asset-rewards/src/mock.rs index 32f1c7913d9e38948133541748ce07abfb9a5f8f..ac643bdf685b84b86898535e48e7221181e8ddaf 100644 --- a/substrate/frame/asset-rewards/src/mock.rs +++ b/substrate/frame/asset-rewards/src/mock.rs @@ -149,7 +149,7 @@ impl Config for MockRuntime { type Balance = <Self as pallet_balances::Config>::Balance; type Assets = NativeAndAssets; type PalletId = StakingRewardsPalletId; - type PermissionedOrigin = MockPermissionedOrigin; + type CreatePoolOrigin = MockPermissionedOrigin; type WeightInfo = (); #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = AssetRewardsBenchmarkHelper;