Skip to content
Snippets Groups Projects
Unverified Commit c487f464 authored by bgallois's avatar bgallois
Browse files

replace session by pool

parent e1668f58
No related branches found
No related tags found
No related merge requests found
Pipeline #36377 passed
This diff is collapsed.
......@@ -48,7 +48,7 @@ where
};
let owner_key = sp_runtime::AccountId32::new(owner_key.0);
let session_index = client
let pool_index = client
.storage(
parent,
&StorageKey(
......@@ -66,11 +66,11 @@ where
&StorageKey(
frame_support::storage::storage_prefix(
b"Distance",
match session_index {
match pool_index {
0 => b"EvaluationPool0",
1 => b"EvaluationPool1",
2 => b"EvaluationPool2",
_ => unreachable!("n%3<3"),
_ => unreachable!("n<3"),
},
)
.to_vec(),
......@@ -90,9 +90,9 @@ where
// Read evaluation result from file, if it exists
log::debug!(
"🧙 [distance oracle] Reading evaluation result from file {:?}",
distance_dir.clone().join(session_index.to_string())
distance_dir.clone().join(pool_index.to_string())
);
let evaluation_result = match std::fs::read(distance_dir.join(session_index.to_string())) {
let evaluation_result = match std::fs::read(distance_dir.join(pool_index.to_string())) {
Ok(data) => data,
Err(e) => {
match e.kind() {
......
......@@ -71,7 +71,7 @@ pub async fn current_pool(
debug!("Looking at Pool0 for pool index {}", current_pool_index);
runtime::storage().distance().evaluation_pool0()
}
_ => unreachable!("n%3<3"),
_ => unreachable!("n<3"),
})
.await
.expect("Cannot fetch current pool")
......
......@@ -127,8 +127,8 @@ pub async fn run_and_save(client: &api::Client, settings: Settings) {
.flatten()
{
if let Ok(entry_name) = entry.file_name().into_string() {
if let Ok(entry_session) = entry_name.parse::<isize>() {
if current_pool_index as isize - entry_session > 3 {
if let Ok(entry_pool) = entry_name.parse::<isize>() {
if current_pool_index as isize - entry_pool > 3 {
files_to_remove.push(entry.path());
}
}
......@@ -187,7 +187,7 @@ pub async fn run(
});
}
info!("Evaluating distance for session {}", current_pool_index);
info!("Evaluating distance for pool {}", current_pool_index);
let evaluation_block = api::evaluation_block(client, parent_hash).await;
// member idty -> issued certs
......
......@@ -340,7 +340,7 @@ pub mod pallet {
0 => EvaluationPool2::<T>::mutate(f),
1 => EvaluationPool0::<T>::mutate(f),
2 => EvaluationPool1::<T>::mutate(f),
_ => unreachable!("index % 3 < 3"),
_ => unreachable!("index < 3"),
}
}
......@@ -361,7 +361,7 @@ pub mod pallet {
0 => EvaluationPool0::<T>::mutate(f),
1 => EvaluationPool1::<T>::mutate(f),
2 => EvaluationPool2::<T>::mutate(f),
_ => unreachable!("index % 3 < 3"),
_ => unreachable!("index < 3"),
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment