git.delta.rocks / unique-network / refs/commits / 373c2a6bf04f

difftreelog

refactor(identity) displace set-identities to identity pallet

Fahrrader2022-12-28parent: #37af826.patch.diff
in: master

19 files changed

modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -133,6 +133,10 @@
 bench-collator-selection:
 	make _bench PALLET=collator-selection
 
+.PHONY: bench-identity
+bench-identity:
+	make _bench PALLET=identity
+
 .PHONY: bench-app-promotion
 bench-app-promotion:
 	make _bench PALLET=app-promotion PALLET_DIR=app-promotion
modifiedpallets/data-management/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/data-management/src/benchmarking.rs
+++ b/pallets/data-management/src/benchmarking.rs
@@ -62,28 +62,4 @@
 		use codec::Encode;
 		let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();
 	}: _(RawOrigin::Root, logs)
-
-	set_identities {
-		let b in 0..600;
-		use frame_benchmarking::account;
-		use pallet_identity::{BalanceOf, Registration, IdentityInfo};
-		let identities = (0..b).map(|i| (
-			account("caller", i, 0),
-			Some(Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
-				judgements: Default::default(),
-				deposit: Default::default(),
-				info: IdentityInfo {
-					additional: Default::default(),
-					display: Default::default(),
-					legal: Default::default(),
-					web: Default::default(),
-					riot: Default::default(),
-					email: Default::default(),
-					pgp_fingerprint: None,
-					image: Default::default(),
-					twitter: Default::default(),
-				},
-			}),
-		)).collect::<Vec<_>>();
-	}: _(RawOrigin::Root, identities)
 }
modifiedpallets/data-management/src/lib.rsdiffbeforeafterboth
--- a/pallets/data-management/src/lib.rs
+++ b/pallets/data-management/src/lib.rs
@@ -34,10 +34,9 @@
 	use sp_std::vec::Vec;
 	use super::weights::WeightInfo;
 	use pallet_evm::{PrecompileHandle, Pallet as PalletEvm};
-	use pallet_identity::Registration;
 
 	#[pallet::config]
-	pub trait Config: frame_system::Config + pallet_evm::Config + pallet_identity::Config {
+	pub trait Config: frame_system::Config + pallet_evm::Config {
 		/// Weights
 		type WeightInfo: WeightInfo;
 		/// The overarching event type.
@@ -147,29 +146,6 @@
 					<T as frame_system::Config>::RuntimeEvent::decode(&mut event.as_slice())
 						.map_err(|_| <Error<T>>::BadEvent)?,
 				);
-			}
-			Ok(())
-		}
-
-		/// Insert or remove identities.
-		#[pallet::call_index(5)]
-		#[pallet::weight(<SelfWeightOf<T>>::set_identities(identities.len() as u32))] // todo:collator weight
-		pub fn set_identities(
-			origin: OriginFor<T>,
-			identities: Vec<(
-				T::AccountId,
-				Option<
-					Registration<
-						pallet_identity::BalanceOf<T>,
-						T::MaxRegistrars,
-						T::MaxAdditionalFields,
-					>,
-				>,
-			)>,
-		) -> DispatchResult {
-			ensure_root(origin)?;
-			for identity in identities {
-				<pallet_identity::IdentityOf<T>>::set(identity.0, identity.1);
 			}
 			Ok(())
 		}
modifiedpallets/data-management/src/weights.rsdiffbeforeafterboth
--- a/pallets/data-management/src/weights.rs
+++ b/pallets/data-management/src/weights.rs
@@ -39,7 +39,6 @@
 	fn finish(b: u32, ) -> Weight;
 	fn insert_eth_logs(b: u32, ) -> Weight;
 	fn insert_events(b: u32, ) -> Weight;
-	fn set_identities(b: u32, ) -> Weight;
 }
 
 /// Weights for pallet_data_management using the Substrate node and recommended hardware.
@@ -77,11 +76,6 @@
 			.saturating_add(Weight::from_ref_time(722_345 as u64).saturating_mul(b as u64))
 	}
 	fn insert_events(b: u32, ) -> Weight {
-		Weight::from_ref_time(10_936_376 as u64)
-			// Standard Error: 1_227
-			.saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
-	}
-	fn set_identities(b: u32, ) -> Weight {
 		Weight::from_ref_time(10_936_376 as u64)
 			// Standard Error: 1_227
 			.saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
@@ -122,11 +116,6 @@
 			.saturating_add(Weight::from_ref_time(722_345 as u64).saturating_mul(b as u64))
 	}
 	fn insert_events(b: u32, ) -> Weight {
-		Weight::from_ref_time(10_936_376 as u64)
-			// Standard Error: 1_227
-			.saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
-	}
-	fn set_identities(b: u32, ) -> Weight {
 		Weight::from_ref_time(10_936_376 as u64)
 			// Standard Error: 1_227
 			.saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
modifiedpallets/identity/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/identity/src/benchmarking.rs
+++ b/pallets/identity/src/benchmarking.rs
@@ -412,6 +412,21 @@
 		ensure!(!IdentityOf::<T>::contains_key(&target), "Identity not removed");
 	}
 
+	set_identities {
+		let x in 0 .. T::MaxAdditionalFields::get();
+		let n in 0..600;
+		use frame_benchmarking::account;
+		let identities = (0..n).map(|i| (
+			account("caller", i, 0),
+			Some(Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
+				judgements: Default::default(),
+				deposit: Default::default(),
+				info: create_identity_info::<T>(x),
+			}),
+		)).collect::<Vec<_>>();
+		let origin = T::ForceOrigin::successful_origin();
+	}: _<T::RuntimeOrigin>(origin, identities)
+
 	add_sub {
 		let s in 0 .. T::MaxSubAccounts::get() - 1;
 
modifiedpallets/identity/src/lib.rsdiffbeforeafterboth
--- a/pallets/identity/src/lib.rs
+++ b/pallets/identity/src/lib.rs
@@ -1089,6 +1089,26 @@
 			});
 			Ok(())
 		}
+
+		/// Insert or remove identities.
+		#[pallet::call_index(15)]
+		#[pallet::weight(T::WeightInfo::set_identities(
+			T::MaxAdditionalFields::get(), // X
+			identities.len() as u32, // N
+		))] // todo:collator weight
+		pub fn set_identities(
+			origin: OriginFor<T>,
+			identities: Vec<(
+				T::AccountId,
+				Option<Registration<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields>>,
+			)>,
+		) -> DispatchResult {
+			T::ForceOrigin::ensure_origin(origin)?;
+			for identity in identities {
+				IdentityOf::<T>::set(identity.0, identity.1);
+			}
+			Ok(())
+		}
 	}
 }
 
modifiedpallets/identity/src/weights.rsdiffbeforeafterboth
--- a/pallets/identity/src/weights.rs
+++ b/pallets/identity/src/weights.rs
@@ -76,6 +76,7 @@
 	fn set_fields(r: u32, ) -> Weight;
 	fn provide_judgement(r: u32, x: u32, ) -> Weight;
 	fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight;
+	fn set_identities(x: u32, n: u32, ) -> Weight;
 	fn add_sub(s: u32, ) -> Weight;
 	fn rename_sub(s: u32, ) -> Weight;
 	fn remove_sub(s: u32, ) -> Weight;
@@ -245,6 +246,19 @@
 			.saturating_add(T::DbWeight::get().writes(3 as u64))
 			.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
 	}
+	// Storage: Identity IdentityOf (r:1 w:1)
+	/// The range of component `x` is `[0, 100]`.
+	/// The range of component `n` is `[0, 600]`.
+	fn set_identities(x: u32, n: u32) -> Weight {
+		// Minimum execution time: 41_872 nanoseconds.
+		Weight::from_ref_time(40_230_216 as u64)
+			// Standard Error: 2_342
+			.saturating_add(Weight::from_ref_time(145_168 as u64))
+			// Standard Error: 457
+			.saturating_add(Weight::from_ref_time(291_732 as u64).saturating_mul(x as u64))
+			.saturating_add(T::DbWeight::get().reads(1 as u64))
+			.saturating_add(T::DbWeight::get().writes(1 as u64).saturating_mul(n as u64))
+	}
 	// Storage: Identity IdentityOf (r:1 w:0)
 	// Storage: Identity SuperOf (r:1 w:1)
 	// Storage: Identity SubsOf (r:1 w:1)
@@ -455,6 +469,19 @@
 			.saturating_add(RocksDbWeight::get().writes(3 as u64))
 			.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
 	}
+	// Storage: Identity IdentityOf (r:1 w:1)
+	/// The range of component `x` is `[0, 100]`.
+	/// The range of component `n` is `[0, 600]`.
+	fn set_identities(x: u32, n: u32) -> Weight {
+		// Minimum execution time: 41_872 nanoseconds.
+		Weight::from_ref_time(40_230_216 as u64)
+			// Standard Error: 2_342
+			.saturating_add(Weight::from_ref_time(145_168 as u64))
+			// Standard Error: 457
+			.saturating_add(Weight::from_ref_time(291_732 as u64).saturating_mul(x as u64))
+			.saturating_add(RocksDbWeight::get().reads(1 as u64))
+			.saturating_add(RocksDbWeight::get().writes(1 as u64).saturating_mul(n as u64))
+	}
 	// Storage: Identity IdentityOf (r:1 w:0)
 	// Storage: Identity SuperOf (r:1 w:1)
 	// Storage: Identity SubsOf (r:1 w:1)
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -708,6 +708,9 @@
                     #[cfg(feature = "collator-selection")]
                     list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
 
+                    #[cfg(feature = "collator-selection")]
+                    list_benchmark!(list, extra, pallet_identity, Identity);
+
                     #[cfg(feature = "foreign-assets")]
                     list_benchmark!(list, extra, pallet_foreign_assets, ForeignAssets);
 
@@ -774,6 +777,9 @@
                     #[cfg(feature = "collator-selection")]
                     add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
 
+                    #[cfg(feature = "collator-selection")]
+                    add_benchmark!(params, batches, pallet_identity, Identity);
+
                     #[cfg(feature = "foreign-assets")]
                     add_benchmark!(params, batches, pallet_foreign_assets, ForeignAssets);
 
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -40,6 +40,7 @@
     'pallet-inflation/runtime-benchmarks',
     'pallet-app-promotion/runtime-benchmarks',
     'pallet-collator-selection/runtime-benchmarks',
+    'pallet-identity/runtime-benchmarks',
     'pallet-unique-scheduler-v2/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -39,6 +39,7 @@
     'pallet-foreign-assets/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
     'pallet-collator-selection/runtime-benchmarks',
+    'pallet-identity/runtime-benchmarks',
     'pallet-app-promotion/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -39,6 +39,7 @@
     'pallet-foreign-assets/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
     'pallet-collator-selection/runtime-benchmarks',
+    'pallet-identity/runtime-benchmarks',
     'pallet-app-promotion/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
modifiedtests/src/collatorSelection.seqtest.tsdiffbeforeafterboth
--- a/tests/src/collatorSelection.seqtest.ts
+++ b/tests/src/collatorSelection.seqtest.ts
@@ -287,7 +287,7 @@
         expect(await helper.collatorSelection.getCandidates()).to.be.deep.equal([]);
       });
 
-      itSub('Dithmarschen', async ({helper}) => {
+      itSub('Penalizes and forfeits license from faulty collators', async ({helper}) => {
         // This one shouldn't even be able to produce blocks.
         const account = crowd.pop()!;
         await helper.collatorSelection.obtainLicense(account);
modifiedtests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -318,10 +318,6 @@
        **/
       setData: AugmentedSubmittable<(address: H160 | string | Uint8Array, data: Vec<ITuple<[H256, H256]>> | ([H256 | string | Uint8Array, H256 | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [H160, Vec<ITuple<[H256, H256]>>]>;
       /**
-       * Insert or remove identities.
-       **/
-      setIdentities: AugmentedSubmittable<(identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>> | ([AccountId32 | string | Uint8Array, Option<PalletIdentityRegistration> | null | Uint8Array | PalletIdentityRegistration | { judgements?: any; deposit?: any; info?: any } | string])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>]>;
-      /**
        * Generic tx
        **/
       [key: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -606,6 +602,10 @@
        **/
       setFields: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, fields: PalletIdentityBitFlags) => SubmittableExtrinsic<ApiType>, [Compact<u32>, PalletIdentityBitFlags]>;
       /**
+       * Insert or remove identities.
+       **/
+      setIdentities: AugmentedSubmittable<(identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>> | ([AccountId32 | string | Uint8Array, Option<PalletIdentityRegistration> | null | Uint8Array | PalletIdentityRegistration | { judgements?: any; deposit?: any; info?: any } | string])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>]>;
+      /**
        * Set an account's identity information and reserve the appropriate deposit.
        * 
        * If the account already has identity information, the deposit is taken as part payment
modifiedtests/src/interfaces/default/types.tsdiffbeforeafterboth
--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1477,11 +1477,7 @@
   readonly asInsertEvents: {
     readonly events: Vec<Bytes>;
   } & Struct;
-  readonly isSetIdentities: boolean;
-  readonly asSetIdentities: {
-    readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
-  } & Struct;
-  readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents' | 'SetIdentities';
+  readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents';
 }
 
 /** @name PalletDataManagementError */
@@ -1825,7 +1821,11 @@
     readonly sub: MultiAddress;
   } & Struct;
   readonly isQuitSub: boolean;
-  readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub';
+  readonly isSetIdentities: boolean;
+  readonly asSetIdentities: {
+    readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
+  } & Struct;
+  readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub' | 'SetIdentities';
 }
 
 /** @name PalletIdentityError */
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1863,17 +1863,20 @@
       remove_sub: {
         sub: 'MultiAddress',
       },
-      quit_sub: 'Null'
+      quit_sub: 'Null',
+      set_identities: {
+        identities: 'Vec<(AccountId32,Option<PalletIdentityRegistration>)>'
+      }
     }
   },
   /**
-   * Lookup248: pallet_identity::pallet::Error<T>
+   * Lookup251: pallet_identity::pallet::Error<T>
    **/
   PalletIdentityError: {
     _enum: ['TooManySubAccounts', 'NotFound', 'NotNamed', 'EmptyIndex', 'FeeChanged', 'NoIdentity', 'StickyJudgement', 'JudgementGiven', 'InvalidJudgement', 'InvalidIndex', 'InvalidTarget', 'TooManyFields', 'TooManyRegistrars', 'AlreadyClaimed', 'NotSub', 'NotOwned', 'JudgementForDifferentIdentity', 'JudgementPaymentFailed']
   },
   /**
-   * Lookup250: pallet_balances::BalanceLock<Balance>
+   * Lookup253: pallet_balances::BalanceLock<Balance>
    **/
   PalletBalancesBalanceLock: {
     id: '[u8;8]',
@@ -1881,20 +1884,20 @@
     reasons: 'PalletBalancesReasons'
   },
   /**
-   * Lookup251: pallet_balances::Reasons
+   * Lookup254: pallet_balances::Reasons
    **/
   PalletBalancesReasons: {
     _enum: ['Fee', 'Misc', 'All']
   },
   /**
-   * Lookup254: pallet_balances::ReserveData<ReserveIdentifier, Balance>
+   * Lookup257: pallet_balances::ReserveData<ReserveIdentifier, Balance>
    **/
   PalletBalancesReserveData: {
     id: '[u8;16]',
     amount: 'u128'
   },
   /**
-   * Lookup256: pallet_balances::pallet::Call<T, I>
+   * Lookup259: pallet_balances::pallet::Call<T, I>
    **/
   PalletBalancesCall: {
     _enum: {
@@ -1927,13 +1930,13 @@
     }
   },
   /**
-   * Lookup257: pallet_balances::pallet::Error<T, I>
+   * Lookup260: pallet_balances::pallet::Error<T, I>
    **/
   PalletBalancesError: {
     _enum: ['VestingBalance', 'LiquidityRestrictions', 'InsufficientBalance', 'ExistentialDeposit', 'KeepAlive', 'ExistingVestingSchedule', 'DeadAccount', 'TooManyReserves']
   },
   /**
-   * Lookup259: pallet_timestamp::pallet::Call<T>
+   * Lookup262: pallet_timestamp::pallet::Call<T>
    **/
   PalletTimestampCall: {
     _enum: {
@@ -1943,13 +1946,13 @@
     }
   },
   /**
-   * Lookup261: pallet_transaction_payment::Releases
+   * Lookup264: pallet_transaction_payment::Releases
    **/
   PalletTransactionPaymentReleases: {
     _enum: ['V1Ancient', 'V2']
   },
   /**
-   * Lookup262: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
+   * Lookup265: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
    **/
   PalletTreasuryProposal: {
     proposer: 'AccountId32',
@@ -1958,7 +1961,7 @@
     bond: 'u128'
   },
   /**
-   * Lookup264: pallet_treasury::pallet::Call<T, I>
+   * Lookup267: pallet_treasury::pallet::Call<T, I>
    **/
   PalletTreasuryCall: {
     _enum: {
@@ -1982,17 +1985,17 @@
     }
   },
   /**
-   * Lookup266: frame_support::PalletId
+   * Lookup269: frame_support::PalletId
    **/
   FrameSupportPalletId: '[u8;8]',
   /**
-   * Lookup267: pallet_treasury::pallet::Error<T, I>
+   * Lookup270: pallet_treasury::pallet::Error<T, I>
    **/
   PalletTreasuryError: {
     _enum: ['InsufficientProposersBalance', 'InvalidIndex', 'TooManyApprovals', 'InsufficientPermission', 'ProposalNotApproved']
   },
   /**
-   * Lookup268: pallet_sudo::pallet::Call<T>
+   * Lookup271: pallet_sudo::pallet::Call<T>
    **/
   PalletSudoCall: {
     _enum: {
@@ -2016,7 +2019,7 @@
     }
   },
   /**
-   * Lookup270: orml_vesting::module::Call<T>
+   * Lookup273: orml_vesting::module::Call<T>
    **/
   OrmlVestingModuleCall: {
     _enum: {
@@ -2035,7 +2038,7 @@
     }
   },
   /**
-   * Lookup272: orml_xtokens::module::Call<T>
+   * Lookup275: orml_xtokens::module::Call<T>
    **/
   OrmlXtokensModuleCall: {
     _enum: {
@@ -2078,7 +2081,7 @@
     }
   },
   /**
-   * Lookup273: xcm::VersionedMultiAsset
+   * Lookup276: xcm::VersionedMultiAsset
    **/
   XcmVersionedMultiAsset: {
     _enum: {
@@ -2087,7 +2090,7 @@
     }
   },
   /**
-   * Lookup276: orml_tokens::module::Call<T>
+   * Lookup279: orml_tokens::module::Call<T>
    **/
   OrmlTokensModuleCall: {
     _enum: {
@@ -2121,7 +2124,7 @@
     }
   },
   /**
-   * Lookup277: cumulus_pallet_xcmp_queue::pallet::Call<T>
+   * Lookup280: cumulus_pallet_xcmp_queue::pallet::Call<T>
    **/
   CumulusPalletXcmpQueueCall: {
     _enum: {
@@ -2170,7 +2173,7 @@
     }
   },
   /**
-   * Lookup278: pallet_xcm::pallet::Call<T>
+   * Lookup281: pallet_xcm::pallet::Call<T>
    **/
   PalletXcmCall: {
     _enum: {
@@ -2224,7 +2227,7 @@
     }
   },
   /**
-   * Lookup279: xcm::VersionedXcm<RuntimeCall>
+   * Lookup282: xcm::VersionedXcm<RuntimeCall>
    **/
   XcmVersionedXcm: {
     _enum: {
@@ -2234,7 +2237,7 @@
     }
   },
   /**
-   * Lookup280: xcm::v0::Xcm<RuntimeCall>
+   * Lookup283: xcm::v0::Xcm<RuntimeCall>
    **/
   XcmV0Xcm: {
     _enum: {
@@ -2288,7 +2291,7 @@
     }
   },
   /**
-   * Lookup282: xcm::v0::order::Order<RuntimeCall>
+   * Lookup285: xcm::v0::order::Order<RuntimeCall>
    **/
   XcmV0Order: {
     _enum: {
@@ -2331,7 +2334,7 @@
     }
   },
   /**
-   * Lookup284: xcm::v0::Response
+   * Lookup287: xcm::v0::Response
    **/
   XcmV0Response: {
     _enum: {
@@ -2339,7 +2342,7 @@
     }
   },
   /**
-   * Lookup285: xcm::v1::Xcm<RuntimeCall>
+   * Lookup288: xcm::v1::Xcm<RuntimeCall>
    **/
   XcmV1Xcm: {
     _enum: {
@@ -2398,7 +2401,7 @@
     }
   },
   /**
-   * Lookup287: xcm::v1::order::Order<RuntimeCall>
+   * Lookup290: xcm::v1::order::Order<RuntimeCall>
    **/
   XcmV1Order: {
     _enum: {
@@ -2443,7 +2446,7 @@
     }
   },
   /**
-   * Lookup289: xcm::v1::Response
+   * Lookup292: xcm::v1::Response
    **/
   XcmV1Response: {
     _enum: {
@@ -2452,11 +2455,11 @@
     }
   },
   /**
-   * Lookup303: cumulus_pallet_xcm::pallet::Call<T>
+   * Lookup306: cumulus_pallet_xcm::pallet::Call<T>
    **/
   CumulusPalletXcmCall: 'Null',
   /**
-   * Lookup304: cumulus_pallet_dmp_queue::pallet::Call<T>
+   * Lookup307: cumulus_pallet_dmp_queue::pallet::Call<T>
    **/
   CumulusPalletDmpQueueCall: {
     _enum: {
@@ -2467,7 +2470,7 @@
     }
   },
   /**
-   * Lookup305: pallet_inflation::pallet::Call<T>
+   * Lookup308: pallet_inflation::pallet::Call<T>
    **/
   PalletInflationCall: {
     _enum: {
@@ -2477,7 +2480,7 @@
     }
   },
   /**
-   * Lookup306: pallet_unique::Call<T>
+   * Lookup309: pallet_unique::Call<T>
    **/
   PalletUniqueCall: {
     _enum: {
@@ -2621,7 +2624,7 @@
     }
   },
   /**
-   * Lookup311: up_data_structs::CollectionMode
+   * Lookup314: up_data_structs::CollectionMode
    **/
   UpDataStructsCollectionMode: {
     _enum: {
@@ -2631,7 +2634,7 @@
     }
   },
   /**
-   * Lookup312: up_data_structs::CreateCollectionData<sp_core::crypto::AccountId32>
+   * Lookup315: up_data_structs::CreateCollectionData<sp_core::crypto::AccountId32>
    **/
   UpDataStructsCreateCollectionData: {
     mode: 'UpDataStructsCollectionMode',
@@ -2646,13 +2649,13 @@
     properties: 'Vec<UpDataStructsProperty>'
   },
   /**
-   * Lookup314: up_data_structs::AccessMode
+   * Lookup317: up_data_structs::AccessMode
    **/
   UpDataStructsAccessMode: {
     _enum: ['Normal', 'AllowList']
   },
   /**
-   * Lookup316: up_data_structs::CollectionLimits
+   * Lookup319: up_data_structs::CollectionLimits
    **/
   UpDataStructsCollectionLimits: {
     accountTokenOwnershipLimit: 'Option<u32>',
@@ -2666,7 +2669,7 @@
     transfersEnabled: 'Option<bool>'
   },
   /**
-   * Lookup318: up_data_structs::SponsoringRateLimit
+   * Lookup321: up_data_structs::SponsoringRateLimit
    **/
   UpDataStructsSponsoringRateLimit: {
     _enum: {
@@ -2675,7 +2678,7 @@
     }
   },
   /**
-   * Lookup321: up_data_structs::CollectionPermissions
+   * Lookup324: up_data_structs::CollectionPermissions
    **/
   UpDataStructsCollectionPermissions: {
     access: 'Option<UpDataStructsAccessMode>',
@@ -2683,7 +2686,7 @@
     nesting: 'Option<UpDataStructsNestingPermissions>'
   },
   /**
-   * Lookup323: up_data_structs::NestingPermissions
+   * Lookup326: up_data_structs::NestingPermissions
    **/
   UpDataStructsNestingPermissions: {
     tokenOwner: 'bool',
@@ -2691,18 +2694,18 @@
     restricted: 'Option<UpDataStructsOwnerRestrictedSet>'
   },
   /**
-   * Lookup325: up_data_structs::OwnerRestrictedSet
+   * Lookup328: up_data_structs::OwnerRestrictedSet
    **/
   UpDataStructsOwnerRestrictedSet: 'BTreeSet<u32>',
   /**
-   * Lookup330: up_data_structs::PropertyKeyPermission
+   * Lookup333: up_data_structs::PropertyKeyPermission
    **/
   UpDataStructsPropertyKeyPermission: {
     key: 'Bytes',
     permission: 'UpDataStructsPropertyPermission'
   },
   /**
-   * Lookup331: up_data_structs::PropertyPermission
+   * Lookup334: up_data_structs::PropertyPermission
    **/
   UpDataStructsPropertyPermission: {
     mutable: 'bool',
@@ -2710,14 +2713,14 @@
     tokenOwner: 'bool'
   },
   /**
-   * Lookup334: up_data_structs::Property
+   * Lookup337: up_data_structs::Property
    **/
   UpDataStructsProperty: {
     key: 'Bytes',
     value: 'Bytes'
   },
   /**
-   * Lookup337: up_data_structs::CreateItemData
+   * Lookup340: up_data_structs::CreateItemData
    **/
   UpDataStructsCreateItemData: {
     _enum: {
@@ -2727,26 +2730,26 @@
     }
   },
   /**
-   * Lookup338: up_data_structs::CreateNftData
+   * Lookup341: up_data_structs::CreateNftData
    **/
   UpDataStructsCreateNftData: {
     properties: 'Vec<UpDataStructsProperty>'
   },
   /**
-   * Lookup339: up_data_structs::CreateFungibleData
+   * Lookup342: up_data_structs::CreateFungibleData
    **/
   UpDataStructsCreateFungibleData: {
     value: 'u128'
   },
   /**
-   * Lookup340: up_data_structs::CreateReFungibleData
+   * Lookup343: up_data_structs::CreateReFungibleData
    **/
   UpDataStructsCreateReFungibleData: {
     pieces: 'u128',
     properties: 'Vec<UpDataStructsProperty>'
   },
   /**
-   * Lookup343: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+   * Lookup346: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
    **/
   UpDataStructsCreateItemExData: {
     _enum: {
@@ -2757,14 +2760,14 @@
     }
   },
   /**
-   * Lookup345: up_data_structs::CreateNftExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+   * Lookup348: up_data_structs::CreateNftExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
    **/
   UpDataStructsCreateNftExData: {
     properties: 'Vec<UpDataStructsProperty>',
     owner: 'PalletEvmAccountBasicCrossAccountIdRepr'
   },
   /**
-   * Lookup352: up_data_structs::CreateRefungibleExSingleOwner<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+   * Lookup355: up_data_structs::CreateRefungibleExSingleOwner<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
    **/
   UpDataStructsCreateRefungibleExSingleOwner: {
     user: 'PalletEvmAccountBasicCrossAccountIdRepr',
@@ -2772,14 +2775,14 @@
     properties: 'Vec<UpDataStructsProperty>'
   },
   /**
-   * Lookup354: up_data_structs::CreateRefungibleExMultipleOwners<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+   * Lookup357: up_data_structs::CreateRefungibleExMultipleOwners<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
    **/
   UpDataStructsCreateRefungibleExMultipleOwners: {
     users: 'BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>',
     properties: 'Vec<UpDataStructsProperty>'
   },
   /**
-   * Lookup355: pallet_configuration::pallet::Call<T>
+   * Lookup358: pallet_configuration::pallet::Call<T>
    **/
   PalletConfigurationCall: {
     _enum: {
@@ -2807,7 +2810,7 @@
     }
   },
   /**
-   * Lookup360: pallet_configuration::AppPromotionConfiguration<BlockNumber>
+   * Lookup363: pallet_configuration::AppPromotionConfiguration<BlockNumber>
    **/
   PalletConfigurationAppPromotionConfiguration: {
     recalculationInterval: 'Option<u32>',
@@ -2816,15 +2819,15 @@
     maxStakersPerCalculation: 'Option<u8>'
   },
   /**
-   * Lookup364: pallet_template_transaction_payment::Call<T>
+   * Lookup367: pallet_template_transaction_payment::Call<T>
    **/
   PalletTemplateTransactionPaymentCall: 'Null',
   /**
-   * Lookup365: pallet_structure::pallet::Call<T>
+   * Lookup368: pallet_structure::pallet::Call<T>
    **/
   PalletStructureCall: 'Null',
   /**
-   * Lookup366: pallet_rmrk_core::pallet::Call<T>
+   * Lookup369: pallet_rmrk_core::pallet::Call<T>
    **/
   PalletRmrkCoreCall: {
     _enum: {
@@ -2915,7 +2918,7 @@
     }
   },
   /**
-   * Lookup372: rmrk_traits::resource::ResourceTypes<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup375: rmrk_traits::resource::ResourceTypes<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsResourceResourceTypes: {
     _enum: {
@@ -2925,7 +2928,7 @@
     }
   },
   /**
-   * Lookup374: rmrk_traits::resource::BasicResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup377: rmrk_traits::resource::BasicResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsResourceBasicResource: {
     src: 'Option<Bytes>',
@@ -2934,7 +2937,7 @@
     thumb: 'Option<Bytes>'
   },
   /**
-   * Lookup376: rmrk_traits::resource::ComposableResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup379: rmrk_traits::resource::ComposableResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsResourceComposableResource: {
     parts: 'Vec<u32>',
@@ -2945,7 +2948,7 @@
     thumb: 'Option<Bytes>'
   },
   /**
-   * Lookup377: rmrk_traits::resource::SlotResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup380: rmrk_traits::resource::SlotResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsResourceSlotResource: {
     base: 'u32',
@@ -2956,7 +2959,7 @@
     thumb: 'Option<Bytes>'
   },
   /**
-   * Lookup380: pallet_rmrk_equip::pallet::Call<T>
+   * Lookup383: pallet_rmrk_equip::pallet::Call<T>
    **/
   PalletRmrkEquipCall: {
     _enum: {
@@ -2977,7 +2980,7 @@
     }
   },
   /**
-   * Lookup383: rmrk_traits::part::PartType<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup386: rmrk_traits::part::PartType<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsPartPartType: {
     _enum: {
@@ -2986,7 +2989,7 @@
     }
   },
   /**
-   * Lookup385: rmrk_traits::part::FixedPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup388: rmrk_traits::part::FixedPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsPartFixedPart: {
     id: 'u32',
@@ -2994,7 +2997,7 @@
     src: 'Bytes'
   },
   /**
-   * Lookup386: rmrk_traits::part::SlotPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup389: rmrk_traits::part::SlotPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsPartSlotPart: {
     id: 'u32',
@@ -3003,7 +3006,7 @@
     z: 'u32'
   },
   /**
-   * Lookup387: rmrk_traits::part::EquippableList<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup390: rmrk_traits::part::EquippableList<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsPartEquippableList: {
     _enum: {
@@ -3013,7 +3016,7 @@
     }
   },
   /**
-   * Lookup389: rmrk_traits::theme::Theme<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>, S>>
+   * Lookup392: rmrk_traits::theme::Theme<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>, S>>
    **/
   RmrkTraitsTheme: {
     name: 'Bytes',
@@ -3021,14 +3024,14 @@
     inherit: 'bool'
   },
   /**
-   * Lookup391: rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+   * Lookup394: rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
    **/
   RmrkTraitsThemeThemeProperty: {
     key: 'Bytes',
     value: 'Bytes'
   },
   /**
-   * Lookup393: pallet_app_promotion::pallet::Call<T>
+   * Lookup396: pallet_app_promotion::pallet::Call<T>
    **/
   PalletAppPromotionCall: {
     _enum: {
@@ -3057,7 +3060,7 @@
     }
   },
   /**
-   * Lookup394: pallet_foreign_assets::module::Call<T>
+   * Lookup397: pallet_foreign_assets::module::Call<T>
    **/
   PalletForeignAssetsModuleCall: {
     _enum: {
@@ -3074,7 +3077,7 @@
     }
   },
   /**
-   * Lookup395: pallet_evm::pallet::Call<T>
+   * Lookup398: pallet_evm::pallet::Call<T>
    **/
   PalletEvmCall: {
     _enum: {
@@ -3117,7 +3120,7 @@
     }
   },
   /**
-   * Lookup401: pallet_ethereum::pallet::Call<T>
+   * Lookup404: pallet_ethereum::pallet::Call<T>
    **/
   PalletEthereumCall: {
     _enum: {
@@ -3127,7 +3130,7 @@
     }
   },
   /**
-   * Lookup402: ethereum::transaction::TransactionV2
+   * Lookup405: ethereum::transaction::TransactionV2
    **/
   EthereumTransactionTransactionV2: {
     _enum: {
@@ -3137,7 +3140,7 @@
     }
   },
   /**
-   * Lookup403: ethereum::transaction::LegacyTransaction
+   * Lookup406: ethereum::transaction::LegacyTransaction
    **/
   EthereumTransactionLegacyTransaction: {
     nonce: 'U256',
@@ -3149,7 +3152,7 @@
     signature: 'EthereumTransactionTransactionSignature'
   },
   /**
-   * Lookup404: ethereum::transaction::TransactionAction
+   * Lookup407: ethereum::transaction::TransactionAction
    **/
   EthereumTransactionTransactionAction: {
     _enum: {
@@ -3158,7 +3161,7 @@
     }
   },
   /**
-   * Lookup405: ethereum::transaction::TransactionSignature
+   * Lookup408: ethereum::transaction::TransactionSignature
    **/
   EthereumTransactionTransactionSignature: {
     v: 'u64',
@@ -3166,7 +3169,7 @@
     s: 'H256'
   },
   /**
-   * Lookup407: ethereum::transaction::EIP2930Transaction
+   * Lookup410: ethereum::transaction::EIP2930Transaction
    **/
   EthereumTransactionEip2930Transaction: {
     chainId: 'u64',
@@ -3182,14 +3185,14 @@
     s: 'H256'
   },
   /**
-   * Lookup409: ethereum::transaction::AccessListItem
+   * Lookup412: ethereum::transaction::AccessListItem
    **/
   EthereumTransactionAccessListItem: {
     address: 'H160',
     storageKeys: 'Vec<H256>'
   },
   /**
-   * Lookup410: ethereum::transaction::EIP1559Transaction
+   * Lookup413: ethereum::transaction::EIP1559Transaction
    **/
   EthereumTransactionEip1559Transaction: {
     chainId: 'u64',
@@ -3206,7 +3209,7 @@
     s: 'H256'
   },
   /**
-   * Lookup411: pallet_data_management::pallet::Call<T>
+   * Lookup414: pallet_data_management::pallet::Call<T>
    **/
   PalletDataManagementCall: {
     _enum: {
@@ -3225,10 +3228,7 @@
         logs: 'Vec<EthereumLog>',
       },
       insert_events: {
-        events: 'Vec<Bytes>',
-      },
-      set_identities: {
-        identities: 'Vec<(AccountId32,Option<PalletIdentityRegistration>)>'
+        events: 'Vec<Bytes>'
       }
     }
   },
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -2057,10 +2057,14 @@
       readonly sub: MultiAddress;
     } & Struct;
     readonly isQuitSub: boolean;
-    readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub';
+    readonly isSetIdentities: boolean;
+    readonly asSetIdentities: {
+      readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
+    } & Struct;
+    readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub' | 'SetIdentities';
   }
 
-  /** @name PalletIdentityError (248) */
+  /** @name PalletIdentityError (251) */
   interface PalletIdentityError extends Enum {
     readonly isTooManySubAccounts: boolean;
     readonly isNotFound: boolean;
@@ -2083,14 +2087,14 @@
     readonly type: 'TooManySubAccounts' | 'NotFound' | 'NotNamed' | 'EmptyIndex' | 'FeeChanged' | 'NoIdentity' | 'StickyJudgement' | 'JudgementGiven' | 'InvalidJudgement' | 'InvalidIndex' | 'InvalidTarget' | 'TooManyFields' | 'TooManyRegistrars' | 'AlreadyClaimed' | 'NotSub' | 'NotOwned' | 'JudgementForDifferentIdentity' | 'JudgementPaymentFailed';
   }
 
-  /** @name PalletBalancesBalanceLock (250) */
+  /** @name PalletBalancesBalanceLock (253) */
   interface PalletBalancesBalanceLock extends Struct {
     readonly id: U8aFixed;
     readonly amount: u128;
     readonly reasons: PalletBalancesReasons;
   }
 
-  /** @name PalletBalancesReasons (251) */
+  /** @name PalletBalancesReasons (254) */
   interface PalletBalancesReasons extends Enum {
     readonly isFee: boolean;
     readonly isMisc: boolean;
@@ -2098,13 +2102,13 @@
     readonly type: 'Fee' | 'Misc' | 'All';
   }
 
-  /** @name PalletBalancesReserveData (254) */
+  /** @name PalletBalancesReserveData (257) */
   interface PalletBalancesReserveData extends Struct {
     readonly id: U8aFixed;
     readonly amount: u128;
   }
 
-  /** @name PalletBalancesCall (256) */
+  /** @name PalletBalancesCall (259) */
   interface PalletBalancesCall extends Enum {
     readonly isTransfer: boolean;
     readonly asTransfer: {
@@ -2141,7 +2145,7 @@
     readonly type: 'Transfer' | 'SetBalance' | 'ForceTransfer' | 'TransferKeepAlive' | 'TransferAll' | 'ForceUnreserve';
   }
 
-  /** @name PalletBalancesError (257) */
+  /** @name PalletBalancesError (260) */
   interface PalletBalancesError extends Enum {
     readonly isVestingBalance: boolean;
     readonly isLiquidityRestrictions: boolean;
@@ -2154,7 +2158,7 @@
     readonly type: 'VestingBalance' | 'LiquidityRestrictions' | 'InsufficientBalance' | 'ExistentialDeposit' | 'KeepAlive' | 'ExistingVestingSchedule' | 'DeadAccount' | 'TooManyReserves';
   }
 
-  /** @name PalletTimestampCall (259) */
+  /** @name PalletTimestampCall (262) */
   interface PalletTimestampCall extends Enum {
     readonly isSet: boolean;
     readonly asSet: {
@@ -2163,14 +2167,14 @@
     readonly type: 'Set';
   }
 
-  /** @name PalletTransactionPaymentReleases (261) */
+  /** @name PalletTransactionPaymentReleases (264) */
   interface PalletTransactionPaymentReleases extends Enum {
     readonly isV1Ancient: boolean;
     readonly isV2: boolean;
     readonly type: 'V1Ancient' | 'V2';
   }
 
-  /** @name PalletTreasuryProposal (262) */
+  /** @name PalletTreasuryProposal (265) */
   interface PalletTreasuryProposal extends Struct {
     readonly proposer: AccountId32;
     readonly value: u128;
@@ -2178,7 +2182,7 @@
     readonly bond: u128;
   }
 
-  /** @name PalletTreasuryCall (264) */
+  /** @name PalletTreasuryCall (267) */
   interface PalletTreasuryCall extends Enum {
     readonly isProposeSpend: boolean;
     readonly asProposeSpend: {
@@ -2205,10 +2209,10 @@
     readonly type: 'ProposeSpend' | 'RejectProposal' | 'ApproveProposal' | 'Spend' | 'RemoveApproval';
   }
 
-  /** @name FrameSupportPalletId (266) */
+  /** @name FrameSupportPalletId (269) */
   interface FrameSupportPalletId extends U8aFixed {}
 
-  /** @name PalletTreasuryError (267) */
+  /** @name PalletTreasuryError (270) */
   interface PalletTreasuryError extends Enum {
     readonly isInsufficientProposersBalance: boolean;
     readonly isInvalidIndex: boolean;
@@ -2218,7 +2222,7 @@
     readonly type: 'InsufficientProposersBalance' | 'InvalidIndex' | 'TooManyApprovals' | 'InsufficientPermission' | 'ProposalNotApproved';
   }
 
-  /** @name PalletSudoCall (268) */
+  /** @name PalletSudoCall (271) */
   interface PalletSudoCall extends Enum {
     readonly isSudo: boolean;
     readonly asSudo: {
@@ -2241,7 +2245,7 @@
     readonly type: 'Sudo' | 'SudoUncheckedWeight' | 'SetKey' | 'SudoAs';
   }
 
-  /** @name OrmlVestingModuleCall (270) */
+  /** @name OrmlVestingModuleCall (273) */
   interface OrmlVestingModuleCall extends Enum {
     readonly isClaim: boolean;
     readonly isVestedTransfer: boolean;
@@ -2261,7 +2265,7 @@
     readonly type: 'Claim' | 'VestedTransfer' | 'UpdateVestingSchedules' | 'ClaimFor';
   }
 
-  /** @name OrmlXtokensModuleCall (272) */
+  /** @name OrmlXtokensModuleCall (275) */
   interface OrmlXtokensModuleCall extends Enum {
     readonly isTransfer: boolean;
     readonly asTransfer: {
@@ -2308,7 +2312,7 @@
     readonly type: 'Transfer' | 'TransferMultiasset' | 'TransferWithFee' | 'TransferMultiassetWithFee' | 'TransferMulticurrencies' | 'TransferMultiassets';
   }
 
-  /** @name XcmVersionedMultiAsset (273) */
+  /** @name XcmVersionedMultiAsset (276) */
   interface XcmVersionedMultiAsset extends Enum {
     readonly isV0: boolean;
     readonly asV0: XcmV0MultiAsset;
@@ -2317,7 +2321,7 @@
     readonly type: 'V0' | 'V1';
   }
 
-  /** @name OrmlTokensModuleCall (276) */
+  /** @name OrmlTokensModuleCall (279) */
   interface OrmlTokensModuleCall extends Enum {
     readonly isTransfer: boolean;
     readonly asTransfer: {
@@ -2354,7 +2358,7 @@
     readonly type: 'Transfer' | 'TransferAll' | 'TransferKeepAlive' | 'ForceTransfer' | 'SetBalance';
   }
 
-  /** @name CumulusPalletXcmpQueueCall (277) */
+  /** @name CumulusPalletXcmpQueueCall (280) */
   interface CumulusPalletXcmpQueueCall extends Enum {
     readonly isServiceOverweight: boolean;
     readonly asServiceOverweight: {
@@ -2390,7 +2394,7 @@
     readonly type: 'ServiceOverweight' | 'SuspendXcmExecution' | 'ResumeXcmExecution' | 'UpdateSuspendThreshold' | 'UpdateDropThreshold' | 'UpdateResumeThreshold' | 'UpdateThresholdWeight' | 'UpdateWeightRestrictDecay' | 'UpdateXcmpMaxIndividualWeight';
   }
 
-  /** @name PalletXcmCall (278) */
+  /** @name PalletXcmCall (281) */
   interface PalletXcmCall extends Enum {
     readonly isSend: boolean;
     readonly asSend: {
@@ -2452,7 +2456,7 @@
     readonly type: 'Send' | 'TeleportAssets' | 'ReserveTransferAssets' | 'Execute' | 'ForceXcmVersion' | 'ForceDefaultXcmVersion' | 'ForceSubscribeVersionNotify' | 'ForceUnsubscribeVersionNotify' | 'LimitedReserveTransferAssets' | 'LimitedTeleportAssets';
   }
 
-  /** @name XcmVersionedXcm (279) */
+  /** @name XcmVersionedXcm (282) */
   interface XcmVersionedXcm extends Enum {
     readonly isV0: boolean;
     readonly asV0: XcmV0Xcm;
@@ -2463,7 +2467,7 @@
     readonly type: 'V0' | 'V1' | 'V2';
   }
 
-  /** @name XcmV0Xcm (280) */
+  /** @name XcmV0Xcm (283) */
   interface XcmV0Xcm extends Enum {
     readonly isWithdrawAsset: boolean;
     readonly asWithdrawAsset: {
@@ -2526,7 +2530,7 @@
     readonly type: 'WithdrawAsset' | 'ReserveAssetDeposit' | 'TeleportAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'RelayedFrom';
   }
 
-  /** @name XcmV0Order (282) */
+  /** @name XcmV0Order (285) */
   interface XcmV0Order extends Enum {
     readonly isNull: boolean;
     readonly isDepositAsset: boolean;
@@ -2574,14 +2578,14 @@
     readonly type: 'Null' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution';
   }
 
-  /** @name XcmV0Response (284) */
+  /** @name XcmV0Response (287) */
   interface XcmV0Response extends Enum {
     readonly isAssets: boolean;
     readonly asAssets: Vec<XcmV0MultiAsset>;
     readonly type: 'Assets';
   }
 
-  /** @name XcmV1Xcm (285) */
+  /** @name XcmV1Xcm (288) */
   interface XcmV1Xcm extends Enum {
     readonly isWithdrawAsset: boolean;
     readonly asWithdrawAsset: {
@@ -2650,7 +2654,7 @@
     readonly type: 'WithdrawAsset' | 'ReserveAssetDeposited' | 'ReceiveTeleportedAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'RelayedFrom' | 'SubscribeVersion' | 'UnsubscribeVersion';
   }
 
-  /** @name XcmV1Order (287) */
+  /** @name XcmV1Order (290) */
   interface XcmV1Order extends Enum {
     readonly isNoop: boolean;
     readonly isDepositAsset: boolean;
@@ -2700,7 +2704,7 @@
     readonly type: 'Noop' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution';
   }
 
-  /** @name XcmV1Response (289) */
+  /** @name XcmV1Response (292) */
   interface XcmV1Response extends Enum {
     readonly isAssets: boolean;
     readonly asAssets: XcmV1MultiassetMultiAssets;
@@ -2709,10 +2713,10 @@
     readonly type: 'Assets' | 'Version';
   }
 
-  /** @name CumulusPalletXcmCall (303) */
+  /** @name CumulusPalletXcmCall (306) */
   type CumulusPalletXcmCall = Null;
 
-  /** @name CumulusPalletDmpQueueCall (304) */
+  /** @name CumulusPalletDmpQueueCall (307) */
   interface CumulusPalletDmpQueueCall extends Enum {
     readonly isServiceOverweight: boolean;
     readonly asServiceOverweight: {
@@ -2722,7 +2726,7 @@
     readonly type: 'ServiceOverweight';
   }
 
-  /** @name PalletInflationCall (305) */
+  /** @name PalletInflationCall (308) */
   interface PalletInflationCall extends Enum {
     readonly isStartInflation: boolean;
     readonly asStartInflation: {
@@ -2731,7 +2735,7 @@
     readonly type: 'StartInflation';
   }
 
-  /** @name PalletUniqueCall (306) */
+  /** @name PalletUniqueCall (309) */
   interface PalletUniqueCall extends Enum {
     readonly isCreateCollection: boolean;
     readonly asCreateCollection: {
@@ -2904,7 +2908,7 @@
     readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
   }
 
-  /** @name UpDataStructsCollectionMode (311) */
+  /** @name UpDataStructsCollectionMode (314) */
   interface UpDataStructsCollectionMode extends Enum {
     readonly isNft: boolean;
     readonly isFungible: boolean;
@@ -2913,7 +2917,7 @@
     readonly type: 'Nft' | 'Fungible' | 'ReFungible';
   }
 
-  /** @name UpDataStructsCreateCollectionData (312) */
+  /** @name UpDataStructsCreateCollectionData (315) */
   interface UpDataStructsCreateCollectionData extends Struct {
     readonly mode: UpDataStructsCollectionMode;
     readonly access: Option<UpDataStructsAccessMode>;
@@ -2927,14 +2931,14 @@
     readonly properties: Vec<UpDataStructsProperty>;
   }
 
-  /** @name UpDataStructsAccessMode (314) */
+  /** @name UpDataStructsAccessMode (317) */
   interface UpDataStructsAccessMode extends Enum {
     readonly isNormal: boolean;
     readonly isAllowList: boolean;
     readonly type: 'Normal' | 'AllowList';
   }
 
-  /** @name UpDataStructsCollectionLimits (316) */
+  /** @name UpDataStructsCollectionLimits (319) */
   interface UpDataStructsCollectionLimits extends Struct {
     readonly accountTokenOwnershipLimit: Option<u32>;
     readonly sponsoredDataSize: Option<u32>;
@@ -2947,7 +2951,7 @@
     readonly transfersEnabled: Option<bool>;
   }
 
-  /** @name UpDataStructsSponsoringRateLimit (318) */
+  /** @name UpDataStructsSponsoringRateLimit (321) */
   interface UpDataStructsSponsoringRateLimit extends Enum {
     readonly isSponsoringDisabled: boolean;
     readonly isBlocks: boolean;
@@ -2955,43 +2959,43 @@
     readonly type: 'SponsoringDisabled' | 'Blocks';
   }
 
-  /** @name UpDataStructsCollectionPermissions (321) */
+  /** @name UpDataStructsCollectionPermissions (324) */
   interface UpDataStructsCollectionPermissions extends Struct {
     readonly access: Option<UpDataStructsAccessMode>;
     readonly mintMode: Option<bool>;
     readonly nesting: Option<UpDataStructsNestingPermissions>;
   }
 
-  /** @name UpDataStructsNestingPermissions (323) */
+  /** @name UpDataStructsNestingPermissions (326) */
   interface UpDataStructsNestingPermissions extends Struct {
     readonly tokenOwner: bool;
     readonly collectionAdmin: bool;
     readonly restricted: Option<UpDataStructsOwnerRestrictedSet>;
   }
 
-  /** @name UpDataStructsOwnerRestrictedSet (325) */
+  /** @name UpDataStructsOwnerRestrictedSet (328) */
   interface UpDataStructsOwnerRestrictedSet extends BTreeSet<u32> {}
 
-  /** @name UpDataStructsPropertyKeyPermission (330) */
+  /** @name UpDataStructsPropertyKeyPermission (333) */
   interface UpDataStructsPropertyKeyPermission extends Struct {
     readonly key: Bytes;
     readonly permission: UpDataStructsPropertyPermission;
   }
 
-  /** @name UpDataStructsPropertyPermission (331) */
+  /** @name UpDataStructsPropertyPermission (334) */
   interface UpDataStructsPropertyPermission extends Struct {
     readonly mutable: bool;
     readonly collectionAdmin: bool;
     readonly tokenOwner: bool;
   }
 
-  /** @name UpDataStructsProperty (334) */
+  /** @name UpDataStructsProperty (337) */
   interface UpDataStructsProperty extends Struct {
     readonly key: Bytes;
     readonly value: Bytes;
   }
 
-  /** @name UpDataStructsCreateItemData (337) */
+  /** @name UpDataStructsCreateItemData (340) */
   interface UpDataStructsCreateItemData extends Enum {
     readonly isNft: boolean;
     readonly asNft: UpDataStructsCreateNftData;
@@ -3002,23 +3006,23 @@
     readonly type: 'Nft' | 'Fungible' | 'ReFungible';
   }
 
-  /** @name UpDataStructsCreateNftData (338) */
+  /** @name UpDataStructsCreateNftData (341) */
   interface UpDataStructsCreateNftData extends Struct {
     readonly properties: Vec<UpDataStructsProperty>;
   }
 
-  /** @name UpDataStructsCreateFungibleData (339) */
+  /** @name UpDataStructsCreateFungibleData (342) */
   interface UpDataStructsCreateFungibleData extends Struct {
     readonly value: u128;
   }
 
-  /** @name UpDataStructsCreateReFungibleData (340) */
+  /** @name UpDataStructsCreateReFungibleData (343) */
   interface UpDataStructsCreateReFungibleData extends Struct {
     readonly pieces: u128;
     readonly properties: Vec<UpDataStructsProperty>;
   }
 
-  /** @name UpDataStructsCreateItemExData (343) */
+  /** @name UpDataStructsCreateItemExData (346) */
   interface UpDataStructsCreateItemExData extends Enum {
     readonly isNft: boolean;
     readonly asNft: Vec<UpDataStructsCreateNftExData>;
@@ -3031,26 +3035,26 @@
     readonly type: 'Nft' | 'Fungible' | 'RefungibleMultipleItems' | 'RefungibleMultipleOwners';
   }
 
-  /** @name UpDataStructsCreateNftExData (345) */
+  /** @name UpDataStructsCreateNftExData (348) */
   interface UpDataStructsCreateNftExData extends Struct {
     readonly properties: Vec<UpDataStructsProperty>;
     readonly owner: PalletEvmAccountBasicCrossAccountIdRepr;
   }
 
-  /** @name UpDataStructsCreateRefungibleExSingleOwner (352) */
+  /** @name UpDataStructsCreateRefungibleExSingleOwner (355) */
   interface UpDataStructsCreateRefungibleExSingleOwner extends Struct {
     readonly user: PalletEvmAccountBasicCrossAccountIdRepr;
     readonly pieces: u128;
     readonly properties: Vec<UpDataStructsProperty>;
   }
 
-  /** @name UpDataStructsCreateRefungibleExMultipleOwners (354) */
+  /** @name UpDataStructsCreateRefungibleExMultipleOwners (357) */
   interface UpDataStructsCreateRefungibleExMultipleOwners extends Struct {
     readonly users: BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>;
     readonly properties: Vec<UpDataStructsProperty>;
   }
 
-  /** @name PalletConfigurationCall (355) */
+  /** @name PalletConfigurationCall (358) */
   interface PalletConfigurationCall extends Enum {
     readonly isSetWeightToFeeCoefficientOverride: boolean;
     readonly asSetWeightToFeeCoefficientOverride: {
@@ -3083,7 +3087,7 @@
     readonly type: 'SetWeightToFeeCoefficientOverride' | 'SetMinGasPriceOverride' | 'SetXcmAllowedLocations' | 'SetAppPromotionConfigurationOverride' | 'SetCollatorSelectionDesiredCollators' | 'SetCollatorSelectionLicenseBond' | 'SetCollatorSelectionKickThreshold';
   }
 
-  /** @name PalletConfigurationAppPromotionConfiguration (360) */
+  /** @name PalletConfigurationAppPromotionConfiguration (363) */
   interface PalletConfigurationAppPromotionConfiguration extends Struct {
     readonly recalculationInterval: Option<u32>;
     readonly pendingInterval: Option<u32>;
@@ -3091,13 +3095,13 @@
     readonly maxStakersPerCalculation: Option<u8>;
   }
 
-  /** @name PalletTemplateTransactionPaymentCall (364) */
+  /** @name PalletTemplateTransactionPaymentCall (367) */
   type PalletTemplateTransactionPaymentCall = Null;
 
-  /** @name PalletStructureCall (365) */
+  /** @name PalletStructureCall (368) */
   type PalletStructureCall = Null;
 
-  /** @name PalletRmrkCoreCall (366) */
+  /** @name PalletRmrkCoreCall (369) */
   interface PalletRmrkCoreCall extends Enum {
     readonly isCreateCollection: boolean;
     readonly asCreateCollection: {
@@ -3203,7 +3207,7 @@
     readonly type: 'CreateCollection' | 'DestroyCollection' | 'ChangeCollectionIssuer' | 'LockCollection' | 'MintNft' | 'BurnNft' | 'Send' | 'AcceptNft' | 'RejectNft' | 'AcceptResource' | 'AcceptResourceRemoval' | 'SetProperty' | 'SetPriority' | 'AddBasicResource' | 'AddComposableResource' | 'AddSlotResource' | 'RemoveResource';
   }
 
-  /** @name RmrkTraitsResourceResourceTypes (372) */
+  /** @name RmrkTraitsResourceResourceTypes (375) */
   interface RmrkTraitsResourceResourceTypes extends Enum {
     readonly isBasic: boolean;
     readonly asBasic: RmrkTraitsResourceBasicResource;
@@ -3214,7 +3218,7 @@
     readonly type: 'Basic' | 'Composable' | 'Slot';
   }
 
-  /** @name RmrkTraitsResourceBasicResource (374) */
+  /** @name RmrkTraitsResourceBasicResource (377) */
   interface RmrkTraitsResourceBasicResource extends Struct {
     readonly src: Option<Bytes>;
     readonly metadata: Option<Bytes>;
@@ -3222,7 +3226,7 @@
     readonly thumb: Option<Bytes>;
   }
 
-  /** @name RmrkTraitsResourceComposableResource (376) */
+  /** @name RmrkTraitsResourceComposableResource (379) */
   interface RmrkTraitsResourceComposableResource extends Struct {
     readonly parts: Vec<u32>;
     readonly base: u32;
@@ -3232,7 +3236,7 @@
     readonly thumb: Option<Bytes>;
   }
 
-  /** @name RmrkTraitsResourceSlotResource (377) */
+  /** @name RmrkTraitsResourceSlotResource (380) */
   interface RmrkTraitsResourceSlotResource extends Struct {
     readonly base: u32;
     readonly src: Option<Bytes>;
@@ -3242,7 +3246,7 @@
     readonly thumb: Option<Bytes>;
   }
 
-  /** @name PalletRmrkEquipCall (380) */
+  /** @name PalletRmrkEquipCall (383) */
   interface PalletRmrkEquipCall extends Enum {
     readonly isCreateBase: boolean;
     readonly asCreateBase: {
@@ -3264,7 +3268,7 @@
     readonly type: 'CreateBase' | 'ThemeAdd' | 'Equippable';
   }
 
-  /** @name RmrkTraitsPartPartType (383) */
+  /** @name RmrkTraitsPartPartType (386) */
   interface RmrkTraitsPartPartType extends Enum {
     readonly isFixedPart: boolean;
     readonly asFixedPart: RmrkTraitsPartFixedPart;
@@ -3273,14 +3277,14 @@
     readonly type: 'FixedPart' | 'SlotPart';
   }
 
-  /** @name RmrkTraitsPartFixedPart (385) */
+  /** @name RmrkTraitsPartFixedPart (388) */
   interface RmrkTraitsPartFixedPart extends Struct {
     readonly id: u32;
     readonly z: u32;
     readonly src: Bytes;
   }
 
-  /** @name RmrkTraitsPartSlotPart (386) */
+  /** @name RmrkTraitsPartSlotPart (389) */
   interface RmrkTraitsPartSlotPart extends Struct {
     readonly id: u32;
     readonly equippable: RmrkTraitsPartEquippableList;
@@ -3288,7 +3292,7 @@
     readonly z: u32;
   }
 
-  /** @name RmrkTraitsPartEquippableList (387) */
+  /** @name RmrkTraitsPartEquippableList (390) */
   interface RmrkTraitsPartEquippableList extends Enum {
     readonly isAll: boolean;
     readonly isEmpty: boolean;
@@ -3297,20 +3301,20 @@
     readonly type: 'All' | 'Empty' | 'Custom';
   }
 
-  /** @name RmrkTraitsTheme (389) */
+  /** @name RmrkTraitsTheme (392) */
   interface RmrkTraitsTheme extends Struct {
     readonly name: Bytes;
     readonly properties: Vec<RmrkTraitsThemeThemeProperty>;
     readonly inherit: bool;
   }
 
-  /** @name RmrkTraitsThemeThemeProperty (391) */
+  /** @name RmrkTraitsThemeThemeProperty (394) */
   interface RmrkTraitsThemeThemeProperty extends Struct {
     readonly key: Bytes;
     readonly value: Bytes;
   }
 
-  /** @name PalletAppPromotionCall (393) */
+  /** @name PalletAppPromotionCall (396) */
   interface PalletAppPromotionCall extends Enum {
     readonly isSetAdminAddress: boolean;
     readonly asSetAdminAddress: {
@@ -3344,7 +3348,7 @@
     readonly type: 'SetAdminAddress' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorContract' | 'StopSponsoringContract' | 'PayoutStakers';
   }
 
-  /** @name PalletForeignAssetsModuleCall (394) */
+  /** @name PalletForeignAssetsModuleCall (397) */
   interface PalletForeignAssetsModuleCall extends Enum {
     readonly isRegisterForeignAsset: boolean;
     readonly asRegisterForeignAsset: {
@@ -3361,7 +3365,7 @@
     readonly type: 'RegisterForeignAsset' | 'UpdateForeignAsset';
   }
 
-  /** @name PalletEvmCall (395) */
+  /** @name PalletEvmCall (398) */
   interface PalletEvmCall extends Enum {
     readonly isWithdraw: boolean;
     readonly asWithdraw: {
@@ -3406,7 +3410,7 @@
     readonly type: 'Withdraw' | 'Call' | 'Create' | 'Create2';
   }
 
-  /** @name PalletEthereumCall (401) */
+  /** @name PalletEthereumCall (404) */
   interface PalletEthereumCall extends Enum {
     readonly isTransact: boolean;
     readonly asTransact: {
@@ -3415,7 +3419,7 @@
     readonly type: 'Transact';
   }
 
-  /** @name EthereumTransactionTransactionV2 (402) */
+  /** @name EthereumTransactionTransactionV2 (405) */
   interface EthereumTransactionTransactionV2 extends Enum {
     readonly isLegacy: boolean;
     readonly asLegacy: EthereumTransactionLegacyTransaction;
@@ -3426,7 +3430,7 @@
     readonly type: 'Legacy' | 'Eip2930' | 'Eip1559';
   }
 
-  /** @name EthereumTransactionLegacyTransaction (403) */
+  /** @name EthereumTransactionLegacyTransaction (406) */
   interface EthereumTransactionLegacyTransaction extends Struct {
     readonly nonce: U256;
     readonly gasPrice: U256;
@@ -3437,7 +3441,7 @@
     readonly signature: EthereumTransactionTransactionSignature;
   }
 
-  /** @name EthereumTransactionTransactionAction (404) */
+  /** @name EthereumTransactionTransactionAction (407) */
   interface EthereumTransactionTransactionAction extends Enum {
     readonly isCall: boolean;
     readonly asCall: H160;
@@ -3445,14 +3449,14 @@
     readonly type: 'Call' | 'Create';
   }
 
-  /** @name EthereumTransactionTransactionSignature (405) */
+  /** @name EthereumTransactionTransactionSignature (408) */
   interface EthereumTransactionTransactionSignature extends Struct {
     readonly v: u64;
     readonly r: H256;
     readonly s: H256;
   }
 
-  /** @name EthereumTransactionEip2930Transaction (407) */
+  /** @name EthereumTransactionEip2930Transaction (410) */
   interface EthereumTransactionEip2930Transaction extends Struct {
     readonly chainId: u64;
     readonly nonce: U256;
@@ -3467,13 +3471,13 @@
     readonly s: H256;
   }
 
-  /** @name EthereumTransactionAccessListItem (409) */
+  /** @name EthereumTransactionAccessListItem (412) */
   interface EthereumTransactionAccessListItem extends Struct {
     readonly address: H160;
     readonly storageKeys: Vec<H256>;
   }
 
-  /** @name EthereumTransactionEip1559Transaction (410) */
+  /** @name EthereumTransactionEip1559Transaction (413) */
   interface EthereumTransactionEip1559Transaction extends Struct {
     readonly chainId: u64;
     readonly nonce: U256;
@@ -3489,7 +3493,7 @@
     readonly s: H256;
   }
 
-  /** @name PalletDataManagementCall (411) */
+  /** @name PalletDataManagementCall (414) */
   interface PalletDataManagementCall extends Enum {
     readonly isBegin: boolean;
     readonly asBegin: {
@@ -3513,11 +3517,7 @@
     readonly asInsertEvents: {
       readonly events: Vec<Bytes>;
     } & Struct;
-    readonly isSetIdentities: boolean;
-    readonly asSetIdentities: {
-      readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
-    } & Struct;
-    readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents' | 'SetIdentities';
+    readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents';
   }
 
   /** @name PalletMaintenanceCall (418) */
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -69,7 +69,7 @@
       const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];
       const testUtils = 'testutils';
 
-      if (chain.eq('OPAL by UNIQUE')) {
+      if (chain.eq('OPAL by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {
         requiredPallets.push(
           refungible,
           foreignAssets,
modifiedtests/src/util/identitySetter.tsdiffbeforeafterboth
--- a/tests/src/util/identitySetter.ts
+++ b/tests/src/util/identitySetter.ts
@@ -33,7 +33,7 @@
     try {
       const superuser = await privateKey(key);
       // todo:collator
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.dataManagement.setIdentities', [identities]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.setIdentities', [identities]);
       console.log(`Tried to upload ${identities.length} identities. `
         + `Now there are ${(await helper.getApi().query.identity.identityOf.keys()).length}.`);
     } catch (error) {
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
before · tests/src/util/playgrounds/unique.dev.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {stringToU8a} from '@polkadot/util';5import {encodeAddress, mnemonicGenerate} from '@polkadot/util-crypto';6import {UniqueHelper, MoonbeamHelper, ChainHelperBase, AcalaHelper, RelayHelper, WestmintHelper} from './unique';7import {ApiPromise, Keyring, WsProvider} from '@polkadot/api';8import * as defs from '../../interfaces/definitions';9import {IKeyringPair} from '@polkadot/types/types';10import {EventRecord} from '@polkadot/types/interfaces';11import {ICrossAccountId, IPovInfo, TSigner} from './types';12import {FrameSystemEventRecord} from '@polkadot/types/lookup';13import {VoidFn} from '@polkadot/api/types';14import {Pallets} from '..';15import {spawnSync} from 'child_process';1617export class SilentLogger {18  log(_msg: any, _level: any): void { }19  level = {20    ERROR: 'ERROR' as const,21    WARNING: 'WARNING' as const,22    INFO: 'INFO' as const,23  };24}2526export class SilentConsole {27  // TODO: Remove, this is temporary: Filter unneeded API output28  // (Jaco promised it will be removed in the next version)29  consoleErr: any;30  consoleLog: any;31  consoleWarn: any;3233  constructor() {34    this.consoleErr = console.error;35    this.consoleLog = console.log;36    this.consoleWarn = console.warn;37  }3839  enable() {40    const outFn = (printer: any) => (...args: any[]) => {41      for (const arg of args) {42        if (typeof arg !== 'string')43          continue;44        if (arg.includes('1000:: Normal connection closure') || arg.includes('Not decorating unknown runtime apis:') || arg.includes('RPC methods not decorated:') || arg === 'Normal connection closure')45          return;46      }47      printer(...args);48    };4950    console.error = outFn(this.consoleErr.bind(console));51    console.log = outFn(this.consoleLog.bind(console));52    console.warn = outFn(this.consoleWarn.bind(console));53  }5455  disable() {56    console.error = this.consoleErr;57    console.log = this.consoleLog;58    console.warn = this.consoleWarn;59  }60}6162export class DevUniqueHelper extends UniqueHelper {63  /**64   * Arrange methods for tests65   */66  arrange: ArrangeGroup;67  wait: WaitGroup;68  admin: AdminGroup;69  session: SessionGroup;70  testUtils: TestUtilGroup;7172  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {73    options.helperBase = options.helperBase ?? DevUniqueHelper;7475    super(logger, options);76    this.arrange = new ArrangeGroup(this);77    this.wait = new WaitGroup(this);78    this.admin = new AdminGroup(this);79    this.testUtils = new TestUtilGroup(this);80    this.session = new SessionGroup(this);81  }8283  async connect(wsEndpoint: string, _listeners?: any): Promise<void> {84    const wsProvider = new WsProvider(wsEndpoint);85    this.api = new ApiPromise({86      provider: wsProvider,87      signedExtensions: {88        ContractHelpers: {89          extrinsic: {},90          payload: {},91        },92        CheckMaintenance: {93          extrinsic: {},94          payload: {},95        },96        FilterIdentity: {97          extrinsic: {},98          payload: {},99        },100        FakeTransactionFinalizer: {101          extrinsic: {},102          payload: {},103        },104      },105      rpc: {106        unique: defs.unique.rpc,107        appPromotion: defs.appPromotion.rpc,108        povinfo: defs.povinfo.rpc,109        rmrk: defs.rmrk.rpc,110        eth: {111          feeHistory: {112            description: 'Dummy',113            params: [],114            type: 'u8',115          },116          maxPriorityFeePerGas: {117            description: 'Dummy',118            params: [],119            type: 'u8',120          },121        },122      },123    });124    await this.api.isReadyOrError;125    this.network = await UniqueHelper.detectNetwork(this.api);126    this.wsEndpoint = wsEndpoint;127  }128}129130export class DevRelayHelper extends RelayHelper {131  wait: WaitGroup;132133  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {134    options.helperBase = options.helperBase ?? DevRelayHelper;135136    super(logger, options);137    this.wait = new WaitGroup(this);138  }139}140141export class DevWestmintHelper extends WestmintHelper {142  wait: WaitGroup;143144  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {145    options.helperBase = options.helperBase ?? DevWestmintHelper;146147    super(logger, options);148    this.wait = new WaitGroup(this);149  }150}151152export class DevStatemineHelper extends DevWestmintHelper {}153154export class DevStatemintHelper extends DevWestmintHelper {}155156export class DevMoonbeamHelper extends MoonbeamHelper {157  account: MoonbeamAccountGroup;158  wait: WaitGroup;159160  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {161    options.helperBase = options.helperBase ?? DevMoonbeamHelper;162    options.notePreimagePallet = options.notePreimagePallet ?? 'democracy';163164    super(logger, options);165    this.account = new MoonbeamAccountGroup(this);166    this.wait = new WaitGroup(this);167  }168}169170export class DevMoonriverHelper extends DevMoonbeamHelper {171  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {172    options.notePreimagePallet = options.notePreimagePallet ?? 'preimage';173    super(logger, options);174  }175}176177export class DevAcalaHelper extends AcalaHelper {178  wait: WaitGroup;179180  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {181    options.helperBase = options.helperBase ?? DevAcalaHelper;182183    super(logger, options);184    this.wait = new WaitGroup(this);185  }186}187188export class DevKaruraHelper extends DevAcalaHelper {}189190class ArrangeGroup {191  helper: DevUniqueHelper;192193  scheduledIdSlider = 0;194195  constructor(helper: DevUniqueHelper) {196    this.helper = helper;197  }198199  /**200   * Generates accounts with the specified UNQ token balance201   * @param balances balances for generated accounts. Each balance will be multiplied by the token nominal.202   * @param donor donor account for balances203   * @returns array of newly created accounts204   * @example const [acc1, acc2, acc3] = await createAccounts([0n, 10n, 20n], donor);205   */206  createAccounts = async (balances: bigint[], donor: IKeyringPair): Promise<IKeyringPair[]> => {207    let nonce = await this.helper.chain.getNonce(donor.address);208    const wait = new WaitGroup(this.helper);209    const ss58Format = this.helper.chain.getChainProperties().ss58Format;210    const tokenNominal = this.helper.balance.getOneTokenNominal();211    const transactions = [];212    const accounts: IKeyringPair[] = [];213    for (const balance of balances) {214      const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);215      accounts.push(recipient);216      if (balance !== 0n) {217        const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, balance * tokenNominal]);218        transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));219        nonce++;220      }221    }222223    await Promise.all(transactions).catch(_e => {});224225    //#region TODO remove this region, when nonce problem will be solved226    const checkBalances = async () => {227      let isSuccess = true;228      for (let i = 0; i < balances.length; i++) {229        const balance = await this.helper.balance.getSubstrate(accounts[i].address);230        if (balance !== balances[i] * tokenNominal) {231          isSuccess = false;232          break;233        }234      }235      return isSuccess;236    };237238    let accountsCreated = false;239    const maxBlocksChecked = await this.helper.arrange.isDevNode() ? 50 : 5;240    // checkBalances retry up to 5-50 blocks241    for (let index = 0; index < maxBlocksChecked; index++) {242      accountsCreated = await checkBalances();243      if(accountsCreated) break;244      await wait.newBlocks(1);245    }246247    if (!accountsCreated) throw Error('Accounts generation failed');248    //#endregion249250    return accounts;251  };252253  // TODO combine this method and createAccounts into one254  createCrowd = async (accountsToCreate: number, withBalance: bigint, donor: IKeyringPair): Promise<IKeyringPair[]> => {255    const createAsManyAsCan = async () => {256      let transactions: any = [];257      const accounts: IKeyringPair[] = [];258      let nonce = await this.helper.chain.getNonce(donor.address);259      const tokenNominal = this.helper.balance.getOneTokenNominal();260      for (let i = 0; i < accountsToCreate; i++) {261        if (i === 500) { // if there are too many accounts to create262          await Promise.allSettled(transactions); // wait while first 500 (should be 100 for devnode) tx will be settled263          transactions = []; //264          nonce = await this.helper.chain.getNonce(donor.address); // update nonce265        }266        const recepient = this.helper.util.fromSeed(mnemonicGenerate());267        accounts.push(recepient);268        if (withBalance !== 0n) {269          const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recepient.address}, withBalance * tokenNominal]);270          transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));271          nonce++;272        }273      }274275      const fullfilledAccounts = [];276      await Promise.allSettled(transactions);277      for (const account of accounts) {278        const accountBalance = await this.helper.balance.getSubstrate(account.address);279        if (accountBalance === withBalance * tokenNominal) {280          fullfilledAccounts.push(account);281        }282      }283      return fullfilledAccounts;284    };285286287    const crowd: IKeyringPair[] = [];288    // do up to 5 retries289    for (let index = 0; index < 5 && accountsToCreate !== 0; index++) {290      const asManyAsCan = await createAsManyAsCan();291      crowd.push(...asManyAsCan);292      accountsToCreate -= asManyAsCan.length;293    }294295    if (accountsToCreate !== 0) throw Error(`Crowd generation failed: ${accountsToCreate} accounts left`);296297    return crowd;298  };299300  isDevNode = async () => {301    let blockNumber = (await this.helper.callRpc('api.query.system.number')).toJSON();302    if (blockNumber == 0) {303      await this.helper.wait.newBlocks(1);304      blockNumber = (await this.helper.callRpc('api.query.system.number')).toJSON();305    }306    const block2 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber])]);307    const block1 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber - 1])]);308    const findCreationDate = (block: any) => {309      const humanBlock = block.toHuman();310      let date;311      humanBlock.block.extrinsics.forEach((ext: any) => {312        if(ext.method.section === 'timestamp') {313          date = Number(ext.method.args.now.replaceAll(',', ''));314        }315      });316      return date;317    };318    const block1date = await findCreationDate(block1);319    const block2date = await findCreationDate(block2);320    if(block2date! - block1date! < 9000) return true;321  };322323  async calculcateFee(payer: ICrossAccountId, promise: () => Promise<any>): Promise<bigint> {324    const address = payer.Substrate ? payer.Substrate : await this.helper.address.ethToSubstrate(payer.Ethereum!);325    let balance = await this.helper.balance.getSubstrate(address);326327    await promise();328329    balance -= await this.helper.balance.getSubstrate(address);330331    return balance;332  }333334  async calculatePoVInfo(txs: any[]): Promise<IPovInfo> {335    const rawPovInfo = await this.helper.callRpc('api.rpc.povinfo.estimateExtrinsicPoV', [txs]);336337    const kvJson: {[key: string]: string} = {};338339    for (const kv of rawPovInfo.keyValues) {340      kvJson[kv.key.toHex()] = kv.value.toHex();341    }342343    const kvStr = JSON.stringify(kvJson);344345    const chainql = spawnSync(346      'chainql',347      [348        `--tla-code=data=${kvStr}`,349        '-e', `function(data) cql.dump(cql.chain("${this.helper.getEndpoint()}").latest._meta, data, {omit_empty:true})`,350      ],351    );352353    if (!chainql.stdout) {354      throw Error('unable to get an output from the `chainql`');355    }356357    return {358      proofSize: rawPovInfo.proofSize.toNumber(),359      compactProofSize: rawPovInfo.compactProofSize.toNumber(),360      compressedProofSize: rawPovInfo.compressedProofSize.toNumber(),361      results: rawPovInfo.results,362      kv: JSON.parse(chainql.stdout.toString()),363    };364  }365366  calculatePalletAddress(palletId: any) {367    const address = stringToU8a(('modl' + palletId).padEnd(32, '\0'));368    return encodeAddress(address, this.helper.chain.getChainProperties().ss58Format);369  }370371  makeScheduledIds(num: number): string[] {372    function makeId(slider: number) {373      const scheduledIdSize = 64;374      const hexId = slider.toString(16);375      const prefixSize = scheduledIdSize - hexId.length;376377      const scheduledId = '0x' + '0'.repeat(prefixSize) + hexId;378379      return scheduledId;380    }381382    const ids = [];383    for (let i = 0; i < num; i++) {384      ids.push(makeId(this.scheduledIdSlider));385      this.scheduledIdSlider += 1;386    }387388    return ids;389  }390391  makeScheduledId(): string {392    return (this.makeScheduledIds(1))[0];393  }394395  async captureEvents(eventSection: string, eventMethod: string): Promise<EventCapture> {396    const capture = new EventCapture(this.helper, eventSection, eventMethod);397    await capture.startCapture();398399    return capture;400  }401}402403class MoonbeamAccountGroup {404  helper: MoonbeamHelper;405406  keyring: Keyring;407  _alithAccount: IKeyringPair;408  _baltatharAccount: IKeyringPair;409  _dorothyAccount: IKeyringPair;410411  constructor(helper: MoonbeamHelper) {412    this.helper = helper;413414    this.keyring = new Keyring({type: 'ethereum'});415    const alithPrivateKey = '0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133';416    const baltatharPrivateKey = '0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b';417    const dorothyPrivateKey = '0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68';418419    this._alithAccount = this.keyring.addFromUri(alithPrivateKey, undefined, 'ethereum');420    this._baltatharAccount = this.keyring.addFromUri(baltatharPrivateKey, undefined, 'ethereum');421    this._dorothyAccount = this.keyring.addFromUri(dorothyPrivateKey, undefined, 'ethereum');422  }423424  alithAccount() {425    return this._alithAccount;426  }427428  baltatharAccount() {429    return this._baltatharAccount;430  }431432  dorothyAccount() {433    return this._dorothyAccount;434  }435436  create() {437    return this.keyring.addFromUri(mnemonicGenerate());438  }439}440441class WaitGroup {442  helper: ChainHelperBase;443444  constructor(helper: ChainHelperBase) {445    this.helper = helper;446  }447448  sleep(milliseconds: number) {449    return new Promise((resolve) => setTimeout(resolve, milliseconds));450  }451452  private async waitWithTimeout(promise: Promise<any>, timeout: number) {453    let isBlock = false;454    promise.then(() => isBlock = true).catch(() => isBlock = true);455    let totalTime = 0;456    const step = 100;457    while(!isBlock) {458      await this.sleep(step);459      totalTime += step;460      if(totalTime >= timeout) throw Error('Blocks production failed');461    }462    return promise;463  }464465  /**466   * Launch some async operation, or throw an error after some time. Note that it will still continue executing after the timeout.467   * @param promise async operation to race against the timeout468   * @param timeoutMS time after which to time out469   * @param timeoutError error message to throw470   * @returns promise of the same type the operation had471   */472  withTimeout<T>(473    promise: Promise<T>,474    timeoutMS = 30000,475    timeoutError = 'The operation has timed out!',476  ): Promise<T> {477    const timeout = new Promise<never>((_, reject) => {478      setTimeout(() => {479        reject(new Error(timeoutError));480      }, timeoutMS);481    });482483    return Promise.race<T>([promise, timeout]).catch(e => {throw new Error(e);});484  }485486  /**487   * Wait for specified number of blocks488   * @param blocksCount number of blocks to wait489   * @returns490   */491  async newBlocks(blocksCount = 1, timeout?: number): Promise<void> {492    timeout = timeout ?? blocksCount * 60_000;493    // eslint-disable-next-line no-async-promise-executor494    const promise = new Promise<void>(async (resolve) => {495      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(() => {496        if (blocksCount > 0) {497          blocksCount--;498        } else {499          unsubscribe();500          resolve();501        }502      });503    });504    await this.waitWithTimeout(promise, timeout);505    return promise;506  }507508  /**509   * Wait for the specified number of sessions to pass.510   * Only applicable if the Session pallet is turned on.511   * @param sessionCount number of sessions to wait512   * @param blockTimeout time in ms until panicking that the chain has stopped producing blocks513   * @returns514   */515  async newSessions(sessionCount = 1, blockTimeout = 60000): Promise<void> {516    console.log(`Waiting for ${sessionCount} new session${sessionCount > 1 ? 's' : ''}.`517      + ' This might take a while -- check SessionPeriod in pallet_session::Config for session time.');518519    const expectedSessionIndex = await (this.helper as DevUniqueHelper).session.getIndex() + sessionCount;520    let currentSessionIndex = -1;521522    while (currentSessionIndex < expectedSessionIndex) {523      // eslint-disable-next-line no-async-promise-executor524      currentSessionIndex = await this.withTimeout(new Promise(async (resolve) => {525        await this.newBlocks(1);526        const res = await (this.helper as DevUniqueHelper).session.getIndex();527        resolve(res);528      }), blockTimeout, 'The chain has stopped producing blocks!');529    }530  }531532  async forParachainBlockNumber(blockNumber: bigint | number, timeout?: number) {533    timeout = timeout ?? 30 * 60 * 1000;534    // eslint-disable-next-line no-async-promise-executor535    const promise = new Promise<void>(async (resolve) => {536      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads((data: any) => {537        if (data.number.toNumber() >= blockNumber) {538          unsubscribe();539          resolve();540        }541      });542    });543    await this.waitWithTimeout(promise, timeout);544    return promise;545  }546547  async forRelayBlockNumber(blockNumber: bigint | number, timeout?: number) {548    timeout = timeout ?? 30 * 60 * 1000;549    // eslint-disable-next-line no-async-promise-executor550    const promise = new Promise<void>(async (resolve) => {551      const unsubscribe = await this.helper.getApi().query.parachainSystem.validationData((data: any) => {552        if (data.value.relayParentNumber.toNumber() >= blockNumber) {553          // @ts-ignore554          unsubscribe();555          resolve();556        }557      });558    });559    await this.waitWithTimeout(promise, timeout);560    return promise;561  }562563  noScheduledTasks() {564    const api = this.helper.getApi();565566    // eslint-disable-next-line no-async-promise-executor567    const promise = new Promise<void>(async resolve => {568      const unsubscribe = await api.rpc.chain.subscribeNewHeads(async () => {569        const areThereScheduledTasks = await api.query.scheduler.lookup.entries();570571        if(areThereScheduledTasks.length == 0) {572          unsubscribe();573          resolve();574        }575      });576    });577578    return promise;579  }580581  event(maxBlocksToWait: number, eventSection: string, eventMethod: string) {582    // eslint-disable-next-line no-async-promise-executor583    const promise = new Promise<EventRecord | null>(async (resolve) => {584      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(async header => {585        const blockNumber = header.number.toHuman();586        const blockHash = header.hash;587        const eventIdStr = `${eventSection}.${eventMethod}`;588        const waitLimitStr = `wait blocks remaining: ${maxBlocksToWait}`;589590        this.helper.logger.log(`[Block #${blockNumber}] Waiting for event \`${eventIdStr}\` (${waitLimitStr})`);591592        const apiAt = await this.helper.getApi().at(blockHash);593        const eventRecords = (await apiAt.query.system.events()) as any;594595        const neededEvent = eventRecords.toArray().find((r: FrameSystemEventRecord) => {596          return r.event.section == eventSection && r.event.method == eventMethod;597        });598599        if (neededEvent) {600          unsubscribe();601          resolve(neededEvent);602        } else if (maxBlocksToWait > 0) {603          maxBlocksToWait--;604        } else {605          this.helper.logger.log(`Event \`${eventIdStr}\` is NOT found`);606          unsubscribe();607          resolve(null);608        }609      });610    });611    return promise;612  }613}614615class SessionGroup {616  helper: ChainHelperBase;617618  constructor(helper: ChainHelperBase) {619    this.helper = helper;620  }621622  //todo:collator documentation623  async getIndex(): Promise<number> {624    return (await this.helper.callRpc('api.query.session.currentIndex')).toNumber();625  }626627  newSessions(sessionCount = 1, blockTimeout = 24000): Promise<void> {628    return (this.helper as DevUniqueHelper).wait.newSessions(sessionCount, blockTimeout);629  }630631  setOwnKeys(signer: TSigner, key: string) {632    return this.helper.executeExtrinsic(633      signer,634      'api.tx.session.setKeys',635      [key, '0x0'],636      true,637    );638  }639640  setOwnKeysFromAddress(signer: TSigner) {641    return this.setOwnKeys(signer, '0x' + Buffer.from(signer.addressRaw).toString('hex'));642  }643}644645class TestUtilGroup {646  helper: DevUniqueHelper;647648  constructor(helper: DevUniqueHelper) {649    this.helper = helper;650  }651652  async enable() {653    if (this.helper.fetchMissingPalletNames([Pallets.TestUtils]).length != 0) {654      return;655    }656657    const signer = this.helper.util.fromSeed('//Alice');658    await this.helper.getSudo<DevUniqueHelper>().executeExtrinsic(signer, 'api.tx.testUtils.enable', [], true);659  }660661  async setTestValue(signer: TSigner, testVal: number) {662    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.setTestValue', [testVal], true);663  }664665  async incTestValue(signer: TSigner) {666    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.incTestValue', [], true);667  }668669  async setTestValueAndRollback(signer: TSigner, testVal: number) {670    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.setTestValueAndRollback', [testVal], true);671  }672673  async testValue(blockIdx?: number) {674    const api = blockIdx675      ? await this.helper.getApi().at(await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockIdx]))676      : this.helper.getApi();677678    return (await api.query.testUtils.testValue()).toJSON();679  }680681  async justTakeFee(signer: TSigner) {682    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.justTakeFee', [], true);683  }684685  async selfCancelingInc(signer: TSigner, scheduledId: string, maxTestVal: number) {686    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.selfCancelingInc', [scheduledId, maxTestVal], true);687  }688}689690class EventCapture {691  helper: DevUniqueHelper;692  eventSection: string;693  eventMethod: string;694  events: EventRecord[] = [];695  unsubscribe: VoidFn | null = null;696697  constructor(698    helper: DevUniqueHelper,699    eventSection: string,700    eventMethod: string,701  ) {702    this.helper = helper;703    this.eventSection = eventSection;704    this.eventMethod = eventMethod;705  }706707  async startCapture() {708    this.stopCapture();709    this.unsubscribe = (await this.helper.getApi().query.system.events((eventRecords: FrameSystemEventRecord[]) => {710      const newEvents = eventRecords.filter(r => {711        return r.event.section == this.eventSection && r.event.method == this.eventMethod;712      });713714      this.events.push(...newEvents);715    })) as any;716  }717718  stopCapture() {719    if (this.unsubscribe !== null) {720      this.unsubscribe();721    }722  }723724  extractCapturedEvents() {725    return this.events;726  }727}728729class AdminGroup {730  helper: UniqueHelper;731732  constructor(helper: UniqueHelper) {733    this.helper = helper;734  }735736  async payoutStakers(signer: IKeyringPair, stakersToPayout: number) {737    const payoutResult = await this.helper.executeExtrinsic(signer, 'api.tx.appPromotion.payoutStakers', [stakersToPayout], true);738    return payoutResult.result.events.filter(e => e.event.method === 'StakingRecalculation').map(e => {739      return {740        staker: e.event.data[0].toString(),741        stake: e.event.data[1].toBigInt(),742        payout: e.event.data[2].toBigInt(),743      };744    });745  }746}
after · tests/src/util/playgrounds/unique.dev.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// SPDX-License-Identifier: Apache-2.034import {stringToU8a} from '@polkadot/util';5import {encodeAddress, mnemonicGenerate} from '@polkadot/util-crypto';6import {UniqueHelper, MoonbeamHelper, ChainHelperBase, AcalaHelper, RelayHelper, WestmintHelper} from './unique';7import {ApiPromise, Keyring, WsProvider} from '@polkadot/api';8import * as defs from '../../interfaces/definitions';9import {IKeyringPair} from '@polkadot/types/types';10import {EventRecord} from '@polkadot/types/interfaces';11import {ICrossAccountId, IPovInfo, TSigner} from './types';12import {FrameSystemEventRecord} from '@polkadot/types/lookup';13import {VoidFn} from '@polkadot/api/types';14import {Pallets} from '..';15import {spawnSync} from 'child_process';1617export class SilentLogger {18  log(_msg: any, _level: any): void { }19  level = {20    ERROR: 'ERROR' as const,21    WARNING: 'WARNING' as const,22    INFO: 'INFO' as const,23  };24}2526export class SilentConsole {27  // TODO: Remove, this is temporary: Filter unneeded API output28  // (Jaco promised it will be removed in the next version)29  consoleErr: any;30  consoleLog: any;31  consoleWarn: any;3233  constructor() {34    this.consoleErr = console.error;35    this.consoleLog = console.log;36    this.consoleWarn = console.warn;37  }3839  enable() {40    const outFn = (printer: any) => (...args: any[]) => {41      for (const arg of args) {42        if (typeof arg !== 'string')43          continue;44        if (arg.includes('1000:: Normal connection closure') || arg.includes('Not decorating unknown runtime apis:') || arg.includes('RPC methods not decorated:') || arg === 'Normal connection closure')45          return;46      }47      printer(...args);48    };4950    console.error = outFn(this.consoleErr.bind(console));51    console.log = outFn(this.consoleLog.bind(console));52    console.warn = outFn(this.consoleWarn.bind(console));53  }5455  disable() {56    console.error = this.consoleErr;57    console.log = this.consoleLog;58    console.warn = this.consoleWarn;59  }60}6162export class DevUniqueHelper extends UniqueHelper {63  /**64   * Arrange methods for tests65   */66  arrange: ArrangeGroup;67  wait: WaitGroup;68  admin: AdminGroup;69  session: SessionGroup;70  testUtils: TestUtilGroup;7172  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {73    options.helperBase = options.helperBase ?? DevUniqueHelper;7475    super(logger, options);76    this.arrange = new ArrangeGroup(this);77    this.wait = new WaitGroup(this);78    this.admin = new AdminGroup(this);79    this.testUtils = new TestUtilGroup(this);80    this.session = new SessionGroup(this);81  }8283  async connect(wsEndpoint: string, _listeners?: any): Promise<void> {84    const wsProvider = new WsProvider(wsEndpoint);85    this.api = new ApiPromise({86      provider: wsProvider,87      signedExtensions: {88        ContractHelpers: {89          extrinsic: {},90          payload: {},91        },92        CheckMaintenance: {93          extrinsic: {},94          payload: {},95        },96        FilterIdentity: {97          extrinsic: {},98          payload: {},99        },100        FakeTransactionFinalizer: {101          extrinsic: {},102          payload: {},103        },104      },105      rpc: {106        unique: defs.unique.rpc,107        appPromotion: defs.appPromotion.rpc,108        povinfo: defs.povinfo.rpc,109        rmrk: defs.rmrk.rpc,110        eth: {111          feeHistory: {112            description: 'Dummy',113            params: [],114            type: 'u8',115          },116          maxPriorityFeePerGas: {117            description: 'Dummy',118            params: [],119            type: 'u8',120          },121        },122      },123    });124    await this.api.isReadyOrError;125    this.network = await UniqueHelper.detectNetwork(this.api);126    this.wsEndpoint = wsEndpoint;127  }128}129130export class DevRelayHelper extends RelayHelper {131  wait: WaitGroup;132133  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {134    options.helperBase = options.helperBase ?? DevRelayHelper;135136    super(logger, options);137    this.wait = new WaitGroup(this);138  }139}140141export class DevWestmintHelper extends WestmintHelper {142  wait: WaitGroup;143144  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {145    options.helperBase = options.helperBase ?? DevWestmintHelper;146147    super(logger, options);148    this.wait = new WaitGroup(this);149  }150}151152export class DevStatemineHelper extends DevWestmintHelper {}153154export class DevStatemintHelper extends DevWestmintHelper {}155156export class DevMoonbeamHelper extends MoonbeamHelper {157  account: MoonbeamAccountGroup;158  wait: WaitGroup;159160  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {161    options.helperBase = options.helperBase ?? DevMoonbeamHelper;162    options.notePreimagePallet = options.notePreimagePallet ?? 'democracy';163164    super(logger, options);165    this.account = new MoonbeamAccountGroup(this);166    this.wait = new WaitGroup(this);167  }168}169170export class DevMoonriverHelper extends DevMoonbeamHelper {171  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {172    options.notePreimagePallet = options.notePreimagePallet ?? 'preimage';173    super(logger, options);174  }175}176177export class DevAcalaHelper extends AcalaHelper {178  wait: WaitGroup;179180  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {181    options.helperBase = options.helperBase ?? DevAcalaHelper;182183    super(logger, options);184    this.wait = new WaitGroup(this);185  }186}187188export class DevKaruraHelper extends DevAcalaHelper {}189190class ArrangeGroup {191  helper: DevUniqueHelper;192193  scheduledIdSlider = 0;194195  constructor(helper: DevUniqueHelper) {196    this.helper = helper;197  }198199  /**200   * Generates accounts with the specified UNQ token balance201   * @param balances balances for generated accounts. Each balance will be multiplied by the token nominal.202   * @param donor donor account for balances203   * @returns array of newly created accounts204   * @example const [acc1, acc2, acc3] = await createAccounts([0n, 10n, 20n], donor);205   */206  createAccounts = async (balances: bigint[], donor: IKeyringPair): Promise<IKeyringPair[]> => {207    let nonce = await this.helper.chain.getNonce(donor.address);208    const wait = new WaitGroup(this.helper);209    const ss58Format = this.helper.chain.getChainProperties().ss58Format;210    const tokenNominal = this.helper.balance.getOneTokenNominal();211    const transactions = [];212    const accounts: IKeyringPair[] = [];213    for (const balance of balances) {214      const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);215      accounts.push(recipient);216      if (balance !== 0n) {217        const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, balance * tokenNominal]);218        transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));219        nonce++;220      }221    }222223    await Promise.all(transactions).catch(_e => {});224225    //#region TODO remove this region, when nonce problem will be solved226    const checkBalances = async () => {227      let isSuccess = true;228      for (let i = 0; i < balances.length; i++) {229        const balance = await this.helper.balance.getSubstrate(accounts[i].address);230        if (balance !== balances[i] * tokenNominal) {231          isSuccess = false;232          break;233        }234      }235      return isSuccess;236    };237238    let accountsCreated = false;239    const maxBlocksChecked = await this.helper.arrange.isDevNode() ? 50 : 5;240    // checkBalances retry up to 5-50 blocks241    for (let index = 0; index < maxBlocksChecked; index++) {242      accountsCreated = await checkBalances();243      if(accountsCreated) break;244      await wait.newBlocks(1);245    }246247    if (!accountsCreated) throw Error('Accounts generation failed');248    //#endregion249250    return accounts;251  };252253  // TODO combine this method and createAccounts into one254  createCrowd = async (accountsToCreate: number, withBalance: bigint, donor: IKeyringPair): Promise<IKeyringPair[]> => {255    const createAsManyAsCan = async () => {256      let transactions: any = [];257      const accounts: IKeyringPair[] = [];258      let nonce = await this.helper.chain.getNonce(donor.address);259      const tokenNominal = this.helper.balance.getOneTokenNominal();260      const ss58Format = this.helper.chain.getChainProperties().ss58Format;261      for (let i = 0; i < accountsToCreate; i++) {262        if (i === 500) { // if there are too many accounts to create263          await Promise.allSettled(transactions); // wait while first 500 (should be 100 for devnode) tx will be settled264          transactions = []; //265          nonce = await this.helper.chain.getNonce(donor.address); // update nonce266        }267        const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);268        accounts.push(recipient);269        if (withBalance !== 0n) {270          const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, withBalance * tokenNominal]);271          transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));272          nonce++;273        }274      }275276      const fullfilledAccounts = [];277      await Promise.allSettled(transactions);278      for (const account of accounts) {279        const accountBalance = await this.helper.balance.getSubstrate(account.address);280        if (accountBalance === withBalance * tokenNominal) {281          fullfilledAccounts.push(account);282        }283      }284      return fullfilledAccounts;285    };286287288    const crowd: IKeyringPair[] = [];289    // do up to 5 retries290    for (let index = 0; index < 5 && accountsToCreate !== 0; index++) {291      const asManyAsCan = await createAsManyAsCan();292      crowd.push(...asManyAsCan);293      accountsToCreate -= asManyAsCan.length;294    }295296    if (accountsToCreate !== 0) throw Error(`Crowd generation failed: ${accountsToCreate} accounts left`);297298    return crowd;299  };300301  isDevNode = async () => {302    let blockNumber = (await this.helper.callRpc('api.query.system.number')).toJSON();303    if (blockNumber == 0) {304      await this.helper.wait.newBlocks(1);305      blockNumber = (await this.helper.callRpc('api.query.system.number')).toJSON();306    }307    const block2 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber])]);308    const block1 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber - 1])]);309    const findCreationDate = (block: any) => {310      const humanBlock = block.toHuman();311      let date;312      humanBlock.block.extrinsics.forEach((ext: any) => {313        if(ext.method.section === 'timestamp') {314          date = Number(ext.method.args.now.replaceAll(',', ''));315        }316      });317      return date;318    };319    const block1date = await findCreationDate(block1);320    const block2date = await findCreationDate(block2);321    if(block2date! - block1date! < 9000) return true;322  };323324  async calculcateFee(payer: ICrossAccountId, promise: () => Promise<any>): Promise<bigint> {325    const address = payer.Substrate ? payer.Substrate : await this.helper.address.ethToSubstrate(payer.Ethereum!);326    let balance = await this.helper.balance.getSubstrate(address);327328    await promise();329330    balance -= await this.helper.balance.getSubstrate(address);331332    return balance;333  }334335  async calculatePoVInfo(txs: any[]): Promise<IPovInfo> {336    const rawPovInfo = await this.helper.callRpc('api.rpc.povinfo.estimateExtrinsicPoV', [txs]);337338    const kvJson: {[key: string]: string} = {};339340    for (const kv of rawPovInfo.keyValues) {341      kvJson[kv.key.toHex()] = kv.value.toHex();342    }343344    const kvStr = JSON.stringify(kvJson);345346    const chainql = spawnSync(347      'chainql',348      [349        `--tla-code=data=${kvStr}`,350        '-e', `function(data) cql.dump(cql.chain("${this.helper.getEndpoint()}").latest._meta, data, {omit_empty:true})`,351      ],352    );353354    if (!chainql.stdout) {355      throw Error('unable to get an output from the `chainql`');356    }357358    return {359      proofSize: rawPovInfo.proofSize.toNumber(),360      compactProofSize: rawPovInfo.compactProofSize.toNumber(),361      compressedProofSize: rawPovInfo.compressedProofSize.toNumber(),362      results: rawPovInfo.results,363      kv: JSON.parse(chainql.stdout.toString()),364    };365  }366367  calculatePalletAddress(palletId: any) {368    const address = stringToU8a(('modl' + palletId).padEnd(32, '\0'));369    return encodeAddress(address, this.helper.chain.getChainProperties().ss58Format);370  }371372  makeScheduledIds(num: number): string[] {373    function makeId(slider: number) {374      const scheduledIdSize = 64;375      const hexId = slider.toString(16);376      const prefixSize = scheduledIdSize - hexId.length;377378      const scheduledId = '0x' + '0'.repeat(prefixSize) + hexId;379380      return scheduledId;381    }382383    const ids = [];384    for (let i = 0; i < num; i++) {385      ids.push(makeId(this.scheduledIdSlider));386      this.scheduledIdSlider += 1;387    }388389    return ids;390  }391392  makeScheduledId(): string {393    return (this.makeScheduledIds(1))[0];394  }395396  async captureEvents(eventSection: string, eventMethod: string): Promise<EventCapture> {397    const capture = new EventCapture(this.helper, eventSection, eventMethod);398    await capture.startCapture();399400    return capture;401  }402}403404class MoonbeamAccountGroup {405  helper: MoonbeamHelper;406407  keyring: Keyring;408  _alithAccount: IKeyringPair;409  _baltatharAccount: IKeyringPair;410  _dorothyAccount: IKeyringPair;411412  constructor(helper: MoonbeamHelper) {413    this.helper = helper;414415    this.keyring = new Keyring({type: 'ethereum'});416    const alithPrivateKey = '0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133';417    const baltatharPrivateKey = '0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b';418    const dorothyPrivateKey = '0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68';419420    this._alithAccount = this.keyring.addFromUri(alithPrivateKey, undefined, 'ethereum');421    this._baltatharAccount = this.keyring.addFromUri(baltatharPrivateKey, undefined, 'ethereum');422    this._dorothyAccount = this.keyring.addFromUri(dorothyPrivateKey, undefined, 'ethereum');423  }424425  alithAccount() {426    return this._alithAccount;427  }428429  baltatharAccount() {430    return this._baltatharAccount;431  }432433  dorothyAccount() {434    return this._dorothyAccount;435  }436437  create() {438    return this.keyring.addFromUri(mnemonicGenerate());439  }440}441442class WaitGroup {443  helper: ChainHelperBase;444445  constructor(helper: ChainHelperBase) {446    this.helper = helper;447  }448449  sleep(milliseconds: number) {450    return new Promise((resolve) => setTimeout(resolve, milliseconds));451  }452453  private async waitWithTimeout(promise: Promise<any>, timeout: number) {454    let isBlock = false;455    promise.then(() => isBlock = true).catch(() => isBlock = true);456    let totalTime = 0;457    const step = 100;458    while(!isBlock) {459      await this.sleep(step);460      totalTime += step;461      if(totalTime >= timeout) throw Error('Blocks production failed');462    }463    return promise;464  }465466  /**467   * Launch some async operation, or throw an error after some time. Note that it will still continue executing after the timeout.468   * @param promise async operation to race against the timeout469   * @param timeoutMS time after which to time out470   * @param timeoutError error message to throw471   * @returns promise of the same type the operation had472   */473  withTimeout<T>(474    promise: Promise<T>,475    timeoutMS = 30000,476    timeoutError = 'The operation has timed out!',477  ): Promise<T> {478    const timeout = new Promise<never>((_, reject) => {479      setTimeout(() => {480        reject(new Error(timeoutError));481      }, timeoutMS);482    });483484    return Promise.race<T>([promise, timeout]).catch(e => {throw new Error(e);});485  }486487  /**488   * Wait for specified number of blocks489   * @param blocksCount number of blocks to wait490   * @returns491   */492  async newBlocks(blocksCount = 1, timeout?: number): Promise<void> {493    timeout = timeout ?? blocksCount * 60_000;494    // eslint-disable-next-line no-async-promise-executor495    const promise = new Promise<void>(async (resolve) => {496      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(() => {497        if (blocksCount > 0) {498          blocksCount--;499        } else {500          unsubscribe();501          resolve();502        }503      });504    });505    await this.waitWithTimeout(promise, timeout);506    return promise;507  }508509  /**510   * Wait for the specified number of sessions to pass.511   * Only applicable if the Session pallet is turned on.512   * @param sessionCount number of sessions to wait513   * @param blockTimeout time in ms until panicking that the chain has stopped producing blocks514   * @returns515   */516  async newSessions(sessionCount = 1, blockTimeout = 60000): Promise<void> {517    console.log(`Waiting for ${sessionCount} new session${sessionCount > 1 ? 's' : ''}.`518      + ' This might take a while -- check SessionPeriod in pallet_session::Config for session time.');519520    const expectedSessionIndex = await (this.helper as DevUniqueHelper).session.getIndex() + sessionCount;521    let currentSessionIndex = -1;522523    while (currentSessionIndex < expectedSessionIndex) {524      // eslint-disable-next-line no-async-promise-executor525      currentSessionIndex = await this.withTimeout(new Promise(async (resolve) => {526        await this.newBlocks(1);527        const res = await (this.helper as DevUniqueHelper).session.getIndex();528        resolve(res);529      }), blockTimeout, 'The chain has stopped producing blocks!');530    }531  }532533  async forParachainBlockNumber(blockNumber: bigint | number, timeout?: number) {534    timeout = timeout ?? 30 * 60 * 1000;535    // eslint-disable-next-line no-async-promise-executor536    const promise = new Promise<void>(async (resolve) => {537      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads((data: any) => {538        if (data.number.toNumber() >= blockNumber) {539          unsubscribe();540          resolve();541        }542      });543    });544    await this.waitWithTimeout(promise, timeout);545    return promise;546  }547548  async forRelayBlockNumber(blockNumber: bigint | number, timeout?: number) {549    timeout = timeout ?? 30 * 60 * 1000;550    // eslint-disable-next-line no-async-promise-executor551    const promise = new Promise<void>(async (resolve) => {552      const unsubscribe = await this.helper.getApi().query.parachainSystem.validationData((data: any) => {553        if (data.value.relayParentNumber.toNumber() >= blockNumber) {554          // @ts-ignore555          unsubscribe();556          resolve();557        }558      });559    });560    await this.waitWithTimeout(promise, timeout);561    return promise;562  }563564  noScheduledTasks() {565    const api = this.helper.getApi();566567    // eslint-disable-next-line no-async-promise-executor568    const promise = new Promise<void>(async resolve => {569      const unsubscribe = await api.rpc.chain.subscribeNewHeads(async () => {570        const areThereScheduledTasks = await api.query.scheduler.lookup.entries();571572        if(areThereScheduledTasks.length == 0) {573          unsubscribe();574          resolve();575        }576      });577    });578579    return promise;580  }581582  event(maxBlocksToWait: number, eventSection: string, eventMethod: string) {583    // eslint-disable-next-line no-async-promise-executor584    const promise = new Promise<EventRecord | null>(async (resolve) => {585      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(async header => {586        const blockNumber = header.number.toHuman();587        const blockHash = header.hash;588        const eventIdStr = `${eventSection}.${eventMethod}`;589        const waitLimitStr = `wait blocks remaining: ${maxBlocksToWait}`;590591        this.helper.logger.log(`[Block #${blockNumber}] Waiting for event \`${eventIdStr}\` (${waitLimitStr})`);592593        const apiAt = await this.helper.getApi().at(blockHash);594        const eventRecords = (await apiAt.query.system.events()) as any;595596        const neededEvent = eventRecords.toArray().find((r: FrameSystemEventRecord) => {597          return r.event.section == eventSection && r.event.method == eventMethod;598        });599600        if (neededEvent) {601          unsubscribe();602          resolve(neededEvent);603        } else if (maxBlocksToWait > 0) {604          maxBlocksToWait--;605        } else {606          this.helper.logger.log(`Event \`${eventIdStr}\` is NOT found`);607          unsubscribe();608          resolve(null);609        }610      });611    });612    return promise;613  }614}615616class SessionGroup {617  helper: ChainHelperBase;618619  constructor(helper: ChainHelperBase) {620    this.helper = helper;621  }622623  //todo:collator documentation624  async getIndex(): Promise<number> {625    return (await this.helper.callRpc('api.query.session.currentIndex')).toNumber();626  }627628  newSessions(sessionCount = 1, blockTimeout = 24000): Promise<void> {629    return (this.helper as DevUniqueHelper).wait.newSessions(sessionCount, blockTimeout);630  }631632  setOwnKeys(signer: TSigner, key: string) {633    return this.helper.executeExtrinsic(634      signer,635      'api.tx.session.setKeys',636      [key, '0x0'],637      true,638    );639  }640641  setOwnKeysFromAddress(signer: TSigner) {642    return this.setOwnKeys(signer, '0x' + Buffer.from(signer.addressRaw).toString('hex'));643  }644}645646class TestUtilGroup {647  helper: DevUniqueHelper;648649  constructor(helper: DevUniqueHelper) {650    this.helper = helper;651  }652653  async enable() {654    if (this.helper.fetchMissingPalletNames([Pallets.TestUtils]).length != 0) {655      return;656    }657658    const signer = this.helper.util.fromSeed('//Alice');659    await this.helper.getSudo<DevUniqueHelper>().executeExtrinsic(signer, 'api.tx.testUtils.enable', [], true);660  }661662  async setTestValue(signer: TSigner, testVal: number) {663    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.setTestValue', [testVal], true);664  }665666  async incTestValue(signer: TSigner) {667    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.incTestValue', [], true);668  }669670  async setTestValueAndRollback(signer: TSigner, testVal: number) {671    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.setTestValueAndRollback', [testVal], true);672  }673674  async testValue(blockIdx?: number) {675    const api = blockIdx676      ? await this.helper.getApi().at(await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockIdx]))677      : this.helper.getApi();678679    return (await api.query.testUtils.testValue()).toJSON();680  }681682  async justTakeFee(signer: TSigner) {683    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.justTakeFee', [], true);684  }685686  async selfCancelingInc(signer: TSigner, scheduledId: string, maxTestVal: number) {687    await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.selfCancelingInc', [scheduledId, maxTestVal], true);688  }689}690691class EventCapture {692  helper: DevUniqueHelper;693  eventSection: string;694  eventMethod: string;695  events: EventRecord[] = [];696  unsubscribe: VoidFn | null = null;697698  constructor(699    helper: DevUniqueHelper,700    eventSection: string,701    eventMethod: string,702  ) {703    this.helper = helper;704    this.eventSection = eventSection;705    this.eventMethod = eventMethod;706  }707708  async startCapture() {709    this.stopCapture();710    this.unsubscribe = (await this.helper.getApi().query.system.events((eventRecords: FrameSystemEventRecord[]) => {711      const newEvents = eventRecords.filter(r => {712        return r.event.section == this.eventSection && r.event.method == this.eventMethod;713      });714715      this.events.push(...newEvents);716    })) as any;717  }718719  stopCapture() {720    if (this.unsubscribe !== null) {721      this.unsubscribe();722    }723  }724725  extractCapturedEvents() {726    return this.events;727  }728}729730class AdminGroup {731  helper: UniqueHelper;732733  constructor(helper: UniqueHelper) {734    this.helper = helper;735  }736737  async payoutStakers(signer: IKeyringPair, stakersToPayout: number) {738    const payoutResult = await this.helper.executeExtrinsic(signer, 'api.tx.appPromotion.payoutStakers', [stakersToPayout], true);739    return payoutResult.result.events.filter(e => e.event.method === 'StakingRecalculation').map(e => {740      return {741        staker: e.event.data[0].toString(),742        stake: e.event.data[1].toBigInt(),743        payout: e.event.data[2].toBigInt(),744      };745    });746  }747}