@@ -67,8 +67,8 @@ impl Eth2Enr for Enr {
6767 /// if the custody value is non-existent in the ENR, then we assume the minimum custody value
6868 /// defined in the spec.
6969 fn custody_subnet_count < E : EthSpec > ( & self , spec : & ChainSpec ) -> u64 {
70- self . get ( PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY )
71- . and_then ( |custody_bytes| custody_bytes . try_into ( ) . map ( u64 :: from_be_bytes ) . ok ( ) )
70+ self . get_decodable :: < u64 > ( PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY )
71+ . and_then ( |r| r . ok ( ) )
7272 // If value supplied in ENR is invalid, fallback to `custody_requirement`
7373 . filter ( |csc| csc <= & spec. data_column_sidecar_subnet_count )
7474 . unwrap_or ( spec. custody_requirement )
@@ -245,8 +245,7 @@ pub fn build_enr<E: EthSpec>(
245245 spec. custody_requirement
246246 } ;
247247
248- let csc_bytes = custody_subnet_count. to_be_bytes ( ) ;
249- builder. add_value ( PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY , & csc_bytes. as_slice ( ) ) ;
248+ builder. add_value ( PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY , & custody_subnet_count) ;
250249
251250 builder
252251 . build ( enr_key)
@@ -353,11 +352,11 @@ mod test {
353352 let config = NetworkConfig :: default ( ) ;
354353 let spec = E :: default_spec ( ) ;
355354 let ( mut enr, enr_key) = build_enr_with_config ( config, & spec) ;
356- let invalid_subnet_count = 999u64 ;
355+ let invalid_subnet_count = 99u64 ;
357356
358357 enr. insert (
359358 PEERDAS_CUSTODY_SUBNET_COUNT_ENR_KEY ,
360- & invalid_subnet_count. to_be_bytes ( ) . as_slice ( ) ,
359+ & invalid_subnet_count,
361360 & enr_key,
362361 )
363362 . unwrap ( ) ;
0 commit comments