Skip to content

Commit

Permalink
Debug/e2e tests fix (#957)
Browse files Browse the repository at this point in the history
* debug e2es

* fix e2e tests mutable references
  • Loading branch information
carlomazzaferro authored Jan 21, 2025
1 parent c6168ee commit 2f340fc
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions iris-mpc-gpu/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,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 Down Expand Up @@ -383,27 +383,28 @@ mod e2e_test {
let shared_template = to_shared_template(is_valid, &e2e_template, &mut rng);

prepare_batch(
batch0.clone(),
&mut batch0,
is_valid,
request_id.to_string(),
0,
shared_template.clone(),
);
)?;

prepare_batch(
batch1.clone(),
&mut batch1,
true,
request_id.to_string(),
1,
shared_template.clone(),
);
)?;

prepare_batch(
batch2.clone(),
&mut batch2,
true,
request_id.to_string(),
2,
shared_template.clone(),
);
)?;
}

// Skip empty batch
Expand Down Expand Up @@ -513,12 +514,12 @@ mod e2e_test {

#[allow(clippy::too_many_arguments)]
fn prepare_batch(
mut batch: BatchQuery,
batch: &mut BatchQuery,
is_valid: bool,
request_id: String,
batch_idx: usize,
e2e_shared_template: E2ESharedTemplate,
) -> BatchQuery {
mut e2e_shared_template: E2ESharedTemplate,
) -> Result<()> {
batch.metadata.push(Default::default());
batch.valid_entries.push(is_valid);
batch.request_ids.push(request_id);
Expand All @@ -540,17 +541,35 @@ mod e2e_test {
.mask
.push(e2e_shared_template.right_shared_mask[batch_idx].clone());

batch
.db_left
.code
.extend(e2e_shared_template.left_shared_code[batch_idx].all_rotations());
batch
.db_left
.mask
.extend(e2e_shared_template.left_shared_mask[batch_idx].all_rotations());

batch
.db_right
.code
.extend(e2e_shared_template.left_shared_code[batch_idx].all_rotations());
batch
.db_right
.mask
.extend(e2e_shared_template.left_shared_mask[batch_idx].all_rotations());

GaloisRingIrisCodeShare::preprocess_iris_code_query_share(
&mut e2e_shared_template.left_shared_code[batch_idx].clone(),
&mut e2e_shared_template.left_shared_code[batch_idx],
);
GaloisRingTrimmedMaskCodeShare::preprocess_mask_code_query_share(
&mut e2e_shared_template.left_shared_mask[batch_idx].clone(),
&mut e2e_shared_template.left_shared_mask[batch_idx],
);
GaloisRingIrisCodeShare::preprocess_iris_code_query_share(
&mut e2e_shared_template.right_shared_code[batch_idx].clone(),
&mut e2e_shared_template.right_shared_code[batch_idx],
);
GaloisRingTrimmedMaskCodeShare::preprocess_mask_code_query_share(
&mut e2e_shared_template.right_shared_mask[batch_idx].clone(),
&mut e2e_shared_template.right_shared_mask[batch_idx],
);
batch
.query_left
Expand All @@ -570,7 +589,7 @@ mod e2e_test {
.mask
.extend(e2e_shared_template.right_shared_mask[batch_idx].all_rotations());

batch
Ok(())
}

fn to_shared_template(
Expand Down

0 comments on commit 2f340fc

Please sign in to comment.