1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
// Copyright 2021 Axiom-Team
//
// This file is part of Duniter-v2S.
//
// Duniter-v2S is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Duniter-v2S is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.

#[macro_export]
macro_rules! pallets_config {
    {$($custom:tt)*} => {
        $($custom)*

        // SYSTEM //

        parameter_types! {
            pub const Version: RuntimeVersion = VERSION;
        }

        impl frame_system::Config for Runtime {
            /// The basic call filter to use in dispatchable.
            type BaseCallFilter = BaseCallFilter;
            /// Block & extrinsics weights: base values and limits.
            type BlockWeights = BlockWeights;
            /// The maximum length of a block (in bytes).
            type BlockLength = BlockLength;
            /// The identifier used to distinguish between accounts.
            type AccountId = AccountId;
            /// The aggregated dispatch type that is available for extrinsics.
            type RuntimeCall = RuntimeCall;
            /// The lookup mechanism to get account ID from whatever is passed in dispatchers.
            type Lookup = AccountIdLookup<AccountId, ()>;
            /// The type for hashing blocks and tries.
            type Hash = Hash;
            /// The hashing algorithm used.
            type Hashing = BlakeTwo256;
            /// The ubiquitous event type.
            type RuntimeEvent = RuntimeEvent;
            /// The ubiquitous origin type.
            type RuntimeOrigin = RuntimeOrigin;
            /// Maximum number of block number to block hash mappings to keep (oldest pruned first).
            type BlockHashCount = BlockHashCount;
            /// The weight of database operations that the runtime can invoke.
            type DbWeight = DbWeight;
            /// Version of the runtime.
            type Version = Version;
            /// Converts a module to the index of the module in `construct_runtime!`.
            ///
            /// This type is being generated by `construct_runtime!`.
            type PalletInfo = PalletInfo;
            /// What to do if a new account is created.
            type OnNewAccount = ();
            /// What to do if an account is fully reaped from the system.
            type OnKilledAccount = ();
            /// The data to be stored in an account.
            type AccountData = pallet_duniter_account::AccountData<Balance, IdtyIndex>;
            /// Weight information for the extrinsics of this pallet.
            type SystemWeightInfo = common_runtime::weights::frame_system::WeightInfo<Runtime>;
            /// This is used as an identifier of the chain. 42 is the generic substrate prefix.
            type SS58Prefix = SS58Prefix;
            /// The set code logic, just the default since we're not a parachain.
            type OnSetCode = ();
            type MaxConsumers = frame_support::traits::ConstU32<16>;
            /// The type for storing how many extrinsics an account has signed.
            type Nonce = node_primitives::Nonce;
            /// The block type for the runtime.
            type Block = Block;
            type RuntimeTask = ();
            type SingleBlockMigrations = ();
            type MultiBlockMigrator = ();
            type PreInherents = ();
            type PostInherents = ();
            type PostTransactions = ();
        }

        // SCHEDULER //

        parameter_types! {
            pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
                BlockWeights::get().max_block;
            pub const MaxScheduledPerBlock: u32 = 50;
            pub const NoPreimagePostponement: Option<u32> = Some(10);
        }
        impl pallet_scheduler::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type RuntimeOrigin = RuntimeOrigin;
            type PalletsOrigin = OriginCaller;
            type RuntimeCall = RuntimeCall;
            type MaximumWeight = MaximumSchedulerWeight;
            type ScheduleOrigin = EnsureRoot<AccountId>;
            type OriginPrivilegeCmp = EqualPrivilegeOnly;
            type MaxScheduledPerBlock = MaxScheduledPerBlock;
            type WeightInfo = common_runtime::weights::pallet_scheduler::WeightInfo<Runtime>;
            type Preimages = Preimage;
        }

        // ACCOUNT //

        impl pallet_duniter_account::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type WeightInfo = common_runtime::weights::pallet_duniter_account::WeightInfo<Runtime>;
            // does currency adapter in any case, but adds "refund with quota" feature
            type InnerOnChargeTransaction = CurrencyAdapter<Balances, HandleFees>;
            type Refund = Quota;
        }

        // QUOTA //
        pub struct TreasuryAccountId;
        impl frame_support::pallet_prelude::Get<AccountId> for TreasuryAccountId {
            fn get() -> AccountId {
                // TODO optimize: make this a constant
                // calling Treasury.account_id() actually requires computation
                Treasury::account_id()
            }
        }
        parameter_types! {
            pub const ReloadRate: BlockNumber = 1 * HOURS; // faster than DAYS
            pub const MaxQuota: Balance = 1000; // 10 ĞD
			pub const MaxNominators: u32 = 64;
pub TreasuryAccount: AccountId = Treasury::account_id(); // TODO
        }
        impl pallet_quota::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            // type IdtyId = IdtyIndex;
            type ReloadRate = ReloadRate;
            type MaxQuota = MaxQuota;
            type RefundAccount = TreasuryAccountId;
            type WeightInfo = common_runtime::weights::pallet_quota::WeightInfo<Runtime>;
        }

        // BLOCK CREATION //

        impl pallet_babe::Config for Runtime {
            type EpochDuration = EpochDuration;
            type ExpectedBlockTime = ExpectedBlockTime;
            // session module is the trigger
            type EpochChangeTrigger = pallet_babe::ExternalTrigger;
            type DisabledValidators = Session;
            type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(
                KeyTypeId,
                pallet_babe::AuthorityId,
            )>>::Proof;
            type EquivocationReportSystem =
                pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
            type WeightInfo = common_runtime::weights::pallet_babe::WeightInfo<Runtime>;
            type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxNominators;
        }

        impl pallet_timestamp::Config for Runtime {
            type Moment = u64;
            type OnTimestampSet = (Babe, UniversalDividend);
            type MinimumPeriod = MinimumPeriod;
            type WeightInfo = common_runtime::weights::pallet_timestamp::WeightInfo<Runtime>;
        }

        // MONEY MANAGEMENT //

        impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
            type RuntimeEvent = RuntimeEvent;
            type MaxLocks = MaxLocks;
            type MaxReserves = frame_support::pallet_prelude::ConstU32<5>;
            type ReserveIdentifier = [u8; 8];
            /// The type for recording an account's balance.
            type Balance = Balance;
            type DustRemoval = HandleDust;
            type ExistentialDeposit = ExistentialDeposit;
            type AccountStore = Account;
			type FreezeIdentifier = ();
			type MaxFreezes = frame_support::pallet_prelude::ConstU32<0>;
            type WeightInfo = common_runtime::weights::pallet_balances::WeightInfo<Runtime>;
        }

        // Take Dust from Balances and put it in the Treasury pot
        pub struct HandleDust;
        type CreditOf = frame_support::traits::tokens::fungible::Credit<AccountId, Balances>;
        impl frame_support::traits::OnUnbalanced<CreditOf> for HandleDust {
            fn on_nonzero_unbalanced(amount: CreditOf) {
                use frame_support::traits::Currency as _;
                use frame_support::traits::Imbalance as _;
                let imbalance = NegativeImbalance::new(amount.peek());
                Balances::resolve_creating(&Treasury::account_id(), imbalance);
            }
        }

        // fees are moved to the treasury
        pub struct HandleFees;
        type NegativeImbalance = <Balances as frame_support::traits::Currency<AccountId>>::NegativeImbalance;
        impl frame_support::traits::OnUnbalanced<NegativeImbalance> for HandleFees {
            fn on_nonzero_unbalanced(amount: NegativeImbalance) {
                use frame_support::traits::Currency as _;

                // fee is moved to treasury
                Balances::resolve_creating(&Treasury::account_id(), amount);
                // should move the tip to author
                // if let Some(author) = Authorship::author() {
                //     Balances::resolve_creating(&author, amount);
                // }
            }
        }
        pub struct OnChargeTransaction;

        parameter_types! {
            pub FeeMultiplier: pallet_transaction_payment::Multiplier = pallet_transaction_payment::Multiplier::one();
        }
        impl pallet_transaction_payment::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            // does a filter on the call
            type OnChargeTransaction = OneshotAccount;
            type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>;
            type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>;
            type LengthToFee = common_runtime::fees::LengthToFeeImpl<Balance>;
            type FeeMultiplierUpdate = pallet_transaction_payment::ConstFeeMultiplier<FeeMultiplier>;
        }
        impl pallet_oneshot_account::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type Currency = Balances;
            // when call is not oneshot account, fall back to duniter-account implementation
            type InnerOnChargeTransaction = Account;
            type WeightInfo = common_runtime::weights::pallet_oneshot_account::WeightInfo<Runtime>;
        }

        // CONSENSUS  //

        impl pallet_authority_discovery::Config for Runtime {
            type MaxAuthorities = MaxAuthorities;
        }
        impl pallet_authority_members::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type IsMember = SmithMembers;
            type OnNewSession = OnNewSessionHandler<Runtime>;
            type MemberId = IdtyIndex;
            type MemberIdOf = common_runtime::providers::IdentityIndexOf<Self>;
            type MaxAuthorities = MaxAuthorities;
            type RemoveMemberOrigin = EnsureRoot<Self::AccountId>;
			type WeightInfo = common_runtime::weights::pallet_authority_members::WeightInfo<Runtime>;
            type OnIncomingMember = SmithMembers;
            type OnOutgoingMember = SmithMembers;
        }
        impl pallet_authorship::Config for Runtime {
            type EventHandler = ImOnline;
            type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
        }
        impl pallet_im_online::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type AuthorityId = ImOnlineId;
            type ValidatorSet = Historical;
            type NextSessionRotation = Babe;
            type ReportUnresponsiveness = Offences;
            type UnsignedPriority = ImOnlineUnsignedPriority;
            type WeightInfo = common_runtime::weights::pallet_im_online::WeightInfo<Runtime>;
            #[cfg(not(feature = "runtime-benchmarks"))]
            type MaxKeys = MaxAuthorities;
            #[cfg(feature = "runtime-benchmarks")]
            type MaxKeys = frame_support::traits::ConstU32<1_000>; // At least 1000 to be benchmarkable see https://github.com/paritytech/substrate/blob/e94cb0dafd4f30ff29512c1c00ec513ada7d2b5d/frame/im-online/src/benchmarking.rs#L35
            type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
        }
        impl pallet_offences::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
            type OnOffenceHandler = AuthorityMembers;
        }
        impl pallet_session::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type ValidatorId = AccountId;
            type ValidatorIdOf = sp_runtime::traits::ConvertInto;
            type ShouldEndSession = Babe;
            type NextSessionRotation = Babe;
            type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, AuthorityMembers>;
            type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
            type Keys = opaque::SessionKeys;
            type WeightInfo = common_runtime::weights::pallet_session::WeightInfo<Runtime>;
        }
        impl pallet_session::historical::Config for Runtime {
            type FullIdentification = ValidatorFullIdentification;
            type FullIdentificationOf = FullIdentificationOfImpl;
        }
        impl pallet_grandpa::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type KeyOwnerProof =
                <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
            type EquivocationReportSystem =
            		pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
            type WeightInfo = common_runtime::weights::pallet_grandpa::WeightInfo<Runtime>;
            type MaxAuthorities = MaxAuthorities;
			type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
			type MaxNominators = frame_support::traits::ConstU32<64>;
		}
        parameter_types! {
            // BondingDuration::get() * SessionsPerEra::get();
            pub const MaxSetIdSessionEntries: u32 = 1000;
        }

        // ONCHAIN GOVERNANCE //

		#[cfg(feature = "runtime-benchmarks")]
		parameter_types! {
			pub const WorstCaseOrigin: pallet_collective::RawOrigin<AccountId, TechnicalCommitteeInstance> =
				pallet_collective::RawOrigin::<AccountId, TechnicalCommitteeInstance>::Members(2, 3);
		}

		impl pallet_upgrade_origin::Config for Runtime {
			type RuntimeEvent = RuntimeEvent;
			type Call = RuntimeCall;
			type UpgradableOrigin = pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCommitteeInstance, 2, 3>;
			type WeightInfo = common_runtime::weights::pallet_upgrade_origin::WeightInfo<Runtime>;
			#[cfg(feature = "runtime-benchmarks")]
			type WorstCaseOriginType = pallet_collective::RawOrigin<AccountId, TechnicalCommitteeInstance>;
			#[cfg(feature = "runtime-benchmarks")]
			type WorstCaseOrigin = WorstCaseOrigin;
		}

        parameter_types! {
            pub const PreimageMaxSize: u32 = 4096 * 1024;
            pub const PreimageBaseDeposit: Balance = deposit(2, 64);
            pub const PreimageByteDeposit: Balance = deposit(0, 1);
        }

        impl pallet_preimage::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type WeightInfo = common_runtime::weights::pallet_preimage::WeightInfo<Runtime>;
            type Currency = Balances;
            type ManagerOrigin = EnsureRoot<AccountId>;
			type Consideration = ();
        }

        // UTILITIES //

        impl pallet_atomic_swap::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type SwapAction = pallet_atomic_swap::BalanceSwapAction<AccountId, Balances>;
            type ProofLimit = frame_support::traits::ConstU32<1_024>;
        }

        impl pallet_provide_randomness::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type Currency = Balances;
            type GetCurrentEpochIndex = GetCurrentEpochIndex<Self>;
            type MaxRequests = frame_support::traits::ConstU32<100>;
            type RequestPrice = frame_support::traits::ConstU64<2_000>;
            type OnFilledRandomness = ();
            type OnUnbalanced = Treasury;
            type ParentBlockRandomness = pallet_babe::ParentBlockRandomness<Self>;
            type RandomnessFromOneEpochAgo = pallet_babe::RandomnessFromOneEpochAgo<Self>;
			type WeightInfo = common_runtime::weights::pallet_provide_randomness::WeightInfo<Runtime>;
        }

        parameter_types! {
            // One storage item; key size 32, value size 8; .
            pub const ProxyDepositBase: Balance = deposit(1, 8);
            // Additional storage item size of 33 bytes.
            pub const ProxyDepositFactor: Balance = deposit(0, 33);
            pub const AnnouncementDepositBase: Balance = deposit(1, 8);
            pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
        }
        impl pallet_proxy::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type RuntimeCall = RuntimeCall;
            type Currency = Balances;
            type ProxyType = ProxyType;
            type ProxyDepositBase = ProxyDepositBase;
            type ProxyDepositFactor = ProxyDepositFactor;
            type MaxProxies = frame_support::traits::ConstU32<32>;
            type MaxPending = frame_support::traits::ConstU32<32>;
            type CallHasher = BlakeTwo256;
            type AnnouncementDepositBase = AnnouncementDepositBase;
            type AnnouncementDepositFactor = AnnouncementDepositFactor;
            type WeightInfo = common_runtime::weights::pallet_proxy::WeightInfo<Runtime>;
        }

        parameter_types! {
            pub const DepositBase: Balance = DEPOSIT_PER_ITEM;
            pub const DepositFactor: Balance = DEPOSIT_PER_BYTE * 32;
        }
        impl pallet_multisig::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type RuntimeCall = RuntimeCall;
            type Currency = Balances;
            type DepositBase = DepositBase;
            type DepositFactor = DepositFactor;
            type MaxSignatories = MaxSignatories;
            type WeightInfo = common_runtime::weights::pallet_multisig::WeightInfo<Runtime>;
        }

        impl pallet_utility::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type RuntimeCall = RuntimeCall;
            type PalletsOrigin = OriginCaller;
            type WeightInfo = common_runtime::weights::pallet_utility::WeightInfo<Runtime>;
        }

        parameter_types! {
            pub const Burn: Permill = Permill::zero();
            pub const ProposalBond: Permill = Permill::from_percent(1);
            pub const ProposalBondMaximum: Option<Balance> = None;
            pub const SpendPeriod: BlockNumber = DAYS;
            // Treasury account address:
            // gdev/gtest: 5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z
            pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
        }
        impl pallet_treasury::Config for Runtime {
            type ApproveOrigin = TreasuryApproveOrigin;
            type Burn = Burn;
            type BurnDestination = ();
            type Currency = Balances;
            type RuntimeEvent = RuntimeEvent;
            type OnSlash = Treasury;
            type ProposalBond = ProposalBond;
            type ProposalBondMinimum = frame_support::traits::ConstU64<10_000>;
            type ProposalBondMaximum = ProposalBondMaximum;
            type MaxApprovals = frame_support::traits::ConstU32<100>;
            type PalletId = TreasuryPalletId;
            type RejectOrigin = TreasuryRejectOrigin;
            type SpendFunds = TreasurySpendFunds<Self>;
            type SpendPeriod = SpendPeriod;
            type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
            type WeightInfo = common_runtime::weights::pallet_treasury::WeightInfo<Runtime>;
            type AssetKind = ();
            type Beneficiary = AccountId;
            type BeneficiaryLookup = AccountIdLookup<AccountId, ()>;
            type Paymaster = frame_support::traits::tokens::pay::PayFromAccount<Balances, TreasuryAccount>;
            type BalanceConverter = frame_support::traits::tokens::UnityAssetBalanceConversion;
            type PayoutPeriod = sp_core::ConstU32<10>;
            #[cfg(feature = "runtime-benchmarks")]
            type BenchmarkHelper = ();
        }

        // UNIVERSAL DIVIDEND //

		pub struct MembersCount;
		impl frame_support::pallet_prelude::Get<Balance> for MembersCount {
			fn get() -> Balance {
				<Membership as sp_membership::traits::MembersCount>::members_count() as Balance
			}
		}

        impl pallet_universal_dividend::Config for Runtime {
            type MomentIntoBalance = sp_runtime::traits::ConvertInto;
            type Currency = Balances;
            type RuntimeEvent = RuntimeEvent;
			type MaxPastReeval = frame_support::traits::ConstU32<160>;
            type MembersCount = MembersCount;
            type MembersStorage = common_runtime::providers::UdMembersStorage<Runtime>;
            type SquareMoneyGrowthRate = SquareMoneyGrowthRate;
            type UdCreationPeriod = UdCreationPeriod;
            type UdReevalPeriod = UdReevalPeriod;
            type UnitsPerUd = frame_support::traits::ConstU64<1_000>;
			type WeightInfo = common_runtime::weights::pallet_universal_dividend::WeightInfo<Runtime>;
            #[cfg(feature = "runtime-benchmarks")]
            type AccountIdOf = common_runtime::providers::IdentityAccountIdProvider<Self>;
        }

        // WEB OF TRUST //

        impl pallet_duniter_wot::Config for Runtime {
            type FirstIssuableOn = WotFirstCertIssuableOn;
            type MinCertForMembership = WotMinCertForMembership;
            type MinCertForCreateIdtyRight = WotMinCertForCreateIdtyRight;
        }

        parameter_types! {
            pub const ValidationPeriod: BlockNumber = 2 * MONTHS;
            pub const DeletionPeriod: BlockNumber = 10 * YEARS;
        }
        impl pallet_identity::Config for Runtime {
			type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod;
            type ConfirmPeriod = ConfirmPeriod;
            type ValidationPeriod = ValidationPeriod;
            type AutorevocationPeriod = AutorevocationPeriod;
            type DeletionPeriod = DeletionPeriod;
            type CheckIdtyCallAllowed = Wot;
            type IdtyCreationPeriod = IdtyCreationPeriod;
			type IdtyData = IdtyData;
            type IdtyIndex = IdtyIndex;
            type AccountLinker = Account;
            type IdtyNameValidator = IdtyNameValidatorImpl;
            type Signer = <Signature as sp_runtime::traits::Verify>::Signer;
			type Signature = Signature;
            type OnNewIdty = OnNewIdtyHandler<Runtime>;
            type OnRemoveIdty = OnRemoveIdtyHandler<Runtime>;
            type RuntimeEvent = RuntimeEvent;
            type WeightInfo = common_runtime::weights::pallet_identity::WeightInfo<Runtime>;
        }

    impl pallet_sudo::Config for Runtime {
        type RuntimeEvent = RuntimeEvent;
        type RuntimeCall = RuntimeCall;
        type WeightInfo = common_runtime::weights::pallet_sudo::WeightInfo<Runtime>;
    }

        impl pallet_membership::Config for Runtime {
            type CheckMembershipOpAllowed = Wot;
            type IdtyId = IdtyIndex;
            type IdtyIdOf = common_runtime::providers::IdentityIndexOf<Self>;
            type AccountIdOf = common_runtime::providers::IdentityAccountIdProvider<Self>;
            type MembershipPeriod = MembershipPeriod;
            type MembershipRenewalPeriod = MembershipRenewalPeriod;
            type OnNewMembership = OnNewMembershipHandler<Runtime>;
            type OnRemoveMembership = OnRemoveMembershipHandler<Runtime>;
            type RuntimeEvent = RuntimeEvent;
            type WeightInfo = common_runtime::weights::pallet_membership::WeightInfo<Runtime>;
            #[cfg(feature = "runtime-benchmarks")]
            type BenchmarkSetupHandler = common_runtime::providers::BenchmarkSetupHandler<Runtime>;
        }

        impl pallet_certification::Config for Runtime {
            type CertPeriod = CertPeriod;
            type IdtyIndex = IdtyIndex;
            type IdtyAttr = Identity;
            type CheckCertAllowed = Wot;
            type MaxByIssuer = MaxByIssuer;
            type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert;
            type OnNewcert = Wot;
            type OnRemovedCert = Wot;
            type RuntimeEvent = RuntimeEvent;
            type WeightInfo = common_runtime::weights::pallet_certification::WeightInfo<Runtime>;
            type ValidityPeriod = ValidityPeriod;
        }
        parameter_types! {
            pub const MinAccessibleReferees: Perbill = Perbill::from_percent(80);
        }
        impl pallet_distance::Config for Runtime {
            type Currency = Balances;
            type EvaluationPeriod = frame_support::traits::ConstU32<7>;
            type EvaluationPrice = frame_support::traits::ConstU64<1000>;
            type MaxRefereeDistance = frame_support::traits::ConstU32<5>;
            type MinAccessibleReferees = MinAccessibleReferees;
            type RuntimeEvent = RuntimeEvent;
            type WeightInfo = common_runtime::weights::pallet_distance::WeightInfo<Runtime>;
            type OnValidDistanceStatus = Wot;
            type CheckRequestDistanceEvaluation = Wot;
        }

        // SMITH-MEMBERS
        impl pallet_smith_members::Config for Runtime {
            type RuntimeEvent = RuntimeEvent;
            type IdtyIndex = IdtyIndex;
            type IsWoTMember = common_runtime::providers::IsWoTMemberProvider<Runtime>;
            type IdtyIdOf = common_runtime::providers::IdentityIndexOf<Self>;
            type MinCertForMembership = SmithWotMinCertForMembership;
            type MaxByIssuer = SmithMaxByIssuer;
            type SmithInactivityMaxDuration = SmithInactivityMaxDuration;
            type OnSmithDelete = OnSmithDeletedHandler<Runtime>;
            type IdtyIdOfAuthorityId = sp_runtime::traits::ConvertInto;
            type MemberId = IdtyIndex;
            type WeightInfo = common_runtime::weights::pallet_smith_members::WeightInfo<Runtime>;
            // TODO: remove as it is only used for benchmarking
            type OwnerKeyOf = Identity;
        }

        pub struct TechnicalCommitteeDefaultVote;
        impl pallet_collective::DefaultVote for TechnicalCommitteeDefaultVote {
            fn default_vote(
                _prime_vote: Option<bool>,
                _yes_votes: u32,
                _no_votes: u32,
                _len: u32,
            ) -> bool {
                false
            }
        }
        parameter_types! {
            pub const TechnicalCommitteeMotionDuration: BlockNumber = 7 * DAYS;
            pub MaxProposalWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block;
        }
        impl pallet_collective::Config<Instance2> for Runtime {
            type RuntimeOrigin = RuntimeOrigin;
            type Proposal = RuntimeCall;
            type RuntimeEvent = RuntimeEvent;
            type MotionDuration = TechnicalCommitteeMotionDuration;
            type MaxProposals = frame_support::pallet_prelude::ConstU32<20>;
            type MaxMembers = frame_support::pallet_prelude::ConstU32<100>;
            type WeightInfo = common_runtime::weights::pallet_collective::WeightInfo<Runtime>;
            type SetMembersOrigin = EnsureRoot<AccountId>;
            type MaxProposalWeight = MaxProposalWeight;
            #[cfg(not(feature = "runtime-benchmarks"))]
            type DefaultVote = TechnicalCommitteeDefaultVote;
            #[cfg(feature = "runtime-benchmarks")]
            type DefaultVote = pallet_collective::PrimeDefaultVote; // Overwrite with a  default vote that can return `true` sometimes as it is necessary for benchmarking
        }
    };
}