Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

The Ambassador Program #2002

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open

The Ambassador Program #2002

wants to merge 53 commits into from

Conversation

muharem
Copy link
Contributor

@muharem muharem commented Dec 19, 2022

The Ambassador Program on Polkadot Collectives Parachain

The Polkadot Ambassador Program has existed for a while; more information can be found here.
In this PR, the program is being brought on chain.

On Chain Structure

The on-chain program consists of nine ranks, divided into four categories (full list):

  • Ambassadors (1-2 tiers)
  • Senior Ambassadors (3-4 tiers)
  • Head Ambassadors (5-7 tiers)
  • Master Ambassadors (8-9 tiers)

Each rank has a corresponding Origin (e.g., HeadAmbassadorTier5 - full list), which represents the collective voice of members of that rank and above.

Referendum

The AmbassadorReferenda instance of referenda pallet consists of nine tracks, each corresponding to an Origin. A referendum taken on senior ambassador tier 4 track invites all members from rank 4 or above to vote and commands SeniorAmbassadorTier4 Origin. Every member gets one vote plus an additional vote for every excess rank. The referendum proposal can be submitted by any member of a senior rank or above.

Membership Management

Initial members will be brought on chain via migration, with subsequent member management handled through the AmbassadorCollective instance of ranked collective pallet. Both Root and FellowshipAdmin Origins, commanded via public Polkadot referendum, can promote or demote members to and from any rank. Members themselves also have the power to promote or demote via its referendum, with a senior member vote by the rank two above the new / current rank - full configuration.

Content Management

The program's on-chain content is managed via the collectives content pallet, allowing for setting its charter and making announcements. The voice of head ambassadors have the authority to set the charter, while announcements can be made by any senior rank member or through a referendum among all members.

Additional Functionality

The AmbassadorCore instance of core fellowship pallet decorates the ranked collectives pallet with features like salary determination, activity/passivity registration, and the handling of promotion and demotion periods. While the usage of this pallet is optional in the first version, future updates will make it the exclusive method for induction/promotion.

Periodic salaries in USDt, payable on Asset Hub, are introduced through the salary pallet. This requires induction into the ambassador core pallet.

Please for more information on the pallets' functionality refer to their documentations.

References:

Next Steps:

  • Migrate to seed the program members
  • Mint ambassador NFT badges on Asset Hub when promoting
  • Treasury pallet instance for the Ambassador Program

@muharem muharem added A3-in_progress Pull request is in progress. No review needed at this stage. B1-note_worthy Changes should be noted in the release notes C3-medium PR touches the given topic and has a medium impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. T1-runtime This PR/Issue is related to the topic “runtime”. labels Dec 19, 2022
@paritytech-ci paritytech-ci requested review from a team December 19, 2022 20:08
{
fn on_unbalanced(amount: NegativeImbalanceOf<T, I>) {
let temp_account: AccountIdOf<T> = TempAcc::get();
let treasury_acc: AccountIdOf<T> = TreasuryAcc::get();
let amount = match amount.drop_zero() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

submission deposit for ambassador referendum is zero, we do not teleport 0 amount

Copy link
Contributor Author

@muharem muharem Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest changes of the impl just simplification

@muharem muharem added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jan 12, 2023

/// IPFS compatible CID.
// worst case 2 bytes base and codec, 2 bytes hash type and size, 64 bytes hash digest.
pub type Cid = BoundedVec<u8, ConstU32<68>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive seen few implementations of the CID in or repos (at least two).
Here I keep it simple instead introducing new. I believe we need to agree first on one type for it, and keep it consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing CID as a bounded vec sounds good to me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a type for cid, maybe we should push it down to a more common place:
https://github.com/paritytech/substrate/blob/8cfe326e4e33c5077fc67f197d6a13dd871881c7/frame/alliance/src/types.rs#L69
We shouldn't have multiple different types for cids.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is we could call this type an OpaqueCid maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renaming to OpaqueCid

#[pallet::pallet]
#[pallet::generate_store(pub (super) trait Store)]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this setup works well for the Ambassador program, we might translate the Alliance into the similar setup, this is why the pallet generic over instance

@muharem
Copy link
Contributor Author

muharem commented Aug 18, 2023

bot fmt

@command-bot
Copy link

command-bot bot commented Aug 18, 2023

@muharem "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" (https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3413364) was cancelled in #2002 (comment)

@muharem
Copy link
Contributor Author

muharem commented Aug 18, 2023

bot cancel

@command-bot
Copy link

command-bot bot commented Aug 18, 2023

@muharem Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3413364 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3413364/artifacts/download.

@muharem
Copy link
Contributor Author

muharem commented Aug 18, 2023

bot fmt

@command-bot
Copy link

command-bot bot commented Aug 18, 2023

@muharem https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3413699 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/cumulus/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 54-ae65a6e6-47e7-464a-be9b-7af4099a8b2f to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Aug 18, 2023

@muharem Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3413699 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3413699/artifacts/download.

@muharem
Copy link
Contributor Author

muharem commented Aug 21, 2023

bot rebase

@paritytech-processbot
Copy link

Rebased

@muharem
Copy link
Contributor Author

muharem commented Aug 24, 2023

bot rebase

@paritytech-processbot
Copy link

Rebased

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable
Logs: https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/3435787

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage. B1-note_worthy Changes should be noted in the release notes C3-medium PR touches the given topic and has a medium impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
Development

Successfully merging this pull request may close these issues.

6 participants