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

Unique Usernames in Identity Pallet #2651

Merged
merged 53 commits into from
Jan 10, 2024
Merged

Unique Usernames in Identity Pallet #2651

merged 53 commits into from
Jan 10, 2024

Conversation

joepetrowski
Copy link
Contributor

@joepetrowski joepetrowski commented Dec 7, 2023

This PR allows username authorities to issue unique usernames that correspond with an account. It also provides two-way lookup, that is from AccountId to a single, "primary" Username (alongside Registration) and multiple unique Usernames to an AccountId.

Key features:

  • Username Authorities added (and removed) via privileged origin.
  • Authorities have a suffix and an allocation. They can grant up to allocation usernames. Their suffix will be appended to the usernames that they issue. A suffix may be up to 7 characters long.
  • Users can ask an authority to grant them a username. This will take the form myusername.suffix. The entire name (including suffix) must be less than or equal to 32 alphanumeric characters.
  • Users can approve a username for themselves in one of two ways (that is, authorities cannot grant them arbitrarily):
    • Pre-sign the entire username (including suffix) with a secret key that corresponds to their AccountId (for keyed accounts, obviously); or
    • Accept the username after it has been granted by an authority (it will be queued until accepted) (for non-keyed accounts like pure proxies or multisigs).
  • The system does not require any funds or deposits. Users without an identity will be given a default one (presumably all fields set to None). If they update this info, they will need to place the normal storage deposit.
  • If a user does not have any username, their first one will be set as Primary, and their AccountId will map to that one. If they get subsequent usernames, they can choose which one to be their primary via set_primary_username.
  • There are some state cleanup functions to remove expired usernames that have not been accepted and dangling usernames whose owners have called clear_identity.

TODO:

  • Add migration to runtimes
  • Probably do off-chain migration into People Chain genesis
  • Address a few TODO questions in code (please review)

@joepetrowski joepetrowski added the T2-pallets This PR/Issue is related to a particular pallet. label Dec 7, 2023
@joepetrowski joepetrowski requested review from a team December 7, 2023 13:41
substrate/frame/identity/src/lib.rs Show resolved Hide resolved
substrate/frame/identity/src/lib.rs Show resolved Hide resolved
/// `username.suffix`.
#[pallet::call_index(19)]
#[pallet::weight(T::WeightInfo::remove_expired_approval())]
pub fn remove_expired_approval(
Copy link
Contributor

Choose a reason for hiding this comment

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

Task API can be used for this.

substrate/frame/identity/src/types.rs Outdated Show resolved Hide resolved
substrate/frame/identity/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/alliance/src/mock.rs Outdated Show resolved Hide resolved
substrate/bin/node/runtime/src/impls.rs Outdated Show resolved Hide resolved
substrate/frame/identity/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/identity/src/lib.rs Show resolved Hide resolved
@seadanda seadanda merged commit d1f678c into master Jan 10, 2024
122 checks passed
@seadanda seadanda deleted the joe-identity-username branch January 10, 2024 10:30
bkontur added a commit to bkontur/runtimes that referenced this pull request Jan 29, 2024
bkontur added a commit to bkontur/runtimes that referenced this pull request Jan 29, 2024
bkontur added a commit to bkontur/runtimes that referenced this pull request Jan 30, 2024
@Polkadot-Forum
Copy link

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/people-chain-launch-and-identity-migration-plan/5930/3

bkontur added a commit to bkontur/runtimes that referenced this pull request Feb 3, 2024
bkontur added a commit to bkontur/runtimes that referenced this pull request Feb 3, 2024
bkontur added a commit to bkontur/runtimes that referenced this pull request Feb 6, 2024
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This PR allows _username authorities_ to issue unique usernames that
correspond with an account. It also provides two-way lookup, that is
from `AccountId` to a single, "primary" `Username` (alongside
`Registration`) and multiple unique `Username`s to an `AccountId`.

Key features:

- Username Authorities added (and removed) via privileged origin.
- Authorities have a `suffix` and an `allocation`. They can grant up to
`allocation` usernames. Their `suffix` will be appended to the usernames
that they issue. A suffix may be up to 7 characters long.
- Users can ask an authority to grant them a username. This will take
the form `myusername.suffix`. The entire name (including suffix) must be
less than or equal to 32 alphanumeric characters.
- Users can approve a username for themselves in one of two ways (that
is, authorities cannot grant them arbitrarily):
- Pre-sign the entire username (including suffix) with a secret key that
corresponds to their `AccountId` (for keyed accounts, obviously); or
- Accept the username after it has been granted by an authority (it will
be queued until accepted) (for non-keyed accounts like pure proxies or
multisigs).
- The system does not require any funds or deposits. Users without an
identity will be given a default one (presumably all fields set to
`None`). If they update this info, they will need to place the normal
storage deposit.
- If a user does not have any username, their first one will be set as
`Primary`, and their `AccountId` will map to that one. If they get
subsequent usernames, they can choose which one to be their primary via
`set_primary_username`.
- There are some state cleanup functions to remove expired usernames
that have not been accepted and dangling usernames whose owners have
called `clear_identity`.

TODO:

- [x] Add migration to runtimes
- [x] Probably do off-chain migration into People Chain genesis
- [x] Address a few TODO questions in code (please review)

---------

Co-authored-by: Liam Aharon <[email protected]>
Co-authored-by: Gonçalo Pestana <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Dónal Murray <[email protected]>
bkchr pushed a commit that referenced this pull request Apr 10, 2024
* Deposit event when relayer reward is registered (#2648)

* RewardRegistered event

* test it

* fix compilation
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
Status: Audited
Development

Successfully merging this pull request may close these issues.

8 participants