Skip to content

Commit

Permalink
test: check that the serialization constant is correct (#133)
Browse files Browse the repository at this point in the history
This PR adds a test that the serialized element size constant is correct
for Ristretto.
  • Loading branch information
AaronFeickert committed May 7, 2024
1 parent 95fbf14 commit 3b29492
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/range_proof.rs
Expand Up @@ -1314,6 +1314,16 @@ mod tests {
BulletproofGens,
};

#[test]
fn test_serialized_element_size() {
// Check that the serialized proof element size constant is correct (at least for Ristretto)
assert_eq!(
RistrettoPoint::identity().compress().as_bytes().len(),
SERIALIZED_ELEMENT_SIZE
);
assert_eq!(Scalar::ZERO.as_bytes().len(), SERIALIZED_ELEMENT_SIZE);
}

#[test]
fn test_from_bytes() {
assert!((RistrettoRangeProof::from_bytes(&[])).is_err());
Expand Down

0 comments on commit 3b29492

Please sign in to comment.