@@ -48,6 +48,20 @@ def get_validator_id(namespace: str, context: Optional[str]) -> str:
4848 return config_data ["validator_id" ]
4949
5050
51+ class NodeValidatorIdCompositeUpdater (ConstConfigValuesUpdater ):
52+ def __init__ (self , config_overrides : dict [str , any ], validator_id_start_from : int ):
53+ super ().__init__ (config_overrides )
54+ self .validator_id_start_from = validator_id_start_from
55+
56+ def get_updated_config_for_instance (
57+ self , config_data : dict [str , any ], instance_index : int
58+ ) -> dict [str , any ]:
59+ updated_config = super ().get_updated_config_for_instance (config_data , instance_index )
60+ validator_id_as_hex = f"0x{ (self .validator_id_start_from + instance_index ):x} "
61+ updated_config ["validator_id" ] = validator_id_as_hex
62+ return updated_config
63+
64+
5165def main ():
5266 usage_example = """
5367Examples:
@@ -94,6 +108,12 @@ def main():
94108 help = "The name of the project to get logs from." ,
95109 )
96110
111+ args_builder .add_argument (
112+ "--validator-id-start-from" ,
113+ type = int ,
114+ help = "If set, also update the validator ID config to this value + index of the instance being restarted." ,
115+ )
116+
97117 args = args_builder .build ()
98118
99119 # Get current block number from feeder URL
@@ -137,8 +157,14 @@ def main():
137157 Service .Core ,
138158 )
139159
160+ updater = (
161+ NodeValidatorIdCompositeUpdater (config_overrides , args .validator_id_start_from )
162+ if args .validator_id_start_from
163+ else ConstConfigValuesUpdater (config_overrides )
164+ )
165+
140166 update_config_and_restart_nodes (
141- ConstConfigValuesUpdater ( config_overrides ) ,
167+ updater ,
142168 namespace_and_instruction_args ,
143169 Service .Core ,
144170 restarter ,
0 commit comments