Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
29a3125
Fellowship into Collectives
muharem Feb 15, 2023
11bad7b
Merge remote-tracking branch 'origin/master' into muharem-collectives…
muharem Feb 15, 2023
2d6f124
cargo.lock
muharem Feb 15, 2023
2ccb3d7
tracks alias
muharem Feb 15, 2023
a1332a9
allow to send Fellows origin over XCM
muharem Feb 15, 2023
63d799c
update todos, remove duplication of type
muharem Feb 15, 2023
916997a
use Collectives location for Fellows body
muharem Feb 15, 2023
7b772d2
alias for ranks constants
muharem Feb 16, 2023
97f6629
benchmarks
muharem Feb 16, 2023
1f9cfdd
proxy for Fellowship
muharem Feb 16, 2023
34a7bd3
docs
muharem Feb 16, 2023
6ece4f3
correct copyright date
muharem Feb 20, 2023
7213d57
Apply suggestions from code review
muharem Feb 25, 2023
ea0abd1
Merge remote-tracking branch 'origin/master' into muharem-collectives…
muharem Feb 25, 2023
0b82eaf
rustfmt
muharem Feb 25, 2023
03f5c87
remove council, update origins
muharem Feb 25, 2023
73a2f36
renames
muharem Feb 25, 2023
58c986e
remove tech committee from promote origin
muharem Feb 25, 2023
c0fe803
renames
muharem Feb 26, 2023
ea1cc24
Fellowship import
muharem Feb 26, 2023
7905206
test
muharem Feb 27, 2023
14622ac
rename mod
muharem Feb 27, 2023
f61fb92
fix import
muharem Mar 6, 2023
9e363bc
updated addresses (only ss58 version)
muharem Mar 6, 2023
ec5a4ec
update addresses
muharem Mar 6, 2023
8127b8f
doc nits
joepetrowski Mar 6, 2023
9499e4f
Merge remote-tracking branch 'origin/master' into muharem-collectives…
muharem Mar 6, 2023
45a5976
weights with new api
muharem Mar 6, 2023
8453d33
Merge remote-tracking branch 'origin/muharem-collectives-fellowship' …
muharem Mar 6, 2023
a45f78a
update addresses
muharem Mar 6, 2023
4ba12cb
fix try runtime
muharem Mar 6, 2023
15aaa70
update addresses
muharem Mar 10, 2023
43b2e33
Merge remote-tracking branch 'origin/master' into muharem-fellowship-…
muharem Mar 21, 2023
ad89df1
Merge remote-tracking branch 'origin/master' into muharem-fellowship-…
Apr 3, 2023
6a32bbe
use pallet api to import the members
muharem Apr 5, 2023
7e75e5d
Merge remote-tracking branch 'origin/master' into muharem-fellowship-…
muharem Apr 5, 2023
f46644f
merge fix
muharem Apr 5, 2023
42b1ca9
hex-literal version
muharem Apr 5, 2023
66a61d0
add Bradley to the 1 rank
muharem Apr 9, 2023
4e9401f
Merge remote-tracking branch 'origin/master' into muharem-fellowship-…
muharem Apr 9, 2023
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
Prev Previous commit
Next Next commit
renames
  • Loading branch information
muharem committed Feb 26, 2023
commit c0fe803909a05cd09603e277e67b77d27430d5b4
6 changes: 3 additions & 3 deletions parachains/runtimes/assets/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use parachains_common::{
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{KsmLocation, XcmConfig};
use xcm_config::{FellowshipLocation, GovernanceLocation, XcmConfig};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand Down Expand Up @@ -466,7 +466,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<KsmLocation, FellowsBodyId>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;
type ControllerOriginConverter = xcm_config::XcmOriginToTransactDispatchOrigin;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
Expand Down Expand Up @@ -517,7 +517,7 @@ parameter_types! {
/// We allow root the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<KsmLocation, StakingAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;

impl pallet_collator_selection::Config for Runtime {
Expand Down
2 changes: 2 additions & 0 deletions parachains/runtimes/assets/statemine/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ parameter_types! {
pub TrustBackedAssetsPalletLocation: MultiLocation =
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub const FellowshipLocation: MultiLocation = MultiLocation::parent();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down
8 changes: 5 additions & 3 deletions parachains/runtimes/assets/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ use parachains_common::{
Signature, StatemintAuraId as AuraId, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{CollectivesLocation, DotLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{
FellowshipLocation, GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin,
};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand Down Expand Up @@ -482,7 +484,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<CollectivesLocation, FellowsBodyId>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type PriceForSiblingDelivery = ();
Expand Down Expand Up @@ -532,7 +534,7 @@ parameter_types! {
/// We allow root and the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<DotLocation, StakingAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;

impl pallet_collator_selection::Config for Runtime {
Expand Down
3 changes: 2 additions & 1 deletion parachains/runtimes/assets/statemint/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ parameter_types! {
pub TrustBackedAssetsPalletLocation: MultiLocation =
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub CollectivesLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down
11 changes: 6 additions & 5 deletions parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ use frame_system::{
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{
FellowshipLocation, GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin,
};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand All @@ -67,12 +69,11 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

// XCM Imports
use crate::xcm_config::KsmRelayLocation;
use parachains_common::{
opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
// XCM Imports
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -295,7 +296,7 @@ parameter_types! {
/// Privileged origin that represents Root or Fellows pluralistic body.
pub type RootOrFellows = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<KsmRelayLocation, FellowsBodyId>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;

impl cumulus_pallet_xcmp_queue::Config for Runtime {
Expand Down Expand Up @@ -349,7 +350,7 @@ parameter_types! {
/// We allow root, the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<KsmRelayLocation, StakingAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;

impl pallet_collator_selection::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ parameter_types! {
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub const FellowshipLocation: MultiLocation = MultiLocation::parent();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down
11 changes: 6 additions & 5 deletions parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ use frame_system::{
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{CollectivesLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{
FellowshipLocation, GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin,
};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand All @@ -67,12 +69,11 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

// XCM Imports
use crate::xcm_config::DotRelayLocation;
use parachains_common::{
opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
// XCM Imports
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -295,7 +296,7 @@ parameter_types! {
/// Privileged origin that represents Root or Fellows.
pub type RootOrFellows = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<CollectivesLocation, FellowsBodyId>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;

impl cumulus_pallet_xcmp_queue::Config for Runtime {
Expand Down Expand Up @@ -349,7 +350,7 @@ parameter_types! {
/// We allow root, the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<DotRelayLocation, StakingAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;

impl pallet_collator_selection::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ parameter_types! {
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
pub CollectivesLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
mod origins;
mod tracks;
pub use origins::{
pallet_origins as pallet_fellowship_origins, Fellows, FellowshipExperts, FellowshipInitiates,
pallet_origins as pallet_fellowship_origins, Fellows, FellowshipCandidates, FellowshipExperts,
FellowshipMasters,
};

use crate::{
constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, BlockNumber,
DotLocation, FellowshipReferenda, Preimage, RelayTreasuryAccount, Runtime, RuntimeCall,
FellowshipReferenda, GovernanceLocation, Preimage, RelayTreasuryAccount, Runtime, RuntimeCall,
RuntimeEvent, Scheduler, DAYS,
};
use frame_support::{
Expand Down Expand Up @@ -115,7 +115,7 @@ impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime
frame_system::EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
EitherOf<
MapSuccess<
EnsureXcm<IsVoiceOfBody<DotLocation, FellowshipAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, FellowshipAdminBodyId>>,
Replace<ConstU16<9>>,
>,
TryMapSuccess<EnsureFellowship, CheckedReduceBy<ConstU16<1>>>,
Expand All @@ -129,7 +129,7 @@ impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime
frame_system::EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
EitherOf<
MapSuccess<
EnsureXcm<IsVoiceOfBody<DotLocation, FellowshipAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, FellowshipAdminBodyId>>,
Replace<ConstU16<9>>,
>,
TryMapSuccess<EnsureFellowship, CheckedReduceBy<ConstU16<2>>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub mod pallet_origins {
#[pallet::origin]
pub enum Origin {
/// Origin commanded by any members of the Polkadot Fellowship (no Dan grade needed).
FellowshipInitiates,
FellowshipCandidates,
/// Origin commanded by Polkadot Fellows (3rd Dan fellows or greater).
Fellows,
/// Origin commanded by Polkadot Experts (5th Dan fellows or greater).
Expand Down Expand Up @@ -93,7 +93,7 @@ pub mod pallet_origins {
() => {}
}
decl_unit_ensures!(
FellowshipInitiates: Rank = ranks::CANDIDATES,
FellowshipCandidates: Rank = ranks::CANDIDATES,
Fellows: Rank = ranks::DAN_3,
FellowshipExperts: Rank = ranks::DAN_5,
FellowshipMasters: Rank = ranks::DAN_7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
}

match Origin::try_from(id.clone()) {
Ok(Origin::FellowshipInitiates) => Ok(tracks::CANDIDATES),
Ok(Origin::FellowshipCandidates) => Ok(tracks::CANDIDATES),
Ok(Origin::Fellowship1Dan) => Ok(tracks::MEMBERS),
Ok(Origin::Fellowship2Dan) => Ok(tracks::PROFICIENTS),
Ok(Origin::Fellowship3Dan) | Ok(Origin::Fellows) => Ok(tracks::FELLOWS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@ pub type BalanceOf<T> =
<pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;

/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury account.
pub struct ToParentTreasury<TreasuryAcc, PalletAcc, T>(PhantomData<(TreasuryAcc, PalletAcc, T)>);
pub struct ToParentTreasury<TreasuryAccount, PalletAccount, T>(
PhantomData<(TreasuryAccount, PalletAccount, T)>,
);

impl<TreasuryAcc, PalletAcc, T> OnUnbalanced<NegativeImbalance<T>>
for ToParentTreasury<TreasuryAcc, PalletAcc, T>
impl<TreasuryAccount, PalletAccount, T> OnUnbalanced<NegativeImbalance<T>>
for ToParentTreasury<TreasuryAccount, PalletAccount, T>
where
T: pallet_balances::Config + pallet_xcm::Config + frame_system::Config,
<<T as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId: From<AccountIdOf<T>>,
[u8; 32]: From<<T as frame_system::Config>::AccountId>,
TreasuryAcc: Get<AccountIdOf<T>>,
PalletAcc: Get<AccountIdOf<T>>,
TreasuryAccount: Get<AccountIdOf<T>>,
PalletAccount: Get<AccountIdOf<T>>,
BalanceOf<T>: Into<Fungibility>,
{
fn on_unbalanced(amount: NegativeImbalance<T>) {
Expand All @@ -54,8 +56,8 @@ where
Err(amount) => amount,
};
let imbalance = amount.peek();
let pallet_acc: AccountIdOf<T> = PalletAcc::get();
let treasury_acc: AccountIdOf<T> = TreasuryAcc::get();
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();

<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc.clone(), amount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ use parachains_common::{
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{DotLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand Down Expand Up @@ -420,7 +420,7 @@ parameter_types! {
/// We allow root and the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<DotLocation, StakingAdminBodyId>>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;

impl pallet_collator_selection::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ parameter_types! {
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
pub const Local: MultiLocation = Here.into_location();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down