11#[ cfg( feature = "testing-flags" ) ]
22use std:: cell:: Cell ;
33use std:: {
4- collections:: HashMap ,
54 fmt:: Display ,
65 net:: Ipv4Addr ,
76 str:: FromStr ,
@@ -17,7 +16,6 @@ use axum::http::HeaderValue;
1716use bytes:: Bytes ;
1817use futures:: StreamExt ;
1918use headers_accept:: Accept ;
20- use lazy_static:: lazy_static;
2119use lh_bls:: Signature ;
2220pub use lh_types:: ForkName ;
2321use lh_types:: {
@@ -62,24 +60,6 @@ pub const WILDCARD: &str = "*/*";
6260const MILLIS_PER_SECOND : u64 = 1_000 ;
6361pub const CONSENSUS_VERSION_HEADER : & str = "Eth-Consensus-Version" ;
6462
65- lazy_static ! {
66- static ref SSZ_VALUE_OFFSETS_BY_FORK : HashMap <ForkName , usize > = {
67- let mut map: HashMap <ForkName , usize > = HashMap :: new( ) ;
68- let forks = [
69- ForkName :: Bellatrix ,
70- ForkName :: Capella ,
71- ForkName :: Deneb ,
72- ForkName :: Electra ,
73- ForkName :: Fulu ,
74- ] ;
75- for fork in forks {
76- let offset = get_ssz_value_offset_for_fork( fork) . unwrap( ) ; // If there isn't a supported fork, this needs to be updated prior to release so panicking is fine
77- map. insert( fork, offset) ;
78- }
79- map
80- } ;
81- }
82-
8363#[ derive( Debug , Error ) ]
8464pub enum ResponseReadError {
8565 #[ error(
@@ -978,8 +958,7 @@ pub fn get_bid_value_from_signed_builder_bid_ssz(
978958 response_bytes : & [ u8 ] ,
979959 fork : ForkName ,
980960) -> Result < U256 , SszValueError > {
981- let value_offset = SSZ_VALUE_OFFSETS_BY_FORK
982- . get ( & fork)
961+ let value_offset = get_ssz_value_offset_for_fork ( fork)
983962 . ok_or ( SszValueError :: UnsupportedFork { name : fork. to_string ( ) } ) ?;
984963
985964 // Sanity check the response length so we don't panic trying to slice it
@@ -992,7 +971,7 @@ pub fn get_bid_value_from_signed_builder_bid_ssz(
992971 }
993972
994973 // Extract the value bytes and convert to U256
995- let value_bytes = & response_bytes[ * value_offset..end_offset] ;
974+ let value_bytes = & response_bytes[ value_offset..end_offset] ;
996975 let value = U256 :: from_le_slice ( value_bytes) ;
997976 Ok ( value)
998977}
0 commit comments