Skip to content

Commit

Permalink
apply PR review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaucube committed Dec 4, 2024
1 parent 8a41e67 commit d73c38f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
9 changes: 7 additions & 2 deletions folding-schemes/src/commitment/ipa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,13 @@ mod tests {
let proofVar = ProofVar::<Projective, GVar>::new_witness(cs.clone(), || Ok(proof.0))?;
let r_blindVar = EmulatedFpVar::<Fr, Fq>::new_witness(cs.clone(), || Ok(r_blind))?;
let uVar_vec = Vec::<EmulatedFpVar<Fr, Fq>>::new_witness(cs.clone(), || Ok(u))?;
let uVar: [EmulatedFpVar<Fr, Fq>; k] =
uVar_vec.try_into().map_err(|_| Error::TypeConversion)?;
let uVar: [EmulatedFpVar<Fr, Fq>; k] = uVar_vec.try_into().map_err(|_| {
Error::ConversionError(
"Vec<_>".to_string(),
"[_; 1]".to_string(),
"variable name: uVar".to_string(),
)
})?;
let UVar = GVar::new_witness(cs.clone(), || Ok(U))?;

let v = IPAGadget::<Projective, GVar, hiding>::verify::<k>(
Expand Down
18 changes: 14 additions & 4 deletions folding-schemes/src/folding/protogalaxy/decider_eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,20 @@ where
Ok(Self::Proof {
snark_proof,
L_X_evals,
kzg_proofs: kzg_proofs.try_into().map_err(|_| Error::TypeConversion)?,
kzg_challenges: kzg_challenges
.try_into()
.map_err(|_| Error::TypeConversion)?,
kzg_proofs: kzg_proofs.try_into().map_err(|_| {
Error::ConversionError(
"Vec<_>".to_string(),
"[_; 1]".to_string(),
"variable name: kzg_proofs".to_string(),
)
})?,
kzg_challenges: kzg_challenges.try_into().map_err(|_| {
Error::ConversionError(
"Vec<_>".to_string(),
"[_; 1]".to_string(),
"variable name: kzg_challenges".to_string(),
)
})?,
})
}

Expand Down
2 changes: 0 additions & 2 deletions folding-schemes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ pub enum Error {
NoMultiInstances,
#[error("Missing 'other' instances, since this is a multi-instances folding scheme. Expected number of instances, mu:{0}, nu:{1}")]
MissingOtherInstances(usize, usize),
#[error("Type conversion error")]
TypeConversion,
}

/// FoldingScheme defines trait that is implemented by the diverse folding schemes. It is defined
Expand Down
8 changes: 6 additions & 2 deletions folding-schemes/src/transcript/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ pub mod tests {
let mut poseidon_sponge: PoseidonSponge<_> = CryptographicSponge::new(&config);
let v: Vec<Fr> = vec!["1", "2", "3", "4"]
.into_iter()
.map(|x| Fr::from_str(x).map_err(|_| Error::TypeConversion))
.map(|x| {
Fr::from_str(x).map_err(|_| {
Error::ConversionError("str".to_string(), "Fr".to_string(), x.to_string())
})
})
.collect::<Result<Vec<Fr>, Error>>()?;
poseidon_sponge.absorb(&v);
poseidon_sponge.squeeze_field_elements::<Fr>(1);
Expand All @@ -144,7 +148,7 @@ pub mod tests {
== Fr::from_str(
"18821383157269793795438455681495246036402687001665670618754263018637548127333"
)
.map_err(|_| Error::TypeConversion)?
.unwrap()
);
Ok(())
}
Expand Down

0 comments on commit d73c38f

Please sign in to comment.