Skip to content

Commit

Permalink
rework sumcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rnburn committed Feb 25, 2025
1 parent 9dc06dd commit e50c455
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions sxt/cbindings/backend/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sxt_cc_component(
with_test = False,
deps = [
"//sxt/proof/sumcheck:sumcheck_transcript",
"//sxt/proof/sumcheck2:sumcheck_transcript",
],
)

Expand Down
19 changes: 19 additions & 0 deletions sxt/cbindings/backend/callback_sumcheck_transcript.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#pragma once

#include "sxt/proof/sumcheck/sumcheck_transcript.h"
#include "sxt/proof/sumcheck2/sumcheck_transcript.h"

namespace sxt::cbnbck {
//--------------------------------------------------------------------------------------------------
Expand All @@ -35,6 +36,24 @@ class callback_sumcheck_transcript final : public prfsk::sumcheck_transcript {
f_(&r, context_, polynomial.data(), static_cast<unsigned>(polynomial.size()));
}

private:
callback_t f_;
void* context_;
};

template <basfld::element T>
class callback_sumcheck_transcript2 final : public prfsk2::sumcheck_transcript<T> {
public:
using callback_t = void (*)(T* r, void* context, T* polynomial, unsigned polynomial_len);

callback_sumcheck_transcript2(callback_t f, void* context) noexcept : f_{f}, context_{context} {}

void init(size_t /*num_variables*/, size_t /*round_degree*/) noexcept override {}

void round_challenge(T& r, basct::cspan<T> polynomial) noexcept override {
f_(&r, context_, polynomial.data(), static_cast<unsigned>(polynomial.size()));
}

private:
callback_t f_;
void* context_;
Expand Down

0 comments on commit e50c455

Please sign in to comment.