MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / open_combinations

Method open_combinations

poly-commit/src/ipa_pc/mod.rs:855–961  ·  view source on GitHub ↗
(
        ck: &Self::CommitterKey,
        linear_combinations: impl IntoIterator<Item = &'a LinearCombination<G::ScalarField>>,
        polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<G::

Source from the content-addressed store, hash-verified

853 }
854
855 fn open_combinations<'a>(
856 ck: &Self::CommitterKey,
857 linear_combinations: impl IntoIterator<Item = &'a LinearCombination<G::ScalarField>>,
858 polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<G::ScalarField, P>>,
859 commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
860 query_set: &QuerySet<P::Point>,
861 sponge: &mut impl CryptographicSponge,
862 states: impl IntoIterator<Item = &'a Self::CommitmentState>,
863 rng: Option<&mut dyn RngCore>,
864 ) -> Result<BatchLCProof<G::ScalarField, Self::BatchProof>, Self::Error>
865 where
866 Self::CommitmentState: 'a,
867 Self::Commitment: 'a,
868 P: 'a,
869 {
870 let label_poly_map = polynomials
871 .into_iter()
872 .zip(states)
873 .zip(commitments)
874 .map(|((p, s), c)| (p.label(), (p, s, c)))
875 .collect::<BTreeMap<_, _>>();
876
877 let mut lc_polynomials = Vec::new();
878 let mut lc_states = Vec::new();
879 let mut lc_commitments = Vec::new();
880 let mut lc_info = Vec::new();
881
882 for lc in linear_combinations {
883 let lc_label = lc.label().clone();
884 let mut poly = P::zero();
885 let mut degree_bound = None;
886 let mut hiding_bound = None;
887
888 let mut combined_comm = G::Group::zero();
889 let mut combined_shifted_comm: Option<G::Group> = None;
890
891 let mut combined_rand = G::ScalarField::zero();
892 let mut combined_shifted_rand: Option<G::ScalarField> = None;
893
894 let num_polys = lc.len();
895 for (coeff, label) in lc.iter().filter(|(_, l)| !l.is_one()) {
896 let label: &String = label.try_into().expect("cannot be one!");
897 let &(cur_poly, cur_rand, cur_comm) =
898 label_poly_map.get(label).ok_or(Error::MissingPolynomial {
899 label: label.to_string(),
900 })?;
901
902 if num_polys == 1 && cur_poly.degree_bound().is_some() {
903 assert!(
904 coeff.is_one(),
905 "Coefficient must be one for degree-bounded equations"
906 );
907 degree_bound = cur_poly.degree_bound();
908 } else if cur_poly.degree_bound().is_some() {
909 eprintln!("Degree bound when number of equations is non-zero");
910 return Err(Self::Error::EquationHasDegreeBounds(lc_label));
911 }
912

Callers

nothing calls this directly

Calls 10

labelMethod · 0.80
lenMethod · 0.80
iterMethod · 0.80
is_oneMethod · 0.80
try_intoMethod · 0.80
degree_boundMethod · 0.80
hiding_boundMethod · 0.80
polynomialMethod · 0.80
commitmentMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected