diff --git a/pallets/certification/src/lib.rs b/pallets/certification/src/lib.rs index d1e02a7b3bcf58b9ade7140f16b7e50d1d7db9d6..658785ef890320f625b4f7be4f1f34eaf399a581 100644 --- a/pallets/certification/src/lib.rs +++ b/pallets/certification/src/lib.rs @@ -71,7 +71,7 @@ pub mod pallet { /// Something that give the owner key of an identity type OwnerKeyOf: Convert<Self::IdtyIndex, Option<Self::AccountId>>; /// - type IsCertAllowed: IsCertAllowed<Self::IdtyIndex>; + type CheckCertAllowed: CheckCertAllowed<Self::IdtyIndex>; #[pallet::constant] /// Maximum number of active certifications by issuer type MaxByIssuer: Get<u32>; @@ -323,7 +323,7 @@ pub mod pallet { ensure!(issuer_owner_key == who, DispatchError::BadOrigin); // Verify compatibility with other pallets state - T::IsCertAllowed::check_cert_allowed(issuer, receiver)?; + T::CheckCertAllowed::check_cert_allowed(issuer, receiver)?; // Verify rule MinReceivedCertToBeAbleToIssueCert let issuer_idty_cert_meta = <StorageIdtyCertMeta<T, I>>::get(issuer); diff --git a/pallets/certification/src/mock.rs b/pallets/certification/src/mock.rs index 066d3ebb0d6bb27fdb206b5252f1ce9ef586fae5..68de7a87ea0637a006ce6fcc2c6e81431eaca57b 100644 --- a/pallets/certification/src/mock.rs +++ b/pallets/certification/src/mock.rs @@ -103,7 +103,7 @@ impl pallet_certification::Config for Test { type Event = Event; type IdtyIndex = IdtyIndex; type OwnerKeyOf = sp_runtime::traits::ConvertInto; - type IsCertAllowed = (); + type CheckCertAllowed = (); type MaxByIssuer = MaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type OnNewcert = (); diff --git a/pallets/certification/src/traits.rs b/pallets/certification/src/traits.rs index 410ea643fab3789513172cf4760f7d38c0b7d81b..9a81bb3d006e4129be8074816f9c85490016ed91 100644 --- a/pallets/certification/src/traits.rs +++ b/pallets/certification/src/traits.rs @@ -16,11 +16,11 @@ use frame_support::pallet_prelude::*; -pub trait IsCertAllowed<IdtyIndex> { +pub trait CheckCertAllowed<IdtyIndex> { fn check_cert_allowed(issuer: IdtyIndex, receiver: IdtyIndex) -> Result<(), DispatchError>; } -impl<IdtyIndex> IsCertAllowed<IdtyIndex> for () { +impl<IdtyIndex> CheckCertAllowed<IdtyIndex> for () { fn check_cert_allowed(_issuer: IdtyIndex, _receiver: IdtyIndex) -> Result<(), DispatchError> { Ok(()) } diff --git a/pallets/duniter-wot/src/lib.rs b/pallets/duniter-wot/src/lib.rs index 0b5e1a0be6b4dc65425f9de6194f6cb4c5827146..e84484e7b49ef5b180e31eacba33fb5317d2344e 100644 --- a/pallets/duniter-wot/src/lib.rs +++ b/pallets/duniter-wot/src/lib.rs @@ -114,7 +114,7 @@ pub mod pallet { } } -impl<AccountId, T: Config<I>, I: 'static> pallet_identity::traits::EnsureIdtyCallAllowed<T> +impl<AccountId, T: Config<I>, I: 'static> pallet_identity::traits::CheckIdtyCallAllowed<T> for Pallet<T, I> where T: frame_system::Config<AccountId = AccountId> + pallet_membership::Config<I>, @@ -196,7 +196,7 @@ where } } -impl<T: Config<I>, I: 'static> pallet_certification::traits::IsCertAllowed<IdtyIndex> +impl<T: Config<I>, I: 'static> pallet_certification::traits::CheckCertAllowed<IdtyIndex> for Pallet<T, I> { fn check_cert_allowed(issuer: IdtyIndex, receiver: IdtyIndex) -> Result<(), DispatchError> { diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs index d6872196fd36aab256e9548176af52c9fa4f0526..d26889790d297bd33e05c2165a24f2598d65f540 100644 --- a/pallets/duniter-wot/src/mock.rs +++ b/pallets/duniter-wot/src/mock.rs @@ -122,7 +122,7 @@ impl pallet_identity::Config for Test { type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; type ConfirmPeriod = ConfirmPeriod; type Event = Event; - type EnsureIdtyCallAllowed = (DuniterWot, SmithsSubWot); + type CheckIdtyCallAllowed = (DuniterWot, SmithsSubWot); type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = (); type IdtyNameValidator = IdtyNameValidatorTestImpl; @@ -167,7 +167,7 @@ impl pallet_certification::Config<Instance1> for Test { type Event = Event; type IdtyIndex = IdtyIndex; type OwnerKeyOf = Identity; - type IsCertAllowed = DuniterWot; + type CheckCertAllowed = DuniterWot; type MaxByIssuer = MaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type OnNewcert = DuniterWot; @@ -221,7 +221,7 @@ impl pallet_certification::Config<Instance2> for Test { type Event = Event; type IdtyIndex = IdtyIndex; type OwnerKeyOf = Identity; - type IsCertAllowed = SmithsSubWot; + type CheckCertAllowed = SmithsSubWot; type MaxByIssuer = SmithsMaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = SmithsMinReceivedCertToBeAbleToIssueCert; type OnNewcert = SmithsSubWot; diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 0c91a9546fb252ab7832ff0482ccb1ac54458290..961b8e2f8d4a45d7adac24f25d94fde3a1a53a37 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -72,7 +72,7 @@ pub mod pallet { type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>; /// Management of the authorizations of the different calls. /// The default implementation allows everything. - type EnsureIdtyCallAllowed: EnsureIdtyCallAllowed<Self>; + type CheckIdtyCallAllowed: CheckIdtyCallAllowed<Self>; #[pallet::constant] /// Minimum duration between the creation of 2 identities by the same creator type IdtyCreationPeriod: Get<Self::BlockNumber>; @@ -272,7 +272,7 @@ pub mod pallet { } // run checks for identity creation - T::EnsureIdtyCallAllowed::check_create_identity(creator)?; + T::CheckIdtyCallAllowed::check_create_identity(creator)?; let block_number = frame_system::pallet::Pallet::<T>::block_number(); @@ -340,7 +340,7 @@ pub mod pallet { if <IdentitiesNames<T>>::contains_key(&idty_name) { return Err(Error::<T>::IdtyNameAlreadyExist.into()); } - T::EnsureIdtyCallAllowed::check_confirm_identity(idty_index)?; + T::CheckIdtyCallAllowed::check_confirm_identity(idty_index)?; // Apply phase // idty_value.status = IdtyStatus::ConfirmedByOwner; @@ -369,7 +369,7 @@ pub mod pallet { match idty_value.status { IdtyStatus::Created => return Err(Error::<T>::IdtyNotConfirmedByOwner.into()), IdtyStatus::ConfirmedByOwner => { - T::EnsureIdtyCallAllowed::check_validate_identity(idty_index)?; + T::CheckIdtyCallAllowed::check_validate_identity(idty_index)?; } IdtyStatus::Validated => return Err(Error::<T>::IdtyAlreadyValidated.into()), } @@ -411,7 +411,7 @@ pub mod pallet { Error::<T>::OwnerKeyAlreadyUsed ); - T::EnsureIdtyCallAllowed::check_change_identity_address(idty_index)?; + T::CheckIdtyCallAllowed::check_change_identity_address(idty_index)?; let block_number = frame_system::Pallet::<T>::block_number(); let maybe_old_old_owner_key = @@ -498,7 +498,7 @@ pub mod pallet { Error::<T>::InvalidRevocationKey ); - T::EnsureIdtyCallAllowed::check_remove_identity(idty_index)?; + T::CheckIdtyCallAllowed::check_remove_identity(idty_index)?; let genesis_hash = frame_system::Pallet::<T>::block_hash(T::BlockNumber::zero()); let revocation_payload = RevocationPayload { diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs index 535e06726a840d850ea833f1d696a027449b7aee..6825ebf66759918a159a93444a45bb590459c869 100644 --- a/pallets/identity/src/mock.rs +++ b/pallets/identity/src/mock.rs @@ -94,7 +94,7 @@ impl pallet_identity::Config for Test { type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; type ConfirmPeriod = ConfirmPeriod; type Event = Event; - type EnsureIdtyCallAllowed = (); + type CheckIdtyCallAllowed = (); type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = (); type IdtyNameValidator = IdtyNameValidatorTestImpl; diff --git a/pallets/identity/src/traits.rs b/pallets/identity/src/traits.rs index 181dec6cccb6a81828f63dc03756ea7f4c3f17e0..012d2a4a66167c6a5b2faa70931ebd384cff1bef 100644 --- a/pallets/identity/src/traits.rs +++ b/pallets/identity/src/traits.rs @@ -19,7 +19,7 @@ use frame_support::pallet_prelude::*; use impl_trait_for_tuples::impl_for_tuples; use sp_runtime::traits::Saturating; -pub trait EnsureIdtyCallAllowed<T: Config> { +pub trait CheckIdtyCallAllowed<T: Config> { fn check_create_identity(creator: T::IdtyIndex) -> Result<(), DispatchError>; fn check_confirm_identity(idty_index: T::IdtyIndex) -> Result<(), DispatchError>; fn check_validate_identity(idty_index: T::IdtyIndex) -> Result<(), DispatchError>; @@ -29,7 +29,7 @@ pub trait EnsureIdtyCallAllowed<T: Config> { #[impl_for_tuples(5)] #[allow(clippy::let_and_return)] -impl<T: Config> EnsureIdtyCallAllowed<T> for Tuple { +impl<T: Config> CheckIdtyCallAllowed<T> for Tuple { fn check_create_identity(creator: T::IdtyIndex) -> Result<(), DispatchError> { for_tuples!( #( Tuple::check_create_identity(creator)?; )* ); Ok(()) diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index cdcaa4944cda9a111335cbb204f901155570c1dc..c5c6418fe87a56b67388e3a754e65c69c8a799ff 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -430,7 +430,7 @@ macro_rules! pallets_config { type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; type ConfirmPeriod = ConfirmPeriod; type Event = Event; - type EnsureIdtyCallAllowed = (Wot, SmithsSubWot); + type CheckIdtyCallAllowed = (Wot, SmithsSubWot); type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = IdtyData; type IdtyIndex = IdtyIndex; @@ -461,7 +461,7 @@ macro_rules! pallets_config { type Event = Event; type IdtyIndex = IdtyIndex; type OwnerKeyOf = Identity; - type IsCertAllowed = Wot; + type CheckCertAllowed = Wot; type MaxByIssuer = MaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type OnNewcert = Wot; @@ -497,7 +497,7 @@ macro_rules! pallets_config { type Event = Event; type IdtyIndex = IdtyIndex; type OwnerKeyOf = Identity; - type IsCertAllowed = SmithsSubWot; + type CheckCertAllowed = SmithsSubWot; type MaxByIssuer = SmithMaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = SmithMinReceivedCertToBeAbleToIssueCert; type OnNewcert = SmithsSubWot;