Skip to content

Commit

Permalink
Rococo & Westend People Chain (paritytech#2281)
Browse files Browse the repository at this point in the history
Rococo and Westend runtimes for the "People Chain". This chain contains
the Identity pallet with plans to migrate all related data from the
Relay Chain.

Changes `IdentityInfo` to:

- Remove `additional_fields`.
- Add `github` and `discord` as first class fields. From scraping chain
data, these were the only two additional fields used (for the Fellowship
and Ambassador Program, respectively).
- Rename `riot` to `matrix`.

Note: This will use the script in
paritytech#2025 to generate the
genesis state.

TODO:

- [x] paritytech#1814 and
integration of the Identity Migrator pallet for migration.
- [x] Tests: paritytech#2373

---------

Co-authored-by: Muharem <ismailov.m.h@gmail.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Dónal Murray <donal.murray@parity.io>
Co-authored-by: Richard Melkonian <35300528+0xmovses@users.noreply.github.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
  • Loading branch information
6 people authored Dec 22, 2023
1 parent 7e538c2 commit 1d96699
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions substrate/frame/identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sp-core = { path = "../../primitives/core" }

[features]
default = ["std"]

std = [
"codec/std",
"enumflags2/std",
Expand Down
25 changes: 18 additions & 7 deletions substrate/frame/identity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,9 @@ impl<T: Config> Pallet<T> {
Ok((new_id_deposit, new_subs_deposit))
}

/// Set an identity with zero deposit. Only used for benchmarking that involves `rejig_deposit`.
#[cfg(feature = "runtime-benchmarks")]
/// Set an identity with zero deposit. Used for benchmarking and XCM emulator tests that involve
/// `rejig_deposit`.
#[cfg(any(feature = "runtime-benchmarks", feature = "std"))]
pub fn set_identity_no_deposit(
who: &T::AccountId,
info: T::IdentityInformation,
Expand All @@ -1022,15 +1023,25 @@ impl<T: Config> Pallet<T> {
Ok(())
}

/// Set subs with zero deposit. Only used for benchmarking that involves `rejig_deposit`.
#[cfg(feature = "runtime-benchmarks")]
pub fn set_sub_no_deposit(who: &T::AccountId, sub: T::AccountId) -> DispatchResult {
/// Set subs with zero deposit and default name. Only used for benchmarks that involve
/// `rejig_deposit`.
#[cfg(any(feature = "runtime-benchmarks", feature = "std"))]
pub fn set_subs_no_deposit(
who: &T::AccountId,
subs: Vec<(T::AccountId, Data)>,
) -> DispatchResult {
use frame_support::BoundedVec;
let subs = BoundedVec::<_, T::MaxSubAccounts>::try_from(vec![sub]).unwrap();
let mut sub_accounts = BoundedVec::<T::AccountId, T::MaxSubAccounts>::default();
for (sub, name) in subs {
<SuperOf<T>>::insert(&sub, (who.clone(), name));
sub_accounts
.try_push(sub)
.expect("benchmark should not pass more than T::MaxSubAccounts");
}
SubsOf::<T>::insert::<
&T::AccountId,
(BalanceOf<T>, BoundedVec<T::AccountId, T::MaxSubAccounts>),
>(&who, (Zero::zero(), subs));
>(&who, (Zero::zero(), sub_accounts));
Ok(())
}
}

0 comments on commit 1d96699

Please sign in to comment.