Skip to content

Commit

Permalink
added test for kickoff
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyasa committed Dec 12, 2024
1 parent d6a9c59 commit e6672ff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion icicle/include/icicle/backend/sumcheck_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace icicle {
* @param round_polynomial a vector of MLE polynomials evaluated at x=0,1,2...
* @return alpha
*/
F get_alpha(std::vector<F>& round_polynomial) = 0;
virtual F get_alpha(std::vector<F>& round_polynomial) = 0;

const F& get_claimed_sum() const { return m_claimed_sum; }

Expand Down
29 changes: 29 additions & 0 deletions icicle/tests/test_field_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "icicle/program/program.h"
#include "icicle/program/returning_value_program.h"
#include "../../icicle/backend/cpu/include/cpu_program_executor.h"
#include "icicle/sumcheck/sumcheck.h"

#include "test_base.h"

using namespace field_config;
Expand Down Expand Up @@ -1054,6 +1056,33 @@ TEST_F(FieldApiTestBase, CpuProgramExecutorReturningVal)
ASSERT_EQ(0, memcmp(out_element_wise.get(), out_vec_ops.get(), total_size * sizeof(scalar_t)));
}

#ifdef SUMCHECK
TEST_F(FieldApiTestBase, Sumcheck)
{
int mle_poly_size = 1 << 13;
int nof_mle_poly = 4;
scalar_t claimed_sum = scalar_t::from(8);

// create transcript_config
const SumcheckTranscriptConfig<scalar_t> transcript_config;

// create sumcheck
Sumcheck sumcheck = create_sumcheck(claimed_sum, std::move(transcript_config));

// generate inputs
std::vector< std::vector<scalar_t>* > mle_polynomials(nof_mle_poly);
for (auto& mle_poly_ptr : mle_polynomials) {
mle_poly_ptr = std::make_shared<std::vector<scalar_t>>(mle_poly_size).get();
scalar_t::rand_host_many(mle_poly_ptr->data(), mle_poly_size);
}
CombineFunction<scalar_t> combine_func(EQ_X_AB_MINUS_C);
SumCheckConfig config;
SumCheckProof<scalar_t> sumcheck_proof(nof_mle_poly, 2);

sumcheck.get_proof(mle_polynomials, combine_func, config, sumcheck_proof);
}
#endif

int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
Expand Down

0 comments on commit e6672ff

Please sign in to comment.