@@ -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" ) ]
@@ -155,7 +155,7 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
155
155
let mut aggregate_signature_bytes = Vec :: new ( ) ;
156
156
let aggregate_signature_type: AggregateSignatureType = self . into ( ) ;
157
157
aggregate_signature_bytes
158
- . extend_from_slice ( & [ aggregate_signature_type. to_bytes_encoding_prefix ( ) ] ) ;
158
+ . extend_from_slice ( & [ aggregate_signature_type. get_byte_encoding_prefix ( ) ] ) ;
159
159
160
160
let mut proof_bytes = match self {
161
161
AggregateSignature :: Concatenation ( concatenation_proof) => {
@@ -171,9 +171,10 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
171
171
172
172
/// Extract an aggregate signature from a byte slice.
173
173
pub fn from_bytes ( bytes : & [ u8 ] ) -> Result < Self , StmAggregateSignatureError < D > > {
174
- let proof_type_byte = bytes. get ( 0 ) . ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
174
+ let proof_type_byte =
175
+ bytes. first ( ) . ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
175
176
let proof_bytes = & bytes[ 1 ..] ;
176
- let proof_type = AggregateSignatureType :: from_bytes_encoding_prefix ( * proof_type_byte)
177
+ let proof_type = AggregateSignatureType :: from_byte_encoding_prefix ( * proof_type_byte)
177
178
. ok_or ( StmAggregateSignatureError :: SerializationError ) ?;
178
179
match proof_type {
179
180
AggregateSignatureType :: Concatenation => Ok ( AggregateSignature :: Concatenation (
@@ -248,10 +249,10 @@ mod tests {
248
249
fn golden_bytes_encoding_prefix ( ) {
249
250
assert_eq ! (
250
251
0u8 ,
251
- AggregateSignatureType :: Concatenation . to_bytes_encoding_prefix ( )
252
+ AggregateSignatureType :: Concatenation . get_byte_encoding_prefix ( )
252
253
) ;
253
254
assert_eq ! (
254
- AggregateSignatureType :: from_bytes_encoding_prefix ( 0u8 ) ,
255
+ AggregateSignatureType :: from_byte_encoding_prefix ( 0u8 ) ,
255
256
Some ( AggregateSignatureType :: Concatenation )
256
257
) ;
257
258
}
0 commit comments