@@ -25,7 +25,7 @@ impl AggregateSignatureType {
2525 /// The prefix byte used in the byte representation of the aggregate signature type.
2626 ///
2727 /// IMPORTANT: This value is used in serialization/deserialization. Changing it will break compatibility.
28- pub fn to_bytes_encoding_prefix ( & self ) -> u8 {
28+ pub fn get_byte_encoding_prefix ( & self ) -> u8 {
2929 match self {
3030 AggregateSignatureType :: Concatenation => 0 ,
3131 #[ cfg( feature = "future_proof_system" ) ]
@@ -36,7 +36,7 @@ impl AggregateSignatureType {
3636 /// Create an aggregate signature type from a prefix byte.
3737 ///
3838 /// IMPORTANT: This value is used in serialization/deserialization. Changing it will break compatibility.
39- pub fn from_bytes_encoding_prefix ( byte : u8 ) -> Option < Self > {
39+ pub fn from_byte_encoding_prefix ( byte : u8 ) -> Option < Self > {
4040 match byte {
4141 0 => Some ( AggregateSignatureType :: Concatenation ) ,
4242 #[ cfg( feature = "future_proof_system" ) ]
@@ -177,7 +177,7 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
177177 let mut aggregate_signature_bytes = Vec :: new ( ) ;
178178 let aggregate_signature_type: AggregateSignatureType = self . into ( ) ;
179179 aggregate_signature_bytes
180- . extend_from_slice ( & [ aggregate_signature_type. to_bytes_encoding_prefix ( ) ] ) ;
180+ . extend_from_slice ( & [ aggregate_signature_type. get_byte_encoding_prefix ( ) ] ) ;
181181
182182 let mut proof_bytes = match self {
183183 AggregateSignature :: Concatenation ( concatenation_proof) => {
@@ -193,9 +193,10 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
193193
194194 /// Extract an aggregate signature from a byte slice.
195195 pub fn from_bytes ( bytes : & [ u8 ] ) -> Result < Self , StmAggregateSignatureError < D > > {
196- let proof_type_byte = bytes. get ( 0 ) . ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
196+ let proof_type_byte =
197+ bytes. first ( ) . ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
197198 let proof_bytes = & bytes[ 1 ..] ;
198- let proof_type = AggregateSignatureType :: from_bytes_encoding_prefix ( * proof_type_byte)
199+ let proof_type = AggregateSignatureType :: from_byte_encoding_prefix ( * proof_type_byte)
199200 . ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
200201 match proof_type {
201202 AggregateSignatureType :: Concatenation => Ok ( AggregateSignature :: Concatenation (
@@ -263,10 +264,10 @@ mod tests {
263264 fn golden_bytes_encoding_prefix ( ) {
264265 assert_eq ! (
265266 0u8 ,
266- AggregateSignatureType :: Concatenation . to_bytes_encoding_prefix ( )
267+ AggregateSignatureType :: Concatenation . get_byte_encoding_prefix ( )
267268 ) ;
268269 assert_eq ! (
269- AggregateSignatureType :: from_bytes_encoding_prefix ( 0u8 ) ,
270+ AggregateSignatureType :: from_byte_encoding_prefix ( 0u8 ) ,
270271 Some ( AggregateSignatureType :: Concatenation )
271272 ) ;
272273 }
0 commit comments