Skip to content
Snippets Groups Projects

Change distance evaluation period from Sessions to Blocks

Merged Benjamin Gallois requested to merge 202-distance-oracle-reevaluation into master
3 files
+ 19
26
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -45,9 +45,9 @@ use sp_std::prelude::*;
type IdtyIndex = u32;
/// Maximum number of identities to be evaluated in a session
/// Maximum number of identities to be evaluated in an evaluation period.
pub const MAX_EVALUATIONS_PER_SESSION: u32 = 600;
/// Maximum number of evaluators in a session
/// Maximum number of evaluators in an evaluation period.
pub const MAX_EVALUATORS_PER_SESSION: u32 = 100;
#[frame_support::pallet()]
@@ -162,13 +162,6 @@ pub mod pallet {
#[pallet::storage]
pub(super) type CurrentPoolIndex<T: Config> = StorageValue<_, u32, ValueQuery>;
// session_index % 3:
// storage_id + 0 => pending
// storage_id + 1 => receives results
// storage_id + 2 => receives new identities
// (this avoids problems for session_index < 3)
//
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
@@ -328,8 +321,8 @@ pub mod pallet {
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
/// * when this period begins: the evaluation results to be applied.
/// * when this period ends: the evaluation requests.
fn mutate_current_pool<
R,
F: FnOnce(
@@ -350,7 +343,7 @@ pub mod pallet {
}
}
/// Mutate the evaluation pool containing the results sent by evaluators on this session.
/// Mutate the evaluation pool containing the results sent by evaluators on this period.
fn mutate_next_pool<
R,
F: FnOnce(
@@ -372,8 +365,8 @@ pub mod pallet {
}
/// Take (and leave empty) the evaluation pool containing:
/// * when this session begins: the evaluation results to be applied
/// * when this session ends: the evaluation requests
/// * when this period begins: the evaluation results to be applied.
/// * when this period ends: the evaluation requests.
#[allow(clippy::type_complexity)]
fn take_current_pool(
index: u32,
@@ -527,8 +520,8 @@ pub mod pallet {
// set evaluation block
EvaluationBlock::<T>::set(frame_system::Pallet::<T>::parent_hash());
// 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.
// Apply the results from the current pool (which was previous period's result pool)
// We take the results so the pool is left empty for the new period.
#[allow(clippy::type_complexity)]
let current_pool: EvaluationPool<
<T as frame_system::Config>::AccountId,
Loading