@@ -5082,6 +5082,7 @@ fn test_duplicate_shreds_switch_failure() {
5082
5082
dup_shred2 : & Shred ,
5083
5083
) {
5084
5084
let disable_turbine = Arc :: new ( AtomicBool :: new ( true ) ) ;
5085
+ duplicate_fork_validator_info. config . voting_disabled = false ;
5085
5086
duplicate_fork_validator_info. config . turbine_disabled = disable_turbine. clone ( ) ;
5086
5087
info ! ( "Restarting node: {}" , pubkey) ;
5087
5088
cluster. restart_node (
@@ -5151,6 +5152,7 @@ fn test_duplicate_shreds_switch_failure() {
5151
5152
. iter ( )
5152
5153
. map ( |s| ( Arc :: new ( Keypair :: from_base58_string ( s) ) , true ) )
5153
5154
. collect :: < Vec < _ > > ( ) ;
5155
+
5154
5156
let validators = validator_keypairs
5155
5157
. iter ( )
5156
5158
. map ( |( kp, _) | kp. pubkey ( ) )
@@ -5239,6 +5241,23 @@ fn test_duplicate_shreds_switch_failure() {
5239
5241
5240
5242
// 1) Set up the cluster
5241
5243
let ( duplicate_slot_sender, duplicate_slot_receiver) = unbounded ( ) ;
5244
+ let validator_configs = validator_keypairs
5245
+ . into_iter ( )
5246
+ . map ( |( validator_keypair, in_genesis) | {
5247
+ let pubkey = validator_keypair. pubkey ( ) ;
5248
+ // Only allow the leader to vote so that no version gets duplicate confirmed.
5249
+ // This is to avoid the leader dumping his own block.
5250
+ let voting_disabled = { pubkey != duplicate_leader_validator_pubkey } ;
5251
+ ValidatorTestConfig {
5252
+ validator_keypair,
5253
+ validator_config : ValidatorConfig {
5254
+ voting_disabled,
5255
+ ..ValidatorConfig :: default ( )
5256
+ } ,
5257
+ in_genesis,
5258
+ }
5259
+ } )
5260
+ . collect ( ) ;
5242
5261
let ( mut cluster, _validator_keypairs) = test_faulty_node (
5243
5262
BroadcastStageType :: BroadcastDuplicates ( BroadcastDuplicatesConfig {
5244
5263
partition : ClusterPartition :: Pubkey ( vec ! [
@@ -5252,7 +5271,7 @@ fn test_duplicate_shreds_switch_failure() {
5252
5271
duplicate_slot_sender : Some ( duplicate_slot_sender) ,
5253
5272
} ) ,
5254
5273
node_stakes,
5255
- Some ( validator_keypairs ) ,
5274
+ Some ( validator_configs ) ,
5256
5275
Some ( FixedSchedule {
5257
5276
leader_schedule : Arc :: new ( leader_schedule) ,
5258
5277
} ) ,
@@ -5265,7 +5284,8 @@ fn test_duplicate_shreds_switch_failure() {
5265
5284
let duplicate_fork_validator2_info = cluster. exit_node ( & duplicate_fork_validator2_pubkey) ;
5266
5285
let target_switch_fork_validator_ledger_path =
5267
5286
cluster. ledger_path ( & target_switch_fork_validator_pubkey) ;
5268
- let target_switch_fork_validator_info = cluster. exit_node ( & target_switch_fork_validator_pubkey) ;
5287
+ let mut target_switch_fork_validator_info =
5288
+ cluster. exit_node ( & target_switch_fork_validator_pubkey) ;
5269
5289
5270
5290
// 2) Wait for a duplicate slot to land on both validators and for the target switch
5271
5291
// fork validator to get another version of the slot. Also ensure all versions of
@@ -5386,6 +5406,7 @@ fn test_duplicate_shreds_switch_failure() {
5386
5406
// 4) Restart `target_switch_fork_validator_pubkey`, and ensure they vote on their own leader slot
5387
5407
// that's not descended from the duplicate slot
5388
5408
info ! ( "Restarting switch fork node" ) ;
5409
+ target_switch_fork_validator_info. config . voting_disabled = false ;
5389
5410
cluster. restart_node (
5390
5411
& target_switch_fork_validator_pubkey,
5391
5412
target_switch_fork_validator_info,
0 commit comments