Skip to content

Commit

Permalink
Merge pull request #480 from kroma-network/fix/enable-halo2-proof-gen…
Browse files Browse the repository at this point in the history
…eration

fix: enable halo2 proof generation
  • Loading branch information
chokobole authored Jul 23, 2024
2 parents 2891896 + acee332 commit 62805b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tachyon/c/zk/plonk/halo2/buffer_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class BufferReader<tachyon::math::UnivariateDensePolynomial<F, MaxDegree>> {
ReadBuffer(buffer, coeffs);
return tachyon::math::UnivariateDensePolynomial<F, MaxDegree>(
tachyon::math::UnivariateDenseCoefficients<F, MaxDegree>(
std::move(coeffs)));
std::move(coeffs), true));
}
}; // namespace tachyon::c::zk

Expand Down
36 changes: 21 additions & 15 deletions vendors/halo2/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,22 @@ where

let mut sub_cs = vec![];
for sub_range in ranges {
let advice = Arc::try_unwrap(self.advice_vec.clone())
.expect("there must only one Arc for advice_vec")
.iter_mut()
.map(|advice| {
advice.create_view(sub_range.start, sub_range.end - sub_range.start)
})
.collect::<Vec<_>>();
let advice_vec = self.advice_vec.clone();
let advice = unsafe {
let ptr = Arc::as_ptr(&advice_vec) as *mut Vec<RationalEvals>;
let mut_ref = &mut (*ptr);
mut_ref
.iter_mut()
.map(|advice| {
advice.create_view(sub_range.start, sub_range.end - sub_range.start)
})
.collect::<Vec<_>>()
};

sub_cs.push(Self {
k: 0,
current_phase: self.current_phase,
advice_vec: self.advice_vec.clone(),
advice_vec,
advice,
challenges: self.challenges,
instances: self.instances,
Expand Down Expand Up @@ -422,13 +426,15 @@ where
.zip(instances)
.enumerate()
{
let mut advice_vec =
Arc::new(vec![prover.empty_rational_evals(); num_advice_columns]);
let advice_slice = Arc::get_mut(&mut advice_vec)
.unwrap()
.iter_mut()
.map(|advice| advice.create_view(0, advice.len()))
.collect::<Vec<_>>();
let advice_vec = Arc::new(vec![prover.empty_rational_evals(); num_advice_columns]);
let advice_slice = unsafe {
let ptr = Arc::as_ptr(&advice_vec) as *mut Vec<RationalEvals>;
let mut_ref = &mut (*ptr);
mut_ref
.iter_mut()
.map(|advice| advice.create_view(0, advice.len()))
.collect::<Vec<_>>()
};
let mut witness = WitnessCollection {
k: prover.k(),
current_phase,
Expand Down

0 comments on commit 62805b6

Please sign in to comment.