Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Secretary Program #347

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
939392f
init
Doordashcon May 9, 2024
acd23f2
imp Doc comm 1
Doordashcon May 13, 2024
7d03cac
remove unreachable pattern
Doordashcon May 13, 2024
1c4659b
location
Doordashcon May 14, 2024
188759e
nit
Doordashcon May 14, 2024
154efb5
update origin, secretary submit fellowship ref
Doordashcon May 17, 2024
bea78a3
changelog include
Doordashcon May 18, 2024
c203940
update imports
Doordashcon May 20, 2024
334c35c
Merge branch 'main' into ddc-secretary-collective
Doordashcon May 20, 2024
482d0be
cargo +nightly fmt
Doordashcon May 20, 2024
d7d4b87
getting weights..
Doordashcon May 21, 2024
2e0968a
nit parameter types
Doordashcon May 21, 2024
572d398
origin update
Doordashcon Jun 1, 2024
09d317c
reset head
Doordashcon Jun 10, 2024
4e5116b
improve documentation
Doordashcon Jun 13, 2024
365d3c5
fmt
Doordashcon Jun 15, 2024
600d2c2
clippy nit
Doordashcon Jun 16, 2024
e884c30
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Jun 18, 2024
bcd0a17
Fellowship Admin
Doordashcon Jun 23, 2024
47ed39e
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Jul 7, 2024
7b0064a
confl-main
Doordashcon Jul 16, 2024
bdbc39b
conflict fix in progress
Doordashcon Jul 16, 2024
ef75bf7
same Cargo.toml
Doordashcon Jul 16, 2024
86d489f
Cargo.lock
Doordashcon Jul 16, 2024
313bb8c
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Jul 16, 2024
d34fcb2
adjust salary periods
Doordashcon Jul 17, 2024
5722c25
doc nit
Doordashcon Jul 22, 2024
b3a82cf
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Jul 23, 2024
daca216
no-op poll + nit
Doordashcon Jul 27, 2024
f8ab6a1
secretary on fellow ref submission removal
Doordashcon Jul 27, 2024
95a2cfb
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Jul 27, 2024
c32eb13
nit max_ongoing
Doordashcon Jul 27, 2024
51b94ef
remove M: GetMaxVoters
Doordashcon Jul 29, 2024
eaaab37
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Jul 31, 2024
ec53bb8
changelog update
Doordashcon Jul 31, 2024
906bc10
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Aug 3, 2024
1b1e81f
rm origins && secrt
Doordashcon Aug 13, 2024
d4dac6f
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Aug 13, 2024
02f8a49
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Aug 15, 2024
a80a668
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Aug 17, 2024
1962aef
cllective
Doordashcon Aug 30, 2024
fe184d9
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Aug 30, 2024
53e60a6
Merge branch 'main' into ddc-secretary-collective2
Doordashcon Sep 4, 2024
fd82ec2
nit time crate + fmt
Doordashcon Sep 6, 2024
b34d4b1
remove {} AHP
Doordashcon Sep 6, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ Note: This release only affects the following runtimes and is not a full system
- Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65))
- Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109))
- Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108))
- The Secretary Program ([polkadot-fellows/runtimes#306](https://github.com/polkadot-fellows/runtimes/pull/306))
Doordashcon marked this conversation as resolved.
Show resolved Hide resolved

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ parameter_types! {
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
}

/// Location type to determine the Technical Fellowship related
/// pallets for use in XCM.
pub struct FellowshipEntities;
impl Contains<Location> for FellowshipEntities {
fn contains(location: &Location) -> bool {
Expand Down Expand Up @@ -259,6 +261,8 @@ impl Contains<Location> for FellowshipEntities {
}
}

/// Location type to determine the Ambassador Collective
/// pallets for use in XCM.
pub struct AmbassadorEntities;
impl Contains<Location> for AmbassadorEntities {
fn contains(location: &Location) -> bool {
Expand All @@ -285,6 +289,34 @@ impl Contains<Location> for AmbassadorEntities {
}
}

/// Location type to determine the Secretary Collective related
/// pallets for use in XCM.
pub struct SecretaryEntities;
impl Contains<Location> for SecretaryEntities {
fn contains(location: &Location) -> bool {
matches!(
location.unpack(),
(
1,
[
Parachain(system_parachain::COLLECTIVES_ID),
PalletInstance(
collectives_polkadot_runtime_constants::SECRETARY_SALARY_PALLET_INDEX
)
]
) | (
1,
[
Parachain(system_parachain::COLLECTIVES_ID),
PalletInstance(
collectives_polkadot_runtime_constants::SECRETARY_TREASURY_PALLET_INDEX
)
]
)
)
}
}

pub struct ParentOrParentsPlurality;
impl Contains<Location> for ParentOrParentsPlurality {
fn contains(location: &Location) -> bool {
Expand Down Expand Up @@ -314,6 +346,7 @@ pub type Barrier = TrailingSetTopicAsId<
Equals<RelayTreasuryLocation>,
Equals<bridging::SiblingBridgeHub>,
AmbassadorEntities,
SecretaryEntities,
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
Expand All @@ -340,6 +373,7 @@ pub type WaivedLocations = (
Equals<RelayTreasuryLocation>,
FellowshipEntities,
AmbassadorEntities,
SecretaryEntities,
);

/// Cases where a remote origin is accepted as trusted Teleporter for a given asset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ pub const AMBASSADOR_SALARY_PALLET_INDEX: u8 = 74;

/// Polkadot Ambassador Treasury pallet instance.
pub const AMBASSADOR_TREASURY_PALLET_INDEX: u8 = 75;

/// Polkadot Secretary Salary pallet instance.
pub const SECRETARY_SALARY_PALLET_INDEX: u8 = 83;

/// Polkadot Secretary Treasury pallet instance.
pub const SECRETARY_TREASURY_PALLET_INDEX: u8 = 84;
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ use sp_runtime::traits::{
};
use xcm_builder::{AliasesIntoAccountId32, PayOverXcm};

use crate::secretary::SecretaryCollectiveInstance;

use crate::secretary::ranks::SECRETARY;

#[cfg(feature = "runtime-benchmarks")]
use crate::{
impls::benchmarks::{OpenHrmpChannel, PayWithEnsure},
Expand Down Expand Up @@ -86,19 +90,22 @@ impl pallet_referenda::Config<FellowshipReferendaInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
type Currency = Balances;
// Fellows can submit proposals.
// Fellows & Secretary can submit proposals.
type SubmitOrigin = EitherOf<
pallet_ranked_collective::EnsureMember<Runtime, FellowshipCollectiveInstance, 3>,
MapSuccess<
TryWithMorphedArg<
RuntimeOrigin,
<RuntimeOrigin as OriginTrait>::PalletsOrigin,
ToVoice,
EnsureOfRank<Runtime, FellowshipCollectiveInstance>,
(AccountId, u16),
EitherOf<
pallet_ranked_collective::EnsureMember<Runtime, FellowshipCollectiveInstance, 3>,
Doordashcon marked this conversation as resolved.
Show resolved Hide resolved
MapSuccess<
TryWithMorphedArg<
RuntimeOrigin,
<RuntimeOrigin as OriginTrait>::PalletsOrigin,
ToVoice,
EnsureOfRank<Runtime, FellowshipCollectiveInstance>,
(AccountId, u16),
>,
TakeFirst,
>,
TakeFirst,
>,
pallet_ranked_collective::EnsureMember<Runtime, SecretaryCollectiveInstance, { SECRETARY }>,
>;
type CancelOrigin = Architects;
type KillOrigin = Masters;
Expand Down
29 changes: 29 additions & 0 deletions system-parachains/collectives/collectives-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ pub mod xcm_config;
pub mod fellowship;
pub use ambassador::pallet_ambassador_origins;

// Secretary Configuration
pub mod secretary;

use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use fellowship::{pallet_fellowship_origins, Fellows};
use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, ToParentTreasury};
use polkadot_runtime_common::impls::VersionedLocatableAsset;
use secretary::pallet_secretary_origins;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
Expand Down Expand Up @@ -304,6 +308,8 @@ pub enum ProxyType {
Fellowship,
/// Ambassador proxy. Allows calls related to the Ambassador Program.
Ambassador,
/// Secretary proxy. Allows calls related to the Secretary collective
Secretary,
}
impl Default for ProxyType {
fn default() -> Self {
Expand Down Expand Up @@ -350,6 +356,14 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. }
),
ProxyType::Secretary => matches!(
c,
RuntimeCall::SecretaryCollective { .. } |
RuntimeCall::SecretaryReferenda { .. } |
RuntimeCall::SecretarySalary { .. } |
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. }
),
}
}
fn is_superset(&self, o: &Self) -> bool {
Expand Down Expand Up @@ -717,6 +731,17 @@ construct_runtime!(
AmbassadorCore: pallet_core_fellowship::<Instance2> = 73,
AmbassadorSalary: pallet_salary::<Instance2> = 74,
AmbassadorTreasury: pallet_treasury::<Instance2> = 75,

// The Secretary Collective
Doordashcon marked this conversation as resolved.
Show resolved Hide resolved
// pub type SecretaryCollectiveInstance = pallet_ranked_cllective::instance3;
SecretaryCollective: pallet_ranked_collective::<Instance3> = 80,
//pub type SecretaryReferandaInstance = pallet_referanda::Instance3;
SecretaryReferenda: pallet_referenda::<Instance3> = 81,
SecretaryOrigins: pallet_secretary_origins = 82,
// pub type SecretarySalaryInstance = pallet_salary::Instance3;
SecretarySalary: pallet_salary::<Instance3> = 83,
// pub type SecretaryTreasuryInstance = pallet_treasury::Instance3;
SecretaryTreasury: pallet_treasury::<Instance3> = 84,
}
);

Expand Down Expand Up @@ -801,6 +826,10 @@ mod benches {
[pallet_core_fellowship, AmbassadorCore]
[pallet_salary, AmbassadorSalary]
[pallet_treasury, AmbassadorTreasury]
[pallet_referenda, SecretaryReferenda]
[pallet_ranked_cllective, SecretaryCollective]
[pallet_salary, SecretarySalary]
[pallet_treasury, SecretaryTreasury]
);
}

Expand Down
Loading
Loading