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

[stable2503] Backport #7685 #7739

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Conversation

paritytech-cmd-bot-polkadot-sdk[bot]
Copy link
Contributor

Backport #7685 into stable2503 from Ank4n.

See the documentation on how to use this bot.

closes #5742

Need to be backported to stable2503 release.

With the migration of staking accounts to [fungible
currency](#5501), we can
now allow pool users to stake directly and vice versa. This update
introduces a configurable filter mechanism to determine which accounts
can join a nomination pool.

## Example Usage

### 1. Allow any account to join a pool
To permit all accounts to join a nomination pool, use the `Nothing`
filter:

```rust
impl pallet_nomination_pools::Config for Runtime {
    ...
    type Filter = Nothing;
}
```

### 2. Restrict direct stakers from joining a pool

To prevent direct stakers from joining a nomination pool, use
`pallet_staking::AllStakers`:
```rust
impl pallet_nomination_pools::Config for Runtime {
    ...
    type Filter = pallet_staking::AllStakers<Runtime>;
}
```

### 3. Define a custom filter
For more granular control, you can define a custom filter:
```rust
struct MyCustomFilter<T: Config>(core::marker::PhantomData<T>);

impl<T: Config> Contains<T::AccountId> for MyCustomFilter<T> {
    fn contains(account: &T::AccountId) -> bool {
        todo!("Implement custom logic. Return `false` to allow the account to join a pool.")
    }
}
```

---------

Co-authored-by: Bastian Köcher <info@kchr.de>
(cherry picked from commit f7e98b4)
@paritytech-cmd-bot-polkadot-sdk paritytech-cmd-bot-polkadot-sdk bot requested a review from a team as a code owner February 26, 2025 21:41
@github-actions github-actions bot added the A3-backport Pull request is already reviewed well in another branch. label Feb 26, 2025
Copy link
Contributor

This pull request is amending an existing release. Please proceed with extreme caution,
as to not impact downstream teams that rely on the stability of it. Some things to consider:

  • Backports are only for 'patch' or 'minor' changes. No 'major' or other breaking change.
  • Should be a legit fix for some bug, not adding tons of new features.
  • Must either be already audited or not need an audit.
Emergency Bypass

If you really need to bypass this check: add validate: false to each crate
in the Prdoc where a breaking change is introduced. This will release a new major
version of that crate and all its reverse dependencies and basically break the release.

@EgorPopelyaev EgorPopelyaev merged commit a1d8291 into stable2503 Feb 27, 2025
240 of 255 checks passed
@EgorPopelyaev EgorPopelyaev deleted the backport-7685-to-stable2503 branch February 27, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A3-backport Pull request is already reviewed well in another branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants