Skip to content

Commit

Permalink
fix: handle empty point with hyperkzg
Browse files Browse the repository at this point in the history
Currently, hyperkzg does not work if the point is empty. This commit simply defaults to using a trivial point. This default respects the commitment and evaluation.
  • Loading branch information
JayWhite2357 committed Jan 11, 2025
1 parent 84d0856 commit d09c9da
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/provider/hyperkzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ where
point: &[E::Scalar],
_eval: &E::Scalar,
) -> Result<Self::EvaluationArgument, NovaError> {
let x: Vec<E::Scalar> = point.to_vec();
let x: Vec<E::Scalar> = if point.is_empty() {
vec![E::Scalar::ZERO]
} else {
point.to_vec()
};

//////////////// begin helper closures //////////
let kzg_open = |f: &[E::Scalar], u: E::Scalar| -> G1Affine<E> {
Expand Down Expand Up @@ -517,7 +521,11 @@ where
P_of_x: &E::Scalar,
pi: &Self::EvaluationArgument,
) -> Result<(), NovaError> {
let x = point.to_vec();
let x = if point.is_empty() {
vec![E::Scalar::ZERO]
} else {
point.to_vec()
};
let y = P_of_x;

// vk is hashed in transcript already, so we do not add it here
Expand Down

0 comments on commit d09c9da

Please sign in to comment.