Skip to content
Snippets Groups Projects

automatically claim membership

Merged Hugo Trentesaux requested to merge hugo-dev into master
All threads resolved!
5 files
+ 37
5
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -91,6 +91,8 @@ pub mod pallet {
@@ -91,6 +91,8 @@ pub mod pallet {
type WeightInfo: WeightInfo;
type WeightInfo: WeightInfo;
/// Handler for successful distance evaluation
/// Handler for successful distance evaluation
type OnValidDistanceStatus: OnValidDistanceStatus<Self>;
type OnValidDistanceStatus: OnValidDistanceStatus<Self>;
 
/// Trait to check that distance evaluation request is allowed
 
type CheckRequestDistanceEvaluation: CheckRequestDistanceEvaluation<Self>;
}
}
// STORAGE //
// STORAGE //
@@ -259,7 +261,7 @@ pub mod pallet {
@@ -259,7 +261,7 @@ pub mod pallet {
}
}
/// Request target identity to be evaluated
/// Request target identity to be evaluated
/// only possible for unconfirmed identity
/// only possible for unvalidated identity
#[pallet::call_index(4)]
#[pallet::call_index(4)]
#[pallet::weight(<T as pallet::Config>::WeightInfo::request_distance_evaluation())]
#[pallet::weight(<T as pallet::Config>::WeightInfo::request_distance_evaluation())]
pub fn request_distance_evaluation_for(
pub fn request_distance_evaluation_for(
@@ -402,7 +404,6 @@ pub mod pallet {
@@ -402,7 +404,6 @@ pub mod pallet {
// caller has an identity
// caller has an identity
let idty_index = pallet_identity::IdentityIndexOf::<T>::get(who)
let idty_index = pallet_identity::IdentityIndexOf::<T>::get(who)
.ok_or(Error::<T>::CallerHasNoIdentity)?;
.ok_or(Error::<T>::CallerHasNoIdentity)?;
// TODO "check idty call allowed" managed by wot that checks received cert count
Self::check_request_distance_evaluation_common(idty_index)?;
Self::check_request_distance_evaluation_common(idty_index)?;
Ok(idty_index)
Ok(idty_index)
}
}
@@ -415,8 +416,6 @@ pub mod pallet {
@@ -415,8 +416,6 @@ pub mod pallet {
// caller has an identity
// caller has an identity
let caller_idty_index = pallet_identity::IdentityIndexOf::<T>::get(who)
let caller_idty_index = pallet_identity::IdentityIndexOf::<T>::get(who)
.ok_or(Error::<T>::CallerHasNoIdentity)?;
.ok_or(Error::<T>::CallerHasNoIdentity)?;
// TODO some of the following can be moved to a "check idty call allowed" managed by wot
// which also checks certification count
let caller_idty = pallet_identity::Identities::<T>::get(caller_idty_index)
let caller_idty = pallet_identity::Identities::<T>::get(caller_idty_index)
.ok_or(Error::<T>::CallerIdentityNotFound)?;
.ok_or(Error::<T>::CallerIdentityNotFound)?;
// caller is member
// caller is member
@@ -450,7 +449,9 @@ pub mod pallet {
@@ -450,7 +449,9 @@ pub mod pallet {
ValidEvaluationResult::<T>::get(target).is_none(),
ValidEvaluationResult::<T>::get(target).is_none(),
Error::<T>::ValidDistanceResultAlreadyAvailable
Error::<T>::ValidDistanceResultAlreadyAvailable
);
);
Ok(())
// external validation
 
// target has received enough certifications
 
T::CheckRequestDistanceEvaluation::check_request_distance_evaluation(target)
}
}
/// request distance evaluation in current pool
/// request distance evaluation in current pool
Loading