mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +00:00
Runtime: Polkadot Fellowship promotion/demotion periods, members activity and salaries (#2607)
* core fellowship * core fellowship weights * salary * weights * fellowship pot * registration period 15 days * use treasury account for salary pay, promotion origin * decision period for tracks 30 days * docs * comment * Couple of fixes and some refactoring * Alter curves to be a bit more conservative * Use `PayOverXcm` for fellowship salary payments * Docs and remove unneeded code * Fixes * Move Fellowship stuff in line with whitepaper * fix: induction by a single Fellow (not proficient) * doc fix * renames, pallet index, allow unpaid for salary pallet * Fix budget units * Fixes * Test sovereign account for Fellowship salaries * Nice address test * Fixes * test for PayOverXcm setup * Update parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs Co-authored-by: Bastian Köcher <git@kchr.de> --------- Co-authored-by: Gav <gavin@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -34,11 +34,12 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
|
||||
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FungiblesAdapter, IsConcrete,
|
||||
LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WeightInfoBounds, WithComputedOrigin,
|
||||
DenyReserveTransferToRelayChain, DenyThenTry, DescribeFamily, DescribePalletTerminal,
|
||||
EnsureXcmOrigin, FungiblesAdapter, HashedDescription, IsConcrete, LocalMint, NativeAsset,
|
||||
NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
|
||||
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
|
||||
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds,
|
||||
WithComputedOrigin,
|
||||
};
|
||||
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
|
||||
|
||||
@@ -66,6 +67,9 @@ pub type LocationToAccountId = (
|
||||
SiblingParachainConvertsVia<Sibling, AccountId>,
|
||||
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
|
||||
AccountId32Aliases<RelayNetwork, AccountId>,
|
||||
// Foreign chain account alias into local accounts according to a hash of their standard
|
||||
// description.
|
||||
HashedDescription<AccountId, DescribeFamily<DescribePalletTerminal>>,
|
||||
);
|
||||
|
||||
/// Means for transacting the native currency on this chain.
|
||||
@@ -177,6 +181,9 @@ match_types! {
|
||||
pub type FellowsPlurality: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) }
|
||||
};
|
||||
pub type FellowshipSalaryPallet: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(64)) }
|
||||
};
|
||||
}
|
||||
|
||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||
@@ -355,7 +362,11 @@ pub type Barrier = DenyThenTry<
|
||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution.
|
||||
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
|
||||
AllowExplicitUnpaidExecutionFrom<(
|
||||
ParentOrParentsPlurality,
|
||||
FellowsPlurality,
|
||||
FellowshipSalaryPallet,
|
||||
)>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
||||
),
|
||||
@@ -498,3 +509,18 @@ impl pallet_assets::BenchmarkHelper<MultiLocation> for XcmBenchmarkHelper {
|
||||
MultiLocation { parents: 1, interior: X1(Parachain(id)) }
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn foreign_pallet_has_correct_local_account() {
|
||||
use sp_core::crypto::{Ss58AddressFormat, Ss58Codec};
|
||||
use xcm_executor::traits::ConvertLocation;
|
||||
|
||||
const COLLECTIVES_PARAID: u32 = 1001;
|
||||
const FELLOWSHIP_SALARY_PALLET_ID: u8 = 64;
|
||||
let fellowship_salary =
|
||||
(Parent, Parachain(COLLECTIVES_PARAID), PalletInstance(FELLOWSHIP_SALARY_PALLET_ID));
|
||||
let account = LocationToAccountId::convert_location(&fellowship_salary.into()).unwrap();
|
||||
let polkadot = Ss58AddressFormat::try_from("polkadot").unwrap();
|
||||
let address = Ss58Codec::to_ss58check_with_version(&account, polkadot);
|
||||
assert_eq!(address, "13w7NdvSR1Af8xsQTArDtZmVvjE8XhWNdL4yed3iFHrUNCnS");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user