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

Ranked collective Add+Remove origins #3212

Merged
merged 12 commits into from
Feb 6, 2024
Merged

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Feb 5, 2024

Superseeds #1245

This PR is a migration of the paritytech/substrate#14577.

The 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, ReplaceWithDefault<()>>;
type RemoveOrigin = Self::DemoteOrigin;

@ggwpez ggwpez requested a review from a team as a code owner February 5, 2024 13:13
@ggwpez ggwpez added the T2-pallets This PR/Issue is related to a particular pallet. label Feb 5, 2024
@ggwpez ggwpez changed the title Oty ranked collective origins Ranked collective Add+Remove origins Feb 5, 2024
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@PraetorP
Copy link
Contributor

PraetorP commented Feb 6, 2024

Thank you for taking my PR for revision!

@ggwpez ggwpez added this pull request to the merge queue Feb 6, 2024
Merged via the queue into master with commit c552fb5 Feb 6, 2024
127 checks passed
@ggwpez ggwpez deleted the oty-ranked-collective-origins branch February 6, 2024 13:33
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
Superseeds paritytech#1245  

This PR is a migration of the
paritytech/substrate#14577.

The 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;
```

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: PraetorP <[email protected]>
Co-authored-by: Pavel Orlov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants