@@ -25,7 +25,7 @@ impl AggregateSignatureType {
25
25
/// The prefix byte used in the byte representation of the aggregate signature type.
26
26
///
27
27
/// 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 {
29
29
match self {
30
30
AggregateSignatureType :: Concatenation => 0 ,
31
31
#[ cfg( feature = "future_proof_system" ) ]
@@ -36,7 +36,7 @@ impl AggregateSignatureType {
36
36
/// Create an aggregate signature type from a prefix byte.
37
37
///
38
38
/// 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 > {
40
40
match byte {
41
41
0 => Some ( AggregateSignatureType :: Concatenation ) ,
42
42
#[ cfg( feature = "future_proof_system" ) ]
@@ -177,7 +177,7 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
177
177
let mut aggregate_signature_bytes = Vec :: new ( ) ;
178
178
let aggregate_signature_type: AggregateSignatureType = self . into ( ) ;
179
179
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 ( ) ] ) ;
181
181
182
182
let mut proof_bytes = match self {
183
183
AggregateSignature :: Concatenation ( concatenation_proof) => {
@@ -193,9 +193,10 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
193
193
194
194
/// Extract an aggregate signature from a byte slice.
195
195
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 ) ?;
197
198
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)
199
200
. ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
200
201
match proof_type {
201
202
AggregateSignatureType :: Concatenation => Ok ( AggregateSignature :: Concatenation (
@@ -263,10 +264,10 @@ mod tests {
263
264
fn golden_bytes_encoding_prefix ( ) {
264
265
assert_eq ! (
265
266
0u8 ,
266
- AggregateSignatureType :: Concatenation . to_bytes_encoding_prefix ( )
267
+ AggregateSignatureType :: Concatenation . get_byte_encoding_prefix ( )
267
268
) ;
268
269
assert_eq ! (
269
- AggregateSignatureType :: from_bytes_encoding_prefix ( 0u8 ) ,
270
+ AggregateSignatureType :: from_byte_encoding_prefix ( 0u8 ) ,
270
271
Some ( AggregateSignatureType :: Concatenation )
271
272
) ;
272
273
}
0 commit comments