Skip to content

Commit

Permalink
don't delete indices used in batch (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
philsippl authored Jan 28, 2025
1 parent 304fcec commit 52fc450
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions iris-mpc-gpu/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod e2e_test {
const DB_BUFFER: usize = 8 * 1000;
const DB_RNG_SEED: u64 = 0xdeadbeef;
const INTERNAL_RNG_SEED: u64 = 0xdeadbeef;
const NUM_BATCHES: usize = 10;
const NUM_BATCHES: usize = 30;
const MAX_BATCH_SIZE: usize = 64;
const MAX_DELETIONS_PER_BATCH: usize = 10;
const THRESHOLD_ABSOLUTE: usize = 4800; // 0.375 * 12800
Expand Down Expand Up @@ -247,6 +247,7 @@ mod e2e_test {
let mut skip_invalidate = false;
let mut batch_duplicates: HashMap<String, String> = HashMap::new();

let mut db_indices_used = HashSet::new();
for idx in 0..batch_size {
let request_id = Uuid::new_v4();
// Automatic random tests
Expand Down Expand Up @@ -294,6 +295,7 @@ mod e2e_test {
if deleted_indices.contains(&(db_index as u32)) {
continue;
}
db_indices_used.insert(db_index);
expected_results
.insert(request_id.to_string(), (Some(db_index as u32), false));
E2ETemplate {
Expand All @@ -302,7 +304,7 @@ mod e2e_test {
}
}
2 => {
println!("Sending iris code on the threshold!!!!!!");
println!("Sending iris code on the threshold");
let db_index = loop {
let db_index = rng.gen_range(0..DB_SIZE / 10);
if !disallowed_queries.contains(&db_index) {
Expand All @@ -312,6 +314,7 @@ mod e2e_test {
if deleted_indices.contains(&(db_index as u32)) {
continue;
}
db_indices_used.insert(db_index);
let variation = rng.gen_range(-1..=1);
expected_results.insert(
request_id.to_string(),
Expand Down Expand Up @@ -343,6 +346,7 @@ mod e2e_test {
let e2e_template = responses.get(keys[idx]).unwrap().clone();
expected_results
.insert(request_id.to_string(), (Some(*keys[idx]), false));
db_indices_used.insert(*keys[idx] as usize);

E2ETemplate {
left: e2e_template.left.clone(),
Expand Down Expand Up @@ -414,7 +418,7 @@ mod e2e_test {

for _ in 0..rng.gen_range(0..MAX_DELETIONS_PER_BATCH) {
let idx = rng.gen_range(0..db.db.len());
if deleted_indices.contains(&(idx as u32)) {
if deleted_indices.contains(&(idx as u32)) || db_indices_used.contains(&idx) {
continue;
}
deleted_indices_buffer.push(idx as u32);
Expand Down

0 comments on commit 52fc450

Please sign in to comment.