From bc08290d1517bb97e12fe0d6f02da6f27d7de40a Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:36:46 -0500 Subject: [PATCH] Check that the serialization constant is correct --- src/range_proof.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/range_proof.rs b/src/range_proof.rs index 15072d9..a44c9bf 100644 --- a/src/range_proof.rs +++ b/src/range_proof.rs @@ -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());