From f8152c2b0ab81f8d937010353e7c2ee674d017c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Eng=C3=A9libert?= <tuxmain@zettascript.org> Date: Mon, 11 Sep 2023 19:59:06 +0200 Subject: [PATCH] Remove instanciation and dep to certification --- Cargo.lock | 1 - end2end-tests/README.md | 2 +- pallets/distance/Cargo.toml | 2 - pallets/distance/src/lib.rs | 188 +++++++++++++-------------- pallets/distance/src/traits.rs | 2 +- resources/metadata.scale | Bin 133619 -> 134215 bytes runtime/common/src/handlers.rs | 4 +- runtime/common/src/pallets_config.rs | 4 +- runtime/common/src/providers.rs | 14 +- runtime/g1/src/lib.rs | 2 +- runtime/gdev/src/lib.rs | 2 +- runtime/gtest/src/lib.rs | 2 +- 12 files changed, 105 insertions(+), 118 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 82a2f51a4..9f89e471d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5262,7 +5262,6 @@ dependencies = [ "frame-system", "pallet-authority-members", "pallet-authorship", - "pallet-certification", "pallet-identity", "pallet-membership", "pallet-session", diff --git a/end2end-tests/README.md b/end2end-tests/README.md index b5f21c0c2..79da56e7f 100644 --- a/end2end-tests/README.md +++ b/end2end-tests/README.md @@ -163,7 +163,7 @@ To work, the integration tests need to have the runtime metadata up to date, her them: ```bash -subxt metadata -f bytes > resources/metadata.scale +subxt metadata -f bytes --version 14 > resources/metadata.scale ``` If you don't have subxt, install it: `cargo install subxt-cli` diff --git a/pallets/distance/Cargo.toml b/pallets/distance/Cargo.toml index 47f1f6710..56226bf77 100644 --- a/pallets/distance/Cargo.toml +++ b/pallets/distance/Cargo.toml @@ -16,7 +16,6 @@ std = [ 'frame-support/std', 'pallet-authority-members/std', 'pallet-authorship/std', - 'pallet-certification/std', 'pallet-identity/std', 'pallet-membership/std', 'pallet-session/std', @@ -29,7 +28,6 @@ std = [ [dependencies] pallet-authority-members = { path = "../authority-members", default-features = false } -pallet-certification = { path = "../certification", default-features = false } pallet-identity = { path = "../identity", default-features = false } pallet-membership = { path = "../membership", default-features = false } sp-distance = { path = "../../primitives/distance", default-features = false } diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index c56e35d60..45ee644be 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -51,12 +51,11 @@ pub mod pallet { #[pallet::generate_store(pub(super) trait Store)] #[pallet::storage_version(STORAGE_VERSION)] #[pallet::without_storage_info] - pub struct Pallet<T, I = ()>(PhantomData<(T, I)>); + pub struct Pallet<T>(PhantomData<T>); #[pallet::config] - pub trait Config<I: 'static = ()>: + pub trait Config: frame_system::Config + pallet_authorship::Config - + pallet_certification::Config<I, IdtyIndex = IdtyIndex> + pallet_identity::Config<IdtyIndex = IdtyIndex> + pallet_session::Config { @@ -77,40 +76,40 @@ pub mod pallet { /// Identities queued for distance evaluation #[pallet::storage] #[pallet::getter(fn evaluation_pool_0)] - pub type EvaluationPool0<T: Config<I>, I: 'static = ()> = StorageValue< + pub type EvaluationPool0<T: Config> = StorageValue< _, EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, >, ValueQuery, >; /// Identities queued for distance evaluation #[pallet::storage] #[pallet::getter(fn evaluation_pool_1)] - pub type EvaluationPool1<T: Config<I>, I: 'static = ()> = StorageValue< + pub type EvaluationPool1<T: Config> = StorageValue< _, EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, >, ValueQuery, >; /// Identities queued for distance evaluation #[pallet::storage] #[pallet::getter(fn evaluation_pool_2)] - pub type EvaluationPool2<T: Config<I>, I: 'static = ()> = StorageValue< + pub type EvaluationPool2<T: Config> = StorageValue< _, EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, >, ValueQuery, >; /// Block for which the distance rule must be checked #[pallet::storage] - pub type EvaluationBlock<T: Config<I>, I: 'static = ()> = + pub type EvaluationBlock<T: Config> = StorageValue<_, <T as frame_system::Config>::Hash, ValueQuery>; /// Distance evaluation status by identity @@ -120,10 +119,10 @@ pub mod pallet { /// * `.1` is the status of the evaluation. #[pallet::storage] #[pallet::getter(fn identity_distance_status)] - pub type IdentityDistanceStatus<T: Config<I>, I: 'static = ()> = StorageMap< + pub type IdentityDistanceStatus<T: Config> = StorageMap< _, Twox64Concat, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, (<T as frame_system::Config>::AccountId, DistanceStatus), OptionQuery, >; @@ -131,12 +130,12 @@ pub mod pallet { /// Identities by distance status expiration session index #[pallet::storage] #[pallet::getter(fn distance_status_expire_on)] - pub type DistanceStatusExpireOn<T: Config<I>, I: 'static = ()> = StorageMap< + pub type DistanceStatusExpireOn<T: Config> = StorageMap< _, Twox64Concat, u32, BoundedVec< - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, ConstU32<MAX_EVALUATIONS_PER_SESSION>, >, ValueQuery, @@ -144,7 +143,7 @@ pub mod pallet { /// Did evaluation get updated in this block? #[pallet::storage] - pub(super) type DidUpdate<T: Config<I>, I: 'static = ()> = StorageValue<_, bool, ValueQuery>; + pub(super) type DidUpdate<T: Config> = StorageValue<_, bool, ValueQuery>; // session_index % 3: // storage_id + 0 => pending @@ -155,7 +154,7 @@ pub mod pallet { // ERRORS // #[pallet::error] - pub enum Error<T, I = ()> { + pub enum Error<T> { AlreadyInEvaluation, CannotReserve, ManyEvaluationsByAuthor, @@ -169,7 +168,7 @@ pub mod pallet { } #[pallet::hooks] - impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> { + impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { /// dummy `on_initialize` to return the weight used in `on_finalize`. fn on_initialize(_n: BlockNumberFor<T>) -> Weight { // weight of `on_finalize` @@ -182,28 +181,28 @@ pub mod pallet { /// - 1 storage deletion (codec `O(1)`). /// # </weight> fn on_finalize(_n: BlockNumberFor<T>) { - DidUpdate::<T, I>::take(); + DidUpdate::<T>::take(); } } // CALLS // #[pallet::call] - impl<T: Config<I>, I: 'static> Pallet<T, I> { + impl<T: Config> Pallet<T> { /// Request an identity to be evaluated #[pallet::weight(1_000_000_000)] pub fn request_distance_evaluation(origin: OriginFor<T>) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - let idty = pallet_identity::IdentityIndexOf::<T>::get(&who) - .ok_or(Error::<T, I>::NoIdentity)?; + let idty = + pallet_identity::IdentityIndexOf::<T>::get(&who).ok_or(Error::<T>::NoIdentity)?; ensure!( - IdentityDistanceStatus::<T, I>::get(idty).is_none(), - Error::<T, I>::AlreadyInEvaluation + IdentityDistanceStatus::<T>::get(idty).is_none(), + Error::<T>::AlreadyInEvaluation ); - Pallet::<T, I>::do_request_distance_evaluation(who, idty)?; + Pallet::<T>::do_request_distance_evaluation(who, idty)?; Ok(().into()) } @@ -215,14 +214,14 @@ pub mod pallet { ) -> DispatchResult { ensure_none(origin)?; ensure!( - !DidUpdate::<T, I>::exists(), - Error::<T, I>::ManyEvaluationsInBlock, + !DidUpdate::<T>::exists(), + Error::<T>::ManyEvaluationsInBlock, ); - let author = pallet_authorship::Pallet::<T>::author().ok_or(Error::<T, I>::NoAuthor)?; + let author = pallet_authorship::Pallet::<T>::author().ok_or(Error::<T>::NoAuthor)?; - Pallet::<T, I>::do_update_evaluation(author, computation_result)?; + Pallet::<T>::do_update_evaluation(author, computation_result)?; - DidUpdate::<T, I>::set(true); + DidUpdate::<T>::set(true); Ok(()) } @@ -235,7 +234,7 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - Pallet::<T, I>::do_update_evaluation(evaluator, computation_result) + Pallet::<T>::do_update_evaluation(evaluator, computation_result) } /// Set the distance evaluation status of an identity @@ -248,18 +247,18 @@ pub mod pallet { #[pallet::weight(1_000_000)] pub fn force_set_distance_status( origin: OriginFor<T>, - identity: <T as pallet_certification::Config<I>>::IdtyIndex, + identity: <T as pallet_identity::Config>::IdtyIndex, status: Option<(<T as frame_system::Config>::AccountId, DistanceStatus)>, ) -> DispatchResult { ensure_root(origin)?; - IdentityDistanceStatus::<T, I>::set(identity, status); - DistanceStatusExpireOn::<T, I>::mutate( + IdentityDistanceStatus::<T>::set(identity, status); + DistanceStatusExpireOn::<T>::mutate( pallet_session::CurrentIndex::<T>::get() + T::ResultExpiration::get(), move |identities| { identities .try_push(identity) - .map_err(|_| Error::<T, I>::ManyEvaluationsInBlock.into()) + .map_err(|_| Error::<T>::ManyEvaluationsInBlock.into()) }, ) } @@ -267,7 +266,7 @@ pub mod pallet { // INTERNAL FUNCTIONS // - impl<T: Config<I>, I: 'static> Pallet<T, I> { + impl<T: Config> Pallet<T> { /// Mutate the evaluation pool containing: /// * when this session begins: the evaluation results to be applied /// * when this session ends: the evaluation requests @@ -276,7 +275,7 @@ pub mod pallet { F: FnOnce( &mut EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, >, ) -> R, >( @@ -284,9 +283,9 @@ pub mod pallet { f: F, ) -> R { match index % 3 { - 0 => EvaluationPool2::<T, I>::mutate(f), - 1 => EvaluationPool0::<T, I>::mutate(f), - 2 => EvaluationPool1::<T, I>::mutate(f), + 0 => EvaluationPool2::<T>::mutate(f), + 1 => EvaluationPool0::<T>::mutate(f), + 2 => EvaluationPool1::<T>::mutate(f), _ => unreachable!("index % 3 < 3"), } } @@ -296,7 +295,7 @@ pub mod pallet { F: FnOnce( &mut EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, >, ) -> R, >( @@ -304,9 +303,9 @@ pub mod pallet { f: F, ) -> R { match index % 3 { - 0 => EvaluationPool0::<T, I>::mutate(f), - 1 => EvaluationPool1::<T, I>::mutate(f), - 2 => EvaluationPool2::<T, I>::mutate(f), + 0 => EvaluationPool0::<T>::mutate(f), + 1 => EvaluationPool1::<T>::mutate(f), + 2 => EvaluationPool2::<T>::mutate(f), _ => unreachable!("index % 3 < 3"), } } @@ -319,41 +318,38 @@ pub mod pallet { index: SessionIndex, ) -> EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, + <T as pallet_identity::Config>::IdtyIndex, > { match index % 3 { - 0 => EvaluationPool2::<T, I>::take(), - 1 => EvaluationPool0::<T, I>::take(), - 2 => EvaluationPool1::<T, I>::take(), + 0 => EvaluationPool2::<T>::take(), + 1 => EvaluationPool0::<T>::take(), + 2 => EvaluationPool1::<T>::take(), _ => unreachable!("index % 3 < 3"), } } fn do_request_distance_evaluation( who: T::AccountId, - idty_index: <T as pallet_certification::Config<I>>::IdtyIndex, + idty_index: <T as pallet_identity::Config>::IdtyIndex, ) -> Result<(), DispatchError> { - Pallet::<T, I>::mutate_current_pool( + Pallet::<T>::mutate_current_pool( pallet_session::CurrentIndex::<T>::get(), |current_pool| { ensure!( current_pool.evaluations.len() < (MAX_EVALUATIONS_PER_SESSION as usize), - Error::<T, I>::QueueFull + Error::<T>::QueueFull ); - T::Currency::reserve(&who, <T as Config<I>>::EvaluationPrice::get())?; + T::Currency::reserve(&who, <T as Config>::EvaluationPrice::get())?; current_pool .evaluations .try_push((idty_index, median::MedianAcc::new())) - .map_err(|_| Error::<T, I>::QueueFull)?; + .map_err(|_| Error::<T>::QueueFull)?; - IdentityDistanceStatus::<T, I>::insert( - idty_index, - (who, DistanceStatus::Pending), - ); + IdentityDistanceStatus::<T>::insert(idty_index, (who, DistanceStatus::Pending)); - DistanceStatusExpireOn::<T, I>::mutate( + DistanceStatusExpireOn::<T>::mutate( pallet_session::CurrentIndex::<T>::get() + T::ResultExpiration::get(), move |identities| identities.try_push(idty_index).ok(), ); @@ -367,50 +363,47 @@ pub mod pallet { evaluator: <T as frame_system::Config>::AccountId, computation_result: ComputationResult, ) -> DispatchResult { - Pallet::<T, I>::mutate_next_pool( - pallet_session::CurrentIndex::<T>::get(), - |result_pool| { - ensure!( - computation_result.distances.len() == result_pool.evaluations.len(), - Error::<T, I>::WrongResultLength - ); - - if result_pool - .evaluators - .try_insert(evaluator) - .map_err(|_| Error::<T, I>::TooManyEvaluators)? + Pallet::<T>::mutate_next_pool(pallet_session::CurrentIndex::<T>::get(), |result_pool| { + ensure!( + computation_result.distances.len() == result_pool.evaluations.len(), + Error::<T>::WrongResultLength + ); + + if result_pool + .evaluators + .try_insert(evaluator) + .map_err(|_| Error::<T>::TooManyEvaluators)? + { + for (distance_value, (_identity, median_acc)) in computation_result + .distances + .into_iter() + .zip(result_pool.evaluations.iter_mut()) { - for (distance_value, (_identity, median_acc)) in computation_result - .distances - .into_iter() - .zip(result_pool.evaluations.iter_mut()) - { - median_acc.push(distance_value); - } - - Ok(()) - } else { - Err(Error::<T, I>::ManyEvaluationsByAuthor.into()) + median_acc.push(distance_value); } - }, - ) + + Ok(()) + } else { + Err(Error::<T>::ManyEvaluationsByAuthor.into()) + } + }) } } - impl<T: Config<I>, I: 'static> pallet_authority_members::OnNewSession for Pallet<T, I> { + impl<T: Config> pallet_authority_members::OnNewSession for Pallet<T> { fn on_new_session(index: SessionIndex) -> Weight { - EvaluationBlock::<T, I>::set(frame_system::Pallet::<T>::parent_hash()); + EvaluationBlock::<T>::set(frame_system::Pallet::<T>::parent_hash()); // Make results expire - DistanceStatusExpireOn::<T, I>::remove(index); + DistanceStatusExpireOn::<T>::remove(index); // Apply the results from the current pool (which was previous session's result pool) // We take the results so the pool is left empty for the new session. #[allow(clippy::type_complexity)] let current_pool: EvaluationPool< <T as frame_system::Config>::AccountId, - <T as pallet_certification::Config<I>>::IdtyIndex, - > = Pallet::<T, I>::take_current_pool(index); + <T as pallet_identity::Config>::IdtyIndex, + > = Pallet::<T>::take_current_pool(index); for (idty, median_acc) in current_pool.evaluations.into_iter() { if let Some(median_result) = median_acc.get_median() { let median = match median_result { @@ -418,29 +411,28 @@ pub mod pallet { MedianResult::Two(m1, m2) => m1 + (m2 - m1) / 2, // Avoid overflow (since max is 1) }; if median >= T::MinAccessibleReferees::get() { - IdentityDistanceStatus::<T, I>::mutate(idty, |entry| { + IdentityDistanceStatus::<T>::mutate(idty, |entry| { entry.as_mut().map(|(account_id, status)| { T::Currency::unreserve( account_id, - <T as Config<I>>::EvaluationPrice::get(), + <T as Config>::EvaluationPrice::get(), ); *status = DistanceStatus::Valid; }) }); } else if let Some((account_id, _status)) = - IdentityDistanceStatus::<T, I>::take(idty) + IdentityDistanceStatus::<T>::take(idty) { - <T as Config<I>>::Currency::slash_reserved( + <T as Config>::Currency::slash_reserved( &account_id, - <T as Config<I>>::EvaluationPrice::get(), + <T as Config>::EvaluationPrice::get(), ); } - } else if let Some((account_id, _status)) = - IdentityDistanceStatus::<T, I>::take(idty) + } else if let Some((account_id, _status)) = IdentityDistanceStatus::<T>::take(idty) { - <T as Config<I>>::Currency::unreserve( + <T as Config>::Currency::unreserve( &account_id, - <T as Config<I>>::EvaluationPrice::get(), + <T as Config>::EvaluationPrice::get(), ); } } @@ -449,8 +441,8 @@ pub mod pallet { } #[pallet::inherent] - impl<T: Config<I>, I: 'static> ProvideInherent for Pallet<T, I> { - type Call = Call<T, I>; + impl<T: Config> ProvideInherent for Pallet<T> { + type Call = Call<T>; type Error = InherentError; const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER; diff --git a/pallets/distance/src/traits.rs b/pallets/distance/src/traits.rs index 4d34c5de0..de9d532d6 100644 --- a/pallets/distance/src/traits.rs +++ b/pallets/distance/src/traits.rs @@ -14,7 +14,7 @@ // 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/>. -pub trait HandleNegativeEvaluation<T: crate::Config<I>, I: 'static> { +pub trait HandleNegativeEvaluation<T: crate::Config> { /// Do something with the reserved amount on the account, /// when distance evaluation result is negative. fn handle_negative_evaluation(account_id: T::AccountId); diff --git a/resources/metadata.scale b/resources/metadata.scale index d90bf7356f6d8550b1fd195e26baaf03f741875d..11d3bc5da37cff7bbbecf45c200e1d612b5caff4 100644 GIT binary patch delta 813 zcmaiy&ubG=5XX0L57Co{Qay;wp@&q~VC=0f3#sI=*dHOA6c57YHE&`THv7_jZ&M3x z<6j^`g!Jg4e?Xx^4k{uDp1pYUA1L-<^AGs4Z4xVm9N)}$X1+6@H|%A;A7+j}p58Fc z%E{N$eYk&QSCC0;voIv(2b>}msNLn|ry^<uFMIs=i<|epd8AM^slWXP=DH{qQ;9^; zKo;S+!Z<2ZOLRz%gkwq2z}khnhJnP|x`?QjGxG3Y9M3&UGou<-uZtv7*bp)9G({_I z)Q*EX;Z6{SxJ8&mG5M0>4sp~f88X=<{u;HOqEt^E7A8yuBEq_8we?OUb04PT@{@7X zEk?tqb-nzTwUec@A8&fcXLq~BNxza1VP>IlVbbMbEVx|lx)G;WaNEd$HEki837=s_ zZ^MaiQr*r@q!z9b4_Ku8*d>a$^kO<xc<vWB3#-*aWuxr*rDEClik|0gtaqJ7>y}0# zRdwmH{f|!Pt_U5=F(7+sLBw+31Q<J5sl-GYp*=Bg;dMR#o9#G;0jw|H!o$InJ@^Tu zPcyi40DB7N`tQym+cg#e^=+?#r~zV3+X+dfS?PZ=y^elyox8+1I(`b-ashD`{HyGr eY4|hHzfb+mrk?A6I)_6r`_&;hgI`0KpZ^Qe<Q~ER delta 185 zcmX>;gX8mLjt#qCP4<1px%uF$Dn|ArHX#a$#R}6Csu)GMt*o5$^U^ZYZ9MHJN4|++ zVwp18|F!Dojc;Z9xfvK(I1*WESr`&orWZIe>TDOPW4y-5#=#Q8z~Z_6bv<KE2@A^{ z1((SO-bisLRVrkrq~?`mmQ+rU`pP(ikz@MjuZ(sQF}{fvu4RcirHLi^Ma2QBMZu}X g#hLke(;XO@q(xHUG76b_3W*BEK*{ZT-xwvu04QZciU0rr diff --git a/runtime/common/src/handlers.rs b/runtime/common/src/handlers.rs index e573fec14..e05a97d4f 100644 --- a/runtime/common/src/handlers.rs +++ b/runtime/common/src/handlers.rs @@ -28,11 +28,11 @@ use sp_runtime::traits::IsMember; pub struct OnNewSessionHandler<Runtime>(core::marker::PhantomData<Runtime>); impl<Runtime> pallet_authority_members::traits::OnNewSession for OnNewSessionHandler<Runtime> where - Runtime: pallet_provide_randomness::Config + pallet_distance::Config<Instance1>, + Runtime: pallet_provide_randomness::Config + pallet_distance::Config, { fn on_new_session(index: sp_staking::SessionIndex) -> Weight { pallet_provide_randomness::Pallet::<Runtime>::on_new_epoch(); - pallet_distance::Pallet::<Runtime, Instance1>::on_new_session(index) + pallet_distance::Pallet::<Runtime>::on_new_session(index) } } diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index 6a8cede3b..74093f6b7 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -430,7 +430,7 @@ macro_rules! pallets_config { use frame_support::instances::Instance1; impl pallet_duniter_wot::Config<Instance1> for Runtime { type FirstIssuableOn = WotFirstCertIssuableOn; - type IsDistanceOk = common_runtime::providers::MainWotIsDistanceOk<Runtime, Instance1>; + type IsDistanceOk = common_runtime::providers::MainWotIsDistanceOk<Runtime>; type IsSubWot = frame_support::traits::ConstBool<false>; type MinCertForMembership = WotMinCertForMembership; type MinCertForCreateIdtyRight = WotMinCertForCreateIdtyRight; @@ -484,7 +484,7 @@ macro_rules! pallets_config { parameter_types! { pub const MinAccessibleReferees: Perbill = Perbill::from_percent(80); } - impl pallet_distance::Config<Instance1> for Runtime { + impl pallet_distance::Config for Runtime { type Currency = Balances; type EvaluationPrice = frame_support::traits::ConstU64<1000>; type MinAccessibleReferees = MinAccessibleReferees; diff --git a/runtime/common/src/providers.rs b/runtime/common/src/providers.rs index cab5f76fa..151f70ece 100644 --- a/runtime/common/src/providers.rs +++ b/runtime/common/src/providers.rs @@ -107,18 +107,16 @@ where } } -pub struct MainWotIsDistanceOk<T, I>(PhantomData<(T, I)>); +pub struct MainWotIsDistanceOk<T>(PhantomData<T>); -impl<T, I> - pallet_duniter_wot::traits::IsDistanceOk<<T as pallet_certification::Config<I>>::IdtyIndex> - for MainWotIsDistanceOk<T, I> +impl<T> pallet_duniter_wot::traits::IsDistanceOk<<T as pallet_identity::Config>::IdtyIndex> + for MainWotIsDistanceOk<T> where - T: pallet_distance::Config<I>, - I: 'static, + T: pallet_distance::Config, { - fn is_distance_ok(idty_id: &<T as pallet_certification::Config<I>>::IdtyIndex) -> bool { + fn is_distance_ok(idty_id: &<T as pallet_identity::Config>::IdtyIndex) -> bool { matches!( - pallet_distance::Pallet::<T, I>::identity_distance_status(idty_id), + pallet_distance::Pallet::<T>::identity_distance_status(idty_id), Some((_, pallet_distance::DistanceStatus::Valid)) ) } diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index a2b24627b..8fc21691c 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -277,7 +277,7 @@ construct_runtime!( Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>} = 41, Membership: pallet_membership::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 42, Cert: pallet_certification::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 43, - Distance: pallet_distance::<Instance1>::{Pallet, Call, Storage, Inherent} = 44, + Distance: pallet_distance::{Pallet, Call, Storage, Inherent} = 44, // Smith Sub-Wot SmithSubWot: pallet_duniter_wot::<Instance2>::{Pallet} = 50, diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index 57553149e..67d2dde35 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -333,7 +333,7 @@ construct_runtime!( Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>} = 41, Membership: pallet_membership::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 42, Cert: pallet_certification::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 43, - Distance: pallet_distance::<Instance1>::{Pallet, Call, Storage, Inherent} = 44, + Distance: pallet_distance::{Pallet, Call, Storage, Inherent} = 44, // Smith Sub-Wot SmithSubWot: pallet_duniter_wot::<Instance2>::{Pallet} = 50, diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index 549fb4268..9722455c4 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -293,7 +293,7 @@ construct_runtime!( Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>} = 41, Membership: pallet_membership::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 42, Cert: pallet_certification::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 43, - Distance: pallet_distance::<Instance1>::{Pallet, Call, Storage, Inherent} = 44, + Distance: pallet_distance::{Pallet, Call, Storage, Inherent} = 44, // Smith Sub-Wot SmithSubWot: pallet_duniter_wot::<Instance2>::{Pallet} = 50, -- GitLab