@@ -11,7 +11,10 @@ use catalyst_types::uuid::{self, CborContext, UuidV7};
1111use ed25519_dalek:: VerifyingKey ;
1212use minicbor:: { Decode , Encode , Encoder , data:: Type , encode:: Write } ;
1313
14- use crate :: doc_sync:: { PROTOCOL_VERSION , PublicKey , Signature } ;
14+ use crate :: {
15+ constant:: PROTOCOL_VERSION ,
16+ doc_sync:: { PublicKey , Signature } ,
17+ } ;
1518
1619/// The unsigned portion of the message envelope.
1720/// This structure corresponds to the **signature input** array:
@@ -47,7 +50,7 @@ impl EnvelopePayload {
4750 Ok ( Self {
4851 peer : PublicKey ( peer) ,
4952 seq : UuidV7 :: new ( ) ,
50- ver : PROTOCOL_VERSION ,
53+ ver : PROTOCOL_VERSION . into ( ) ,
5154 payload,
5255 } )
5356 }
@@ -99,7 +102,7 @@ impl EnvelopePayload {
99102 let seq: UuidV7 = decoder. decode_with ( & mut CborContext :: Tagged ) ?;
100103 let ver = decoder. u64 ( ) ?;
101104
102- if ver != PROTOCOL_VERSION {
105+ if ver != PROTOCOL_VERSION . into ( ) {
103106 return Err ( minicbor:: decode:: Error :: message ( format ! (
104107 "unsupported protocol version: {ver}"
105108 ) ) ) ;
@@ -169,7 +172,7 @@ impl<'b, C> Decode<'b, C> for EnvelopePayload {
169172 let seq: UuidV7 = d. decode_with ( & mut CborContext :: Tagged ) ?;
170173 let ver = d. u64 ( ) ?;
171174
172- if ver != PROTOCOL_VERSION {
175+ if ver != PROTOCOL_VERSION . into ( ) {
173176 return Err ( minicbor:: decode:: Error :: message ( format ! (
174177 "unsupported protocol version: {ver}"
175178 ) ) ) ;
@@ -428,7 +431,7 @@ mod tests {
428431 signed
429432 . encode_with ( payload. seq , & mut CborContext :: Tagged )
430433 . unwrap ( ) ;
431- signed. u64 ( PROTOCOL_VERSION + 1 ) . unwrap ( ) ;
434+ signed. u64 ( PROTOCOL_VERSION . into ( ) + 1 ) . unwrap ( ) ;
432435 <Vec < u8 > as Write >:: write_all ( signed. writer_mut ( ) , & payload. payload ) . unwrap ( ) ;
433436 signed. encode ( Signature ( signature) ) . unwrap ( ) ;
434437
@@ -512,7 +515,7 @@ mod tests {
512515 bad_array
513516 . encode_with ( payload. seq , & mut CborContext :: Tagged )
514517 . unwrap ( ) ;
515- bad_array. u64 ( PROTOCOL_VERSION ) . unwrap ( ) ;
518+ bad_array. u64 ( PROTOCOL_VERSION . into ( ) ) . unwrap ( ) ;
516519 // Skip payload & signature to force length error or skip signature
517520
518521 let mut envelope = Encoder :: new ( Vec :: new ( ) ) ;
0 commit comments