mirror of
https://github.com/arnaucube/Nova.git
synced 2026-01-10 16:11: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)
|
||||
}
|
||||
|
||||
fn to_bytes(s: &Self) -> Vec<u8> {
|
||||
s.to_repr().as_ref().to_vec()
|
||||
fn to_bytes(&self) -> Vec<u8> {
|
||||
self.to_repr().as_ref().to_vec()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,9 @@ impl<G: Group> SumcheckProof<G> {
|
||||
return Err(NovaError::InvalidSumcheckProof);
|
||||
}
|
||||
|
||||
// check if G_k(0) + G_k(1) = e
|
||||
if poly.eval_at_zero() + poly.eval_at_one() != e {
|
||||
return Err(NovaError::InvalidSumcheckProof);
|
||||
}
|
||||
// we do not need to check if poly(0) + poly(1) = e, as
|
||||
// decompress() call above already ensures that hods
|
||||
debug_assert_eq!(poly.eval_at_zero() + poly.eval_at_one(), e);
|
||||
|
||||
// append the prover's message to the transcript
|
||||
poly.append_to_transcript(b"poly", transcript);
|
||||
|
||||
@@ -228,7 +228,7 @@ pub trait PrimeFieldExt: PrimeField {
|
||||
fn from_uniform(bytes: &[u8]) -> Self;
|
||||
|
||||
/// 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 {
|
||||
|
||||
Reference in New Issue
Block a user