mirror of
https://github.com/arnaucube/Nova.git
synced 2026-01-11 08:31:29 +01:00
Small optimizations (#142)
This commit is contained in:
@@ -178,8 +178,8 @@ macro_rules! impl_traits {
|
|||||||
$name::Scalar::from_bytes_wide(&bytes_arr)
|
$name::Scalar::from_bytes_wide(&bytes_arr)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_bytes(s: &Self) -> Vec<u8> {
|
fn to_bytes(&self) -> Vec<u8> {
|
||||||
s.to_repr().as_ref().to_vec()
|
self.to_repr().as_ref().to_vec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,9 @@ impl<G: Group> SumcheckProof<G> {
|
|||||||
return Err(NovaError::InvalidSumcheckProof);
|
return Err(NovaError::InvalidSumcheckProof);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if G_k(0) + G_k(1) = e
|
// we do not need to check if poly(0) + poly(1) = e, as
|
||||||
if poly.eval_at_zero() + poly.eval_at_one() != e {
|
// decompress() call above already ensures that hods
|
||||||
return Err(NovaError::InvalidSumcheckProof);
|
debug_assert_eq!(poly.eval_at_zero() + poly.eval_at_one(), e);
|
||||||
}
|
|
||||||
|
|
||||||
// append the prover's message to the transcript
|
// append the prover's message to the transcript
|
||||||
poly.append_to_transcript(b"poly", transcript);
|
poly.append_to_transcript(b"poly", transcript);
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ pub trait PrimeFieldExt: PrimeField {
|
|||||||
fn from_uniform(bytes: &[u8]) -> Self;
|
fn from_uniform(bytes: &[u8]) -> Self;
|
||||||
|
|
||||||
/// Returns a vector of bytes representing the scalar
|
/// Returns a vector of bytes representing the scalar
|
||||||
fn to_bytes(s: &Self) -> Vec<u8>;
|
fn to_bytes(&self) -> Vec<u8>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<G: Group<Scalar = F>, F: PrimeField + PrimeFieldExt> AppendToTranscriptTrait<G> for F {
|
impl<G: Group<Scalar = F>, F: PrimeField + PrimeFieldExt> AppendToTranscriptTrait<G> for F {
|
||||||
|
|||||||
Reference in New Issue
Block a user