@@ -2,7 +2,7 @@ use account_utils::{read_input_from_user, STDIN_INPUTS_FLAG};
22use beacon_chain:: chain_config:: {
33 DisallowedReOrgOffsets , ReOrgThreshold , DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR ,
44 DEFAULT_RE_ORG_HEAD_THRESHOLD , DEFAULT_RE_ORG_MAX_EPOCHS_SINCE_FINALIZATION ,
5- DEFAULT_RE_ORG_PARENT_THRESHOLD ,
5+ DEFAULT_RE_ORG_PARENT_THRESHOLD , INVALID_HOLESKY_BLOCK_ROOT ,
66} ;
77use beacon_chain:: graffiti_calculator:: GraffitiOrigin ;
88use beacon_chain:: TrustedSetup ;
@@ -20,9 +20,10 @@ use lighthouse_network::{multiaddr::Protocol, Enr, Multiaddr, NetworkConfig, Pee
2020use sensitive_url:: SensitiveUrl ;
2121use slog:: { info, warn, Logger } ;
2222use std:: cmp:: max;
23+ use std:: collections:: HashSet ;
2324use std:: fmt:: Debug ;
2425use std:: fs;
25- use std:: io:: IsTerminal ;
26+ use std:: io:: { IsTerminal , Read } ;
2627use std:: net:: Ipv6Addr ;
2728use std:: net:: { IpAddr , Ipv4Addr , ToSocketAddrs } ;
2829use std:: num:: NonZeroU16 ;
@@ -903,6 +904,40 @@ pub fn get_config<E: EthSpec>(
903904 . max_gossip_aggregate_batch_size =
904905 clap_utils:: parse_required ( cli_args, "beacon-processor-aggregate-batch-size" ) ?;
905906
907+ if let Some ( invalid_block_roots_file_path) =
908+ clap_utils:: parse_optional :: < String > ( cli_args, "invalid-block-roots" ) ?
909+ {
910+ let mut file = std:: fs:: File :: open ( invalid_block_roots_file_path)
911+ . map_err ( |e| format ! ( "Failed to open invalid-block-roots file: {}" , e) ) ?;
912+ let mut contents = String :: new ( ) ;
913+ file. read_to_string ( & mut contents)
914+ . map_err ( |e| format ! ( "Failed to read invalid-block-roots file {}" , e) ) ?;
915+ let invalid_block_roots: HashSet < Hash256 > = contents
916+ . split ( ',' )
917+ . filter_map (
918+ |s| match Hash256 :: from_str ( s. strip_prefix ( "0x" ) . unwrap_or ( s) . trim ( ) ) {
919+ Ok ( block_root) => Some ( block_root) ,
920+ Err ( e) => {
921+ warn ! (
922+ log,
923+ "Unable to parse invalid block root" ;
924+ "block_root" => s,
925+ "error" => ?e,
926+ ) ;
927+ None
928+ }
929+ } ,
930+ )
931+ . collect ( ) ;
932+ client_config. chain . invalid_block_roots = invalid_block_roots;
933+ } else if spec
934+ . config_name
935+ . as_ref ( )
936+ . is_some_and ( |network_name| network_name == "holesky" )
937+ {
938+ client_config. chain . invalid_block_roots = HashSet :: from ( [ * INVALID_HOLESKY_BLOCK_ROOT ] ) ;
939+ }
940+
906941 Ok ( client_config)
907942}
908943
0 commit comments