substrate icon indicating copy to clipboard operation
substrate copied to clipboard

feat(pallet-ranked-collective): added types

Open PraetorP opened this issue 2 years ago • 2 comments

This PR added associated types(AddOrigin & RemoveOrigin) to Config. It allows you to decouple types and areas of responsibility, since at the moment the same types are responsible for adding and promoting(removing and demoting). This will improve the flexibility of the pallet configuration.

/// The origin required to add a member.
type AddOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = ()>;

/// The origin required to remove a member. The success value indicates the
/// maximum rank *from which* the removal may be.
type RemoveOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Rank>;

To achieve the backward compatibility, the users of the pallet can use the old type via the new morph:

type AddOrigin = MapSuccess<Self::PromoteOrigin, Ignore>;
type RemoveOrigin = Self::DemoteOrigin;

Polkadot companion: https://github.com/paritytech/polkadot/pull/7500 Cumulus companion: https://github.com/paritytech/cumulus/pull/2881

PraetorP avatar Jul 14 '23 09:07 PraetorP

User @PraetorP, please sign the CLA here.

cla-bot-2021[bot] avatar Jul 14 '23 09:07 cla-bot-2021[bot]

The CI pipeline was cancelled due to failure one of the required jobs. Job name: cargo-check-each-crate-macos Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3415827

paritytech-cicd-pr avatar Aug 19 '23 12:08 paritytech-cicd-pr