|
27 | 27 | #include "sxt/execution/async/future.h" |
28 | 28 | #include "sxt/execution/schedule/scheduler.h" |
29 | 29 | #include "sxt/memory/management/managed_array.h" |
| 30 | +#include "sxt/proof/sumcheck/chunked_gpu_driver.h" |
| 31 | +#include "sxt/proof/sumcheck/cpu_driver.h" |
30 | 32 | #include "sxt/proof/sumcheck/gpu_driver.h" |
31 | 33 | #include "sxt/proof/sumcheck/proof_computation.h" |
32 | 34 | #include "sxt/proof/sumcheck/reference_transcript.h" |
| 35 | +#include "sxt/proof/sumcheck/verification.h" |
33 | 36 | #include "sxt/proof/transcript/transcript.h" |
34 | 37 | #include "sxt/scalar25/random/element.h" |
35 | 38 | #include "sxt/scalar25/realization/field.h" |
@@ -78,6 +81,20 @@ static bool read_params(params& p, int argc, char* argv[]) noexcept { |
78 | 81 | return true; |
79 | 82 | } |
80 | 83 |
|
| 84 | +static void check_verifiy(basct::cspan<s25t::element> round_polynomials, unsigned round_degree, |
| 85 | + unsigned num_rounds) noexcept { |
| 86 | + prft::transcript base_transcript{"abc123"}; |
| 87 | + prfsk::reference_transcript<s25t::element> transcript{base_transcript}; |
| 88 | + memmg::managed_array<s25t::element> evaluation_point(num_rounds); |
| 89 | + s25t::element expected_sum; |
| 90 | + prfsk::sum_polynomial_01(expected_sum, round_polynomials.subspan(0, round_degree + 1)); |
| 91 | + auto was_successful = prfsk::verify_sumcheck_no_evaluation<s25t::element>( |
| 92 | + expected_sum, evaluation_point, transcript, round_polynomials, round_degree); |
| 93 | + if (!was_successful) { |
| 94 | + baser::panic("verification failed"); |
| 95 | + } |
| 96 | +} |
| 97 | + |
81 | 98 | int main(int argc, char* argv[]) { |
82 | 99 | params p; |
83 | 100 | if (!read_params(p, argc, argv)) { |
@@ -119,6 +136,7 @@ int main(int argc, char* argv[]) { |
119 | 136 | auto fut = prfsk::prove_sum<s25t::element>(polynomials, evaluation_point, transcript, drv, mles, |
120 | 137 | product_table, product_terms, p.n); |
121 | 138 | xens::get_scheduler().run(); |
| 139 | + check_verifiy(polynomials, p.degree, num_rounds); |
122 | 140 | } |
123 | 141 |
|
124 | 142 | // sample |
|
0 commit comments