Skip to content

Commit

Permalink
test: Expand on recufier
Browse files Browse the repository at this point in the history
Co-authored-by: Alan Szepieniec <[email protected]>
  • Loading branch information
Sword-Smith and aszepieniec committed Mar 15, 2024
1 parent 18ab7f0 commit 6b0c844
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
21 changes: 18 additions & 3 deletions src/tests_and_benchmarks/ozk/programs/recufier/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,14 @@ fn recufy() {
);
RecufyDebug::dump_xfes(&base_and_ext_codeword_weights);

let quotient_segment_codeword_weights: Vec<XFieldElement> =
base_and_ext_codeword_weights.split_off(Recufier::num_columns());
RecufyDebug::dump_xfes(&quotient_segment_codeword_weights);
let quotient_segment_codeword_weights: [XFieldElement; 4] = <[XFieldElement; 4]>::try_from(
base_and_ext_codeword_weights.split_off(Recufier::num_columns()),
)
.unwrap();
RecufyDebug::dump_xfes(&quotient_segment_codeword_weights.to_vec());
RecufyDebug::dump_xfes(&base_and_ext_codeword_weights);

// sum out-of-domain values
let out_of_domain_curr_row_base_and_ext_value: XFieldElement =
Recufier::linearly_sum_base_and_ext_row(
out_of_domain_curr_base_row,
Expand All @@ -413,8 +416,20 @@ fn recufy() {
out_of_domain_next_ext_row,
&base_and_ext_codeword_weights,
);
let out_of_domain_curr_row_quotient_segment_value: XFieldElement =
tasm::tasm_array_inner_product_of_4_xfes(
quotient_segment_codeword_weights,
*out_of_domain_curr_row_quot_segments,
);
RecufyDebug::dump_xfe(out_of_domain_curr_row_base_and_ext_value);
RecufyDebug::dump_xfe(out_of_domain_next_row_base_and_ext_value);
RecufyDebug::dump_xfe(out_of_domain_curr_row_quotient_segment_value);

// Fiat-Shamir 3
let deep_coreword_weights: [XFieldElement; 3] =
<[XFieldElement; 3]>::try_from(Tip5WithState::sample_scalars(3)).unwrap();
RecufyDebug::dump_xfes(&deep_coreword_weights.to_vec());

// Good until here!!

RecufyDebug::sponge_state(Tip5WithState::squeeze());
Expand Down
17 changes: 14 additions & 3 deletions src/tests_and_benchmarks/ozk/rust_shadows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,24 @@ pub(super) fn tasm_recufier_challenges_new_empty_input_and_output_59_4(
Box::new(challenges)
}

fn inner_product(a: &[XFieldElement], b: &[XFieldElement]) -> XFieldElement {
a.iter()
.zip_eq(b.iter())
.fold(XFieldElement::zero(), |acc, (a, b)| acc + *a * *b)
}

pub(super) fn tasm_array_inner_product_of_4_xfes(
a: [XFieldElement; 4],
b: [XFieldElement; 4],
) -> XFieldElement {
inner_product(&a, &b)
}

pub(super) fn tasm_array_inner_product_of_596_xfes(
a: [XFieldElement; 596],
b: [XFieldElement; 596],
) -> XFieldElement {
a.into_iter()
.zip_eq(b)
.fold(XFieldElement::zero(), |acc, (a, b)| acc + a * b)
inner_product(&a, &b)
}

pub(super) fn tasm_array_horner_evaluation_with_4_coefficients(
Expand Down

0 comments on commit 6b0c844

Please sign in to comment.