From ba917b93f45576da1107e145e59610be16ed5cc8 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/range_proof.rs b/src/range_proof.rs index 15072d9..758279f 100644 --- a/src/range_proof.rs +++ b/src/range_proof.rs @@ -1314,6 +1314,13 @@ 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());