Skip to content

Commit 365cd9a

Browse files
authored
chore: add verification step to benchmark (PROOF-913) (#258)
add verification step to benchmark
1 parent 1f579c0 commit 365cd9a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

benchmark/sumcheck/benchmark.m.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@
2727
#include "sxt/execution/async/future.h"
2828
#include "sxt/execution/schedule/scheduler.h"
2929
#include "sxt/memory/management/managed_array.h"
30+
#include "sxt/proof/sumcheck/chunked_gpu_driver.h"
31+
#include "sxt/proof/sumcheck/cpu_driver.h"
3032
#include "sxt/proof/sumcheck/gpu_driver.h"
3133
#include "sxt/proof/sumcheck/proof_computation.h"
3234
#include "sxt/proof/sumcheck/reference_transcript.h"
35+
#include "sxt/proof/sumcheck/verification.h"
3336
#include "sxt/proof/transcript/transcript.h"
3437
#include "sxt/scalar25/random/element.h"
3538
#include "sxt/scalar25/realization/field.h"
@@ -78,6 +81,20 @@ static bool read_params(params& p, int argc, char* argv[]) noexcept {
7881
return true;
7982
}
8083

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+
8198
int main(int argc, char* argv[]) {
8299
params p;
83100
if (!read_params(p, argc, argv)) {
@@ -119,6 +136,7 @@ int main(int argc, char* argv[]) {
119136
auto fut = prfsk::prove_sum<s25t::element>(polynomials, evaluation_point, transcript, drv, mles,
120137
product_table, product_terms, p.n);
121138
xens::get_scheduler().run();
139+
check_verifiy(polynomials, p.degree, num_rounds);
122140
}
123141

124142
// sample

0 commit comments

Comments
 (0)